lib: open-amp: Use struct fw_resource_table type instead of void
The type of the resource table is known, casting to and from void* only hides this type which can prevent the compiler from giving helpful warnings. One warning would have been the accidental use of "st_resource_table" in a cast, a struct which does not exist. Use the fw_resource_table type when dealing with resource tables. Signed-off-by: Andrew Davis <afd@ti.com>
This commit is contained in:
parent
4c5eb92650
commit
39863b66bd
3 changed files with 14 additions and 14 deletions
|
@ -74,8 +74,8 @@ static struct fw_resource_table __resource resource_table = {
|
|||
#endif
|
||||
};
|
||||
|
||||
void rsc_table_get(void **table_ptr, int *length)
|
||||
void rsc_table_get(struct fw_resource_table **table_ptr, int *length)
|
||||
{
|
||||
*table_ptr = (void *)&resource_table;
|
||||
*table_ptr = &resource_table;
|
||||
*length = sizeof(resource_table);
|
||||
}
|
||||
|
|
|
@ -56,23 +56,23 @@ struct fw_resource_table {
|
|||
#endif
|
||||
} METAL_PACKED_END;
|
||||
|
||||
void rsc_table_get(void **table_ptr, int *length);
|
||||
void rsc_table_get(struct fw_resource_table **table_ptr, int *length);
|
||||
|
||||
#if (CONFIG_OPENAMP_RSC_TABLE_NUM_RPMSG_BUFF > 0)
|
||||
|
||||
inline struct fw_rsc_vdev *rsc_table_to_vdev(void *rsc_table)
|
||||
inline struct fw_rsc_vdev *rsc_table_to_vdev(struct fw_resource_table *rsc_table)
|
||||
{
|
||||
return &((struct fw_resource_table *)rsc_table)->vdev;
|
||||
return &rsc_table->vdev;
|
||||
}
|
||||
|
||||
inline struct fw_rsc_vdev_vring *rsc_table_get_vring0(void *rsc_table)
|
||||
inline struct fw_rsc_vdev_vring *rsc_table_get_vring0(struct fw_resource_table *rsc_table)
|
||||
{
|
||||
return &((struct fw_resource_table *)rsc_table)->vring0;
|
||||
return &rsc_table->vring0;
|
||||
}
|
||||
|
||||
inline struct fw_rsc_vdev_vring *rsc_table_get_vring1(void *rsc_table)
|
||||
inline struct fw_rsc_vdev_vring *rsc_table_get_vring1(struct fw_resource_table *rsc_table)
|
||||
{
|
||||
return &((struct fw_resource_table *)rsc_table)->vring1;
|
||||
return &rsc_table->vring1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -53,6 +53,7 @@ static const struct device *const ipm_handle =
|
|||
DEVICE_DT_GET(DT_CHOSEN(zephyr_ipc));
|
||||
|
||||
static metal_phys_addr_t shm_physmap = SHM_START_ADDR;
|
||||
static metal_phys_addr_t rsc_tab_physmap;
|
||||
|
||||
static struct metal_io_region shm_io_data; /* shared memory */
|
||||
static struct metal_io_region rsc_io_data; /* rsc_table memory */
|
||||
|
@ -67,7 +68,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 void *rsc_table;
|
||||
static struct fw_resource_table *rsc_table;
|
||||
static struct rpmsg_device *rpdev;
|
||||
|
||||
static char rx_sc_msg[20]; /* should receive "Hello world!" */
|
||||
|
@ -139,7 +140,6 @@ int mailbox_notify(void *priv, uint32_t id)
|
|||
|
||||
int platform_init(void)
|
||||
{
|
||||
void *rsc_tab_addr;
|
||||
int rsc_size;
|
||||
struct metal_init_params metal_params = METAL_INIT_DEFAULTS;
|
||||
int status;
|
||||
|
@ -155,11 +155,11 @@ int platform_init(void)
|
|||
SHM_SIZE, -1, 0, NULL);
|
||||
|
||||
/* declare resource table region */
|
||||
rsc_table_get(&rsc_tab_addr, &rsc_size);
|
||||
rsc_table = (struct st_resource_table *)rsc_tab_addr;
|
||||
rsc_table_get(&rsc_table, &rsc_size);
|
||||
rsc_tab_physmap = (uintptr_t)rsc_table;
|
||||
|
||||
metal_io_init(rsc_io, rsc_table,
|
||||
(metal_phys_addr_t *)rsc_table, rsc_size, -1, 0, NULL);
|
||||
&rsc_tab_physmap, rsc_size, -1, 0, NULL);
|
||||
|
||||
/* setup IPM */
|
||||
if (!device_is_ready(ipm_handle)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue