![]() |
NMSIS-Core
Version 1.5.0
NMSIS-Core support for Nuclei processor-based devices
|
Functions that related to the RISCV Phyiscal Memory Protection. More...
Data Structures | |
| struct | pmp_config |
Macros | |
| #define | PMPCFG_LIST_RV32_0_7 X(0) X(1) X(2) X(3) X(4) X(5) X(6) X(7) |
| PMPCFG list for RV32 (indices 0-7) More... | |
| #define | PMPCFG_LIST_RV32_8_15 X(8) X(9) X(10) X(11) X(12) X(13) X(14) X(15) |
| PMPCFG list for RV32 (indices 8-15) More... | |
| #define | PMPCFG_LIST_RV64_0_6 X(0) X(2) X(4) X(6) |
| PMPCFG list for RV64 (even indices 0-6) More... | |
| #define | PMPCFG_LIST_RV64_8_14 X(8) X(10) X(12) X(14) |
| PMPCFG list for RV64 (even indices 8-14) More... | |
| #define | PMPCFG_LIST PMPCFG_LIST_RV32_0_7 |
| Select appropriate PMPCFG list based on architecture and PMP entry count. More... | |
| #define | PMPADDR_LIST_BASE X(0) X(1) X(2) X(3) X(4) X(5) X(6) X(7) |
| Base PMPADDR list (indices 0-7) More... | |
| #define | PMPADDR_LIST_8_15 X(8) X(9) X(10) X(11) X(12) X(13) X(14) X(15) |
| Extended PMPADDR list (indices 8-15) More... | |
| #define | PMPADDR_LIST_16_31 |
| Extended PMPADDR list (indices 16-31) More... | |
| #define | PMPADDR_LIST_32_63 |
| Extended PMPADDR list (indices 32-63) More... | |
| #define | PMPADDR_LIST PMPADDR_LIST_BASE PMPADDR_LIST_8_15 |
| Select appropriate PMPADDR list based on PMP_ENTRY_NUM. More... | |
Functions | |
| __STATIC_INLINE rv_csr_t | __get_PMPCFGx (uint32_t csr_idx) |
| Get PMPCFGx Register by CSR index. More... | |
| __STATIC_INLINE void | __set_PMPCFGx (uint32_t csr_idx, rv_csr_t pmpcfg) |
| Set PMPCFGx by CSR index. More... | |
| __STATIC_INLINE uint8_t | __get_PMPxCFG (uint32_t entry_idx) |
| Get 8bit PMPxCFG Register by PMP entry index. More... | |
| __STATIC_INLINE void | __set_PMPxCFG (uint32_t entry_idx, uint8_t pmpxcfg) |
| Set 8bit PMPxCFG by pmp entry index. More... | |
| __STATIC_INLINE rv_csr_t | __get_PMPADDRx (uint32_t csr_idx) |
| Get PMPADDRx Register by CSR index. More... | |
| __STATIC_INLINE void | __set_PMPADDRx (uint32_t csr_idx, rv_csr_t pmpaddr) |
| Set PMPADDRx by CSR index. More... | |
| __STATIC_INLINE void | __set_PMPENTRYx (uint32_t entry_idx, const pmp_config *pmp_cfg) |
| Set PMP entry by entry idx. More... | |
| __STATIC_INLINE int | __get_PMPENTRYx (unsigned int entry_idx, pmp_config *pmp_cfg) |
| Get PMP entry by entry idx. More... | |
Functions that related to the RISCV Phyiscal Memory Protection.
Optional physical memory protection (PMP) unit provides per-hart machine-mode control registers to allow physical memory access privileges (read, write, execute) to be specified for each physical memory region.
The PMP can supports region access control settings as small as four bytes.
| #define PMPADDR_LIST PMPADDR_LIST_BASE PMPADDR_LIST_8_15 |
Select appropriate PMPADDR list based on PMP_ENTRY_NUM.
This macro defines the complete PMPADDR list by combining base and extended lists according to the configured number of PMP entries.
Definition at line 325 of file core_feature_pmp.h.
| #define PMPADDR_LIST_16_31 |
Extended PMPADDR list (indices 16-31)
Definition at line 297 of file core_feature_pmp.h.
| #define PMPADDR_LIST_32_63 |
Extended PMPADDR list (indices 32-63)
Definition at line 304 of file core_feature_pmp.h.
| #define PMPADDR_LIST_8_15 X(8) X(9) X(10) X(11) X(12) X(13) X(14) X(15) |
Extended PMPADDR list (indices 8-15)
Definition at line 291 of file core_feature_pmp.h.
| #define PMPADDR_LIST_BASE X(0) X(1) X(2) X(3) X(4) X(5) X(6) X(7) |
Base PMPADDR list (indices 0-7)
Definition at line 285 of file core_feature_pmp.h.
| #define PMPCFG_LIST PMPCFG_LIST_RV32_0_7 |
Select appropriate PMPCFG list based on architecture and PMP entry count.
This macro defines the complete PMPCFG list according to:
Definition at line 130 of file core_feature_pmp.h.
| #define PMPCFG_LIST_RV32_0_7 X(0) X(1) X(2) X(3) X(4) X(5) X(6) X(7) |
PMPCFG list for RV32 (indices 0-7)
For RV32, each PMPCFG register holds 4 PMP entries. This list covers the first 32 entries (registers 0-7).
Definition at line 83 of file core_feature_pmp.h.
| #define PMPCFG_LIST_RV32_8_15 X(8) X(9) X(10) X(11) X(12) X(13) X(14) X(15) |
PMPCFG list for RV32 (indices 8-15)
For RV32, each PMPCFG register holds 4 PMP entries. This list covers entries 33-64 (registers 8-15).
Definition at line 92 of file core_feature_pmp.h.
| #define PMPCFG_LIST_RV64_0_6 X(0) X(2) X(4) X(6) |
PMPCFG list for RV64 (even indices 0-6)
For RV64, each PMPCFG register holds 8 PMP entries. This list covers the first 32 entries (registers 0,2,4,6).
Definition at line 101 of file core_feature_pmp.h.
| #define PMPCFG_LIST_RV64_8_14 X(8) X(10) X(12) X(14) |
PMPCFG list for RV64 (even indices 8-14)
For RV64, each PMPCFG register holds 8 PMP entries. This list covers entries 33-64 (registers 8,10,12,14).
Definition at line 110 of file core_feature_pmp.h.
| __STATIC_INLINE rv_csr_t __get_PMPADDRx | ( | uint32_t | csr_idx | ) |
Get PMPADDRx Register by CSR index.
Return the content of the PMPADDRx Register.
| [in] | csr_idx | PMP region CSR index(0-63) |
Definition at line 340 of file core_feature_pmp.h.
References PMPADDR_LIST.
Referenced by __get_PMPENTRYx().
| __STATIC_INLINE rv_csr_t __get_PMPCFGx | ( | uint32_t | csr_idx | ) |
Get PMPCFGx Register by CSR index.
Return the content of the PMPCFGx Register.
| [in] | csr_idx | PMPCFG CSR index (0-15 for RV32, 0,2,4,6,8,10,12,14 for RV64) |
Definition at line 166 of file core_feature_pmp.h.
References PMPCFG_LIST.
Referenced by __get_PMPENTRYx(), __get_PMPxCFG(), __set_PMPENTRYx(), and __set_PMPxCFG().
| __STATIC_INLINE int __get_PMPENTRYx | ( | unsigned int | entry_idx, |
| pmp_config * | pmp_cfg | ||
| ) |
Get PMP entry by entry idx.
Write the given value to the PMPxCFG Register and PMPADDRx.
| [in] | entry_idx | PMP entry index(0-63) |
| [out] | pmp_cfg | structure of L, X, W, R, A field of PMP configuration register, memory region base address and size of memory region as power of 2 |
Definition at line 438 of file core_feature_pmp.h.
References __CTZ(), __get_PMPADDRx(), __get_PMPCFGx(), pmp_config::base_addr, pmp_config::order, PMP_A, PMP_A_NAPOT, PMP_SHIFT, and pmp_config::protection.
| __STATIC_INLINE uint8_t __get_PMPxCFG | ( | uint32_t | entry_idx | ) |
Get 8bit PMPxCFG Register by PMP entry index.
Return the content of the PMPxCFG Register.
| [in] | entry_idx | PMP region index(0-63) |
Definition at line 210 of file core_feature_pmp.h.
References __get_PMPCFGx().
| __STATIC_INLINE void __set_PMPADDRx | ( | uint32_t | csr_idx, |
| rv_csr_t | pmpaddr | ||
| ) |
Set PMPADDRx by CSR index.
Write the given value to the PMPADDRx Register.
| [in] | csr_idx | PMP region CSR index(0-63) |
| [in] | pmpaddr | PMPADDRx Register value to set |
Definition at line 356 of file core_feature_pmp.h.
References PMPADDR_LIST.
Referenced by __set_PMPENTRYx().
| __STATIC_INLINE void __set_PMPCFGx | ( | uint32_t | csr_idx, |
| rv_csr_t | pmpcfg | ||
| ) |
Set PMPCFGx by CSR index.
Write the given value to the PMPCFGx Register.
| [in] | csr_idx | PMPCFG CSR index (0-15 for RV32, 0,2,4,6,8,10,12,14 for RV64) |
| [in] | pmpcfg | PMPCFGx Register value to set |
Definition at line 194 of file core_feature_pmp.h.
References PMPCFG_LIST.
Referenced by __set_PMPENTRYx(), and __set_PMPxCFG().
| __STATIC_INLINE void __set_PMPENTRYx | ( | uint32_t | entry_idx, |
| const pmp_config * | pmp_cfg | ||
| ) |
Set PMP entry by entry idx.
Write the given value to the PMPxCFG Register and PMPADDRx.
| [in] | entry_idx | PMP entry index(0-63) |
| [in] | pmp_cfg | structure of L, X, W, R field of PMP configuration register, memory region base address and size of memory region as power of 2 |
Definition at line 377 of file core_feature_pmp.h.
References __get_PMPCFGx(), __RISCV_XLEN, __set_PMPADDRx(), __set_PMPCFGx(), pmp_config::base_addr, pmp_config::order, PMP_A_NA4, PMP_A_NAPOT, PMP_SHIFT, and pmp_config::protection.
| __STATIC_INLINE void __set_PMPxCFG | ( | uint32_t | entry_idx, |
| uint8_t | pmpxcfg | ||
| ) |
Set 8bit PMPxCFG by pmp entry index.
Set the given pmpxcfg value to the PMPxCFG Register.
| [in] | entry_idx | PMPx region index(0-63) |
| [in] | pmpxcfg | PMPxCFG register value to set |
Definition at line 251 of file core_feature_pmp.h.
References __get_PMPCFGx(), and __set_PMPCFGx().