SmartSnippets DA1459x SDK
Files | Typedefs | Enumerations | Functions
iCache Controller

iCache Controller LLD common API More...

Files

file  hw_cache.h
 Definition of API for the iCache Controller Low Level Driver.
 
file  hw_cache_da1459x.h
 Definition of DA1459x specific API for the iCache Controller Low Level Driver.
 

Typedefs

typedef void(* hw_cache_mrm_cb_t) (void)
 Application defined callback for the MRM interrupt. More...
 

Enumerations

enum  HW_CACHE_EFLASH_REGION_SZ
 Cacheable eflash Region Sizes as defined in DA1459x datasheet. More...
 
enum  HW_CACHE_FLASH_REGION_SZ
 Cacheable flash Region Sizes as defined in DA1459x datasheet. More...
 

Functions

__STATIC_INLINE void hw_cache_mrm_set_misses_thres (uint32_t thres)
 Set the cache MRM interrupt threshold for misses. More...
 
__STATIC_INLINE uint32_t hw_cache_mrm_get_misses_thres (void)
 Get the cache MRM interrupt threshold for misses. More...
 
__STATIC_INLINE void hw_cache_mrm_set_hits_thres (uint32_t thres)
 Set the cache MRM interrupt threshold for hits. More...
 
__STATIC_INLINE uint32_t hw_cache_mrm_get_hits_thres (void)
 Get the cache MRM interrupt threshold for hits. More...
 
__STATIC_INLINE bool hw_cache_mrm_get_misses_thres_status (void)
 Get the cache MRM misses threshold IRQ status. More...
 
__STATIC_INLINE void hw_cache_mrm_clr_misses_thres_status (void)
 Clear the cache MRM misses threshold IRQ status. More...
 
__STATIC_INLINE bool hw_cache_mrm_get_hits_thres_status (void)
 Get the cache MRM hits threshold IRQ status. More...
 
__STATIC_INLINE void hw_cache_mrm_clr_hits_thres_status (void)
 Clear the cache MRM hits threshold IRQ status. More...
 
__STATIC_INLINE void hw_cache_mrm_set_tint (uint32_t tint)
 Set the cache MRM monitoring time interval. More...
 
__STATIC_INLINE uint32_t hw_cache_mrm_get_tint (void)
 Get the cache MRM monitoring time interval. More...
 
__STATIC_INLINE bool hw_cache_mrm_get_tint_status (void)
 Get the cache MRM timer interval IRQ status. More...
 
__STATIC_INLINE void hw_cache_mrm_clr_tint_status (void)
 Clear the cache MRM timer interval IRQ status. More...
 
__STATIC_INLINE void hw_cache_mrm_start_counters (void)
 Start MRM counters. More...
 
__STATIC_INLINE void hw_cache_mrm_freeze_counters (void)
 Freeze MRM counters. More...
 
__STATIC_INLINE uint32_t hw_cache_mrm_get_misses (void)
 Get the cache MRM misses number. More...
 
__STATIC_INLINE void hw_cache_mrm_set_misses (uint32_t misses)
 Set the cache MRM cache misses number. More...
 
__STATIC_INLINE uint32_t hw_cache_mrm_get_hits (void)
 Get the cache MRM cache hits number. More...
 
__STATIC_INLINE void hw_cache_mrm_set_hits (uint32_t hits)
 Set the cache MRM cache hits number. More...
 
void hw_cache_mrm_enable_interrupt (hw_cache_mrm_cb_t cb)
 Enable the MRM interrupt generation. More...
 
void hw_cache_mrm_disable_interrupt (void)
 Disable the MRM interrupt generation. More...
 
__STATIC_INLINE void hw_cache_enable ()
 Enables the iCache Controller. More...
 
__STATIC_INLINE void hw_cache_disable ()
 Disables the iCache Controller. More...
 
__STATIC_INLINE bool hw_cache_is_enabled ()
 Checks if the iCache Controller is enabled. More...
 
