nrfx 3.3
Macros | Enumerations | Functions
VPR CSR HAL

Hardware access layer for managing the VPR RISC-V CPU Control and Status Registers (VPR CSR). More...

Macros

#define NRF_VPR_CSR_NORDIC_KEY_MASK    (VPRCSR_NORDIC_VPRNORDICCTRL_NORDICKEY_Enabled << VPRCSR_NORDIC_VPRNORDICCTRL_NORDICKEY_Pos)
 Nordic key for CSR writes.
 
#define NRF_VPR_CSR_INT_THRESHOLD_MAX   VPRCSR_MINTTHRESH_TH_Max
 Symbol specifying maximum interrupt threshold.
 
#define NRF_VPR_CSR_INT_THRESHOLD_MIN   VPRCSR_MINTTHRESH_TH_Min
 Symbol specifying minimum interrupt threshold.
 

Enumerations

enum  nrf_vpr_csr_trap_cause_t {
  NRF_VPR_CSR_TRAP_CAUSE_INSTR_ADDR_MISALIGNED = VPRCSR_MCAUSE_EXCEPTIONCODE_INSTADDRMISALIGN ,
  NRF_VPR_CSR_TRAP_CAUSE_INSTR_ACCESS_FAULT = VPRCSR_MCAUSE_EXCEPTIONCODE_INSTACCESSFAULT ,
  NRF_VPR_CSR_TRAP_CAUSE_INSTR_ILLEGAL = VPRCSR_MCAUSE_EXCEPTIONCODE_ILLEGALINST ,
  NRF_VPR_CSR_TRAP_CAUSE_BREAKPOINT = VPRCSR_MCAUSE_EXCEPTIONCODE_BKPT ,
  NRF_VPR_CSR_TRAP_CAUSE_LOAD_ADDR_MISALIGNED = VPRCSR_MCAUSE_EXCEPTIONCODE_LOADADDRMISALIGN ,
  NRF_VPR_CSR_TRAP_CAUSE_LOAD_ACCESS_FAULT = VPRCSR_MCAUSE_EXCEPTIONCODE_LOADACCESSFAULT ,
  NRF_VPR_CSR_TRAP_CAUSE_STORE_ADDR_MISALIGNED = VPRCSR_MCAUSE_EXCEPTIONCODE_STOREADDRMISALIGN ,
  NRF_VPR_CSR_TRAP_CAUSE_STORE_ACCESS_FAULT = VPRCSR_MCAUSE_EXCEPTIONCODE_STOREACCESSFAULT ,
  NRF_VPR_CSR_TRAP_CAUSE_ECALL_M = VPRCSR_MCAUSE_EXCEPTIONCODE_ECALLMMODE ,
  NRF_VPR_CSR_TRAP_CAUSE_STACKING_BUS_FAULT = VPRCSR_MCAUSE_EXCEPTIONCODE_BUSFAULTSTACKING ,
  NRF_VPR_CSR_TRAP_CAUSE_STACKING_UNALIGNED = VPRCSR_MCAUSE_EXCEPTIONCODE_MISALIGNSTACKING ,
  NRF_VPR_CSR_TRAP_CAUSE_VECTOR_FAULT = VPRCSR_MCAUSE_EXCEPTIONCODE_INTVECTORFAULT ,
  NRF_VPR_CSR_TRAP_CAUSE_STACKING_UNALIGNED_EX = VPRCSR_MCAUSE_EXCEPTIONCODE_STACKINGEXCFAULT ,
  NRF_VPR_CSR_TRAP_CAUSE_UNSTACKING_UNALIGNED = VPRCSR_MCAUSE_EXCEPTIONCODE_MISALIGNUNSTACKING ,
  NRF_VPR_CSR_TRAP_CAUSE_UNSTACKING_BUS_FAULT = VPRCSR_MCAUSE_EXCEPTIONCODE_BUSFAULTUNSTACKING ,
  NRF_VPR_CSR_TRAP_CAUSE_STORE_TIMEOUT_FAULT = VPRCSR_MCAUSE_EXCEPTIONCODE_STORETIMEOUTFAULT ,
  NRF_VPR_CSR_TRAP_CAUSE_LOAD_TIMEOUT_FAULT = VPRCSR_MCAUSE_EXCEPTIONCODE_LOADTIMEOUTFAULT
}
 Trap causes. More...
 
