Help on simple memory sharing.
I guess most of you will think this is a pretty silly question, but I must
say in my defense that I am new to RTOS and to VxWorks 6.2.
Thing is, I have two RTPs running at the same time on the same PPC
processor. I need to share some information between them, so, reading the
manual, I've found out that I should use the library sdLib. The API says I
should create a named shared memory region with sdCreate(name,...) and
access it from another RTP with sdOpen(name,...). That's clear for me.
My question is: how do I create variables in that region? I mean, I need to
share a boolean and a buffer, but I have no idea how to do it. I guess just
declaring the variables after creating the shared memory region won't make
Any help will be deeply appreciated.
Best regards from Spain
Re: Help on simple memory sharing.
This may be a late reply , but may help to maintain the knowledge database
The physical address passed to sdCreate/sdOpen can be used for storing the shared variable.
void * pVirtAddress = (char*)malloc(512);;
sharedDataMemId = sdOpen("sharedDataMem", 0, OM_CREATE, 512,0, (SD_ATTR_RWX |SD_CACHE_OFF),VirtAddress);
struct sampleSharedFirstData * sd = pVirtAddress;
sd->i = 100;
sd->f = 10.23;
bool b* = pVirtAddress + sizeof(struct sampleSharedFirstData );
void * pVirtAddress = NULL;
sharedDataMemId = sdOpen("sharedDataMem", 0,OM_CREATE , 512,0, (SD_ATTR_RWX |SD_CACHE_OFF), &pVirtAddress);
sampleSharedFirstData * st = pVirtAddress;
printf("\nst->i = %d",st->i);
printf("\nst->f = %f",st->f);
int *bl = pVirtAddress + sizeof(sampleSharedFirstData);