VPR CSR HAL
- group nrf_vpr_csr_hal
Hardware access layer for managing the VPR RISC-V CPU Control and Status Registers (VPR CSR).
Defines
-
NRF_VPR_CSR_NORDIC_KEY_MASK
Nordic key for CSR writes.
Enums
-
enum nrf_vpr_csr_int_threshold_t
Interrupt threshold levels.
Values:
-
enumerator NRF_VPR_CSR_INT_THRESHOLD_DISABLED
Threshold disabled.
-
enumerator NRF_VPR_CSR_INT_THRESHOLD_LEVEL0
Threshold level 0.
-
enumerator NRF_VPR_CSR_INT_THRESHOLD_LEVEL1
Threshold level 1.
-
enumerator NRF_VPR_CSR_INT_THRESHOLD_LEVEL2
Threshold level 2.
-
enumerator NRF_VPR_CSR_INT_THRESHOLD_LEVEL3
Threshold level 3.
-
enumerator NRF_VPR_CSR_INT_THRESHOLD_DISABLED
-
enum nrf_vpr_csr_trap_cause_t
Trap causes.
Values:
-
enumerator NRF_VPR_CSR_TRAP_CAUSE_INSTR_ADDR_MISALIGNED
Instruction address misaligned.
-
enumerator NRF_VPR_CSR_TRAP_CAUSE_INSTR_ACCESS_FAULT
Instruction access fault.
-
enumerator NRF_VPR_CSR_TRAP_CAUSE_INSTR_ILLEGAL
Illegal instruction.
-
enumerator NRF_VPR_CSR_TRAP_CAUSE_BREAKPOINT
Breakpoint.
-
enumerator NRF_VPR_CSR_TRAP_CAUSE_LOAD_ADDR_MISALIGNED
Load address misaligned.
-
enumerator NRF_VPR_CSR_TRAP_CAUSE_LOAD_ACCESS_FAULT
Load access fault.
-
enumerator NRF_VPR_CSR_TRAP_CAUSE_STORE_ADDR_MISALIGNED
Store/AMO address misaligned.
-
enumerator NRF_VPR_CSR_TRAP_CAUSE_STORE_ACCESS_FAULT
Store/AMO access misaligned.
-
enumerator NRF_VPR_CSR_TRAP_CAUSE_ECALL_M
Environment call M-mode.
-
enumerator NRF_VPR_CSR_TRAP_CAUSE_STACKING_BUS_FAULT
Bus fault on stacking.
-
enumerator NRF_VPR_CSR_TRAP_CAUSE_STACKING_UNALIGNED
Misaligned Stacking.
-
enumerator NRF_VPR_CSR_TRAP_CAUSE_VECTOR_FAULT
Interrupt Vector Fault.
-
enumerator NRF_VPR_CSR_TRAP_CAUSE_STACKING_UNALIGNED_EX
Fault on Exception Stacking.
-
enumerator NRF_VPR_CSR_TRAP_CAUSE_UNSTACKING_UNALIGNED
Misaligned Unstacking.
-
enumerator NRF_VPR_CSR_TRAP_CAUSE_UNSTACKING_BUS_FAULT
Bus fault on unstacking.
-
enumerator NRF_VPR_CSR_TRAP_CAUSE_STORE_TIMEOUT_FAULT
Store timeout fault.
-
enumerator NRF_VPR_CSR_TRAP_CAUSE_LOAD_TIMEOUT_FAULT
Load timeout fault.
-
enumerator NRF_VPR_CSR_TRAP_CAUSE_INSTR_ADDR_MISALIGNED
-
enum nrf_vpr_csr_sleep_state_t
Sleep states.
Values:
-
enumerator NRF_VPR_CSR_SLEEP_STATE_WAIT
During sleep, clock is not turned off.
-
enumerator NRF_VPR_CSR_SLEEP_STATE_RESET
Sleep mode out of reset.
-
enumerator NRF_VPR_CSR_SLEEP_STATE_SLEEP
During sleep, clock is turned off.
-
enumerator NRF_VPR_CSR_SLEEP_STATE_DEEP_SLEEP
During sleep, clock and power are turned off.
-
enumerator NRF_VPR_CSR_SLEEP_STATE_HIBERNATE
During sleep, clock is turned off. All the registers are saved automatically. Restart by a reset.
-
enumerator NRF_VPR_CSR_SLEEP_STATE_WAIT
Functions
-
NRF_STATIC_INLINE void nrf_vpr_csr_machine_interrupts_enable(void)
Function for enabling the interrupts in machine mode.
-
NRF_STATIC_INLINE void nrf_vpr_csr_machine_interrupts_disable(void)
Function for disabling the interrupts in machine mode.
-
NRF_STATIC_INLINE bool nrf_vpr_csr_machine_interrupts_check(void)
Function for checking whether interrupts are enabled in machine mode.
- Return values:
true – Interrupts are enabled.
false – Interrupts are disabled.
-
NRF_STATIC_INLINE void nrf_vpr_csr_machine_trap_vector_table_addr_set(uint32_t address)
Function for setting the base address of trap vector table.
- Parameters:
address – [in] Machine trap vector table base address to be set. Has to be aligned on 64-byte or greater power-of-two boundary.
-
NRF_STATIC_INLINE uint32_t nrf_vpr_csr_machine_trap_vector_table_addr_get(void)
Function for getting the machine trap vector table base address.
- Returns:
Machine trap vector table base address.
-
NRF_STATIC_INLINE uint32_t nrf_vpr_csr_machine_exception_pc_get(void)
Function for getting the machine exception program counter.
- Returns:
Virtual address of the instruction that was interrupted or that encountered the exception.
-
NRF_STATIC_INLINE nrf_vpr_csr_trap_cause_t nrf_vpr_csr_machine_trap_cause_code_get(void)
Function for getting the machine trap cause exception code.
- Returns:
Exception code.
-
NRF_STATIC_INLINE bool nrf_vpr_csr_machine_trap_interrupt_check(void)
Function for checking the state of the interrupt bit for machine trap.
- Return values:
true – Trap was caused by an interrupt.
false – Trap was not caused by an interrupt.
-
NRF_STATIC_INLINE uint32_t nrf_vpr_csr_machine_trap_value_get(void)
Function for getting the machine trap value.
- Returns:
Exception-specific information.
-
NRF_STATIC_INLINE void nrf_vpr_csr_machine_interrupt_threshold_set(nrf_vpr_csr_int_threshold_t th)
Function for setting the machine mode interrupt level threshold.
- Parameters:
th – [in] Machine mode interrupt level threshold to be set.
-
NRF_STATIC_INLINE nrf_vpr_csr_int_threshold_t nrf_vpr_csr_machine_interrupt_threshold_get(void)
Function for getting the machine mode interrupt level threshold.
- Returns:
Machine mode interrupt level threshold.
-
NRF_STATIC_INLINE void nrf_vpr_csr_machine_cycle_counter_enable_set(bool enable)
Function for enabling or disabling the Cycle Counter.
- Parameters:
enable – [in] True if Cycle Counter is to be enabled, false otherwise.
-
NRF_STATIC_INLINE bool nrf_vpr_csr_machine_cycle_counter_enable_check(void)
Function for checking whether the Cycle Counter is enabled.
- Return values:
true – Cycle counter is enabled.
false – Cycle counter is disabled.
-
NRF_STATIC_INLINE uint64_t nrf_vpr_csr_machine_cycle_counter_get(void)
Function for getting the machine cycle counter.
- Returns:
Number of clock cycles executed by the processor core.
-
NRF_STATIC_INLINE void nrf_vpr_csr_machine_instruction_counter_enable_set(bool enable)
Function for enabling or disabling the Instruction Counter.
- Parameters:
enable – [in] True if Instruction Counter is to be enabled, false otherwise.
-
NRF_STATIC_INLINE bool nrf_vpr_csr_machine_instruction_counter_enable_check(void)
Function for checking whether the Instruction Counter is enabled.
- Return values:
true – Instruction counter is enabled.
false – Instruction counter is disabled.
-
NRF_STATIC_INLINE uint64_t nrf_vpr_csr_machine_instruction_counter_get(void)
Function for getting the machine instruction counter.
- Returns:
Number of instructions exectuted by the processor.
-
NRF_STATIC_INLINE void nrf_vpr_csr_rtperiph_enable_set(bool enable)
Function for enabling or disabling the Real-Time Peripherals.
- Parameters:
enable – [in] True if RT Perhiperals are to be enabled, false otherwise.
-
NRF_STATIC_INLINE bool nrf_vpr_csr_rtperiph_enable_check(void)
Function for checking whether the Real-Time Peripherals are enabled.
- Return values:
true – RT Peripherals are enabled.
false – RT Peripherals are disabled.
-
NRF_STATIC_INLINE void nrf_vpr_csr_cnt_irq_enable_set(bool enable)
Function for enabling or disabling the generation of IRQ at position CNT_IRQ_POSITION.
- Parameters:
enable – [in] True if generation of IRQ at position CNT_IRQ_POSITION is to be enabled, false otherwise.
-
NRF_STATIC_INLINE bool nrf_vpr_csr_cnt_irq_enable_check(void)
Function for checking whether the generation of IRQ at position CNT_IRQ_POSITION is enabled.
- Return values:
true – Generation of IRQ is enabled.
false – Generation of IRQ is disabled.
-
NRF_STATIC_INLINE void nrf_vpr_csr_sleep_state_set(nrf_vpr_csr_sleep_state_t state)
Function for setting the sleep state.
- Parameters:
state – [in] Sleep state to be set.
-
NRF_STATIC_INLINE nrf_vpr_csr_sleep_state_t nrf_vpr_csr_sleep_state_get(void)
Function for getting the sleep state.
- Returns:
Current sleep state.
-
NRF_STATIC_INLINE void nrf_vpr_csr_return_to_sleep_set(bool enable)
Function for enabling or disabling the return to sleep functionality.
- Parameters:
enable – [in] True if CPU should be forced to return to sleep when it returns in a non-handler program, false otherwise.
-
NRF_STATIC_INLINE bool nrf_vpr_csr_return_to_sleep_check(void)
Function for checking whether the return to sleep functionality is enabled.
- Return values:
true – Return to sleep functionality is enabled.
false – Return to sleep functionality is disabled.
-
NRF_STATIC_INLINE void nrf_vpr_csr_stack_on_sleep_set(bool enable)
Function for enabling or disabling the stack on sleep functionality.
- Parameters:
enable – [in] True if CPU should be forced to stack the context before going to sleep (used in order to have a fast wake-up), false otherwise.
-
NRF_STATIC_INLINE bool nrf_vpr_csr_stack_on_sleep_check(void)
Function for checking whether the stack on sleep functionality is enabled.
- Return values:
true – Stack on sleep functionality is enabled.
false – Stack on sleep functionality is disabled.
-
NRF_STATIC_INLINE void nrf_vpr_csr_clic_round_robin_set(bool enable)
Function for enabling or disabling the CLIC round robin arbitration.
- Parameters:
enable – [in] True if round robin arbitration should be used for CLIC interrupt requests, false otherwise.
-
NRF_STATIC_INLINE bool nrf_vpr_csr_clic_round_robin_check(void)
Function for checking whether the CLIC round robin arbitration is enabled.
- Return values:
true – CLIC round robin arbitration is enabled.
false – CLIC round robin arbitration is disabled.
-
NRF_STATIC_INLINE void nrf_vpr_csr_unrecoverable_return_set(bool enable)
Function for enabling or disabling the unrecoverable return functionality.
- Parameters:
enable – [in] True if unrecoverable return from exception is to be forced, false otherwise.
-
NRF_STATIC_INLINE bool nrf_vpr_csr_unrecoverable_return_check(void)
Function for checking whether the unrecoverable return is enabled.
- Return values:
true – Unrecoverable return is enabled.
false – Unrecoverable return is disabled.
-
NRF_VPR_CSR_NORDIC_KEY_MASK