Global Real Timer Counter (GRTC) peripheral driver. More...
Data Structures | |
struct | nrfx_grtc_channel_t |
GRTC capture/compare channel description structure. More... | |
struct | nrfx_grtc_rtcounter_handler_data_t |
GRTC RTCOUNTER handler data structure. More... | |
Typedefs | |
typedef void(* | nrfx_grtc_cc_handler_t) (int32_t id, uint64_t cc_value, void *p_context) |
GRTC driver instance compare handler type. | |
typedef void(* | nrfx_grtc_syscountervalid_handler_t) (void *p_context) |
GRTC driver instance SYSCOUNTER valid handler type. | |
typedef void(* | nrfx_grtc_rtcomparesync_handler_t) (void *p_context) |
GRTC driver instance RTCOMPARESYNC handler type. | |
Enumerations | |
enum | nrfx_grtc_action_t { NRFX_GRTC_ACTION_START = NRF_GRTC_TASK_START , NRFX_GRTC_ACTION_STOP = NRF_GRTC_TASK_STOP , NRFX_GRTC_ACTION_CLEAR = NRF_GRTC_TASK_CLEAR } |
GRTC action types. More... | |
enum | nrfx_grtc_cc_relative_reference_t { NRFX_GRTC_CC_RELATIVE_SYSCOUNTER = NRF_GRTC_CC_ADD_REFERENCE_SYSCOUNTER , NRFX_GRTC_CC_RELATIVE_COMPARE = NRF_GRTC_CC_ADD_REFERENCE_CC } |
GRTC compare event relative references. More... | |
Functions | |
nrfx_err_t | nrfx_grtc_channel_alloc (uint8_t *p_channel) |
Function for allocating the GRTC capture/compare channel. | |
nrfx_err_t | nrfx_grtc_channel_free (uint8_t channel) |
Function for freeing the GRTC capture/compare channel. | |
bool | nrfx_grtc_is_channel_used (uint8_t channel) |
Function for checking whether the specified channel is used by the driver. | |
nrfx_err_t | nrfx_grtc_init (uint8_t interrupt_priority) |
Function for initializing the GRTC. | |
nrfx_err_t | nrfx_grtc_rtcounter_cc_disable (void) |
Function for disabling the RTCOUNTER CC channel. | |
void | nrfx_grtc_rtcomparesync_int_enable (nrfx_grtc_rtcomparesync_handler_t handler, void *p_context) |
Function for enabling the RTCOMPARESYNC interrupt. | |
void | nrfx_grtc_rtcomparesync_int_disable (void) |
Function for disabling the RTCOMPARESYNC interrupt. | |
nrfx_err_t | nrfx_grtc_rtcounter_cc_absolute_set (nrfx_grtc_rtcounter_handler_data_t *handler_data, uint64_t val, bool enable_irq, bool sync) |
Function for setting the absolute compare value for the RTCOUNTER. | |
void | nrfx_grtc_rtcounter_cc_int_enable (bool sync) |
Function for enabling the RTCOUNTER compare interrupt. | |
void | nrfx_grtc_rtcounter_cc_int_disable (void) |
Function for disabling the RTCOUNTER compare interrupt. | |
void | nrfx_grtc_syscountervalid_int_enable (nrfx_grtc_syscountervalid_handler_t handler, void *p_context) |
Function for enabling the SYSCOUNTER valid interrupt. | |
void | nrfx_grtc_syscountervalid_int_disable (void) |
Function for disabling the SYSCOUNTERVALID interrupt. | |
nrfx_err_t | nrfx_grtc_syscounter_start (bool busy_wait, uint8_t *p_main_cc_channel) |
Function for starting the 1 MHz SYSCOUNTER. | |
nrfx_err_t | nrfx_grtc_action_perform (nrfx_grtc_action_t action) |
Function for performing an action for the GRTC. | |
void | nrfx_grtc_uninit (void) |
Function for uninitializing the GRTC. | |
bool | nrfx_grtc_init_check (void) |
Function for checking if the GRTC driver is initialized. | |
nrfx_err_t | nrfx_grtc_syscounter_cc_disable (uint8_t channel) |
Function for disabling the SYSCOUNTER CC channel. | |
nrfx_err_t | nrfx_grtc_syscounter_cc_absolute_set (nrfx_grtc_channel_t *p_chan_data, uint64_t val, bool enable_irq) |
Function for setting the absolute compare value for the SYSCOUNTER. | |
nrfx_err_t | nrfx_grtc_syscounter_cc_relative_set (nrfx_grtc_channel_t *p_chan_data, uint32_t val, bool enable_irq, nrfx_grtc_cc_relative_reference_t reference) |
Function for setting the relative compare value for the SYSCOUNTER. | |
nrfx_err_t | nrfx_grtc_syscounter_cc_int_disable (uint8_t channel) |
Function for disabling the SYSCOUNTER compare interrupt. | |
nrfx_err_t | nrfx_grtc_syscounter_cc_int_enable (uint8_t channel) |
Function for enabling the SYSCOUNTER compare interrupt. | |
bool | nrfx_grtc_syscounter_cc_int_enable_check (uint8_t channel) |
Function for checking whether the SYSCOUNTER compare interrupt is enabled for the specified channel. | |
nrfx_err_t | nrfx_grtc_syscounter_capture (uint8_t channel) |
Function for triggering the SYSCOUNTER capture task. | |
nrfx_err_t | nrfx_grtc_syscounter_cc_value_read (uint8_t channel, uint64_t *p_val) |
Function for reading the GRTC capture/compare register for the specified channel . | |
void | nrfx_grtc_active_request_set (bool active) |
Function for requesting the SYSCOUNTER state. | |
nrfx_err_t | nrfx_grtc_syscounter_get (uint64_t *p_counter) |
Function for reading the GRTC SYSCOUNTER value. | |
NRFX_STATIC_INLINE uint32_t | nrfx_grtc_task_address_get (nrf_grtc_task_t task) |
Function for retrieving the address of the specified GRTC task. | |
NRFX_STATIC_INLINE uint32_t | nrfx_grtc_event_address_get (nrf_grtc_event_t event) |
Function for retrieving the address of the specified GRTC event. | |
NRFX_STATIC_INLINE uint32_t | nrfx_grtc_capture_task_address_get (uint8_t channel) |
Function for retrieving the address of the capture task for the specified channel. | |
NRFX_STATIC_INLINE uint32_t | nrfx_grtc_event_compare_address_get (uint8_t channel) |
Function for retrieving the address of the capture task for the specified channel. | |
NRFX_STATIC_INLINE bool | nrfx_grtc_sys_counter_cc_enable_check (uint8_t channel) |
Function for checking whether the specified capture/compare channel is enabled. | |
NRFX_STATIC_INLINE uint64_t | nrfx_grtc_rtcounter_get (void) |
Function for reading the GRTC RTCOUNTER value. | |
Global Real Timer Counter (GRTC) peripheral driver.
typedef void(* nrfx_grtc_cc_handler_t) (int32_t id, uint64_t cc_value, void *p_context) |
GRTC driver instance compare handler type.
[in] | id | Channel ID. |
[in] | cc_value | Compare value. |
[in] | p_context | User context. |
typedef void(* nrfx_grtc_rtcomparesync_handler_t) (void *p_context) |
GRTC driver instance RTCOMPARESYNC handler type.
[in] | p_context | User context. |
typedef void(* nrfx_grtc_syscountervalid_handler_t) (void *p_context) |
GRTC driver instance SYSCOUNTER valid handler type.
[in] | p_context | User context. |
enum nrfx_grtc_action_t |
nrfx_err_t nrfx_grtc_action_perform | ( | nrfx_grtc_action_t | action | ) |
Function for performing an action for the GRTC.
[in] | action | Action to be performed. |
NRFX_SUCCESS | Starting was successful. |
NRFX_ERROR_INTERNAL | The SYSCOUNTER (1 MHz) is running and the operation is not allowed. |
void nrfx_grtc_active_request_set | ( | bool | active | ) |
Function for requesting the SYSCOUNTER state.
[in] | active | True if SYSCOUNTER is to be always kept active, false otherwise. |
NRFX_STATIC_INLINE uint32_t nrfx_grtc_capture_task_address_get | ( | uint8_t | channel | ) |
Function for retrieving the address of the capture task for the specified channel.
[in] | channel | Capture channel number. |
nrfx_err_t nrfx_grtc_channel_alloc | ( | uint8_t * | p_channel | ) |
Function for allocating the GRTC capture/compare channel.
[out] | p_channel | Pointer to the capture/compare channel. |
NRFX_SUCCESS | Allocation was successful. |
NRFX_ERROR_NO_MEM | No resource available. |
nrfx_err_t nrfx_grtc_channel_free | ( | uint8_t | channel | ) |
Function for freeing the GRTC capture/compare channel.
[in] | channel | Allocated channel to be freed. |
NRFX_SUCCESS | Allocation was successful. |
NRFX_ERROR_FORBIDDEN | The domain is not allowed to use specified channel . |
NRFX_ERROR_INVALID_PARAM | Channel is not allocated. |
NRFX_STATIC_INLINE uint32_t nrfx_grtc_event_address_get | ( | nrf_grtc_event_t | event | ) |
Function for retrieving the address of the specified GRTC event.
[in] | event | GRTC event. |
NRFX_STATIC_INLINE uint32_t nrfx_grtc_event_compare_address_get | ( | uint8_t | channel | ) |
Function for retrieving the address of the capture task for the specified channel.
[in] | channel | Compare channel number. |
nrfx_err_t nrfx_grtc_init | ( | uint8_t | interrupt_priority | ) |
Function for initializing the GRTC.
[in] | interrupt_priority | Interrupt priority. |
NRFX_SUCCESS | Initialization was successful. |
NRFX_ERROR_ALREADY | The driver is already initialized. |
NRFX_ERROR_INVALID_STATE | The driver is already initialized. Deprecated - use NRFX_ERROR_ALREADY instead. |
NRFX_ERROR_INTERNAL | No valid channel configuration provided. |
bool nrfx_grtc_init_check | ( | void | ) |
Function for checking if the GRTC driver is initialized.
true | Driver is already initialized. |
false | Driver is not initialized. |
bool nrfx_grtc_is_channel_used | ( | uint8_t | channel | ) |
Function for checking whether the specified channel is used by the driver.
[in] | channel | Channel to be checked. |
true | Channel is used by the driver. |
false | Channel is not used by the driver. |
void nrfx_grtc_rtcomparesync_int_enable | ( | nrfx_grtc_rtcomparesync_handler_t | handler, |
void * | p_context | ||
) |
Function for enabling the RTCOMPARESYNC interrupt.
[in] | handler | Handler provided by the user. May be NULL. |
[in] | p_context | User context. |
nrfx_err_t nrfx_grtc_rtcounter_cc_absolute_set | ( | nrfx_grtc_rtcounter_handler_data_t * | handler_data, |
uint64_t | val, | ||
bool | enable_irq, | ||
bool | sync | ||
) |
Function for setting the absolute compare value for the RTCOUNTER.
[in] | handler_data | Pointer to the handler data instance structure. |
[in] | val | Absolute value to be set in the compare register. |
[in] | enable_irq | True if interrupt is to be enabled, false otherwise. |
[in] | sync | True if the internal synchronization mechanism shall be used, false otherwise. |
NRFX_SUCCESS | The procedure was successful. |
NRFX_ERROR_INTERNAL | The SYSCOUNTER (1 MHz) is running and the operation is not allowed. |
nrfx_err_t nrfx_grtc_rtcounter_cc_disable | ( | void | ) |
Function for disabling the RTCOUNTER CC channel.
NRFX_SUCCESS | The procedure was successful. |
NRFX_ERROR_INTERNAL | The SYSCOUNTER (1 MHz) is running and the operation is not allowed. |
NRFX_ERROR_TIMEOUT | RTCOUNTER compare interrupt is pending. |
void nrfx_grtc_rtcounter_cc_int_enable | ( | bool | sync | ) |
Function for enabling the RTCOUNTER compare interrupt.
[in] | sync | True if the internal synchronization mechanism shall be used, false otherwise. |
NRFX_STATIC_INLINE uint64_t nrfx_grtc_rtcounter_get | ( | void | ) |
Function for reading the GRTC RTCOUNTER value.
NRFX_STATIC_INLINE bool nrfx_grtc_sys_counter_cc_enable_check | ( | uint8_t | channel | ) |
Function for checking whether the specified capture/compare channel is enabled.
[in] | channel | Channel to be checked. |
true | Channel is enabled. |
false | Channel is disabled. |
nrfx_err_t nrfx_grtc_syscounter_capture | ( | uint8_t | channel | ) |
Function for triggering the SYSCOUNTER capture task.
channel
as used.[in] | channel | Capture channel number. |
NRFX_SUCCESS | The procedure was successful. |
NRFX_ERROR_FORBIDDEN | The domain is not allowed to use specified channel . |
NRFX_ERROR_INVALID_PARAM | Channel is not allocated. |
NRFX_ERROR_INTERNAL | The SYSCOUNTER (1 MHz) is not running. |
nrfx_err_t nrfx_grtc_syscounter_cc_absolute_set | ( | nrfx_grtc_channel_t * | p_chan_data, |
uint64_t | val, | ||
bool | enable_irq | ||
) |
Function for setting the absolute compare value for the SYSCOUNTER.
channel
as used.[in] | p_chan_data | Pointer to the channel data instance structure. |
[in] | val | Absolute value to be set in the compare register. |
[in] | enable_irq | True if interrupt is to be enabled, false otherwise. |
NRFX_SUCCESS | The procedure was successful. |
NRFX_ERROR_FORBIDDEN | The domain is not allowed to use specified channel . |
NRFX_ERROR_INVALID_PARAM | Channel is not allocated. |
NRFX_ERROR_INTERNAL | The SYSCOUNTER (1 MHz) is not running. |
nrfx_err_t nrfx_grtc_syscounter_cc_disable | ( | uint8_t | channel | ) |
Function for disabling the SYSCOUNTER CC channel.
channel
as unused.[in] | channel | Channel to be disabled. |
NRFX_SUCCESS | The procedure was successful. |
NRFX_ERROR_FORBIDDEN | The domain is not allowed to use specified channel . |
NRFX_ERROR_INVALID_PARAM | The specified channel is either not allocated or marked as unused. |
NRFX_ERROR_INTERNAL | The SYSCOUNTER (1 MHz) is not running. |
NRFX_ERROR_TIMEOUT | SYSCOUNTER compare interrupt is pending on the requested channel. |
nrfx_err_t nrfx_grtc_syscounter_cc_int_disable | ( | uint8_t | channel | ) |
Function for disabling the SYSCOUNTER compare interrupt.
[in] | channel | Compare channel number. |
NRFX_SUCCESS | The procedure was successful. |
NRFX_ERROR_FORBIDDEN | The domain is not allowed to use specified channel . |
NRFX_ERROR_INVALID_PARAM | The specified channel is either not allocated or marked as unused. |
NRFX_ERROR_INTERNAL | The SYSCOUNTER (1 MHz) is not running. |
nrfx_err_t nrfx_grtc_syscounter_cc_int_enable | ( | uint8_t | channel | ) |
Function for enabling the SYSCOUNTER compare interrupt.
channel
as used.[in] | channel | Compare channel number. |
NRFX_SUCCESS | The procedure was successful. |
NRFX_ERROR_FORBIDDEN | The domain is not allowed to use specified channel . |
NRFX_ERROR_INVALID_PARAM | Channel is not allocated. |
NRFX_ERROR_INTERNAL | The SYSCOUNTER (1 MHz) is not running. |
bool nrfx_grtc_syscounter_cc_int_enable_check | ( | uint8_t | channel | ) |
Function for checking whether the SYSCOUNTER compare interrupt is enabled for the specified channel.
[in] | channel | Compare channel number. |
true | The interrupt is enabled for the specified channel. |
false | The interrupt is disabled for the specified channel. |
nrfx_err_t nrfx_grtc_syscounter_cc_relative_set | ( | nrfx_grtc_channel_t * | p_chan_data, |
uint32_t | val, | ||
bool | enable_irq, | ||
nrfx_grtc_cc_relative_reference_t | reference | ||
) |
Function for setting the relative compare value for the SYSCOUNTER.
channel
as used.[in] | p_chan_data | Pointer to the channel data instance structure. |
[in] | val | Relative value to be set in the compare register. |
[in] | enable_irq | True if interrupt is to be enabled, false otherwise. |
[in] | reference | Reference type to be used. |
NRFX_SUCCESS | The procedure was successful. |
NRFX_ERROR_FORBIDDEN | The domain is not allowed to use specified channel . |
NRFX_ERROR_INVALID_PARAM | Channel is not allocated. |
NRFX_ERROR_INTERNAL | The SYSCOUNTER (1 MHz) is not running. |
nrfx_err_t nrfx_grtc_syscounter_cc_value_read | ( | uint8_t | channel, |
uint64_t * | p_val | ||
) |
Function for reading the GRTC capture/compare register for the specified channel
.
[in] | channel | Capture channel number. |
[out] | p_val | Pointer to the variable where the result is to be stored. |
NRFX_SUCCESS | The procedure was successful. |
NRFX_ERROR_FORBIDDEN | The domain is not allowed to use specified channel . |
NRFX_ERROR_INVALID_PARAM | The specified channel is either not allocated or marked as unused. |
NRFX_ERROR_INTERNAL | The SYSCOUNTER (1 MHz) is not running. |
nrfx_err_t nrfx_grtc_syscounter_get | ( | uint64_t * | p_counter | ) |
Function for reading the GRTC SYSCOUNTER value.
[out] | p_counter | p_counter Pointer to the variable to be filled with the SYSCOUNTER value. |
NRFX_SUCCESS | The procedure was successful. |
NRFX_ERROR_INTERNAL | The SYSCOUNTER (1 MHz) is not running. |
nrfx_err_t nrfx_grtc_syscounter_start | ( | bool | busy_wait, |
uint8_t * | p_main_cc_channel | ||
) |
Function for starting the 1 MHz SYSCOUNTER.
[in] | busy_wait | True if wait for synchronization operation is to be performed, false otherwise. |
[out] | p_main_cc_channel | Pointer to the main capture/compare channel. |
NRFX_SUCCESS | Starting was successful. |
NRFX_ERROR_NO_MEM | No resource available to allocate main channel. |
NRFX_ERROR_ALREADY | The GRTC is already running. |
void nrfx_grtc_syscountervalid_int_enable | ( | nrfx_grtc_syscountervalid_handler_t | handler, |
void * | p_context | ||
) |
Function for enabling the SYSCOUNTER valid interrupt.
[in] | handler | Handler provided by the user. May be NULL. |
[in] | p_context | User context. |
NRFX_STATIC_INLINE uint32_t nrfx_grtc_task_address_get | ( | nrf_grtc_task_t | task | ) |
Function for retrieving the address of the specified GRTC task.
[in] | task | GRTC task. |
void nrfx_grtc_uninit | ( | void | ) |
Function for uninitializing the GRTC.