__STATIC_INLINE void hw_cache_set_extflash_cacheable_len (uint32_t len)
 Set the external (QSPI) flash cacheable memory length. More...
 
__STATIC_INLINE int hw_cache_get_extflash_cacheable_len (void)
 Get the external (QSPI) flash cacheable memory length. More...
 
__STATIC_INLINE void hw_cache_set_eflash_cacheable_len (uint32_t len)
 Set the eflash cacheable memory length. More...
 
__STATIC_INLINE int hw_cache_get_eflash_cacheable_len (void)
 Get the eflash cacheable memory length. More...
 
__STATIC_INLINE void hw_cache_set_len (uint32_t len)
 Set the cacheable memory length. Backwards compatibility wrapper. More...
 
__STATIC_INLINE int hw_cache_get_len (void)
 Get the cacheable memory length. Backwards compatibility wrapper. More...
 
__STATIC_INLINE void hw_cache_enable_flushing (void)
 Enable flushing the iCache Controller (cache RAM cells) contents. For debugging only.
 
__STATIC_INLINE void hw_cache_disable_flushing (void)
 Disable flushing the iCache Controller (cache RAM cells) contents. For debugging only.
 
__STATIC_INLINE bool hw_cache_is_flushing_disabled ()
 Checks if the iCache Controller flushing is disabled. For debugging only. More...
 
__STATIC_INLINE void hw_cache_flush (void)
 Flush the cache contents. More...
 
__STATIC_INLINE void hw_cache_eflash_set_region_base (eflash_region_base_t base)
 Set the eflash region base. More...
 
__STATIC_INLINE eflash_region_base_t hw_cache_eflash_get_region_base (void)
 Get the eflash region base. More...
 
__STATIC_INLINE void hw_cache_eflash_set_region_offset (eflash_region_offset_t offset)
 Set the eflash region offset. More...
 
__STATIC_INLINE eflash_region_offset_t hw_cache_eflash_get_region_offset (void)
 Get the eflash region offset. More...
 
__STATIC_INLINE void hw_cache_eflash_set_region_size (HW_CACHE_EFLASH_REGION_SZ sz)
 Set the eflash region size. More...
 
__STATIC_INLINE HW_CACHE_EFLASH_REGION_SZ hw_cache_eflash_get_region_size (void)
 Get the eflash region size. More...
 
__STATIC_INLINE void hw_cache_eflash_configure_region (eflash_region_base_t base, eflash_region_offset_t offset, HW_CACHE_EFLASH_REGION_SZ sz)
 Configure the eflash memory region that will be cacheable. More...
 
__STATIC_INLINE void hw_cache_flash_set_region_base (flash_region_base_t base)
 Set the flash region base. More...
 
__STATIC_INLINE flash_region_base_t hw_cache_flash_get_region_base (void)
 Get the flash region base. More...
 
__STATIC_INLINE void hw_cache_flash_set_region_offset (flash_region_offset_t offset)
 Set the flash region offset. More...
 
__STATIC_INLINE flash_region_offset_t hw_cache_flash_get_region_offset (void)
 Get the flash region offset. More...
 
__STATIC_INLINE void hw_cache_flash_set_region_size (HW_CACHE_FLASH_REGION_SZ sz)
 Set the flash region size. More...
 
__STATIC_INLINE HW_CACHE_FLASH_REGION_SZ hw_cache_flash_get_region_size (void)
 Get the flash region size. More...
 
__STATIC_INLINE void hw_cache_flash_configure_region (flash_region_base_t base, flash_region_offset_t offset, HW_CACHE_FLASH_REGION_SZ sz)
 Configure the flash memory region that will be cacheable. More...
 
__STATIC_INLINE uint32_t hw_cache_mrm_get_hits_with_one_wait_state (void)
 Get the cache MRM hits with 1 Wait State number. More...
 
__STATIC_INLINE void hw_cache_mrm_set_hits_with_one_wait_state (uint32_t hits)
 Set the cache MRM hits with 1 Wait State number. More...
 

Detailed Description

iCache Controller LLD common API

