Browse Source

lib: open-amp: Replace struct fw_resource_table with void

Switching to void allows greater flexibility in supporting
vendor-specific resource tables.

This change reverts commit 39863b66bd, and adds some fixes.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
pull/92175/head
Iuliana Prodan 4 weeks ago committed by Benjamin Cabé
parent
commit
a50ddace58
  1. 4
      lib/open-amp/resource_table.c
  2. 14
      lib/open-amp/resource_table.h
  3. 2
      samples/subsys/ipc/openamp_rsc_table/src/main_remote.c

4
lib/open-amp/resource_table.c

@ -80,11 +80,11 @@ static struct fw_resource_table __resource resource_table = { @@ -80,11 +80,11 @@ static struct fw_resource_table __resource resource_table = {
#endif
};
void rsc_table_get(struct fw_resource_table **table_ptr, int *length)
void rsc_table_get(void **table_ptr, int *length)
{
*length = sizeof(resource_table);
#ifdef CONFIG_OPENAMP_COPY_RSC_TABLE
*table_ptr = (struct fw_resource_table *)RSC_TABLE_ADDR;
*table_ptr = (void *)RSC_TABLE_ADDR;
memcpy(*table_ptr, &resource_table, *length);
#else
*table_ptr = &resource_table;

14
lib/open-amp/resource_table.h

@ -56,23 +56,23 @@ struct fw_resource_table { @@ -56,23 +56,23 @@ struct fw_resource_table {
#endif
} METAL_PACKED_END;
void rsc_table_get(struct fw_resource_table **table_ptr, int *length);
void rsc_table_get(void **table_ptr, int *length);
#if (CONFIG_OPENAMP_RSC_TABLE_NUM_RPMSG_BUFF > 0)
inline struct fw_rsc_vdev *rsc_table_to_vdev(struct fw_resource_table *rsc_table)
inline struct fw_rsc_vdev *rsc_table_to_vdev(void *rsc_table)
{
return &rsc_table->vdev;
return &((struct fw_resource_table *)rsc_table)->vdev;
}
inline struct fw_rsc_vdev_vring *rsc_table_get_vring0(struct fw_resource_table *rsc_table)
inline struct fw_rsc_vdev_vring *rsc_table_get_vring0(void *rsc_table)
{
return &rsc_table->vring0;
return &((struct fw_resource_table *)rsc_table)->vring0;
}
inline struct fw_rsc_vdev_vring *rsc_table_get_vring1(struct fw_resource_table *rsc_table)
inline struct fw_rsc_vdev_vring *rsc_table_get_vring1(void *rsc_table)
{
return &rsc_table->vring1;
return &((struct fw_resource_table *)rsc_table)->vring1;
}
#endif

2
samples/subsys/ipc/openamp_rsc_table/src/main_remote.c

@ -75,7 +75,7 @@ static struct metal_io_region *shm_io = &shm_io_data; @@ -75,7 +75,7 @@ static struct metal_io_region *shm_io = &shm_io_data;
static struct metal_io_region *rsc_io = &rsc_io_data;
static struct rpmsg_virtio_device rvdev;
static struct fw_resource_table *rsc_table;
static void *rsc_table;
static struct rpmsg_device *rpdev;
static char rx_sc_msg[20]; /* should receive "Hello world!" */

Loading…
Cancel
Save