]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/open-amp.git/commitdiff
add header file for common constants and cleanup.
authoropen-amp@googlegroups.com <open-amp@googlegroups.com>
Tue, 7 Feb 2017 19:57:34 +0000 (11:57 -0800)
committerWendy Liang <jliang@xilinx.com>
Tue, 7 Feb 2017 19:57:34 +0000 (11:57 -0800)
Add platform_info.h to hold common constants.
Protect rsc_table.h from multiple inclusion.
Replace numerical values with common named constants.
Remove unneeded definitions.

Signed-off-by: Sam Sortais <sam.sortais@xilinx.com>
apps/machine/zynq7/platform_info.c
apps/machine/zynq7/rsc_table.c
apps/machine/zynq7/rsc_table.h
apps/machine/zynqmp_r5/platform_info.c
apps/machine/zynqmp_r5/platform_info.h
apps/machine/zynqmp_r5/rsc_table.c
apps/machine/zynqmp_r5/rsc_table.h

index 75fd1f0a5a331c2931cb66b7033db72b0dc3f388..299c2349f7dc384dceeb7edd3403191e0c8f8cc0 100644 (file)
 
 #include "openamp/hil.h"
 #include "metal/atomic.h"
 
 #include "openamp/hil.h"
 #include "metal/atomic.h"
+#include "platform_info.h"
 
 
-#define IPI0_VECT_ID            15
-#define IPI1_VECT_ID            14
-#define APU_CPU_ID              0
-#define RPMSG_CHAN_NAME         "rpmsg-openamp-demo-channel"
+#define APU_CPU_ID     0
 
 extern struct hil_platform_ops zynq_a9_proc_ops;
 
 
 extern struct hil_platform_ops zynq_a9_proc_ops;
 
@@ -67,8 +65,8 @@ struct hil_proc *platform_create_proc(int proc_index)
        if (!proc)
                return NULL;
 
        if (!proc)
                return NULL;
 
-       hil_set_vring_ipi(proc, 0, IPI0_VECT_ID, NULL);
-       hil_set_vring_ipi(proc, 1, IPI1_VECT_ID, NULL);
+       hil_set_vring_ipi(proc, 0, VRING0_IPI_INTR_VECT, NULL);
+       hil_set_vring_ipi(proc, 1, VRING1_IPI_INTR_VECT, NULL);
 
        hil_set_rpmsg_channel(proc, 0, RPMSG_CHAN_NAME);
        return proc;
 
        hil_set_rpmsg_channel(proc, 0, RPMSG_CHAN_NAME);
        return proc;
index 959d49fbe83fe39dce34f966deecee451e3cdd83..af4683cbe94f668a2c2c466d8b3a475acd56f7f9 100644 (file)
@@ -73,16 +73,16 @@ struct remote_resource_table __resource resources = {
         },
 
        {RSC_RPROC_MEM, 0x200000, 0x200000, 0x100000, 0},
         },
 
        {RSC_RPROC_MEM, 0x200000, 0x200000, 0x100000, 0},
-        /* Virtio device entry */
-       {RSC_VDEV, VIRTIO_ID_RPMSG_, 0, RPMSG_IPU_C0_FEATURES, 0, 0, 0,
+
+       /* Virtio device entry */
+       {
+        RSC_VDEV, VIRTIO_ID_RPMSG_, 0, RPMSG_IPU_C0_FEATURES, 0, 0, 0,
         NUM_VRINGS, {0, 0},
         NUM_VRINGS, {0, 0},
-        },
+       },
 
        /* Vring rsc entry - part of vdev rsc entry */
 
        /* Vring rsc entry - part of vdev rsc entry */
-       {
-        RING_TX, VRING_ALIGN, VRING_SIZE, 1, 0},
-       {
-        RING_RX, VRING_ALIGN, VRING_SIZE, 2, 0},
+       {RING_TX, VRING_ALIGN, VRING_SIZE, 1, 0},
+       {RING_RX, VRING_ALIGN, VRING_SIZE, 2, 0},
 };
 
 void *get_resource_table (int rsc_id, int *len)
 };
 
 void *get_resource_table (int rsc_id, int *len)
