Global cache control – Comtrol eCos User Manual

Page 293

Advertising
background image

Chapter 9. HAL Interfaces

HAL_XCACHE_SETS

Defines the number of sets in the cache, and is calculated from the previous values.

Global Cache Control

HAL_XCACHE_ENABLE()

HAL_XCACHE_DISABLE()

HAL_XCACHE_INVALIDATE_ALL()

HAL_XCACHE_SYNC()

HAL_XCACHE_BURST_SIZE( size )

HAL_DCACHE_WRITE_MODE( mode )

HAL_XCACHE_LOCK( base, size )

HAL_XCACHE_UNLOCK( base, size )

HAL_XCACHE_UNLOCK_ALL()

These macros affect the state of the entire cache, or a large part of it.

HAL_XCACHE_ENABLE() and HAL_XCACHE_DISABLE()

Enable and disable the cache.

HAL_XCACHE_INVALIDATE_ALL()

Causes the entire contents of the cache to be invalidated. Depending on the hardware, this may

require the cache to be disabled during the invalidation process. If so, the implementation must use

HAL_XCACHE_IS_ENABLED()

to save and restore the previous state.

Note: If this macro is called after

HAL_XCACHE_SYNC()

with the intention of clearing the cache (invalidating

the cache after writing dirty data back to memory), you must prevent interrupts from happening between
the two calls:

...

HAL_DISABLE_INTERRUPTS(old);

HAL_XCACHE_SYNC();

HAL_XCACHE_INVALIDATE_ALL();

HAL_RESTORE_INTERRUPTS(old);

...

Since the operation may take a very long time, real-time responsiveness could be affected, so only do this
when it is absolutely required and you know the delay will not interfere with the operation of drivers or the
application.

HAL_XCACHE_SYNC()

Causes the contents of the cache to be brought into synchronization with the contents of memory. In some

implementations this may be equivalent to

HAL_XCACHE_INVALIDATE_ALL()

.

189

Advertising