iCache Controller DA1459x specific LLD API

Typedef Documentation

◆ hw_cache_mrm_cb_t

typedef void(* hw_cache_mrm_cb_t) (void)

Application defined callback for the MRM interrupt.

Note
The application defined callback should be declared as __RETAINED_CODE.

Enumeration Type Documentation

◆ HW_CACHE_EFLASH_REGION_SZ

Cacheable eflash Region Sizes as defined in DA1459x datasheet.

◆ HW_CACHE_FLASH_REGION_SZ

Cacheable flash Region Sizes as defined in DA1459x datasheet.

Function Documentation

◆ hw_cache_disable()

__STATIC_INLINE void hw_cache_disable ( )

Disables the iCache Controller.

The iCache Controller is disabled by setting the CACHERAM_MUX to '0'. This action disables the corresponding HW block, bypassing the iCache Controller for all read requests and letting the RAM memory of the block be visible in the entire memory space.

◆ hw_cache_eflash_configure_region()

__STATIC_INLINE void hw_cache_eflash_configure_region ( eflash_region_base_t  base,
eflash_region_offset_t  offset,
HW_CACHE_EFLASH_REGION_SZ  sz 
)

Configure the eflash memory region that will be cacheable.

This is an alternative API to hw_cache_eflash_set_region_base()/_size()/_offset(). It automatically configures the entire eflash region in one call.

See the relevant called functions for input parameter definition.

Note
The updated value takes effect only after a software reset.

◆ hw_cache_eflash_get_region_base()

__STATIC_INLINE eflash_region_base_t hw_cache_eflash_get_region_base ( void  )

Get the eflash region base.

Returns
The eflash region base to use with the cache

◆ hw_cache_eflash_get_region_offset()

__STATIC_INLINE eflash_region_offset_t hw_cache_eflash_get_region_offset ( void  )

Get the eflash region offset.

Returns
The region offset to be used in conjunction with the region base to indicate the starting address within the eflash memory area that will be cacheable

◆ hw_cache_eflash_get_region_size()

__STATIC_INLINE HW_CACHE_EFLASH_REGION_SZ hw_cache_eflash_get_region_size ( void  )

Get the eflash region size.

Returns
The eflash region size to use with the cache

◆ hw_cache_eflash_set_region_base()

__STATIC_INLINE void hw_cache_eflash_set_region_base ( eflash_region_base_t  base)

Set the eflash region base.

Parameters
[in]baseThe eflash region base corresponds to the eflash address bits [31:16]. Default value is '0x00A0'. Bits [31:24] are fixed to '0x00'. Max value is thus 0x00FF and min 0x0000.
Note
This should be aligned to the region size value (hw_cache_eflash_set_region_size()).
The updated value takes effect only after a software reset.

◆ hw_cache_eflash_set_region_offset()

__STATIC_INLINE void hw_cache_eflash_set_region_offset ( eflash_region_offset_t  offset)

Set the eflash region offset.

This value (expressed in words) is added to eflash region base (see hw_cache_eflash_set/get_region_base()) to calculate the the starting address within the eflash memory area that will be cacheable (remapped to 0x0) and XiPed.

Parameters
[in]offseteflash region offset in 32-bit words. Max: 0xFFF since the corresponding register bit field area is 3 nibbles in length.
Note
The updated value takes effect only after a software reset.

◆ hw_cache_eflash_set_region_size()

__STATIC_INLINE void hw_cache_eflash_set_region_size ( HW_CACHE_EFLASH_REGION_SZ  sz)

Set the eflash region size.

Parameters
[in]szThe eflash region size to use with the cache

This is the size of the eflash memory that will be cached. The size starts from eflash region base (see hw_cache_eflash_set_region_base()) plus eflash region offset (see hw_cache_eflash_set_region_offset()).

Note
The updated value takes effect only after a software reset.

◆ hw_cache_enable()

__STATIC_INLINE void hw_cache_enable ( )

Enables the iCache Controller.

