|
SmartSnippets DA1459x SDK
|
Go to the documentation of this file.
42 #ifndef HW_CACHE_DA1459X_H_
43 #define HW_CACHE_DA1459X_H_
58 HW_CACHE_EFLASH_REGION_SZ_512KB = 4,
59 HW_CACHE_EFLASH_REGION_SZ_256KB = 5,
60 HW_CACHE_EFLASH_REGION_SZ_128KB = 6,
61 HW_CACHE_EFLASH_REGION_SZ_64KB = 7,
62 HW_CACHE_EFLASH_REGION_SZ_INVALID,
65 typedef uint16_t eflash_region_base_t;
66 typedef uint16_t eflash_region_offset_t;
68 #define HW_CACHE_EFLASH_DEFAULT_REGION_BASE 0x00A0
69 #define HW_CACHE_EFLASH_MAX_REGION_BASE 0xFF
70 #define HW_CACHE_EFLASH_DEFAULT_REGION_OFFSET 0x0
71 #define HW_CACHE_EFLASH_MAX_REGION_OFFSET 0xFFF
72 #define HW_CACHE_EFLASH_DEFAULT_REGION_SZ HW_CACHE_EFLASH_REGION_SZ_128KB
73 #define HW_CACHE_EFLASH_MIN_REGION_SZ HW_CACHE_EFLASH_REGION_SZ_64KB
74 #define HW_CACHE_EFLASH_MAX_REGION_SZ HW_CACHE_EFLASH_REGION_SZ_512KB
81 HW_CACHE_FLASH_REGION_SZ_32MB = 0,
82 HW_CACHE_FLASH_REGION_SZ_16MB = 1,
83 HW_CACHE_FLASH_REGION_SZ_8MB = 2,
84 HW_CACHE_FLASH_REGION_SZ_4MB = 3,
85 HW_CACHE_FLASH_REGION_SZ_2MB = 4,
86 HW_CACHE_FLASH_REGION_SZ_1MB = 5,
87 HW_CACHE_FLASH_REGION_SZ_512KB = 6,
88 HW_CACHE_FLASH_REGION_SZ_256KB = 7,
89 HW_CACHE_FLASH_REGION_SZ_INVALID,
92 typedef uint16_t flash_region_base_t;
93 typedef uint16_t flash_region_offset_t;
95 #define HW_CACHE_FLASH_DEFAULT_REGION_BASE 0x1600
96 #define HW_CACHE_FLASH_MAX_REGION_BASE 0x17fc
97 #define HW_CACHE_FLASH_DEFAULT_REGION_OFFSET 0x0
98 #define HW_CACHE_FLASH_MAX_REGION_OFFSET 0xFFF
99 #define HW_CACHE_FLASH_DEFAULT_REGION_SZ HW_CACHE_FLASH_REGION_SZ_512KB
100 #define HW_CACHE_FLASH_MIN_REGION_SZ HW_CACHE_FLASH_REGION_SZ_256KB
101 #define HW_CACHE_FLASH_MAX_REGION_SZ HW_CACHE_FLASH_REGION_SZ_32MB
120 while (
REG_GETF(CRG_TOP, SYS_CTRL_REG, CACHERAM_MUX) != 1) {}
135 while (
REG_GETF(CRG_TOP, SYS_CTRL_REG, CACHERAM_MUX) != 0) {}
147 return REG_GETF(CRG_TOP, SYS_CTRL_REG, CACHERAM_MUX);
163 REG_SETF(CACHE, CACHE_CTRL2_REG, CACHE_LEN, len);
174 return REG_GETF(CACHE, CACHE_CTRL2_REG, CACHE_LEN);
192 REG_SETF(CACHE, CACHE_CTRL2_REG, CACHE_EF_LEN, len);
203 return REG_GETF(CACHE, CACHE_CTRL2_REG, CACHE_EF_LEN);
213 DEPRECATED_MSG(
"API no longer supported, use hw_cache_set_eflash_cacheable_len.")
225 DEPRECATED_MSG(
"API no longer supported, use hw_cache_get_eflash_cacheable_len.")
236 REG_CLR_BIT(CACHE, CACHE_CTRL2_REG, CACHE_FLUSH_DISABLE);
244 REG_SET_BIT(CACHE, CACHE_CTRL2_REG, CACHE_FLUSH_DISABLE);
256 return REG_GETF(CACHE, CACHE_CTRL2_REG, CACHE_FLUSH_DISABLE);
292 ASSERT_WARNING(base <= HW_CACHE_EFLASH_MAX_REGION_BASE);
293 REG_SETF(CACHE, CACHE_EFLASH_REG, EFLASH_REGION_BASE, base);
303 return REG_GETF(CACHE, CACHE_EFLASH_REG, EFLASH_REGION_BASE);
322 ASSERT_WARNING(offset <= HW_CACHE_EFLASH_MAX_REGION_OFFSET);
323 REG_SETF(CACHE, CACHE_EFLASH_REG, EFLASH_REGION_OFFSET, offset);
334 return REG_GETF(CACHE, CACHE_EFLASH_REG, EFLASH_REGION_OFFSET);
350 ASSERT_WARNING(sz >= HW_CACHE_EFLASH_MAX_REGION_SZ && sz <= HW_CACHE_EFLASH_MIN_REGION_SZ);
351 REG_SETF(CACHE, CACHE_EFLASH_REG, EFLASH_REGION_SIZE, sz);
361 return REG_GETF(CACHE, CACHE_EFLASH_REG, EFLASH_REGION_SIZE);
400 ASSERT_WARNING((base & 0xfe03) == HW_CACHE_FLASH_DEFAULT_REGION_BASE);
401 REG_SETF(CACHE, CACHE_FLASH_REG, FLASH_REGION_BASE, base);
411 return REG_GETF(CACHE, CACHE_FLASH_REG, FLASH_REGION_BASE);
430 ASSERT_WARNING(offset <= HW_CACHE_FLASH_MAX_REGION_OFFSET);
431 REG_SETF(CACHE, CACHE_FLASH_REG, FLASH_REGION_OFFSET, offset);
442 return REG_GETF(CACHE, CACHE_FLASH_REG, FLASH_REGION_OFFSET);
458 ASSERT_WARNING(sz >= HW_CACHE_FLASH_MAX_REGION_SZ && sz <= HW_CACHE_FLASH_MIN_REGION_SZ);
459 REG_SETF(CACHE, CACHE_FLASH_REG, FLASH_REGION_SIZE, sz);
469 return REG_GETF(CACHE, CACHE_FLASH_REG, FLASH_REGION_SIZE);
502 return CACHE->CACHE_MRM_HITS1WS_REG;
515 CACHE->CACHE_MRM_HITS1WS_REG = hits;
__STATIC_INLINE int hw_cache_get_extflash_cacheable_len(void)
Get the external (QSPI) flash cacheable memory length.
Definition: hw_cache_da1459x.h:172
__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.
Definition: hw_cache_da1459x.h:482
__STATIC_INLINE HW_CACHE_EFLASH_REGION_SZ hw_cache_eflash_get_region_size(void)
Get the eflash region size.
Definition: hw_cache_da1459x.h:359
__STATIC_INLINE void hw_cache_eflash_set_region_size(HW_CACHE_EFLASH_REGION_SZ sz)
Set the eflash region size.
Definition: hw_cache_da1459x.h:348
#define REG_SETF(base, reg, field, new_val)
Set the value of a register field.
Definition: sdk_defs.h:738
#define REG_CLR_BIT(base, reg, field)
Clear a bit of a register.
Definition: sdk_defs.h:781
__STATIC_INLINE void hw_cache_enable_flushing(void)
Enable flushing the iCache Controller (cache RAM cells) contents. For debugging only.
Definition: hw_cache_da1459x.h:234
__STATIC_INLINE flash_region_offset_t hw_cache_flash_get_region_offset(void)
Get the flash region offset.
Definition: hw_cache_da1459x.h:440
#define REG_SET_BIT(base, reg, field)
Set a bit of a register.
Definition: sdk_defs.h:766
#define CACHE_CACHE_CTRL2_REG_CACHE_EF_LEN_Pos
Definition: DA1459x-00.h:1612
__STATIC_INLINE eflash_region_offset_t hw_cache_eflash_get_region_offset(void)
Get the eflash region offset.
Definition: hw_cache_da1459x.h:332
Central include header file with platform definitions.
__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.
Definition: hw_cache_da1459x.h:513
__STATIC_INLINE void hw_cache_set_extflash_cacheable_len(uint32_t len)
Set the external (QSPI) flash cacheable memory length.
Definition: hw_cache_da1459x.h:160
#define CACHE_CACHE_CTRL2_REG_CACHE_EF_LEN_Msk
Definition: DA1459x-00.h:1613
#define CACHE_CACHE_CTRL2_REG_CACHE_LEN_Msk
Definition: DA1459x-00.h:1627
__STATIC_INLINE void hw_cache_eflash_set_region_offset(eflash_region_offset_t offset)
Set the eflash region offset.
Definition: hw_cache_da1459x.h:320
__STATIC_INLINE void hw_cache_set_len(uint32_t len)
Set the cacheable memory length. Backwards compatibility wrapper.
Definition: hw_cache_da1459x.h:214
__STATIC_INLINE eflash_region_base_t hw_cache_eflash_get_region_base(void)
Get the eflash region base.
Definition: hw_cache_da1459x.h:301
__STATIC_INLINE int hw_cache_get_eflash_cacheable_len(void)
Get the eflash cacheable memory length.
Definition: hw_cache_da1459x.h:201
__STATIC_INLINE flash_region_base_t hw_cache_flash_get_region_base(void)
Get the flash region base.
Definition: hw_cache_da1459x.h:409
__STATIC_INLINE void hw_cache_eflash_set_region_base(eflash_region_base_t base)
Set the eflash region base.
Definition: hw_cache_da1459x.h:290
__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.
Definition: hw_cache_da1459x.h:374
HW_CACHE_EFLASH_REGION_SZ
Cacheable eflash Region Sizes as defined in DA1459x datasheet.
Definition: hw_cache_da1459x.h:57
__STATIC_INLINE uint32_t hw_cache_mrm_get_hits_with_one_wait_state(void)
Get the cache MRM hits with 1 Wait State number.
Definition: hw_cache_da1459x.h:500
__STATIC_INLINE void hw_cache_disable()
Disables the iCache Controller.
Definition: hw_cache_da1459x.h:131
__STATIC_INLINE void hw_cache_flash_set_region_base(flash_region_base_t base)
Set the flash region base.
Definition: hw_cache_da1459x.h:398
__STATIC_INLINE int hw_cache_get_len(void)
Get the cacheable memory length. Backwards compatibility wrapper.
Definition: hw_cache_da1459x.h:226
__STATIC_INLINE void hw_cache_set_eflash_cacheable_len(uint32_t len)
Set the eflash cacheable memory length.
Definition: hw_cache_da1459x.h:188
__STATIC_INLINE void hw_cache_enable()
Enables the iCache Controller.
Definition: hw_cache_da1459x.h:116
#define GLOBAL_INT_RESTORE()
Macro to restore all interrupts.
Definition: sdk_defs.h:477
__STATIC_INLINE void hw_cache_disable_flushing(void)
Disable flushing the iCache Controller (cache RAM cells) contents. For debugging only.
Definition: hw_cache_da1459x.h:242
#define REG_GETF(base, reg, field)
Return the value of a register field.
Definition: sdk_defs.h:711
__STATIC_INLINE void hw_cache_flash_set_region_size(HW_CACHE_FLASH_REGION_SZ sz)
Set the flash region size.
Definition: hw_cache_da1459x.h:456
HW_CACHE_FLASH_REGION_SZ
Cacheable flash Region Sizes as defined in DA1459x datasheet.
Definition: hw_cache_da1459x.h:80
__STATIC_INLINE HW_CACHE_FLASH_REGION_SZ hw_cache_flash_get_region_size(void)
Get the flash region size.
Definition: hw_cache_da1459x.h:467
__STATIC_INLINE void hw_cache_flush(void)
Flush the cache contents.
Definition: hw_cache_da1459x.h:265
__STATIC_INLINE bool hw_cache_is_enabled()
Checks if the iCache Controller is enabled.
Definition: hw_cache_da1459x.h:145
__STATIC_INLINE bool hw_cache_is_flushing_disabled()
Checks if the iCache Controller flushing is disabled. For debugging only.
Definition: hw_cache_da1459x.h:254
__STATIC_INLINE void hw_cache_flash_set_region_offset(flash_region_offset_t offset)
Set the flash region offset.
Definition: hw_cache_da1459x.h:428
#define GLOBAL_INT_DISABLE()
Macro to disable all interrupts.
Definition: sdk_defs.h:452