index cd22e3f9077fe3dc4d382a5a651f28e814f79958..16cc38762b565e48f049e692bbe30cd6b1c7aecb 100644 (file)
@@ -31,6 +31,9 @@
 /* This file populates resource table for BM remote
  * for use by the Linux Master */
 
 /* This file populates resource table for BM remote
  * for use by the Linux Master */
 
+#ifndef RSC_TABLE_H_
+#define RSC_TABLE_H_
+
 #include <stddef.h>
 #include "openamp/open_amp.h"
 
 #include <stddef.h>
 #include "openamp/open_amp.h"
 
@@ -49,3 +52,8 @@ struct remote_resource_table {
        struct fw_rsc_vdev_vring rpmsg_vring0;
        struct fw_rsc_vdev_vring rpmsg_vring1;
 };
        struct fw_rsc_vdev_vring rpmsg_vring0;
        struct fw_rsc_vdev_vring rpmsg_vring1;
 };
+
+void *get_resource_table (int rsc_id, int *len);
+
+#endif /* RSC_TABLE_H_ */
+
index 03b22733e64085d1174813a8e69b4225069f553e..66aa3144c9c0b40be937c2833bd6ce456c997447 100755 (executable)
 
 #include "openamp/hil.h"
 #include "metal/atomic.h"
 
 #include "openamp/hil.h"
 #include "metal/atomic.h"
+#include "platform_info.h"
 
 #define IPI_BASE_ADDR                     0xFF310000 /* IPI base address */
 #define IPI_CHN_BITMASK                   0x01000000 /* IPI channel bit mask APU<->RPU0 */
 
 #define IPI_BASE_ADDR                     0xFF310000 /* IPI base address */
 #define IPI_CHN_BITMASK                   0x01000000 /* IPI channel bit mask APU<->RPU0 */
-#define IPI_VECT_ID                       65
+
 #define APU_CPU_ID                        0
 #define APU_CPU_ID                        0
