AnsweredAssumed Answered

Cache Invalidation

Question asked by mmccar on Dec 1, 2010
Latest reply on Dec 23, 2010 by mmccar

I am looking for an efficient way to flush the data cache as we are writing to an area of SDRAM via DMA and then accessing it via the cache. We are using a BF548 and running using the VDK.

 

They only way that I have found to get this to work is to use the flush_data_buffer function with the invalidate option(uses FLUSHINV instruction). This function is somewhat slow as it loops through all the addresses and executes the FLUSHINV instruction.

 

According to the hardware manual, there are two additional methods to invalidate the cache - setting the invalid bits on each cache line using DTEST_COMMAND and DTEST_DATA registers and to disable and then re-enable the cache.

 

The function dcache_invalidate appears to implement the first of these, and I also tried implementing the second one. In both cases the cache seems to fail to invalidate as ind a simple test if I set and then read-back a cached area of SDRAM, use DMA to write a different value to SDRAM, call the invalidating code and read the cached area again, it has not changed.

 

Does anyone know how to get these faster cache invalidation methods to work?

 

Thanks

Outcomes