hello,
In my project, if I put the process data in DDR with L2 cache 128KB, the process speed of corepac is the same with the data in MSM RAM. I wonder whether anywhere is wrong. So I have a test,below is my test case:
void MSM_DDR_test()
{
int i;
CACHE_setL2Size(CACHE_128KCACHE);
for (i = 128; i < 129; i++) {
/* enables caching for a specific memory region */
CACHE_enableCaching(i);
}
printf("***********TEST START***********\r\n");
memset(g_p_DDR,0,0x400000);
memset(g_p_MSM,0,0x400000);
g_ll_startcycle = CSL_tscRead();
for(i = 0; i < 0x100000; i++)
{
g_p_DDR[i] = i;
}
g_ll_endcycle = CSL_tscRead();
g_ll_overhead = g_ll_endcycle - g_ll_startcycle;
printf("DDR write g_ll_overhead = %lld\r\n",g_ll_overhead);
g_ll_startcycle = CSL_tscRead();
for(i = 0; i < 0x100000; i++)
{
mytemp = g_p_DDR[i];
}
g_ll_endcycle = CSL_tscRead();
g_ll_overhead = g_ll_endcycle - g_ll_startcycle;
printf("DDR read g_ll_overhead = %lld\r\n",g_ll_overhead);
g_ll_startcycle = CSL_tscRead();
for(i = 0; i < 0x100000; i++)
{
g_p_MSM[i] = i;
}
g_ll_endcycle = CSL_tscRead();
g_ll_overhead = g_ll_endcycle - g_ll_startcycle;
printf("MSM write g_ll_overhead = %lld\r\n",g_ll_overhead);
g_ll_startcycle = CSL_tscRead();
for(i = 0; i < 0x100000; i++)
{
mytemp = g_p_MSM[i];
}
g_ll_endcycle = CSL_tscRead();
g_ll_overhead = g_ll_endcycle - g_ll_startcycle;
printf("MSM read g_ll_overhead = %lld\r\n",g_ll_overhead);
printf("***********TEST OVER***********\r\n");
}
the result is(L2 cache 128KB) :
***********TEST START***********
DDR write g_ll_overhead = 23068699
DDR read g_ll_overhead = 28939522
MSM write g_ll_overhead = 23068699
MSM read g_ll_overhead = 28803127
***********TEST OVER***********
the result is(L2 cache 0KB) :
***********TEST START***********
DDR write g_ll_overhead = 23068699
DDR read g_ll_overhead = 59362879
MSM write g_ll_overhead = 23068699
MSM read g_ll_overhead = 28803128
***********TEST OVER***********
1 from the test results, I can make a conclusion: whether L2 CACHE is enable, the speed to write DDR and MSM RAM is almost the same, and if L2 CACHE is enable for 128KB, the speed to write and read DDR and MSM RAM is almost the same. From the test data, it can explain in my project why whether the data in DDR or MSM RAM is the same. I am not sure whether it is right, if not ,please tell me why?
2 during my test, I find that when I write the data to MSM SRAM, it write the MSM SRAM directly,not through L1D cache, if L2 cache disable, it is the same with DDR write, I have a question here, in this situation, how the CPU write the data to MSM OR DDR, is it through L1D cache or bypass the L1D cahce directly write to the MSM or DDR?
Best Regards,
Si