enum  nrf_vpr_csr_sleep_state_t {
  NRF_VPR_CSR_SLEEP_STATE_WAIT = VPRCSR_NORDIC_VPRNORDICSLEEPCTRL_SLEEPSTATE_WAIT ,
  NRF_VPR_CSR_SLEEP_STATE_RESET = VPRCSR_NORDIC_VPRNORDICSLEEPCTRL_SLEEPSTATE_RESET ,
  NRF_VPR_CSR_SLEEP_STATE_SLEEP = VPRCSR_NORDIC_VPRNORDICSLEEPCTRL_SLEEPSTATE_SLEEP ,
  NRF_VPR_CSR_SLEEP_STATE_DEEP_SLEEP = VPRCSR_NORDIC_VPRNORDICSLEEPCTRL_SLEEPSTATE_DEEPSLEEP ,
  NRF_VPR_CSR_SLEEP_STATE_HIBERNATE = VPRCSR_NORDIC_VPRNORDICSLEEPCTRL_SLEEPSTATE_HIBERNATE
}
 Sleep states. More...
 

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.
 
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.
 
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.
 
NRF_STATIC_INLINE uint32_t nrf_vpr_csr_machine_exception_pc_get (void)
 Function for getting the machine exception program counter.
 
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.
 
NRF_STATIC_INLINE bool nrf_vpr_csr_machine_trap_interrupt_check (void)
 Function for checking the state of the interrupt bit for machine trap.
 
NRF_STATIC_INLINE uint32_t nrf_vpr_csr_machine_trap_value_get (void)
 Function for getting the machine trap value.
 
NRF_STATIC_INLINE void nrf_vpr_csr_machine_interrupt_threshold_set (uint8_t th)
 Function for setting the machine mode interrupt level threshold.
 
NRF_STATIC_INLINE uint8_t nrf_vpr_csr_machine_interrupt_threshold_get (void)
 Function for getting the 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.
 
NRF_STATIC_INLINE bool nrf_vpr_csr_machine_cycle_counter_enable_check (void)
 Function for checking whether the Cycle Counter is enabled.
 
NRF_STATIC_INLINE uint64_t nrf_vpr_csr_machine_cycle_counter_get (void)
 Function for getting the machine cycle counter.
 
NRF_STATIC_INLINE void nrf_vpr_csr_machine_instruction_counter_enable_set (bool enable)
 Function for enabling or disabling the Instruction Counter.
 
NRF_STATIC_INLINE bool nrf_vpr_csr_machine_instruction_counter_enable_check (void)
 Function for checking whether the Instruction Counter is enabled.
 
NRF_STATIC_INLINE uint64_t nrf_vpr_csr_machine_instruction_counter_get (void)
 Function for getting the machine instruction counter.
 
NRF_STATIC_INLINE void nrf_vpr_csr_rtperiph_enable_set (bool enable)
 Function for enabling or disabling the Real-Time Peripherals.
 
NRF_STATIC_INLINE bool nrf_vpr_csr_rtperiph_enable_check (void)
 Function for checking whether the Real-Time Peripherals are enabled.
 
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.
 
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.
 
NRF_STATIC_INLINE void nrf_vpr_csr_sleep_state_set (nrf_vpr_csr_sleep_state_t state)
 Function for setting the sleep state.
 
NRF_STATIC_INLINE nrf_vpr_csr_sleep_state_t nrf_vpr_csr_sleep_state_get (void)
 Function for getting the 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.
 
NRF_STATIC_INLINE bool nrf_vpr_csr_return_to_sleep_check (void)
 Function for checking whether the return to sleep functionality is enabled.
 
NRF_STATIC_INLINE void nrf_vpr_csr_stack_on_sleep_set (bool enable)
 Function for enabling or disabling the stack on sleep functionality.
 
NRF_STATIC_INLINE bool nrf_vpr_csr_stack_on_sleep_check (void)
 Function for checking whether the stack on sleep functionality is enabled.
 
NRF_STATIC_INLINE void nrf_vpr_csr_clic_round_robin_set (bool enable)
 Function for enabling or disabling the CLIC round robin arbitration.
 
NRF_STATIC_INLINE bool nrf_vpr_csr_clic_round_robin_check (void)
 Function for checking whether the CLIC round robin arbitration is enabled.
 
NRF_STATIC_INLINE void nrf_vpr_csr_unrecoverable_return_set (bool enable)
 Function for enabling or disabling the unrecoverable return functionality.
 
NRF_STATIC_INLINE bool nrf_vpr_csr_unrecoverable_return_check (void)
 Function for checking whether the unrecoverable return is enabled.
 

Detailed Description

Hardware access layer for managing the VPR RISC-V CPU Control and Status Registers (VPR CSR).

