HI
I'm probably having an issue about cache coherency on c6678 (sometimes I read wrong values)
I want eight cores to access a shared variable in MSMC. Could you confirm that the following procedure is correct
I set cache as follow in the platform settings:
L2 cache= 32K
L1D cache = 32K
L1P cache = 32K
Variable definition as follow (pseudo code):
#pragma DATA_ALIGN (128);
#pragma DATA_SECTION(".MSharedSram")
var x;
I pad the variable so that sizeof(x) = 128
To modify the variable (pseudo code):
#define MY_SEM (17)
{
while ((CSL_semAcquireDirect (MY_SEM)) == 0);
CACHE_invL1d ((void*)&x, sizeof(x), CACHE_WAIT);
CACHE_invL2 ((void*)&x, sizeof(x), CACHE_WAIT);
x= x + 1; //write to x
CACHE_wbL1d ((void*)&x, sizeof(x), CACHE_WAIT);
CACHE_wbL2 ((void*)&x, sizeof(x), CACHE_WAIT);
CSL_semReleaseSemaphore (MY_SEM);
}
is it ok?
Thanks
Fabio