The hardware access layer for managing the CACHE peripheral. More...
Macros | |
#define | NRF_CACHE_HAS_CACHEDATA 1 |
Presence of the CACHEDATA feature. | |
#define | NRF_CACHE_HAS_CACHEDATA_DU 1 |
Presence of the CACHE data units feature. | |
#define | NRF_CACHE_HAS_CACHEINFO 1 |
Presence of the CACHEINFO feature. | |
#define | NRF_CACHE_HAS_TASKS 1 |
Symbol indicating whether cache tasks are supported. | |
#define | NRF_CACHE_HAS_TASK_CLEAN 1 |
Symbol indicating whether the CLEAN cache/line tasks are supported. | |
#define | NRF_CACHE_HAS_TASK_FLUSH 1 |
Symbol indicating whether the FLUSH cache/line tasks are supported. | |
#define | NRF_CACHE_HAS_TASK_SAVE_RESTORE 1 |
Symbol indicating whether save and restore tasks are supported. | |
#define | NRF_CACHE_HAS_STATUS 1 |
Symbol indicating whether status check is supported. | |
#define | NRF_CACHE_HAS_RAMSIZE 1 |
Symbol indicating whether splitting the dedicated RAM between cache and generic memory is supported. | |
#define | NRF_CACHE_HAS_CACHEINFO_DU_DIRTY 1 |
Symbol indicating whether dirtiness check functionality for cache is supported. | |
#define | NRF_CACHE_HAS_CACHEINFO_DU_VALIDATION 1 |
Symbol indicating whether data unit validation functionality for cache is supported. | |
#define | NRF_CACHE_HAS_CACHEINFO_SET_WAY_INFO 1 |
Symbol indicating whether cache info has INFO register. | |
#define | NRF_CACHEDATA_DATA_WORDS_IN_UNIT_MAX CACHEDATA_SET_WAY_DU_DATA_MaxCount |
Max number of words in CACHEDATA data units. | |
#define | NRF_CACHEDATA_DATA_UNITS_MAX CACHEDATA_SET_WAY_DU_MaxCount |
Max number of CACHEDATA data units. | |
#define | NRF_CACHEDATA_WORD_INDEX_MAX (NRF_CACHEDATA_DATA_WORDS_IN_UNIT_MAX * NRF_CACHEDATA_DATA_UNITS_MAX) |
Max number of CACHEDATA words. | |
#define | NRF_CACHEDATA_WAY_INDEX_MAX CACHEDATA_SET_WAY_MaxCount |
Max number of CACHEDATA ways. | |
#define | NRF_CACHEDATA_SET_INDEX_MAX CACHEDATA_SET_MaxCount |
Max number of CACHEDATA sets. | |
#define | NRF_CACHEINFO_DATA_WORDS_IN_UNIT_MAX CACHEDATA_SET_WAY_DU_DATA_MaxCount |
Max number of words in CACHEINFO data units. | |
#define | NRF_CACHEINFO_DATA_UNITS_MAX CACHEDATA_SET_WAY_DU_MaxCount |
Max number of CACHEINFO data units. | |
#define | NRF_CACHEINFO_WORD_INDEX_MAX (NRF_CACHEINFO_DATA_WORDS_IN_UNIT_MAX * NRF_CACHEINFO_DATA_UNITS_MAX) |
Max number of CACHEINFO words. | |
#define | NRF_CACHEINFO_WAY_INDEX_MAX CACHEINFO_SET_WAY_MaxCount |
Max number of CACHEINFO ways. | |
#define | NRF_CACHEINFO_SET_INDEX_MAX CACHEINFO_SET_MaxCount |
Max number of CACHEINFO sets. | |
#define | NRF_CACHE_MODE_RAMSIZE_MAX CACHE_MODE_RAMSIZE_Max |
Max enumerator value of RAMSIZE field. | |
Enumerations | |
enum | nrf_cache_task_t { NRF_CACHE_TASK_CLEANCACHE = offsetof(NRF_CACHE_Type, TASKS_CLEANCACHE) , NRF_CACHE_TASK_CLEANLINE = offsetof(NRF_CACHE_Type, TASKS_CLEANLINE) , NRF_CACHE_TASK_FLUSHCACHE = offsetof(NRF_CACHE_Type, TASKS_FLUSHCACHE) , NRF_CACHE_TASK_FLUSHLINE = offsetof(NRF_CACHE_Type, TASKS_FLUSHLINE) , NRF_CACHE_TASK_SAVE = offsetof(NRF_CACHE_Type, TASKS_SAVE) , NRF_CACHE_TASK_RESTORE = offsetof(NRF_CACHE_Type, TASKS_RESTORE) , NRF_CACHE_TASK_INVALIDATECACHE = offsetof(NRF_CACHE_Type, TASKS_INVALIDATECACHE) , NRF_CACHE_TASK_INVALIDATELINE = offsetof(NRF_CACHE_Type, TASKS_INVALIDATELINE) , NRF_CACHE_TASK_ERASE = offsetof(NRF_CACHE_Type, TASKS_ERASE) } |
CACHE tasks. More... | |
enum | nrf_cache_region_t { NRF_CACHE_REGION_FLASH = 0 , NRF_CACHE_REGION_XIP = 1 } |
Cache regions. More... | |
enum | nrf_cache_ramsize_t { NRF_CACHE_RAMSIZE_ALL = CACHE_MODE_RAMSIZE_All , NRF_CACHE_RAMSIZE_HALF = CACHE_MODE_RAMSIZE_Half , NRF_CACHE_RAMSIZE_QUARTER = CACHE_MODE_RAMSIZE_Quarter , NRF_CACHE_RAMSIZE_NONE = CACHE_MODE_RAMSIZE_None } |
Dedicated RAM size used for cache memory. More... | |
Functions | |
NRF_STATIC_INLINE void | nrf_cache_enable (NRF_CACHE_Type *p_reg) |
Function for enabling the CACHE peripheral. | |
NRF_STATIC_INLINE void | nrf_cache_disable (NRF_CACHE_Type *p_reg) |
Function for disabling the CACHE peripheral. | |
NRF_STATIC_INLINE bool | nrf_cache_enable_check (NRF_CACHE_Type const *p_reg) |
Function for checking if the CACHE peripheral is enabled. | |
NRF_STATIC_INLINE void | nrf_cache_invalidate (NRF_CACHE_Type *p_reg) |
Function for invalidating the cache content. | |
NRF_STATIC_INLINE void | nrf_cache_erase (NRF_CACHE_Type *p_reg) |
Function for erasing the cache content. | |
NRF_STATIC_INLINE bool | nrf_cache_erase_status_check (NRF_CACHE_Type const *p_reg) |
Function for checking the status of nrf_cache_erase(). | |
NRF_STATIC_INLINE void | nrf_cache_erase_status_clear (NRF_CACHE_Type *p_reg) |
Function for clearing the status of the cache erase. | |
NRF_STATIC_INLINE void | nrf_cache_profiling_set (NRF_CACHE_Type *p_reg, bool enable) |
Function for setting the cache profiling. | |
NRF_STATIC_INLINE void | nrf_cache_profiling_counters_clear (NRF_CACHE_Type *p_reg) |
Function for clearing the cache profiling counters. | |
NRF_STATIC_INLINE uint32_t | nrf_cache_instruction_hit_counter_get (NRF_CACHE_Type const *p_reg, nrf_cache_region_t region) |
Function for getting the number of cache hits for instruction fetch from the specified cache region. | |
NRF_STATIC_INLINE uint32_t | nrf_cache_instruction_miss_counter_get (NRF_CACHE_Type const *p_reg, nrf_cache_region_t region) |
Function for getting the number of cache misses for instruction fetch from the specified cache region. | |
NRF_STATIC_INLINE uint32_t | nrf_cache_data_hit_counter_get (NRF_CACHE_Type const *p_reg, nrf_cache_region_t region) |
Function for getting the number of cache hits for data fetch from the specified cache region. | |
NRF_STATIC_INLINE uint32_t | nrf_cache_data_miss_counter_get (NRF_CACHE_Type const *p_reg, nrf_cache_region_t region) |
Function for getting the number of cache misses for data fetch from the specified cache region. | |
NRF_STATIC_INLINE void | nrf_cache_ram_mode_set (NRF_CACHE_Type *p_reg, bool enable) |
Function for setting the cache RAM mode. | |
NRF_STATIC_INLINE bool | nrf_cache_ram_mode_check (NRF_CACHE_Type const *p_reg) |
Function for checking whether the cache is in RAM mode. | |
NRF_STATIC_INLINE void | nrf_cache_ramsize_set (NRF_CACHE_Type *p_reg, nrf_cache_ramsize_t ramsize) |
Function for setting the configuration of splitting the dedicated cache RAM. | |
NRF_STATIC_INLINE nrf_cache_ramsize_t | nrf_cache_ramsize_get (NRF_CACHE_Type const *p_reg) |
Function for getting the configuration of splitting the dedicated cache RAM. | |
NRF_STATIC_INLINE void | nrf_cache_read_lock_enable (NRF_CACHE_Type *p_reg) |
Function for blocking the cache content access. | |
NRF_STATIC_INLINE void | nrf_cache_update_lock_set (NRF_CACHE_Type *p_reg, bool enable) |
Function for blocking the cache content updates. | |
NRF_STATIC_INLINE uint32_t | nrf_cache_data_get (NRF_CACHEDATA_Type const *p_reg, uint32_t set, uint8_t way, uint8_t word) |
Function for getting the cache data word. | |
NRF_STATIC_INLINE uint32_t | nrf_cache_tag_get (NRF_CACHEINFO_Type const *p_reg, uint32_t set, uint8_t way) |
Function for getting the tag associated with the specified set and way. | |
NRF_STATIC_INLINE bool | nrf_cache_line_validity_check (NRF_CACHEINFO_Type const *p_reg, uint32_t set, uint8_t way) |
Function for checking the validity of a cache line associated with the specified set and way. | |
NRF_STATIC_INLINE uint8_t | nrf_cache_mru_get (NRF_CACHEINFO_Type const *p_reg, uint32_t set) |
Function for getting the most recently used way in the specified set. | |
NRF_STATIC_INLINE bool | nrf_cache_data_unit_validity_check (NRF_CACHEINFO_Type const *p_reg, uint32_t set, uint8_t way, uint8_t word) |
Function for checking the validity of a data unit associated with the specified set, way and word. | |
NRF_STATIC_INLINE bool | nrf_cache_is_data_unit_dirty_check (NRF_CACHEINFO_Type const *p_reg, uint32_t set, uint8_t way, uint8_t word) |
Function for checking the dirtiness of a data unit associated with the specified set, way and word. | |
NRF_STATIC_INLINE void | nrf_cache_lineaddr_set (NRF_CACHE_Type *p_reg, uint32_t addr) |
Function to set the memory address covered by the line to be maintained. | |
NRF_STATIC_INLINE void | nrf_cache_task_trigger (NRF_CACHE_Type *p_reg, nrf_cache_task_t task) |
Function for triggering the specified CACHE task. | |
NRF_STATIC_INLINE uint32_t | nrf_cache_task_address_get (NRF_CACHE_Type const *p_reg, nrf_cache_task_t task) |
Function for returning the address of the specified task register. | |
NRF_STATIC_INLINE bool | nrf_cache_busy_check (NRF_CACHE_Type const *p_reg) |
Function for checking if the cache is busy or not. | |
The hardware access layer for managing the CACHE peripheral.
enum nrf_cache_ramsize_t |
Dedicated RAM size used for cache memory.
enum nrf_cache_region_t |
enum nrf_cache_task_t |
CACHE tasks.
NRF_STATIC_INLINE bool nrf_cache_busy_check | ( | NRF_CACHE_Type const * | p_reg | ) |
Function for checking if the cache is busy or not.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE uint32_t nrf_cache_data_get | ( | NRF_CACHEDATA_Type const * | p_reg, |
uint32_t | set, | ||
uint8_t | way, | ||
uint8_t | word | ||
) |
Function for getting the cache data word.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | set | Set that contains the data to get. |
[in] | way | Way that contains the data to get. |
[in] | word | Data word index to get. |
NRF_STATIC_INLINE uint32_t nrf_cache_data_hit_counter_get | ( | NRF_CACHE_Type const * | p_reg, |
nrf_cache_region_t | region | ||
) |
Function for getting the number of cache hits for data fetch from the specified cache region.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | region | Cache region. |
NRF_STATIC_INLINE uint32_t nrf_cache_data_miss_counter_get | ( | NRF_CACHE_Type const * | p_reg, |
nrf_cache_region_t | region | ||
) |
Function for getting the number of cache misses for data fetch from the specified cache region.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | region | Cache region. |
NRF_STATIC_INLINE bool nrf_cache_data_unit_validity_check | ( | NRF_CACHEINFO_Type const * | p_reg, |
uint32_t | set, | ||
uint8_t | way, | ||
uint8_t | word | ||
) |
Function for checking the validity of a data unit associated with the specified set, way and word.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | set | Set that contains the data unit to check. |
[in] | way | Way that contains the data unit to check. |
[in] | word | Data word index. |
true | Data unit is valid. |
false | Data unit is invalid. |
NRF_STATIC_INLINE void nrf_cache_disable | ( | NRF_CACHE_Type * | p_reg | ) |
Function for disabling the CACHE peripheral.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_cache_enable | ( | NRF_CACHE_Type * | p_reg | ) |
Function for enabling the CACHE peripheral.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE bool nrf_cache_enable_check | ( | NRF_CACHE_Type const * | p_reg | ) |
Function for checking if the CACHE peripheral is enabled.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
true | The CACHE is enabled. |
false | The CACHE is not enabled. |
NRF_STATIC_INLINE void nrf_cache_erase | ( | NRF_CACHE_Type * | p_reg | ) |
Function for erasing the cache content.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE bool nrf_cache_erase_status_check | ( | NRF_CACHE_Type const * | p_reg | ) |
Function for checking the status of nrf_cache_erase().
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
true | Erase is finished. |
false | Erase is not complete or has not started. |
NRF_STATIC_INLINE void nrf_cache_erase_status_clear | ( | NRF_CACHE_Type * | p_reg | ) |
Function for clearing the status of the cache erase.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE uint32_t nrf_cache_instruction_hit_counter_get | ( | NRF_CACHE_Type const * | p_reg, |
nrf_cache_region_t | region | ||
) |
Function for getting the number of cache hits for instruction fetch from the specified cache region.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | region | Cache region. |
NRF_STATIC_INLINE uint32_t nrf_cache_instruction_miss_counter_get | ( | NRF_CACHE_Type const * | p_reg, |
nrf_cache_region_t | region | ||
) |
Function for getting the number of cache misses for instruction fetch from the specified cache region.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | region | Cache region. |
NRF_STATIC_INLINE void nrf_cache_invalidate | ( | NRF_CACHE_Type * | p_reg | ) |
Function for invalidating the cache content.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE bool nrf_cache_is_data_unit_dirty_check | ( | NRF_CACHEINFO_Type const * | p_reg, |
uint32_t | set, | ||
uint8_t | way, | ||
uint8_t | word | ||
) |
Function for checking the dirtiness of a data unit associated with the specified set, way and word.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | set | Set that contains the data unit to check. |
[in] | way | Way that contains the data unit to check. |
[in] | word | Data word index. |
true | Data unit is dirty. |
false | Data unit is clean. |
NRF_STATIC_INLINE bool nrf_cache_line_validity_check | ( | NRF_CACHEINFO_Type const * | p_reg, |
uint32_t | set, | ||
uint8_t | way | ||
) |
Function for checking the validity of a cache line associated with the specified set and way.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | set | Set that contains the cache line to check. |
[in] | way | Way that contains the cache line to check. |
true | Cache line is valid. |
false | Cache line is invalid. |
NRF_STATIC_INLINE void nrf_cache_lineaddr_set | ( | NRF_CACHE_Type * | p_reg, |
uint32_t | addr | ||
) |
Function to set the memory address covered by the line to be maintained.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | addr | Cache line adress. |
NRF_STATIC_INLINE uint8_t nrf_cache_mru_get | ( | NRF_CACHEINFO_Type const * | p_reg, |
uint32_t | set | ||
) |
Function for getting the most recently used way in the specified set.
The most recently used way is updated on each fetch from the cache and is used for the cache replacement policy.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | set | Specified set. |
NRF_STATIC_INLINE void nrf_cache_profiling_counters_clear | ( | NRF_CACHE_Type * | p_reg | ) |
Function for clearing the cache profiling counters.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_cache_profiling_set | ( | NRF_CACHE_Type * | p_reg, |
bool | enable | ||
) |
Function for setting the cache profiling.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | enable | True if cache profiling is to be enabled, false otherwise. |
NRF_STATIC_INLINE bool nrf_cache_ram_mode_check | ( | NRF_CACHE_Type const * | p_reg | ) |
Function for checking whether the cache is in RAM mode.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_cache_ram_mode_set | ( | NRF_CACHE_Type * | p_reg, |
bool | enable | ||
) |
Function for setting the cache RAM mode.
When configured in the RAM mode, the accesses to internal or external flash will not be cached. In this mode, the cache data contents can be used as the read/write RAM. Only the data content of the cache is available as RAM.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | enable | True if the cache RAM mode is to be enabled, false otherwise. |
NRF_STATIC_INLINE nrf_cache_ramsize_t nrf_cache_ramsize_get | ( | NRF_CACHE_Type const * | p_reg | ) |
Function for getting the configuration of splitting the dedicated cache RAM.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE void nrf_cache_ramsize_set | ( | NRF_CACHE_Type * | p_reg, |
nrf_cache_ramsize_t | ramsize | ||
) |
Function for setting the configuration of splitting the dedicated cache RAM.
Dedicated cache RAM can be splitted into cache memory and generic memory. By default, all dedicated RAM is used for cache memory.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | ramsize | Dedicated cache RAM split configuration. |
NRF_STATIC_INLINE void nrf_cache_read_lock_enable | ( | NRF_CACHE_Type * | p_reg | ) |
Function for blocking the cache content access.
To unlock the cache content access, a reset has to be performed.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
NRF_STATIC_INLINE uint32_t nrf_cache_tag_get | ( | NRF_CACHEINFO_Type const * | p_reg, |
uint32_t | set, | ||
uint8_t | way | ||
) |
Function for getting the tag associated with the specified set and way.
The tag is used to check if an entry in the cache matches the address that is being fetched.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | set | Set that contains the tag to get. |
[in] | way | Way that contains the tag to get. |
NRF_STATIC_INLINE uint32_t nrf_cache_task_address_get | ( | NRF_CACHE_Type const * | p_reg, |
nrf_cache_task_t | task | ||
) |
Function for returning the address of the specified task register.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | Task. |
NRF_STATIC_INLINE void nrf_cache_task_trigger | ( | NRF_CACHE_Type * | p_reg, |
nrf_cache_task_t | task | ||
) |
Function for triggering the specified CACHE task.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | task | Task. |
NRF_STATIC_INLINE void nrf_cache_update_lock_set | ( | NRF_CACHE_Type * | p_reg, |
bool | enable | ||
) |
Function for blocking the cache content updates.
Blocking of updates prevents updating of cache content on cache misses, but the peripheral will continue to check for instruction/data fetches in the content already present in the cache.
[in] | p_reg | Pointer to the structure of registers of the peripheral. |
[in] | enable | True if cache content update lock is to be enabled, false otherwise. |