-#define RPMSG_CHAN_NAME                   "rpmsg-openamp-demo-channel"
 
 /* -- FIX ME: ipi info is to be defined -- */
 struct ipi_info {
 
 /* -- FIX ME: ipi info is to be defined -- */
 struct ipi_info {
@@ -64,7 +64,7 @@ struct ipi_info {
 extern struct hil_platform_ops zynqmp_r5_a53_proc_ops;
 
 static struct ipi_info chn_ipi_info[] = {
 extern struct hil_platform_ops zynqmp_r5_a53_proc_ops;
 
 static struct ipi_info chn_ipi_info[] = {
-       {NULL, NULL, NULL, NULL, 0xFF310000, IPI_CHN_BITMASK, 0, 0},
+       {NULL, NULL, NULL, NULL, IPI_BASE_ADDR, IPI_CHN_BITMASK, 0, 0},
 };
 
 const struct firmware_info fw_table[] =
 };
 
 const struct firmware_info fw_table[] =
@@ -84,13 +84,15 @@ struct hil_proc *platform_create_proc(int proc_index)
        if (!proc)
                return NULL;
 
        if (!proc)
                return NULL;
 
+       /* Setup IPI info */
        hil_set_vdev_ipi(proc, 0,
        hil_set_vdev_ipi(proc, 0,
-               IPI_VECT_ID, (void *)&chn_ipi_info[0]);
+               IPI_IRQ_VECT_ID, (void *)&chn_ipi_info[0]);
        hil_set_vring_ipi(proc, 0,
        hil_set_vring_ipi(proc, 0,
-               IPI_VECT_ID, (void *)&chn_ipi_info[0]);
+               IPI_IRQ_VECT_ID, (void *)&chn_ipi_info[0]);
        hil_set_vring_ipi(proc, 1,
        hil_set_vring_ipi(proc, 1,
-               IPI_VECT_ID, (void *)&chn_ipi_info[1]);
+               IPI_IRQ_VECT_ID, (void *)&chn_ipi_info[1]);
 
        hil_set_rpmsg_channel(proc, 0, RPMSG_CHAN_NAME);
        return proc;
 }
 
        hil_set_rpmsg_channel(proc, 0, RPMSG_CHAN_NAME);
        return proc;
 }
+
index 2903d2aafd9f7469a5c6f642d0affa06fbea29ea..99980cc9f9c9960f925ebbdfd5fa2d0dcfef27bf 100644 (file)
@@ -1,43 +1,14 @@
-/*
- * Copyright (c) 2016 Xilinx, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. Neither the name of Mentor Graphics Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived from this
- *    software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* This file populates resource table for BM remote
- * for use by the Linux Master */
+#ifndef PLATFORM_INFO_H_
+#define PLATFORM_INFO_H_
 
 #include "openamp/hil.h"
 
 #include "openamp/hil.h"
-#include "openamp/remoteproc_plat.h"
 
 
-/* remoteproc platform data structure */
-struct rproc_info_plat_local {
-       struct proc_info_hdr proc_hdr; /**< hil proc header */
-       struct plat_vring vring0; /**< vring0 data */
-       struct plat_vring vring1; /**< vring1 data */
-       struct plat_shm shm; /**< shared memory data */
-       struct plat_rpmsg_chnl rpmsg_chnl; /**< RPMSG channel data */
-       unsigned int last_type;
-};
+/* Interrupt vectors */
+#define IPI_IRQ_VECT_ID              65
+
+#define RPMSG_CHAN_NAME              "rpmsg-openamp-demo-channel"
+
+struct hil_proc *platform_create_proc(int proc_index);
+
+#endif /* PLATFORM_INFO_H_ */
+
index 18966a0ef29d7cc3be8a4bed1e2a31299bba368b..2ee5f7a61e5d8444402d6c3ee691085f2da1a141 100644 (file)
@@ -76,15 +76,14 @@ struct remote_resource_table __resource resources = {
        {RSC_FW_CHKSUM, "sha256", {0}},
 
        /* Virtio device entry */
        {RSC_FW_CHKSUM, "sha256", {0}},
 
        /* Virtio device entry */
-       {RSC_VDEV, VIRTIO_ID_RPMSG_, 0, RPMSG_IPU_C0_FEATURES, 0, 0, 0,
+       {
+        RSC_VDEV, VIRTIO_ID_RPMSG_, 0, RPMSG_IPU_C0_FEATURES, 0, 0, 0,
         NUM_VRINGS, {0, 0},
         },
 
        /* Vring rsc entry - part of vdev rsc entry */
         NUM_VRINGS, {0, 0},
         },
 
        /* Vring rsc entry - part of vdev rsc entry */
-       {
-        RING_TX, VRING_ALIGN, VRING_SIZE, 1, 0},
-       {
-        RING_RX, VRING_ALIGN, VRING_SIZE, 2, 0},
+       {RING_TX, VRING_ALIGN, VRING_SIZE, 1, 0},
+       {RING_RX, VRING_ALIGN, VRING_SIZE, 2, 0},
 };
 
 void *get_resource_table (int rsc_id, int *len)
 };
 
 void *get_resource_table (int rsc_id, int *len)
index 551e6dc4d2f252da19d78286d0d5a3cc81787884..13c2e68dfd9c05c5e012928ca19be1a36fb120cf 100644 (file)
@@ -31,6 +31,9 @@
 /* This file populates resource table for BM remote
  * for use by the Linux Master */
 
 /* This file populates resource table for BM remote
  * for use by the Linux Master */
 
+#ifndef RSC_TABLE_H_
+#define RSC_TABLE_H_
+
 #include <stddef.h>
 #include "openamp/open_amp.h"
 
 #include <stddef.h>
 #include "openamp/open_amp.h"
 
@@ -51,3 +54,8 @@ struct remote_resource_table {
        struct fw_rsc_vdev_vring rpmsg_vring0;
        struct fw_rsc_vdev_vring rpmsg_vring1;
 };
        struct fw_rsc_vdev_vring rpmsg_vring0;
        struct fw_rsc_vdev_vring rpmsg_vring1;
 };
+
+void *get_resource_table (int rsc_id, int *len);
+
+#endif /* RSC_TABLE_H_ */
+