The MCUXpresso SDK provides a peripheral driver for the CACHE Controller of MCUXpresso SDK devices.
The CACHE driver is created to help the user more easily operate the cache memory. The APIs for basic operations are including the following three levels: 1L. The local cache driver API. This level provides the caches controller drivers.
2L. The unified cache driver API. This level provides many APIs for unified cache driver APIs for combined L1 and L2 cache maintain operations. This is provided for SDK drivers (DMA, ENET, USDHC, etc) which should do the cache maintenance in their transactional APIs. Because in this arch, there is no L2 cache so the unified cache driver API directly calls local driver APIs.
Function groups
CACHE Operation
There are Enable/Disable APIs for cache control and cache maintenance operations as Invalidate/Clean/CleanInvalidate by all and by address range.
#define XCACHE_LINESIZE_BYTE (FSL_FEATURE_XCACHE_LINESIZE_BYTE) |
uint32_t XCACHE_GetInstanceByAddr |
( |
uint32_t |
address | ) |
|
param address The physical memory address.
- Returns
- XCACHE instance number starting from 0.
void XCACHE_EnableCache |
( |
XCACHE_Type * |
base | ) |
|
- Parameters
-
base | XCACHE peripheral base address. |
void XCACHE_DisableCache |
( |
XCACHE_Type * |
base | ) |
|
- Parameters
-
base | XCACHE peripheral base address. |
void XCACHE_InvalidateCache |
( |
XCACHE_Type * |
base | ) |
|
- Parameters
-
base | XCACHE peripheral base address. |
void XCACHE_InvalidateCacheByRange |
( |
uint32_t |
address, |
|
|
uint32_t |
size_byte |
|
) |
| |
- Parameters
-
address | The physical address of cache. |
size_byte | size of the memory to be invalidated, should be larger than 0, better to align with cache line size. |
- Note
- Address and size should be aligned to "XCACHE_LINESIZE_BYTE". The startAddr here will be forced to align to XCACHE_LINESIZE_BYTE if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.
void XCACHE_CleanCache |
( |
XCACHE_Type * |
base | ) |
|
- Parameters
-
base | XCACHE peripheral base address. |
void XCACHE_CleanCacheByRange |
( |
uint32_t |
address, |
|
|
uint32_t |
size_byte |
|
) |
| |
- Parameters
-
address | The physical address of cache. |
size_byte | size of the memory to be cleaned, should be larger than 0, better to align with cache line size. |
- Note
- Address and size should be aligned to "XCACHE_LINESIZE_BYTE". The startAddr here will be forced to align to XCACHE_LINESIZE_BYTE if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.
void XCACHE_CleanInvalidateCache |
( |
XCACHE_Type * |
base | ) |
|
- Parameters
-
base | XCACHE peripheral base address. |
void XCACHE_CleanInvalidateCacheByRange |
( |
uint32_t |
address, |
|
|
uint32_t |
size_byte |
|
) |
| |
- Parameters
-
address | The physical address of cache. |
size_byte | size of the memory to be Cleaned and Invalidated, should be larger than 0, better to align with cache line size. |
- Note
- Address and size should be aligned to "XCACHE_LINESIZE_BYTE". The startAddr here will be forced to align to XCACHE_LINESIZE_BYTE if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.
static void ICACHE_InvalidateByRange |
( |
uint32_t |
address, |
|
|
uint32_t |
size_byte |
|
) |
| |
|
inlinestatic |
- Parameters
-
address | The physical address. |
size_byte | size of the memory to be invalidated, should be larger than 0, better to align with cache line size. |
- Note
- Address and size should be aligned to XCACHE_LINESIZE_BYTE due to the cache operation unit FSL_FEATURE_XCACHE_LINESIZE_BYTE. The startAddr here will be forced to align to the cache line size if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.
static void DCACHE_InvalidateByRange |
( |
uint32_t |
address, |
|
|
uint32_t |
size_byte |
|
) |
| |
|
inlinestatic |
- Parameters
-
address | The physical address. |
size_byte | size of the memory to be invalidated, should be larger than 0, better to align with cache line size. |
- Note
- Address and size should be aligned to XCACHE_LINESIZE_BYTE due to the cache operation unit FSL_FEATURE_XCACHE_LINESIZE_BYTE. The startAddr here will be forced to align to the cache line size if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.
static void DCACHE_CleanByRange |
( |
uint32_t |
address, |
|
|
uint32_t |
size_byte |
|
) |
| |
|
inlinestatic |
- Parameters
-
address | The physical address. |
size_byte | size of the memory to be cleaned, should be larger than 0, better to align with cache line size. |
- Note
- Address and size should be aligned to XCACHE_LINESIZE_BYTE due to the cache operation unit FSL_FEATURE_XCACHE_LINESIZE_BYTE. The startAddr here will be forced to align to the cache line size if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.
static void DCACHE_CleanInvalidateByRange |
( |
uint32_t |
address, |
|
|
uint32_t |
size_byte |
|
) |
| |
|
inlinestatic |
- Parameters
-
address | The physical address. |
size_byte | size of the memory to be Cleaned and Invalidated, should be larger than 0, better to align with cache line size. |
- Note
- Address and size should be aligned to XCACHE_LINESIZE_BYTE due to the cache operation unit FSL_FEATURE_XCACHE_LINESIZE_BYTE. The startAddr here will be forced to align to the cache line size if startAddr is not aligned. For the size_byte, application should make sure the alignment or make sure the right operation order if the size_byte is not aligned.