This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM8127 and Shared Memory

Hello,

Using IPNC_RDK v3.8.0 on DM8127 proprietary board.

I want to use shared memory between the ARM and the DSP.

In the \ipnc_rdk\ipnc_app\interface\inc\share_mem.h file there is a short example of how this is done.

The system itself has its own shared memory regions (in \ipnc_rdk\ipnc_app\interface\inc\Msg_Def.h) with their own "keys"

#define MSG_KEY			0x12345
#define SYS_MSG_KEY        0x36f9 ///< Message key used by system server.
#define FILE_MSG_KEY	0xc54be5 ///< File message key.
#define ALARM_KEY		0x542c7ae6 ///< Alarm message key.
#define AUD_MSG_KEY       0x31       ///< Audio alarm message key

If I init a new shared memory space for my own structure with a different key, how do I specify this new area in the following API functions?

void ShareMemRead(int offset,void *buf, int length); 
void ShareMemWrite(int offset,void *buf, int length);

Do I have to give a specific offset? How is it calculated?

I see that ShareMemInit uses all of the MAX shared memory.

int ShareMemInit(int key)
{
	mid = shmget(key, PROC_MEM_SIZE * MAX_SHARE_PROC, IPC_CREAT | 0660);
	if(mid < 0)
		mid = shmget(key, 0, 0);
	__D("shared memory id:%d\n",mid);
	if(mid < 0)
		return -1;
	return mid;
}

I also only found that the offset given for Shared memory is 

Thanks,

Mechi

  • Hello,

    I will notify the IPNC team.

    BR
    Margarita
  • Hi,

    This shared memory is Linux specific and used across different processes running under Linux OS.
    And this cannot be used across cores.
    You should use IPC (Inter Processor communication) shared region.
    The SR1 (cached) memory region is mapped on both A8 and DSP, so you can allocate the memory from SR1 on either A8 or DSP as per your requirement (addr).
    And then pass the share region address (srAddr) to the other core in the following way:

    srId = SharedRegion_getId(addr);
    srAddr = SharedRegion_getSRPtr(addr, srId);

    On the other core you can retrieve the proper addressable mapped address (addr) in the following way:

    addr = SharedRegion_getPtr(srAddr);

    regards,
    Anand
  • >>On the other core you can retrieve the proper addressable mapped address (addr) in the following way:

    This is always the problem - how does "the other core" "know" the srAddr?
    I tried passing messages- but not so reliable.
    I want to be able to write something t a place in memory with the A8, and the DSP will periodically poll and read. Then the DSP will write something to the shared structure which the A8 will poll.

    Thanks
  • Hi,

    A message should be sent from one core to the other which carries the srAddr.

    regards,
    Anand