NMSIS-Core
Version 1.3.1
NMSIS-Core support for Nuclei processor-based devices
|
Functions that related to the RISCV supervisor-mode Phyiscal Memory Protection. More...
Data Structures | |
struct | SPMP_CONFIG |
Functions | |
__STATIC_INLINE rv_csr_t | __get_sPMPCFGx (uint32_t csr_idx) |
Get sPMPCFGx Register by csr index. More... | |
__STATIC_INLINE void | __set_sPMPCFGx (uint32_t csr_idx, rv_csr_t spmpcfg) |
Set sPMPCFGx by csr index. More... | |
__STATIC_INLINE uint8_t | __get_sPMPxCFG (uint32_t entry_idx) |
Get 8bit sPMPxCFG Register by sPMP entry index. More... | |
__STATIC_INLINE void | __set_sPMPxCFG (uint32_t entry_idx, uint8_t spmpxcfg) |
Set 8bit sPMPxCFG by spmp entry index. More... | |
__STATIC_INLINE rv_csr_t | __get_sPMPADDRx (uint32_t csr_idx) |
Get sPMPADDRx Register by CSR index. More... | |
__STATIC_INLINE void | __set_sPMPADDRx (uint32_t csr_idx, rv_csr_t spmpaddr) |
Set sPMPADDRx by CSR index. More... | |
__STATIC_INLINE void | __set_sPMPENTRYx (uint32_t entry_idx, const spmp_config *spmp_cfg) |
Set sPMP entry by entry idx. More... | |
__STATIC_INLINE int | __get_sPMPENTRYx (unsigned int entry_idx, spmp_config *spmp_cfg) |
Get sPMP entry by entry idx. More... | |
Functions that related to the RISCV supervisor-mode Phyiscal Memory Protection.
Optional superviosr physical memory protection (sPMP) unit provides per-hart supervisor-mode control registers to allow physical memory access privileges (read, write, execute) to be specified for each physical memory region. The sPMP values are checked after the physical address to be accessed pass PMP checks described in the RISC-V privileged spec.
Like PMP, the sPMP can supports region access control settings as small as four bytes.
__STATIC_INLINE rv_csr_t __get_sPMPADDRx | ( | uint32_t | csr_idx | ) |
Get sPMPADDRx Register by CSR index.
Return the content of the sPMPADDRx Register.
[in] | csr_idx | sPMP region CSR index(0-15) |
Definition at line 212 of file core_feature_spmp.h.
References __RV_CSR_READ, CSR_SPMPADDR0, CSR_SPMPADDR1, CSR_SPMPADDR10, CSR_SPMPADDR11, CSR_SPMPADDR12, CSR_SPMPADDR13, CSR_SPMPADDR14, CSR_SPMPADDR15, CSR_SPMPADDR2, CSR_SPMPADDR3, CSR_SPMPADDR4, CSR_SPMPADDR5, CSR_SPMPADDR6, CSR_SPMPADDR7, CSR_SPMPADDR8, and CSR_SPMPADDR9.
Referenced by __get_sPMPENTRYx().
__STATIC_INLINE rv_csr_t __get_sPMPCFGx | ( | uint32_t | csr_idx | ) |
Get sPMPCFGx Register by csr index.
Return the content of the sPMPCFGx Register.
[in] | csr_idx | sPMPCFG CSR index(0-3) |
Definition at line 95 of file core_feature_spmp.h.
References __RV_CSR_READ, CSR_SPMPCFG0, CSR_SPMPCFG1, CSR_SPMPCFG2, and CSR_SPMPCFG3.
Referenced by __get_sPMPENTRYx(), __get_sPMPxCFG(), __set_sPMPENTRYx(), and __set_sPMPxCFG().
__STATIC_INLINE int __get_sPMPENTRYx | ( | unsigned int | entry_idx, |
spmp_config * | spmp_cfg | ||
) |
Get sPMP entry by entry idx.
Write the given value to the sPMPxCFG Register and sPMPADDRx.
[in] | entry_idx | sPMP entry index(0-15) |
[out] | spmp_cfg | structure of L, U, X, W, R, A field of sPMP configuration register, memory region base address and size of memory region as power of 2 |
Definition at line 336 of file core_feature_spmp.h.
References __CTZ(), __get_sPMPADDRx(), __get_sPMPCFGx(), SPMP_A, SPMP_A_NAPOT, and SPMP_SHIFT.
__STATIC_INLINE uint8_t __get_sPMPxCFG | ( | uint32_t | entry_idx | ) |
Get 8bit sPMPxCFG Register by sPMP entry index.
Return the content of the sPMPxCFG Register.
[in] | entry_idx | sPMP region index(0-15) |
Definition at line 135 of file core_feature_spmp.h.
References __get_sPMPCFGx().
__STATIC_INLINE void __set_sPMPADDRx | ( | uint32_t | csr_idx, |
rv_csr_t | spmpaddr | ||
) |
Set sPMPADDRx by CSR index.
Write the given value to the sPMPADDRx Register.
[in] | csr_idx | sPMP region CSR index(0-15) |
[in] | spmpaddr | sPMPADDRx Register value to set |
Definition at line 241 of file core_feature_spmp.h.
References __RV_CSR_WRITE, CSR_SPMPADDR0, CSR_SPMPADDR1, CSR_SPMPADDR10, CSR_SPMPADDR11, CSR_SPMPADDR12, CSR_SPMPADDR13, CSR_SPMPADDR14, CSR_SPMPADDR15, CSR_SPMPADDR2, CSR_SPMPADDR3, CSR_SPMPADDR4, CSR_SPMPADDR5, CSR_SPMPADDR6, CSR_SPMPADDR7, CSR_SPMPADDR8, and CSR_SPMPADDR9.
Referenced by __set_sPMPENTRYx().
__STATIC_INLINE void __set_sPMPCFGx | ( | uint32_t | csr_idx, |
rv_csr_t | spmpcfg | ||
) |
Set sPMPCFGx by csr index.
Write the given value to the sPMPCFGx Register.
[in] | csr_idx | sPMPCFG CSR index(0-3) |
[in] | spmpcfg | sPMPCFGx Register value to set |
Definition at line 118 of file core_feature_spmp.h.
References __RV_CSR_WRITE, CSR_SPMPCFG0, CSR_SPMPCFG1, CSR_SPMPCFG2, and CSR_SPMPCFG3.
Referenced by __set_sPMPENTRYx(), and __set_sPMPxCFG().
__STATIC_INLINE void __set_sPMPENTRYx | ( | uint32_t | entry_idx, |
const spmp_config * | spmp_cfg | ||
) |
Set sPMP entry by entry idx.
Write the given value to the sPMPxCFG Register and sPMPADDRx.
[in] | entry_idx | sPMP entry index(0-15) |
[in] | spmp_cfg | structure of L,U,X,W,R field of sPMP configuration register, memory region base address and size of memory region as power of 2 |
Definition at line 275 of file core_feature_spmp.h.
References __get_sPMPCFGx(), __RISCV_XLEN, __set_sPMPADDRx(), __set_sPMPCFGx(), SPMP_A_NA4, SPMP_A_NAPOT, and SPMP_SHIFT.
__STATIC_INLINE void __set_sPMPxCFG | ( | uint32_t | entry_idx, |
uint8_t | spmpxcfg | ||
) |
Set 8bit sPMPxCFG by spmp entry index.
Set the given spmpxcfg value to the sPMPxCFG Register.
[in] | entry_idx | sPMPx region index(0-15) |
[in] | spmpxcfg | sPMPxCFG register value to set |
Definition at line 175 of file core_feature_spmp.h.
References __get_sPMPCFGx(), and __set_sPMPCFGx().