|
@@ -290,6 +290,42 @@ typedef struct
|
|
|
/*@} end of group CSI_CACHE */
|
|
|
|
|
|
|
|
|
+#define SYSMAP_SYSMAPCFG_B_Pos 0U /*!< SYSMAP SYSMAPCFG: B Position */
|
|
|
+#define SYSMAP_SYSMAPCFG_B_Msk (0x1UL << SYSMAP_SYSMAPCFG_B_Pos) /*!< SYSMAP SYSMAPCFG: B Mask */
|
|
|
+#define SYSMAP_SYSMAPCFG_C_Pos 1U /*!< SYSMAP SYSMAPCFG: C Position */
|
|
|
+#define SYSMAP_SYSMAPCFG_C_Msk (0x1UL << SYSMAP_SYSMAPCFG_C_Pos) /*!< SYSMAP SYSMAPCFG: C Mask */
|
|
|
+#define SYSMAP_SYSMAPCFG_SO_Pos 2U /*!< SYSMAP SYSMAPCFG: SO Position */
|
|
|
+#define SYSMAP_SYSMAPCFG_SO_Msk (0x1UL << SYSMAP_SYSMAPCFG_SO_Pos) /*!< SYSMAP SYSMAPCFG: SO Mask */
|
|
|
+/**
|
|
|
+ \ingroup CSI_core_register
|
|
|
+ \defgroup CSI_SYSMAP system map (SYSMAP)
|
|
|
+ \brief Type definitions for the SYSMAP Registers
|
|
|
+ @{
|
|
|
+ */
|
|
|
+typedef struct
|
|
|
+{
|
|
|
+ __IOM uint32_t SYSMAPADDR0; /*!< Offset: 0x000 (R/W) SYSMAP configure register */
|
|
|
+ __IOM uint32_t SYSMAPCFG0; /*!< Offset: 0x004 (R/W) SYSMAP configure register */
|
|
|
+ __IOM uint32_t SYSMAPADDR1; /*!< Offset: 0x008 (R/W) SYSMAP configure register */
|
|
|
+ __IOM uint32_t SYSMAPCFG1; /*!< Offset: 0x00c (R/W) SYSMAP configure register */
|
|
|
+ __IOM uint32_t SYSMAPADDR2; /*!< Offset: 0x010 (R/W) SYSMAP configure register */
|
|
|
+ __IOM uint32_t SYSMAPCFG2; /*!< Offset: 0x014 (R/W) SYSMAP configure register */
|
|
|
+ __IOM uint32_t SYSMAPADDR3; /*!< Offset: 0x018 (R/W) SYSMAP configure register */
|
|
|
+ __IOM uint32_t SYSMAPCFG3; /*!< Offset: 0x01c (R/W) SYSMAP configure register */
|
|
|
+ __IOM uint32_t SYSMAPADDR4; /*!< Offset: 0x020 (R/W) SYSMAP configure register */
|
|
|
+ __IOM uint32_t SYSMAPCFG4; /*!< Offset: 0x024 (R/W) SYSMAP configure register */
|
|
|
+ __IOM uint32_t SYSMAPADDR5; /*!< Offset: 0x028 (R/W) SYSMAP configure register */
|
|
|
+ __IOM uint32_t SYSMAPCFG5; /*!< Offset: 0x02c (R/W) SYSMAP configure register */
|
|
|
+ __IOM uint32_t SYSMAPADDR6; /*!< Offset: 0x030 (R/W) SYSMAP configure register */
|
|
|
+ __IOM uint32_t SYSMAPCFG6; /*!< Offset: 0x034 (R/W) SYSMAP configure register */
|
|
|
+ __IOM uint32_t SYSMAPADDR7; /*!< Offset: 0x038 (R/W) SYSMAP configure register */
|
|
|
+ __IOM uint32_t SYSMAPCFG7; /*!< Offset: 0x03c (R/W) SYSMAP configure register */
|
|
|
+} SYSMAP_Type;
|
|
|
+
|
|
|
+
|
|
|
+/*@} end of group CSI_SYSMAP */
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
\ingroup CSI_core_register
|
|
|
\defgroup CSI_SysTick System Tick Timer (CORET)
|
|
@@ -383,12 +419,14 @@ typedef struct
|
|
|
#define TCIP_BASE (0xE000E000UL) /*!< Titly Coupled IP Base Address */
|
|
|
#define CORET_BASE (0xE0004000UL) /*!< CORET Base Address */
|
|
|
#define CLIC_BASE (0xE0800000UL) /*!< CLIC Base Address */
|
|
|
+#define SYSMAP_BASE (0xEFFFF000UL) /*!< SYSMAP Base Address */
|
|
|
#define DCC_BASE (0xE4010000UL) /*!< DCC Base Address */
|
|
|
#define CACHE_BASE (TCIP_BASE + 0x1000UL) /*!< CACHE Base Address */
|
|
|
|
|
|
#define CORET ((CORET_Type *) CORET_BASE ) /*!< SysTick configuration struct */
|
|
|
#define CLIC ((CLIC_Type *) CLIC_BASE ) /*!< CLIC configuration struct */
|
|
|
#define DCC ((DCC_Type *) DCC_BASE ) /*!< DCC configuration struct */
|
|
|
+#define SYSMAP ((SYSMAP_Type *) SYSMAP_BASE ) /*!< SYSMAP configuration struct */
|
|
|
#define CACHE ((CACHE_Type *) CACHE_BASE ) /*!< cache configuration struct */
|
|
|
|
|
|
/*@} */
|
|
@@ -646,7 +684,7 @@ __STATIC_INLINE void csi_mpu_disable_region(uint32_t idx)
|
|
|
*/
|
|
|
__STATIC_INLINE uint32_t csi_coret_config(uint32_t ticks, int32_t IRQn)
|
|
|
{
|
|
|
- if (CORET->MTIMECMP) {
|
|
|
+ if ((CORET->MTIMECMP != 0) && (CORET->MTIMECMP != 0xffffffffffffffff)) {
|
|
|
CORET->MTIMECMP = CORET->MTIMECMP + ticks;
|
|
|
} else {
|
|
|
CORET->MTIMECMP = CORET->MTIME + ticks;
|
|
@@ -691,6 +729,126 @@ __STATIC_INLINE uint32_t csi_coret_get_valueh(void)
|
|
|
}
|
|
|
|
|
|
/*@} end of CSI_Core_SysTickFunctions */
|
|
|
+/* ########################## SYSMAP functions #################################### */
|
|
|
+/**
|
|
|
+ \ingroup CSI_Core_FunctionInterface
|
|
|
+ \defgroup CSI_Core_SYSMAPFunctions SYSMAP Functions
|
|
|
+ \brief Functions that manage system map attribute
|
|
|
+ @{
|
|
|
+ */
|
|
|
+
|
|
|
+/**
|
|
|
+ \brief Get SYSMAPCFGx Register by index
|
|
|
+ \details Returns the content of the SYSMAPxCFG Register.
|
|
|
+ \param [in] idx SYSMAP region index
|
|
|
+ \return SYSMAPxCFG Register value
|
|
|
+ */
|
|
|
+__STATIC_INLINE uint8_t __get_SYSMAPCFGx(uint32_t idx)
|
|
|
+{
|
|
|
+ switch (idx)
|
|
|
+ {
|
|
|
+ case 0: return SYSMAP->SYSMAPCFG0;
|
|
|
+ case 1: return SYSMAP->SYSMAPCFG1;
|
|
|
+ case 2: return SYSMAP->SYSMAPCFG2;
|
|
|
+ case 3: return SYSMAP->SYSMAPCFG3;
|
|
|
+ case 4: return SYSMAP->SYSMAPCFG4;
|
|
|
+ case 5: return SYSMAP->SYSMAPCFG5;
|
|
|
+ case 6: return SYSMAP->SYSMAPCFG6;
|
|
|
+ case 7: return SYSMAP->SYSMAPCFG7;
|
|
|
+ default: return 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ \brief Set SYSMAPCFGx by index
|
|
|
+ \details Writes the given value to the SYSMAPxCFG Register.
|
|
|
+ \param [in] idx SYSMAPx region index
|
|
|
+ \param [in] sysmapxcfg SYSMAPxCFG Register value to set
|
|
|
+ */
|
|
|
+__STATIC_INLINE void __set_SYSMAPCFGx(uint32_t idx, uint32_t sysmapxcfg)
|
|
|
+{
|
|
|
+ switch (idx)
|
|
|
+ {
|
|
|
+ case 0: SYSMAP->SYSMAPCFG0 = sysmapxcfg; break;
|
|
|
+ case 1: SYSMAP->SYSMAPCFG1 = sysmapxcfg; break;
|
|
|
+ case 2: SYSMAP->SYSMAPCFG2 = sysmapxcfg; break;
|
|
|
+ case 3: SYSMAP->SYSMAPCFG3 = sysmapxcfg; break;
|
|
|
+ case 4: SYSMAP->SYSMAPCFG4 = sysmapxcfg; break;
|
|
|
+ case 5: SYSMAP->SYSMAPCFG5 = sysmapxcfg; break;
|
|
|
+ case 6: SYSMAP->SYSMAPCFG6 = sysmapxcfg; break;
|
|
|
+ case 7: SYSMAP->SYSMAPCFG7 = sysmapxcfg; break;
|
|
|
+ default: return;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ \brief Get SYSMAPADDRx Register by index
|
|
|
+ \details Returns the content of the SYSMAPADDRx Register.
|
|
|
+ \param [in] idx SYSMAP region index
|
|
|
+ \return SYSMAPADDRx Register value
|
|
|
+ */
|
|
|
+__STATIC_INLINE uint32_t __get_SYSMAPADDRx(uint32_t idx)
|
|
|
+{
|
|
|
+ switch(idx)
|
|
|
+ {
|
|
|
+ case 0: return SYSMAP->SYSMAPADDR0;
|
|
|
+ case 1: return SYSMAP->SYSMAPADDR1;
|
|
|
+ case 2: return SYSMAP->SYSMAPADDR2;
|
|
|
+ case 3: return SYSMAP->SYSMAPADDR3;
|
|
|
+ case 4: return SYSMAP->SYSMAPADDR4;
|
|
|
+ case 5: return SYSMAP->SYSMAPADDR5;
|
|
|
+ case 6: return SYSMAP->SYSMAPADDR6;
|
|
|
+ case 7: return SYSMAP->SYSMAPADDR7;
|
|
|
+ default: return 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ \brief Set SYSMAPADDRx by index
|
|
|
+ \details Writes the given value to the SYSMAPADDRx Register.
|
|
|
+ \param [in] idx SYSMAP region index
|
|
|
+ \param [in] sysmapaddr SYSMAPADDRx Register value to set
|
|
|
+ */
|
|
|
+__STATIC_INLINE void __set_SYSMAPADDRx(uint32_t idx, uint32_t sysmapxaddr)
|
|
|
+{
|
|
|
+ switch (idx)
|
|
|
+ {
|
|
|
+ case 0: SYSMAP->SYSMAPADDR0 = sysmapxaddr; break;
|
|
|
+ case 1: SYSMAP->SYSMAPADDR1 = sysmapxaddr; break;
|
|
|
+ case 2: SYSMAP->SYSMAPADDR2 = sysmapxaddr; break;
|
|
|
+ case 3: SYSMAP->SYSMAPADDR3 = sysmapxaddr; break;
|
|
|
+ case 4: SYSMAP->SYSMAPADDR4 = sysmapxaddr; break;
|
|
|
+ case 5: SYSMAP->SYSMAPADDR5 = sysmapxaddr; break;
|
|
|
+ case 6: SYSMAP->SYSMAPADDR6 = sysmapxaddr; break;
|
|
|
+ case 7: SYSMAP->SYSMAPADDR7 = sysmapxaddr; break;
|
|
|
+ default: return;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ \brief configure system map attribute.
|
|
|
+ \details
|
|
|
+ \param [in] idx system map region (0, 1, 2, ..., 7).
|
|
|
+ \param [in] base_addr base address must be aligned with page size.
|
|
|
+ \param [in] enable enable or disable memory protected region.
|
|
|
+ */
|
|
|
+__STATIC_INLINE void csi_sysmap_config_region(uint32_t idx, uint32_t base_addr, uint32_t attr)
|
|
|
+{
|
|
|
+ uint32_t addr = 0;
|
|
|
+
|
|
|
+ if (idx > 7) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ addr = base_addr >> 12;
|
|
|
+ attr = attr << 2;
|
|
|
+
|
|
|
+ __set_SYSMAPADDRx(idx, addr);
|
|
|
+ __set_SYSMAPCFGx(idx, attr);
|
|
|
+}
|
|
|
+
|
|
|
+/*@} end of CSI_Core_SYSMAPFunctions */
|
|
|
+
|
|
|
|
|
|
/* ##################################### DCC function ########################################### */
|
|
|
/**
|
|
@@ -986,7 +1144,7 @@ __STATIC_INLINE void csi_dcache_invalid_range (uint32_t *addr, int32_t dsize)
|
|
|
__STATIC_INLINE void csi_dcache_clean_range (uint32_t *addr, int32_t dsize)
|
|
|
{
|
|
|
|
|
|
-#if (__DCACHE_PRESENT == 1)
|
|
|
+#if (__DCACHE_PRESENT == 1U)
|
|
|
int32_t op_size = dsize + (uint32_t)addr % 32;
|
|
|
uint32_t op_addr = (uint32_t) addr & CACHE_INV_ADDR_Msk;
|
|
|
int32_t linesize = 32;
|