The cache lock Scanario in demo-cache-lock are: For example, 1. set g_selfmodify = 7777777. 2. lock cache. If g_selfmodify = 7777777, it means cache lock successfully. Note:Keep the set value same. 3. unlock cache. if g_selfmodify = 8888888, it means cache unlock successfully.
Implement cache lock by following function: void ICacheLock(unsigned int* va) { //uart_puts("Calling ICacheLock()\n");
__nds32__cctlva_lck(NDS32_CCTL_L1I_VA_FILLCK, va);
//uart_puts("End of Calling ICacheLock()\n"); }
Argument "va" of above function is the start address of code. above function only lock one cache line 32 bytes. For example, if you want to lock 40 bytes code, you have to run ICacheLock() 2 times to cover 40 bytes code.
|