Enumeration Type Documentation

◆ nrf_vpr_csr_sleep_state_t

Sleep states.

Enumerator
NRF_VPR_CSR_SLEEP_STATE_WAIT 

During sleep, clock is not turned off.

NRF_VPR_CSR_SLEEP_STATE_RESET 

Sleep mode out of reset.

NRF_VPR_CSR_SLEEP_STATE_SLEEP 

During sleep, clock is turned off.

NRF_VPR_CSR_SLEEP_STATE_DEEP_SLEEP 

During sleep, clock and power are turned off.

NRF_VPR_CSR_SLEEP_STATE_HIBERNATE 

During sleep, clock is turned off. All the registers are saved automatically. Restart by a reset.

◆ nrf_vpr_csr_trap_cause_t

Trap causes.

Enumerator
NRF_VPR_CSR_TRAP_CAUSE_INSTR_ADDR_MISALIGNED 

Instruction address misaligned.

NRF_VPR_CSR_TRAP_CAUSE_INSTR_ACCESS_FAULT 

Instruction access fault.

NRF_VPR_CSR_TRAP_CAUSE_INSTR_ILLEGAL 

Illegal instruction.

NRF_VPR_CSR_TRAP_CAUSE_BREAKPOINT 

Breakpoint.

NRF_VPR_CSR_TRAP_CAUSE_LOAD_ADDR_MISALIGNED 

Load address misaligned.

NRF_VPR_CSR_TRAP_CAUSE_LOAD_ACCESS_FAULT 

Load access fault.

NRF_VPR_CSR_TRAP_CAUSE_STORE_ADDR_MISALIGNED 

Store/AMO address misaligned.

NRF_VPR_CSR_TRAP_CAUSE_STORE_ACCESS_FAULT 

Store/AMO access misaligned.

NRF_VPR_CSR_TRAP_CAUSE_ECALL_M 

Environment call M-mode.

NRF_VPR_CSR_TRAP_CAUSE_STACKING_BUS_FAULT 

Bus fault on stacking.

NRF_VPR_CSR_TRAP_CAUSE_STACKING_UNALIGNED 

Misaligned Stacking.

NRF_VPR_CSR_TRAP_CAUSE_VECTOR_FAULT 

Interrupt Vector Fault.

NRF_VPR_CSR_TRAP_CAUSE_STACKING_UNALIGNED_EX 

Fault on Exception Stacking.

NRF_VPR_CSR_TRAP_CAUSE_UNSTACKING_UNALIGNED 

Misaligned Unstacking.

NRF_VPR_CSR_TRAP_CAUSE_UNSTACKING_BUS_FAULT 

Bus fault on unstacking.

NRF_VPR_CSR_TRAP_CAUSE_STORE_TIMEOUT_FAULT 

Store timeout fault.

NRF_VPR_CSR_TRAP_CAUSE_LOAD_TIMEOUT_FAULT 

Load timeout fault.

Function Documentation

◆ nrf_vpr_csr_clic_round_robin_check()

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
trueCLIC round robin arbitration is enabled.
falseCLIC round robin arbitration is disabled.

◆ nrf_vpr_csr_clic_round_robin_set()

NRF_STATIC_INLINE void nrf_vpr_csr_clic_round_robin_set ( bool  enable)

Function for enabling or disabling the CLIC round robin arbitration.

Parameters
[in]enableTrue if round robin arbitration should be used for CLIC interrupt requests, false otherwise.

◆ nrf_vpr_csr_cnt_irq_enable_check()

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
trueGeneration of IRQ is enabled.
falseGeneration of IRQ is disabled.

◆ nrf_vpr_csr_cnt_irq_enable_set()

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
[in]enableTrue if generation of IRQ at position CNT_IRQ_POSITION is to be enabled, false otherwise.

◆ nrf_vpr_csr_machine_cycle_counter_enable_check()

NRF_STATIC_INLINE bool nrf_vpr_csr_machine_cycle_counter_enable_check ( void  )

Function for checking whether the Cycle Counter is enabled.

Return values
trueCycle counter is enabled.
falseCycle counter is disabled.

◆ nrf_vpr_csr_machine_cycle_counter_enable_set()

NRF_STATIC_INLINE void nrf_vpr_csr_machine_cycle_counter_enable_set ( bool  enable)

Function for enabling or disabling the Cycle Counter.

Parameters
[in]enableTrue if Cycle Counter is to be enabled, false otherwise.

◆ nrf_vpr_csr_machine_cycle_counter_get()

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_vpr_csr_machine_exception_pc_get()

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_vpr_csr_machine_instruction_counter_enable_check()