The iCache Controller is enabled by setting the CACHERAM_MUX to '1'. This action enables the corresponding HW block, letting the RAM memory of the block be visible only to the iCache Controller for caching purposes.

◆ hw_cache_flash_configure_region()

__STATIC_INLINE void hw_cache_flash_configure_region ( flash_region_base_t  base,
flash_region_offset_t  offset,
HW_CACHE_FLASH_REGION_SZ  sz 
)

Configure the flash memory region that will be cacheable.

This is an alternative API to hw_cache_flash_set_region_base()/_size()/_offset(). It automatically configures the entire flash region in one call.

See the relevant called functions for input parameter definition.

Note
The updated value takes effect only after a software reset.

◆ hw_cache_flash_get_region_base()

__STATIC_INLINE flash_region_base_t hw_cache_flash_get_region_base ( void  )

Get the flash region base.

Returns
The flash region base to use with the cache

◆ hw_cache_flash_get_region_offset()

__STATIC_INLINE flash_region_offset_t hw_cache_flash_get_region_offset ( void  )

Get the flash region offset.

Returns
The region offset to be used in conjunction with the region base to indicate the starting address within the flash memory area that will be cacheable

◆ hw_cache_flash_get_region_size()

__STATIC_INLINE HW_CACHE_FLASH_REGION_SZ hw_cache_flash_get_region_size ( void  )

Get the flash region size.

Returns
The flash region size to use with the cache

◆ hw_cache_flash_set_region_base()

__STATIC_INLINE void hw_cache_flash_set_region_base ( flash_region_base_t  base)

Set the flash region base.

Parameters
[in]baseThe Flash region base corresponds to the flash address bits [31:16]. Bits [31:25] should be fixed to '0xb' and bits [17:16] should be fixed to '0x0'. Therefore, valid values are from 0x1600 to 0x17fc. This address should be 'size'-param aligned.
Note
This should be aligned to the region size value (hw_cache_flash_set_region_size()).
The updated value takes effect only after a software reset.

◆ hw_cache_flash_set_region_offset()

__STATIC_INLINE void hw_cache_flash_set_region_offset ( flash_region_offset_t  offset)

Set the flash region offset.

This value (expressed in words) is added to flash region base (see hw_cache_flash_set/get_region_base()) to calculate the the starting address within the flash memory area that will be cacheable (remapped to 0x0) and XiPed.

Parameters
[in]offsetflash region offset in 32-bit words. Max: 0xFFF since the corresponding register bit field area is 3 nibbles in length.
Note
The updated value takes effect only after a software reset.

◆ hw_cache_flash_set_region_size()

__STATIC_INLINE void hw_cache_flash_set_region_size ( HW_CACHE_FLASH_REGION_SZ  sz)

Set the flash region size.

Parameters
[in]szThe flash region size to use with the cache

This is the size of the flash memory that will be cached. The size starts from flash region base (see hw_cache_flash_set_region_base()) plus flash region offset (see hw_cache_flash_set_region_offset()).

Note
The updated value takes effect only after a software reset.

◆ hw_cache_flush()

__STATIC_INLINE void hw_cache_flush ( void  )

Flush the cache contents.

Note: The very first flushing occurred after power on reset when the iCache Controller is enabled for the first time by the booter.

◆ hw_cache_get_eflash_cacheable_len()

__STATIC_INLINE int hw_cache_get_eflash_cacheable_len ( void  )

Get the eflash cacheable memory length.

Returns
The eflash cacheable memory length, in 64KB blocks. The actual cacheable memory length will therefore be len * 64KB.

◆ hw_cache_get_extflash_cacheable_len()

__STATIC_INLINE int hw_cache_get_extflash_cacheable_len ( void  )

Get the external (QSPI) flash cacheable memory length.

Returns
The eflash cacheable memory length, in 64KB blocks. The actual cacheable memory length will therefore be len * 64KB.

◆ hw_cache_get_len()

__STATIC_INLINE int hw_cache_get_len ( void  )

Get the cacheable memory length. Backwards compatibility wrapper.

