|  | NMSIS-Core
    Version 1.4.1
    NMSIS-Core support for Nuclei processor-based devices | 
Functions that set/disable/enable different attribute type(Device/Non-Cacheable/Cacheable) memory regions, or get region info. More...
| Data Structures | |
| struct | pma_config | 
| Macros | |
| #define | PMA_REGION_TYPE_SECSHARE (1UL << 3) | 
| Set this region shareable between secure world and non-secure world, or else default is invalid.  More... | |
| #define | PMA_REGION_TYPE_NC (1UL << 2) | 
| Set this region Non-Cacheable, or else default is invalid.  More... | |
| #define | PMA_REGION_TYPE_DEV (1UL << 1) | 
| Set this region Device, or else default is invalid.  More... | |
| #define | PMA_REGION_TYPE_CA (0) | 
| Set this region Cacheable, which is default.  More... | |
| #define | PMA_REGION_ENA (1UL << 0) | 
| Enable this region, then the region type will take effect.  More... | |
| #define | PMA_REGION_DIS (0) | 
| Disable this region.  More... | |
| Functions | |
| __STATIC_INLINE long | PMA_SetRegion (unsigned long entry_idx, pma_config *pma_cfg) | 
| Configure one region in machine mode.  More... | |
| __STATIC_INLINE long | PMA_GetRegion (unsigned long entry_idx, pma_config *pma_cfg) | 
| Get the region info in machine mode.  More... | |
| __STATIC_INLINE long | PMA_SetRegion_S (unsigned long entry_idx, pma_config *pma_cfg) | 
| Configure one region for Secure S-Mode world to share with Non-Secure S-Mode world.  More... | |
| __STATIC_INLINE long | PMA_GetRegion_S (unsigned long entry_idx, pma_config *pma_cfg) | 
| Get the region info of Secure S-Mode world sharing with Non-Secure S-Mode world.  More... | |
| __STATIC_FORCEINLINE void | PMA_EnableHwDevRegion (unsigned long entry_idx) | 
| Enable hardware defined Device regions.  More... | |
| __STATIC_FORCEINLINE void | PMA_DisableHwDevRegion (unsigned long entry_idx) | 
| Disable hardware defined Device regions.  More... | |
| __STATIC_FORCEINLINE void | PMA_EnableHwNCRegion (unsigned long entry_idx) | 
| Enable hardware defined Non-Cacheable regions.  More... | |
| __STATIC_FORCEINLINE void | PMA_DisableHwNCRegion (unsigned long entry_idx) | 
| Disable hardware defined Non-Cacheable regions.  More... | |
| __STATIC_FORCEINLINE void | PMA_EnableHwCARegion (unsigned long entry_idx) | 
| Enable hardware defined Cacheable regions.  More... | |
| __STATIC_FORCEINLINE void | PMA_DisableHwCARegion (unsigned long entry_idx) | 
| Disable hardware defined Cacheable regions.  More... | |
Functions that set/disable/enable different attribute type(Device/Non-Cacheable/Cacheable) memory regions, or get region info.
Nuclei provide Physical Memory Attribute(PMA) to define the attribute of memory.PMA will affect CPU access memory behavior.
PMA are split into three attributes:
Hardware provide some software CSR to set the pma by mattri(n)_base/mattri(n)_mask/sattri(n)_base/sattri(n)_mask
Hardware defined PMA regions(up to 8 DEV/NC/CA regions) can be disable or enable by CSR mmacro_dev_en/mmacro_noc_en/mmacro_ca_en
| #define PMA_REGION_DIS (0) | 
Disable this region.
Definition at line 58 of file core_feature_pma.h.
| #define PMA_REGION_ENA (1UL << 0) | 
Enable this region, then the region type will take effect.
Definition at line 57 of file core_feature_pma.h.
| #define PMA_REGION_TYPE_CA (0) | 
Set this region Cacheable, which is default.
Definition at line 56 of file core_feature_pma.h.
| #define PMA_REGION_TYPE_DEV (1UL << 1) | 
Set this region Device, or else default is invalid.
Definition at line 55 of file core_feature_pma.h.
| #define PMA_REGION_TYPE_NC (1UL << 2) | 
Set this region Non-Cacheable, or else default is invalid.
Definition at line 54 of file core_feature_pma.h.
| #define PMA_REGION_TYPE_SECSHARE (1UL << 3) | 
Set this region shareable between secure world and non-secure world, or else default is invalid.
Definition at line 53 of file core_feature_pma.h.
| __STATIC_FORCEINLINE void PMA_DisableHwCARegion | ( | unsigned long | entry_idx | ) | 
Disable hardware defined Cacheable regions.
Disable Cacheable region by corresponding index
| [in] | entry_idx | Index(0-7) | 
Definition at line 351 of file core_feature_pma.h.
References __RV_CSR_CLEAR, and CSR_MMACRO_CA_EN.
| __STATIC_FORCEINLINE void PMA_DisableHwDevRegion | ( | unsigned long | entry_idx | ) | 
Disable hardware defined Device regions.
Disable Device region by corresponding index
| [in] | entry_idx | Index(0-7) | 
Definition at line 279 of file core_feature_pma.h.
References __RV_CSR_CLEAR, and CSR_MMACRO_DEV_EN.
| __STATIC_FORCEINLINE void PMA_DisableHwNCRegion | ( | unsigned long | entry_idx | ) | 
Disable hardware defined Non-Cacheable regions.
Disable Non-Cacheable region by corresponding index
| [in] | entry_idx | Index(0-7) | 
Definition at line 315 of file core_feature_pma.h.
References __RV_CSR_CLEAR, and CSR_MMACRO_NOC_EN.
| __STATIC_FORCEINLINE void PMA_EnableHwCARegion | ( | unsigned long | entry_idx | ) | 
Enable hardware defined Cacheable regions.
Enable Cacheable region by corresponding index
| [in] | entry_idx | Index(0-7) | 
Definition at line 333 of file core_feature_pma.h.
References __RV_CSR_SET, and CSR_MMACRO_CA_EN.
| __STATIC_FORCEINLINE void PMA_EnableHwDevRegion | ( | unsigned long | entry_idx | ) | 
Enable hardware defined Device regions.
Enable Device region by corresponding index
| [in] | entry_idx | Index(0-7) | 
Definition at line 261 of file core_feature_pma.h.
References __RV_CSR_SET, and CSR_MMACRO_DEV_EN.
| __STATIC_FORCEINLINE void PMA_EnableHwNCRegion | ( | unsigned long | entry_idx | ) | 
Enable hardware defined Non-Cacheable regions.
Enable Non-Cacheable region by corresponding index
| [in] | entry_idx | Index(0-7) | 
Definition at line 297 of file core_feature_pma.h.
References __RV_CSR_SET, and CSR_MMACRO_NOC_EN.
| __STATIC_INLINE long PMA_GetRegion | ( | unsigned long | entry_idx, | 
| pma_config * | pma_cfg | ||
| ) | 
Get the region info in machine mode.
Read the region(0-n) info of base address/region type/region size/enable status
| [in] | entry_idx | Index(0-n) of paired mattri(n)_mask and mattri(n)_base | 
| [out] | pma_cfg | Region info read | 
Definition at line 139 of file core_feature_pma.h.
References __CTZ(), __RV_CSR_READ, CSR_MATTRI0_BASE, CSR_MATTRI0_MASK, CSR_MATTRI1_BASE, CSR_MATTRI1_MASK, CSR_MATTRI2_BASE, CSR_MATTRI2_MASK, CSR_MATTRI3_BASE, CSR_MATTRI3_MASK, CSR_MATTRI4_BASE, CSR_MATTRI4_MASK, CSR_MATTRI5_BASE, CSR_MATTRI5_MASK, CSR_MATTRI6_BASE, CSR_MATTRI6_MASK, CSR_MATTRI7_BASE, CSR_MATTRI7_MASK, pma_config::region_base, pma_config::region_enable, pma_config::region_size, and pma_config::region_type.
| __STATIC_INLINE long PMA_GetRegion_S | ( | unsigned long | entry_idx, | 
| pma_config * | pma_cfg | ||
| ) | 
Get the region info of Secure S-Mode world sharing with Non-Secure S-Mode world.
Read the region(0-7) info of base address/region size/enable status
| [in] | entry_idx | Index(0-7) of paired sattri(n)_mask and sattri(n)_base | 
| [out] | pma_cfg | Region info read | 
Definition at line 219 of file core_feature_pma.h.
References __CTZ(), __RV_CSR_READ, CSR_SATTRI0_BASE, CSR_SATTRI0_MASK, CSR_SATTRI1_BASE, CSR_SATTRI1_MASK, CSR_SATTRI2_BASE, CSR_SATTRI2_MASK, CSR_SATTRI3_BASE, CSR_SATTRI3_MASK, CSR_SATTRI4_BASE, CSR_SATTRI4_MASK, CSR_SATTRI5_BASE, CSR_SATTRI5_MASK, CSR_SATTRI6_BASE, CSR_SATTRI6_MASK, CSR_SATTRI7_BASE, CSR_SATTRI7_MASK, pma_config::region_base, pma_config::region_enable, and pma_config::region_size.
| __STATIC_INLINE long PMA_SetRegion | ( | unsigned long | entry_idx, | 
| pma_config * | pma_cfg | ||
| ) | 
Configure one region in machine mode.
Set the region(0-n) info of base address/region type/region size/enable status
| [in] | entry_idx | Index(0-n) of paired mattri(n)_mask and mattri(n)_base | 
| [in] | pma_cfg | Region info to configure | 
Definition at line 99 of file core_feature_pma.h.
References __RV_CSR_WRITE, CSR_MATTRI0_BASE, CSR_MATTRI0_MASK, CSR_MATTRI1_BASE, CSR_MATTRI1_MASK, CSR_MATTRI2_BASE, CSR_MATTRI2_MASK, CSR_MATTRI3_BASE, CSR_MATTRI3_MASK, CSR_MATTRI4_BASE, CSR_MATTRI4_MASK, CSR_MATTRI5_BASE, CSR_MATTRI5_MASK, CSR_MATTRI6_BASE, CSR_MATTRI6_MASK, CSR_MATTRI7_BASE, CSR_MATTRI7_MASK, pma_config::region_base, pma_config::region_enable, pma_config::region_size, and pma_config::region_type.
| __STATIC_INLINE long PMA_SetRegion_S | ( | unsigned long | entry_idx, | 
| pma_config * | pma_cfg | ||
| ) | 
Configure one region for Secure S-Mode world to share with Non-Secure S-Mode world.
Set the region(0-7) info of base address/region size/enable status
| [in] | entry_idx | Index(0-7) of paired sattri(n)_mask and sattri(n)_base | 
| [in] | pma_cfg | Region info to configure | 
Definition at line 181 of file core_feature_pma.h.
References __RV_CSR_WRITE, CSR_SATTRI0_BASE, CSR_SATTRI0_MASK, CSR_SATTRI1_BASE, CSR_SATTRI1_MASK, CSR_SATTRI2_BASE, CSR_SATTRI2_MASK, CSR_SATTRI3_BASE, CSR_SATTRI3_MASK, CSR_SATTRI4_BASE, CSR_SATTRI4_MASK, CSR_SATTRI5_BASE, CSR_SATTRI5_MASK, CSR_SATTRI6_BASE, CSR_SATTRI6_MASK, CSR_SATTRI7_BASE, CSR_SATTRI7_MASK, pma_config::region_base, pma_config::region_enable, and pma_config::region_size.