VPR CSR VTIM HAL

group nrf_vpr_csr_vtim_hal

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

Enums

enum nrf_vpr_csr_vtim_count_t

Counter modes.

Values:

enumerator NRF_VPR_CSR_VTIM_COUNT_STOP

Counter stops at 0.

enumerator NRF_VPR_CSR_VTIM_COUNT_WRAP

Counter will continue counting from 0xFFF.

enumerator NRF_VPR_CSR_VTIM_COUNT_RELOAD

Counter will continue counting from the value in counter top.

enumerator NRF_VPR_CSR_VTIM_COUNT_TRIGGER_COMBINED

Trigger (counter 0) or combined (counter 1) mode.

Trigger (applies to counter 0): Counter stops at 0. Counting will restart when a VIO event happens. Combined (applies to counter 1): Counter 1 acts as an extension of counter 0. (16 most significant bits of a 32-bit counter.)

Functions

NRF_STATIC_INLINE nrf_vpr_csr_vtim_count_t nrf_vpr_cst_vtim_count_mode_get(uint8_t counter)

Function for getting the counter mode.

Parameters:
  • counter[in] Index of the counter.

Returns:

Counter mode.

NRF_STATIC_INLINE void nrf_vpr_csr_vtim_count_mode_set(uint8_t counter, nrf_vpr_csr_vtim_count_t mode)

Function for setting the counter mode.

Parameters:
  • counter[in] Index of the counter.

  • mode[in] Counter mode to be set.

NRF_STATIC_INLINE uint16_t nrf_vpr_csr_vtim_simple_counter_get(uint8_t counter)

Function for getting the counter value.

Parameters:
  • counter[in] Index of the counter.

Returns:

Counter value.

NRF_STATIC_INLINE void nrf_vpr_csr_vtim_simple_counter_set(uint8_t counter, uint16_t value)

Function for setting the counter value.

Parameters:
  • counter[in] Index of the counter.

  • value[in] Value to be set.

NRF_STATIC_INLINE uint16_t nrf_vpr_csr_vtim_simple_counter_top_get(uint8_t counter)

Function for getting the counter top.

Parameters:
  • counter[in] Index of the counter.

Returns:

Counter top.

NRF_STATIC_INLINE void nrf_vpr_csr_vtim_simple_counter_top_set(uint8_t counter, uint16_t value)

Function for setting the counter top.

Parameters:
  • counter[in] Index of the counter.

  • value[in] Top value to be set.

NRF_STATIC_INLINE void nrf_vpr_csr_vtim_simple_counter_add_set(uint8_t counter, uint16_t value)

Function for setting the counter add.

Parameters:
  • counter[in] Index of the counter.

  • value[in] Add value to be set.

NRF_STATIC_INLINE void nrf_vpr_csr_vtim_simple_wait_set(uint8_t counter, bool write, uint16_t value)

Function for setting the wait register.

Writing to this register will stall the CPU until counter reaches 0.

Parameters:
  • counter[in] Index of the counter.

  • write[in] True if value is to be writtten to the counter value before starting the wait. False otherwise.

  • value[in] Value to be written to the counter if write is true.

NRF_STATIC_INLINE uint32_t nrf_vpr_csr_vtim_combined_counter_get(void)

Function for getting the combined counter value.

Note

Lower 16 bits represent counter 0, while higher 16 bits represent counter 1.

Returns:

Counter value.

NRF_STATIC_INLINE void nrf_vpr_csr_vtim_combined_counter_set(uint32_t value)

Function for setting the combined counter value.

Note

Lower 16 bits represent counter 0, while higher 16 bits represent counter 1.

Parameters:
  • value[in] Value to be set.

NRF_STATIC_INLINE uint32_t nrf_vpr_csr_vtim_combined_counter_top_get(void)

Function for getting the combined counter top.

Note

Lower 16 bits represent counter 0, while higher 16 bits represent counter 1.

Returns:

Counter top.

NRF_STATIC_INLINE void nrf_vpr_csr_vtim_combined_counter_top_set(uint32_t value)

Function for setting the combined counter top.

Note

Lower 16 bits represent counter 0, while higher 16 bits represent counter 1.

Parameters:
  • value[in] Top value to be set.

NRF_STATIC_INLINE void nrf_vpr_csr_vtim_combined_counter_add_set(uint32_t value)

Function for setting the combined counter add.

Note

This function should be used in 32-bit counter mode.

Parameters:
  • value[in] Add value to be set.

NRF_STATIC_INLINE void nrf_vpr_csr_vtim_combined_wait_trigger(void)

Function for triggering the wait.

Writing to this register will stall the CPU until 32-bit counter reaches 0.

Note

This function should be used in 32-bit counter mode.