Returns
See hw_cache_get_eflash_cacheable_len for details.
Deprecated:
API no longer supported, use hw_cache_get_eflash_cacheable_len.

◆ hw_cache_is_enabled()

__STATIC_INLINE bool hw_cache_is_enabled ( )

Checks if the iCache Controller is enabled.

Returns
True if the iCache Controller is enabled, False otherwise.

◆ hw_cache_is_flushing_disabled()

__STATIC_INLINE bool hw_cache_is_flushing_disabled ( )

Checks if the iCache Controller flushing is disabled. For debugging only.

Returns
True if the iCache Controller flushing is disabled, False otherwise.

◆ hw_cache_mrm_clr_hits_thres_status()

__STATIC_INLINE void hw_cache_mrm_clr_hits_thres_status ( void  )

Clear the cache MRM hits threshold IRQ status.

◆ hw_cache_mrm_clr_misses_thres_status()

__STATIC_INLINE void hw_cache_mrm_clr_misses_thres_status ( void  )

Clear the cache MRM misses threshold IRQ status.

◆ hw_cache_mrm_clr_tint_status()

__STATIC_INLINE void hw_cache_mrm_clr_tint_status ( void  )

Clear the cache MRM timer interval IRQ status.

◆ hw_cache_mrm_disable_interrupt()

void hw_cache_mrm_disable_interrupt ( void  )

Disable the MRM interrupt generation.

Note
The application defined called is unregistered.

◆ hw_cache_mrm_enable_interrupt()

void hw_cache_mrm_enable_interrupt ( hw_cache_mrm_cb_t  cb)

Enable the MRM interrupt generation.

The application should define its own callback. The latter is registered and then invoked when the MRM interrupt is generated.

Parameters
[in]cbCallback defined by the application.

◆ hw_cache_mrm_freeze_counters()

__STATIC_INLINE void hw_cache_mrm_freeze_counters ( void  )

Freeze MRM counters.

◆ hw_cache_mrm_get_hits()

__STATIC_INLINE uint32_t hw_cache_mrm_get_hits ( void  )

Get the cache MRM cache hits number.

Returns
The number of cache hits

◆ hw_cache_mrm_get_hits_thres()

__STATIC_INLINE uint32_t hw_cache_mrm_get_hits_thres ( void  )

Get the cache MRM interrupt threshold for hits.

Returns
The interrupt generation threshold (in hits)

◆ hw_cache_mrm_get_hits_thres_status()

__STATIC_INLINE bool hw_cache_mrm_get_hits_thres_status ( void  )

Get the cache MRM hits threshold IRQ status.

Returns
True if an interrupt has been generated because the number of hits reached the programmed threshold (if !=0)

◆ hw_cache_mrm_get_hits_with_one_wait_state()

__STATIC_INLINE uint32_t hw_cache_mrm_get_hits_with_one_wait_state ( void  )

Get the cache MRM hits with 1 Wait State number.

Returns
The number of hits with 1 Wait State

◆ hw_cache_mrm_get_misses()

__STATIC_INLINE uint32_t hw_cache_mrm_get_misses ( void  )

Get the cache MRM misses number.

Returns
The number of cache misses

◆ hw_cache_mrm_get_misses_thres()

__STATIC_INLINE uint32_t hw_cache_mrm_get_misses_thres ( void  )

Get the cache MRM interrupt threshold for misses.

Returns
The interrupt generation threshold (in misses)

◆ hw_cache_mrm_get_misses_thres_status()

__STATIC_INLINE bool hw_cache_mrm_get_misses_thres_status ( void  )

Get the cache MRM misses threshold IRQ status.

Returns
True if an interrupt has been generated because the number of misses reached the programmed threshold (if !=0)

◆ hw_cache_mrm_get_tint()

__STATIC_INLINE uint32_t hw_cache_mrm_get_tint ( void  )

Get the cache MRM monitoring time interval.

Returns
The monitoring time interval in clock cycles

◆ hw_cache_mrm_get_tint_status()

