Skip to content

Commit

Permalink
samples: Support different base address of the shared mem
Browse files Browse the repository at this point in the history
Now, in open_amp_rsc_table sample we support only the devices
that have the same value for physical and virtual address.
But, in case they are different, we need to give both addresses.
Therefore, for physical address take the second register block from
ipc_shm node if it exists, otherwise take the first one, as before.

Signed-off-by: Iuliana Prodan <[email protected]>
  • Loading branch information
iuliana-prodan committed Jan 17, 2025
1 parent 2a6e590 commit d98e948
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion doc/build/dts/api/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,10 @@ device.
* - zephyr,ipc_shm
- A node whose ``reg`` is used by the OpenAMP subsystem to determine the
base address and size of the shared memory (SHM) usable for
interprocess-communication (IPC)
interprocess-communication (IPC).
A second register block is optional and, if used, is the physical address (pa) of
the shared memory. The second value for pa register is not used, is just
required by devicetree ``reg`` property.
* - zephyr,itcm
- Instruction Tightly Coupled Memory node on some Arm SoCs
* - zephyr,log-uart
Expand Down
6 changes: 5 additions & 1 deletion samples/subsys/ipc/openamp_rsc_table/src/main_remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ LOG_MODULE_REGISTER(openamp_rsc_table, LOG_LEVEL_DBG);
#define SHM_START_ADDR DT_REG_ADDR(SHM_NODE)
#define SHM_SIZE DT_REG_SIZE(SHM_NODE)

#define SHM_PHYS_START_ADDR COND_CODE_1(DT_NUM_REGS(SHM_NODE), \
(DT_REG_ADDR(SHM_NODE)), \
(DT_REG_ADDR_BY_NAME(SHM_NODE, 1))) \

#define APP_TASK_STACK_SIZE (1024)

/* Add 1024 extra bytes for the TTY task stack for the "tx_buff" buffer. */
Expand All @@ -52,7 +56,7 @@ static struct k_thread thread_tty_data;
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 shm_physmap = SHM_PHYS_START_ADDR;
static metal_phys_addr_t rsc_tab_physmap;

static struct metal_io_region shm_io_data; /* shared memory */
Expand Down

0 comments on commit d98e948

Please sign in to comment.