Sharing data between 2 RTPs or 2 DKMs or DKM-RTP

176 Views Asked by At

I'm working on a large project with multiple individual(s).
We have broken the project into multiple modules.
Individual(s) are working on separate DKMs and RTPs depending on the module they are working on. Individuals working with hardware interfaces/drivers are working on DKMs while individuals working only software components are working on RTPs.

My question is that how will individual working on different modules share data between 2 RTPs or 2 DKMs or DKM-RTP?
I was thinking of using Message Queues but unlike Linux in vxWorks their is no provision for ftok to generate key for message queue create API msgQCreate.
IPC using Sockets is not feasible due to the latency involved and real-time capabilities required.

1

There are 1 best solutions below

0
ØXmose On

For time-sensitive applications, shared memory can be used. You can rely on pmapGlobalMap to map a fixed region in memory in the DKM:

uint8_t* memRegion = pmapGlobalMap(SHARED_PHYS_ADDR,
                                   SHARED_PHYS_SIZE,
                                   MMU_ATTR_SUP_RWX | MMU_ATTR_VALID);

Where SHARED_PHYS_ADDR is the physical address of the memory you want to share, SHARED_PHYS_SIZE its size in bytes and MMU_ATTR_SUP_RWX | MMU_ATTR_VALID the MMU attributes used for the memory region.

Then in the RTPs use sdOpen:

uint8_t* memRegion;
retVal = sdOpen(SHARED_PHYS_NAME,
                SD_LINGER,
                OM_CREATE,
                SHARED_PHYS_SIZE, 
                SHARED_PHYS_ADDR,
                SD_ATTR_RW | SD_CACHE_DEFAULT,
                (void**)&memRegion);

Where SHARED_PHYS_ADDR is the physical address of the memory you want to share, SHARED_PHYS_SIZE its size in bytes and SD_ATTR_RW | SD_CACHE_DEFAULT the MMU attributes used for the memory region. SHARED_PHYS_NAME is the name of the shared region.