Cache line control – Comtrol eCos User Manual

Page 294

Advertising
background image

Chapter 9. HAL Interfaces

HAL_XCACHE_BURST_SIZE()

Allows the size of cache to/from memory bursts to be controlled. This macro will only be defined if this

functionality is available.

HAL_DCACHE_WRITE_MODE()

Controls the way in which data cache lines are written back to memory. There will be definitions for the pos-

sible modes. Typical definitions are

HAL_DCACHE_WRITEBACK_MODE

and

HAL_DCACHE_WRITETHRU_MODE

.

This macro will only be defined if this functionality is available.

HAL_XCACHE_LOCK()

Causes data to be locked into the cache. The base and size arguments define the memory region that will be

locked into the cache. It is architecture dependent whether more than one locked region is allowed at any one
time, and whether this operation causes the cache to cease acting as a cache for addresses outside the region
during the duration of the lock. This macro will only be defined if this functionality is available.

HAL_XCACHE_UNLOCK()

Cancels the locking of the memory region given. This should normally correspond to a region supplied in a

matching lock call. This macro will only be defined if this functionality is available.

HAL_XCACHE_UNLOCK_ALL()

Cancels all existing locked memory regions. This may be required as part of the cache initialization on some

architectures. This macro will only be defined if this functionality is available.

Cache Line Control

HAL_DCACHE_ALLOCATE( base , size )

HAL_DCACHE_FLUSH( base , size )

HAL_XCACHE_INVALIDATE( base , size )

HAL_DCACHE_STORE( base , size )

HAL_DCACHE_READ_HINT( base , size )

HAL_DCACHE_WRITE_HINT( base , size )

HAL_DCACHE_ZERO( base , size )

All of these macros apply a cache operation to all cache lines that match the memory address region defined by the
base and size arguments. These macros will only be defined if the described functionality is available. Also, it is
not guaranteed that the cache function will only be applied to just the described regions, in some architectures it
may be applied to the whole cache.

HAL_DCACHE_ALLOCATE()

Allocates lines in the cache for the given region without reading their contents from memory, hence the

contents of the lines is undefined. This is useful for preallocating lines which are to be completely overwritten,
for example in a block copy operation.

HAL_DCACHE_FLUSH()

Invalidates all cache lines in the region after writing any dirty lines to memory.

190

Advertising