NRF_STATIC_INLINE bool nrf_vpr_csr_machine_instruction_counter_enable_check ( void  )

Function for checking whether the Instruction Counter is enabled.

Return values
trueInstruction counter is enabled.
falseInstruction counter is disabled.

◆ nrf_vpr_csr_machine_instruction_counter_enable_set()

NRF_STATIC_INLINE void nrf_vpr_csr_machine_instruction_counter_enable_set ( bool  enable)

Function for enabling or disabling the Instruction Counter.

Parameters
[in]enableTrue if Instruction Counter is to be enabled, false otherwise.

◆ nrf_vpr_csr_machine_instruction_counter_get()

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_vpr_csr_machine_interrupt_threshold_get()

NRF_STATIC_INLINE uint8_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_vpr_csr_machine_interrupt_threshold_set()

NRF_STATIC_INLINE void nrf_vpr_csr_machine_interrupt_threshold_set ( uint8_t  th)

Function for setting the machine mode interrupt level threshold.

Parameters
[in]thMachine mode interrupt level threshold to be set.

◆ nrf_vpr_csr_machine_interrupts_check()

NRF_STATIC_INLINE bool nrf_vpr_csr_machine_interrupts_check ( void  )

Function for checking whether interrupts are enabled in machine mode.

Return values
trueInterrupts are enabled.
falseInterrupts are disabled.

◆ nrf_vpr_csr_machine_trap_cause_code_get()

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_vpr_csr_machine_trap_interrupt_check()

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
trueTrap was caused by an interrupt.
falseTrap was not caused by an interrupt.

◆ nrf_vpr_csr_machine_trap_value_get()

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_vpr_csr_machine_trap_vector_table_addr_get()

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_vpr_csr_machine_trap_vector_table_addr_set()

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
[in]addressMachine trap vector table base address to be set. Has to be aligned on 64-byte or greater power-of-two boundary.

◆ nrf_vpr_csr_return_to_sleep_check()

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
trueReturn to sleep functionality is enabled.
falseReturn to sleep functionality is disabled.

◆ nrf_vpr_csr_return_to_sleep_set()

NRF_STATIC_INLINE void nrf_vpr_csr_return_to_sleep_set ( bool  enable)

Function for enabling or disabling the return to sleep functionality.

Parameters
[in]enableTrue if CPU should be forced to return to sleep when it returns in a non-handler program, false otherwise.

◆ nrf_vpr_csr_rtperiph_enable_check()

NRF_STATIC_INLINE bool nrf_vpr_csr_rtperiph_enable_check ( void  )

Function for checking whether the Real-Time Peripherals are enabled.

Return values
trueRT Peripherals are enabled.
falseRT Peripherals are disabled.

◆ nrf_vpr_csr_rtperiph_enable_set()

NRF_STATIC_INLINE void nrf_vpr_csr_rtperiph_enable_set ( bool  enable)

Function for enabling or disabling the Real-Time Peripherals.

Parameters
[in]enableTrue if RT Perhiperals are to be enabled, false otherwise.

◆ nrf_vpr_csr_sleep_state_get()

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_vpr_csr_sleep_state_set()

NRF_STATIC_INLINE void nrf_vpr_csr_sleep_state_set ( nrf_vpr_csr_sleep_state_t  state)

Function for setting the sleep state.

Parameters
[in]stateSleep state to be set.

◆ nrf_vpr_csr_stack_on_sleep_check()

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
trueStack on sleep functionality is enabled.
falseStack on sleep functionality is disabled.

◆ nrf_vpr_csr_stack_on_sleep_set()

NRF_STATIC_INLINE void nrf_vpr_csr_stack_on_sleep_set ( bool  enable)

Function for enabling or disabling the stack on sleep functionality.

Parameters
[in]enableTrue 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_vpr_csr_unrecoverable_return_check()

NRF_STATIC_INLINE bool nrf_vpr_csr_unrecoverable_return_check ( void  )

Function for checking whether the unrecoverable return is enabled.

Return values
trueUnrecoverable return is enabled.
falseUnrecoverable return is disabled.

◆ nrf_vpr_csr_unrecoverable_return_set()

NRF_STATIC_INLINE void nrf_vpr_csr_unrecoverable_return_set ( bool  enable)

Function for enabling or disabling the unrecoverable return functionality.

Parameters
[in]enableTrue if unrecoverable return from exception is to be forced, false otherwise.

Documentation feedback | Developer Zone | Subscribe | Updated