__STATIC_INLINE bool hw_cache_mrm_get_tint_status ( void  )

Get the cache MRM timer interval IRQ status.

Returns
True if an interrupt has been generated because the time interval counter reached the end (time interval != 0).

◆ hw_cache_mrm_set_hits()

__STATIC_INLINE void hw_cache_mrm_set_hits ( uint32_t  hits)

Set the cache MRM cache hits number.

This is primarily intended for clearing the hits number

Parameters
[in]hitsThe number of cache hits

◆ hw_cache_mrm_set_hits_thres()

__STATIC_INLINE void hw_cache_mrm_set_hits_thres ( uint32_t  thres)

Set the cache MRM interrupt threshold for hits.

Defines the threshold (in hits) to trigger the interrupt generation. A value of 0 disables interrupt generation

Parameters
[in]thresThe interrupt generation threshold (in hits)

◆ hw_cache_mrm_set_hits_with_one_wait_state()

__STATIC_INLINE void hw_cache_mrm_set_hits_with_one_wait_state ( uint32_t  hits)

Set the cache MRM hits with 1 Wait State number.

This is primarily intended for clearing the register

Parameters
[in]hitsThe number of cache hits with 1 Wait State

◆ hw_cache_mrm_set_misses()

__STATIC_INLINE void hw_cache_mrm_set_misses ( uint32_t  misses)

Set the cache MRM cache misses number.

This is primarily intended for clearing the misses number

Parameters
[in]missesThe number of cache misses

◆ hw_cache_mrm_set_misses_thres()

__STATIC_INLINE void hw_cache_mrm_set_misses_thres ( uint32_t  thres)

Set the cache MRM interrupt threshold for misses.

Defines the threshold (in misses) to trigger the interrupt generation. A value of 0 disables interrupt generation

Parameters
[in]thresThe interrupt generation threshold (in misses)

◆ hw_cache_mrm_set_tint()

__STATIC_INLINE void hw_cache_mrm_set_tint ( uint32_t  tint)

Set the cache MRM monitoring time interval.

Defines the time interval for the monitoring in 32 MHz clock cycles. Must be an 19-bit value max. When this time is reached, an interrupt will be generated. A value of 0 disables interrupt generation

Parameters
[in]tintMonitoring time interval in clock cycles

◆ hw_cache_mrm_start_counters()

__STATIC_INLINE void hw_cache_mrm_start_counters ( void  )

Start MRM counters.

Note
If Timer interval is not set to 0 using hw_cache_mrm_set_tint, the timer interval will count down to 0. When zero is reached, an interrupt will be generated, and the counters will be disabled automatically.

◆ hw_cache_set_eflash_cacheable_len()

__STATIC_INLINE void hw_cache_set_eflash_cacheable_len ( uint32_t  len)

Set the eflash cacheable memory length.

Parameters
[in]lenThe eflash cacheable memory length, in 64KB blocks. The actual cacheable memory length will therefore be len * 64KB. Valid values: [0, 511]. A value of 0 sets the iCache Controller in bypass mode for the read requests targeting the cacheable eflash memory area. Any value greater than zero will set it in caching mode.

◆ hw_cache_set_extflash_cacheable_len()

__STATIC_INLINE void hw_cache_set_extflash_cacheable_len ( uint32_t  len)

Set the external (QSPI) flash cacheable memory length.

Parameters
[in]lenThe QSPI flash cacheable memory length, in 64KB blocks. The actual cacheable memory length will therefore be len * 64KB. Valid values: [0, 511]. A value of 0 sets the iCache Controller in bypass mode for the read requests targeting the cacheable QSPI flash memory area. Any value greater than zero will set it in caching mode.

◆ hw_cache_set_len()

__STATIC_INLINE void hw_cache_set_len ( uint32_t  len)

Set the cacheable memory length. Backwards compatibility wrapper.

Parameters
[in]lenSee hw_cache_set_eflash_cacheable_len for details.
Deprecated:
API no longer supported, use hw_cache_set_eflash_cacheable_len.