PMP Functions

Click Nuclei PMP Unit to learn about Core PMP Unit in Nuclei ISA Spec.

__STATIC_INLINE uint8_t __get_PMPxCFG(uint32_t idx)
__STATIC_INLINE void __set_PMPxCFG(uint32_t idx, uint8_t pmpxcfg)
__STATIC_INLINE rv_csr_t __get_PMPCFGx(uint32_t idx)
__STATIC_INLINE void __set_PMPCFGx(uint32_t idx, rv_csr_t pmpcfg)
__STATIC_INLINE rv_csr_t __get_PMPADDRx(uint32_t idx)
__STATIC_INLINE void __set_PMPADDRx(uint32_t idx, rv_csr_t pmpaddr)
group NMSIS_Core_PMP_Functions

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.

Functions

__STATIC_INLINE uint8_t __get_PMPxCFG(uint32_t idx)

Get 8bit PMPxCFG Register by PMP entry index.

Return the content of the PMPxCFG Register.

Return

PMPxCFG Register value

Parameters
  • [in] idx: PMP region index(0-15)

__STATIC_INLINE void __set_PMPxCFG(uint32_t idx, uint8_t pmpxcfg)

Set 8bit PMPxCFG by pmp entry index.

Set the given pmpxcfg value to the PMPxCFG Register.

Parameters
  • [in] idx: PMPx region index(0-15)

  • [in] pmpxcfg: PMPxCFG register value to set

__STATIC_INLINE rv_csr_t __get_PMPCFGx(uint32_t idx)

Get PMPCFGx Register by index.

Return the content of the PMPCFGx Register.

Return

PMPCFGx Register value

Remark

  • For RV64, only idx = 0 and idx = 2 is allowed. pmpcfg0 and pmpcfg2 hold the configurations for the 16 PMP entries, pmpcfg1 and pmpcfg3 are illegal

  • For RV32, pmpcfg0–pmpcfg3, hold the configurations pmp0cfg–pmp15cfg for the 16 PMP entries

Parameters
  • [in] idx: PMPCFG CSR index(0-3)

__STATIC_INLINE void __set_PMPCFGx(uint32_t idx, rv_csr_t pmpcfg)

Set PMPCFGx by index.

Write the given value to the PMPCFGx Register.

Remark

  • For RV64, only idx = 0 and idx = 2 is allowed. pmpcfg0 and pmpcfg2 hold the configurations for the 16 PMP entries, pmpcfg1 and pmpcfg3 are illegal

  • For RV32, pmpcfg0–pmpcfg3, hold the configurations pmp0cfg–pmp15cfg for the 16 PMP entries

Parameters
  • [in] idx: PMPCFG CSR index(0-3)

  • [in] pmpcfg: PMPCFGx Register value to set

__STATIC_INLINE rv_csr_t __get_PMPADDRx(uint32_t idx)

Get PMPADDRx Register by index.

Return the content of the PMPADDRx Register.

Return

PMPADDRx Register value

Parameters
  • [in] idx: PMP region index(0-15)

__STATIC_INLINE void __set_PMPADDRx(uint32_t idx, rv_csr_t pmpaddr)

Set PMPADDRx by index.

Write the given value to the PMPADDRx Register.

Parameters
  • [in] idx: PMP region index(0-15)

  • [in] pmpaddr: PMPADDRx Register value to set