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.

AM5728: 不用IPC,CMEM,怎样操作可以使ARM/DSP 共享OCRAM3

Part Number: AM5728
Other Parts Discussed in Thread: SYSBIOS

项目需求,不用IPC,CMEM,目前得到的反馈,写法大致如下,结果DSP的写入,ARM测读不到,

问题是,

Linux端,如何保证Cache的一致性,

DSP端,关于Cache的操作,有两个头文件,到底要用哪个?又是如何保证Cache的一致性?

Linux:

sharedRegionAllocPtr = (unsigned int* )mmap(NULL, SR_SIZE, PROT_WRITE | PROT_READ, MAP_SHARED, shm_fd, SR_PHY_BASE);

volatile PetersonVar* ppv2 = (PetersonVar*)(sharedRegionAllocPtr + SR_VAR_OFFSET);
ppv2->cmd_seq++;

msync(ppv2, SR_VAR_SIZE, MS_SYNC);

DSP:

#include <ti/sysbios/hal/Cache.h>
#include <ti/csl/csl_cacheAux.h>

Cache_inv(ppv, 0x100, Cache_Type_ALL, TRUE);

key = _disable_interrupts();
CACHE_invL1d ((void *)ppv2, 256, CACHE_WAIT);
CACHE_invL2 ((void *)ppv2, 256, CACHE_WAIT);
_mfence();
/* Re-enable Interrupts. */
_restore_interrupts(key);

last_cmd = *ppv;
*(ppv2) = *(ppv2) + 1;
//Cache_wb(ppv2, 0x100, Cache_Type_ALL, TRUE);
CACHE_wbInvL1d(ppv2, 256, CACHE_WAIT);
CACHE_wbInvL2(ppv2, 256, CACHE_WAIT);