nrfx 4.5.0
Loading...
Searching...
No Matches
GRTC driver

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...
 
struct  nrfx_grtc_sleep_config_t
 GRTC SYSCOUNTER sleep configuration structure. More...
 

Macros

#define NRFX_GRTC_SLEEP_DEFAULT_CONFIG
 GRTC sleep default configuration.
 

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

void nrfx_grtc_sleep_configure (nrfx_grtc_sleep_config_t const *p_sleep_cfg)
 Function for configuring the SYSCOUNTER sleep feature.
 
void nrfx_grtc_sleep_configuration_get (nrfx_grtc_sleep_config_t *p_sleep_cfg)
 Function for getting the SYSCOUNTER sleep configuration.
 
int nrfx_grtc_channel_alloc (uint8_t *p_channel)
 Function for allocating the GRTC capture/compare channel.
 
int nrfx_grtc_extended_channel_alloc (uint8_t *p_channel)
 Function for allocating the extended GRTC capture/compare channel.
 
void nrfx_grtc_channel_callback_set (uint8_t channel, nrfx_grtc_cc_handler_t handler, void *p_context)
 Function for setting a callback to a channel.
 
int 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.
 
int nrfx_grtc_init (uint8_t interrupt_priority)
 Function for initializing the GRTC.
 
int 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.
 
int 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 SYSCOUNTERVALID interrupt.
 
void nrfx_grtc_syscountervalid_int_disable (void)
 Function for disabling the SYSCOUNTERVALID interrupt.
 
int nrfx_grtc_syscounter_start (bool busy_wait, uint8_t *p_main_cc_channel)
 Function for starting the 1 MHz SYSCOUNTER.
 
int 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.
 
int nrfx_grtc_syscounter_cc_disable (uint8_t channel)
 Function for disabling the SYSCOUNTER CC channel.
 
int 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.
 
void nrfx_grtc_syscounter_cc_interval_set (uint8_t channel, uint32_t start_val, uint32_t val)
 Function for setting the interval compare value for the SYSCOUNTER.
 
void nrfx_grtc_syscounter_cc_interval_reset (uint8_t channel)
 Function for resetting the interval compare value for the SYSCOUNTER.
 
void nrfx_grtc_syscounter_cc_abs_set (uint8_t channel, uint64_t val, bool safe_setting)
 Function for setting the absolute compare value for the SYSCOUNTER in an optimized way.
 
int 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.
 
void nrfx_grtc_syscounter_cc_rel_set (uint8_t channel, uint32_t val, nrfx_grtc_cc_relative_reference_t reference)
 Function for setting the relative compare value in an optimized way.
 
int nrfx_grtc_syscounter_cc_int_disable (uint8_t channel)
 Function for disabling the SYSCOUNTER compare interrupt.
 
int 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.
 
int nrfx_grtc_syscounter_capture (uint8_t channel)
 Function for triggering the SYSCOUNTER capture task.
 
int 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.
 
bool nrfx_grtc_ready_check (void)
 Function for checking whether the SYSCOUNTER is in ready state.
 
bool nrfx_grtc_active_request_check (void)
 Function for checking the current request for the SYSCOUNTER state.
 
void nrfx_grtc_active_request_set (bool active)
 Function for requesting the SYSCOUNTER state.
 
uint64_t nrfx_grtc_syscounter_get (void)
 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 bool nrfx_grtc_syscounter_compare_event_check (uint8_t channel)
 Function for retrieving the state of the compare GRTC event.
 
NRFX_STATIC_INLINE uint64_t nrfx_grtc_sys_counter_cc_get (uint8_t channel)
 Function for retrieving CC value.
 
NRFX_STATIC_INLINE uint64_t nrfx_grtc_rtcounter_get (void)
 Function for reading the GRTC RTCOUNTER value.
 
NRFX_STATIC_INLINE void nrfx_grtc_clock_source_set (nrf_grtc_clksel_t clk_src)
 Function for setting the clock source for the GRTC low-frequency clock.
 

Detailed Description

Global Real Timer Counter (GRTC) peripheral driver.

Macro Definition Documentation

◆ NRFX_GRTC_SLEEP_DEFAULT_CONFIG

#define NRFX_GRTC_SLEEP_DEFAULT_CONFIG
Value:
{ \
.timeout = 5, \
.waketime = 4, \
.auto_mode = true \
}

GRTC sleep default configuration.

This configuration sets up GRTC with the following options:

  • sleep timeout: 5 LFCLK cycles
  • wake time: 4 LFCLK cycles
  • automatic mode: true

Typedef Documentation

◆ nrfx_grtc_cc_handler_t

typedef void(* nrfx_grtc_cc_handler_t) (int32_t id, uint64_t cc_value, void *p_context)

GRTC driver instance compare handler type.

Parameters
[in]idChannel ID.
[in]cc_valueCompare value.
[in]p_contextUser context.

◆ nrfx_grtc_rtcomparesync_handler_t

typedef void(* nrfx_grtc_rtcomparesync_handler_t) (void *p_context)

GRTC driver instance RTCOMPARESYNC handler type.

Parameters
[in]p_contextUser context.

◆ nrfx_grtc_syscountervalid_handler_t

typedef void(* nrfx_grtc_syscountervalid_handler_t) (void *p_context)

GRTC driver instance SYSCOUNTER valid handler type.

Parameters
[in]p_contextUser context.

Enumeration Type Documentation

◆ nrfx_grtc_action_t

GRTC action types.

Enumerator
NRFX_GRTC_ACTION_START 

Start the GRTC.

NRFX_GRTC_ACTION_STOP 

Stop the GRTC.

NRFX_GRTC_ACTION_CLEAR 

Clear the GRTC.

◆ nrfx_grtc_cc_relative_reference_t

GRTC compare event relative references.

Enumerator
NRFX_GRTC_CC_RELATIVE_SYSCOUNTER 

The SYSCOUNTER content will be used as the reference.

NRFX_GRTC_CC_RELATIVE_COMPARE 

The corresponding compare register content will be used as the reference.

Function Documentation

◆ nrfx_grtc_action_perform()

int nrfx_grtc_action_perform ( nrfx_grtc_action_t action)

Function for performing an action for the GRTC.

Parameters
[in]actionAction to be performed.
Return values
0Starting was successful.
-ECANCELEDThe SYSCOUNTER (1 MHz) is running and the operation is not allowed.

◆ nrfx_grtc_active_request_check()

bool nrfx_grtc_active_request_check ( void )

Function for checking the current request for the SYSCOUNTER state.

Return values
trueThe SYSCOUNTER is requested to be enabled.
falseThe SYSCOUNTER is requested to be disabled.

◆ nrfx_grtc_active_request_set()

void nrfx_grtc_active_request_set ( bool active)

Function for requesting the SYSCOUNTER state.

Note
By using this function any domain can prevent SYSCOUNTER from going to sleep state.
Parameters
[in]activeTrue if SYSCOUNTER is to be always kept active, false otherwise.

◆ nrfx_grtc_capture_task_address_get()

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.

Parameters
[in]channelCapture channel number.
Returns
Task address.

◆ nrfx_grtc_channel_alloc()

int nrfx_grtc_channel_alloc ( uint8_t * p_channel)

Function for allocating the GRTC capture/compare channel.

Note
Function is thread safe as it uses nrfx_flag32_alloc.
Routines that allocate and free the GRTC channels are independent from the rest of the driver. In particular, the driver does not need to be initialized when this function is called.
Parameters
[out]p_channelPointer to the capture/compare channel.
Return values
0Allocation was successful.
-ENOMEMNo resource available.

◆ nrfx_grtc_channel_callback_set()

void nrfx_grtc_channel_callback_set ( uint8_t channel,
nrfx_grtc_cc_handler_t handler,
void * p_context )

Function for setting a callback to a channel.

Function enables the interrupt for that channel.

Parameters
[in]channelChannel.
[in]handlerUser handler called when channel expires.
[in]p_contextContext passed to the callback.

◆ nrfx_grtc_channel_free()

int nrfx_grtc_channel_free ( uint8_t channel)

Function for freeing the GRTC capture/compare channel.

Note
Function is thread safe as it uses nrfx_flag32_free.
Routines that allocate and free the GRTC channels are independent from the rest of the driver. In particular, the driver does not need to be initialized when this function is called.
This function also mark specified channel as unused by the driver.
Parameters
[in]channelAllocated channel to be freed.
Return values
0Allocation was successful.
-EPERMThe domain is not allowed to use specified channel.
-EINVALChannel is not allocated.

◆ nrfx_grtc_clock_source_set()

NRFX_STATIC_INLINE void nrfx_grtc_clock_source_set ( nrf_grtc_clksel_t clk_src)

Function for setting the clock source for the GRTC low-frequency clock.

Parameters
[in]clk_srcSelected clock source.

◆ nrfx_grtc_event_address_get()

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.

Parameters
[in]eventGRTC event.
Returns
Event address.

◆ nrfx_grtc_event_compare_address_get()

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.

Parameters
[in]channelCompare channel number.
Returns
Event address.

◆ nrfx_grtc_extended_channel_alloc()

int nrfx_grtc_extended_channel_alloc ( uint8_t * p_channel)

Function for allocating the extended GRTC capture/compare channel.

Note
The periodic CC event (interval) is the special feature, that requires allocating channel such way. See nrfx_grtc_syscounter_cc_interval_set.
The channels supporting special features are defined by the hardware. Refer to Product Specification for more details.
Function is thread safe as it uses nrfx_flag32_alloc.
Routines that allocate and free the GRTC channels are independent from the rest of the driver. In particular, the driver does not need to be initialized when this function is called.
To free the special channel, just use nrfx_grtc_channel_free.
Parameters
[out]p_channelPointer to the capture/compare channel.
Return values
0Allocation was successful.
-ENOMEMNo resource available.

◆ nrfx_grtc_init()

int nrfx_grtc_init ( uint8_t interrupt_priority)

Function for initializing the GRTC.

Parameters
[in]interrupt_priorityInterrupt priority.
Return values
0Initialization was successful.
-EALREADYThe driver is already initialized.
-ECANCELEDNo valid channel configuration provided.

◆ nrfx_grtc_init_check()

bool nrfx_grtc_init_check ( void )

Function for checking if the GRTC driver is initialized.

Return values
trueDriver is already initialized.
falseDriver is not initialized.

◆ nrfx_grtc_is_channel_used()

bool nrfx_grtc_is_channel_used ( uint8_t channel)

Function for checking whether the specified channel is used by the driver.

Note
Channels marked as used cannot be utilized by external API.
Parameters
[in]channelChannel to be checked.
Return values
trueChannel is used by the driver.
falseChannel is not used by the driver.

◆ nrfx_grtc_ready_check()

bool nrfx_grtc_ready_check ( void )

Function for checking whether the SYSCOUNTER is in ready state.

Note
When the SYSCOUNTER is not ready its value may be corrupted.
Return values
trueThe SYSCOUNTER is in ready state.
falseThe SYSCOUNTER is not in ready state.

◆ nrfx_grtc_rtcomparesync_int_enable()

void nrfx_grtc_rtcomparesync_int_enable ( nrfx_grtc_rtcomparesync_handler_t handler,
void * p_context )

Function for enabling the RTCOMPARESYNC interrupt.

Parameters
[in]handlerHandler provided by the user. May be NULL.
[in]p_contextUser context.

◆ nrfx_grtc_rtcounter_cc_absolute_set()

int 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.

Parameters
[in]handler_dataPointer to the handler data instance structure.
[in]valAbsolute value to be set in the compare register.
[in]enable_irqTrue if interrupt is to be enabled, false otherwise.
[in]syncTrue if the internal synchronization mechanism shall be used, false otherwise.
Return values
0The procedure was successful.
-ECANCELEDThe SYSCOUNTER (1 MHz) is running and the operation is not allowed.

◆ nrfx_grtc_rtcounter_cc_disable()

int nrfx_grtc_rtcounter_cc_disable ( void )

Function for disabling the RTCOUNTER CC channel.

Return values
0The procedure was successful.
-ECANCELEDThe SYSCOUNTER (1 MHz) is running and the operation is not allowed.
-ETIMEDOUTRTCOUNTER compare interrupt is pending.

◆ nrfx_grtc_rtcounter_cc_int_enable()

void nrfx_grtc_rtcounter_cc_int_enable ( bool sync)

Function for enabling the RTCOUNTER compare interrupt.

Parameters
[in]syncTrue if the internal synchronization mechanism shall be used, false otherwise.

◆ nrfx_grtc_rtcounter_get()

NRFX_STATIC_INLINE uint64_t nrfx_grtc_rtcounter_get ( void )

Function for reading the GRTC RTCOUNTER value.

Returns
RTCOUNTER (32 kHz) value.

◆ nrfx_grtc_sleep_configuration_get()

void nrfx_grtc_sleep_configuration_get ( nrfx_grtc_sleep_config_t * p_sleep_cfg)

Function for getting the SYSCOUNTER sleep configuration.

Parameters
[out]p_sleep_cfgPointer to the structure to be filled with sleep configuration.

◆ nrfx_grtc_sleep_configure()

void nrfx_grtc_sleep_configure ( nrfx_grtc_sleep_config_t const * p_sleep_cfg)

Function for configuring the SYSCOUNTER sleep feature.

Parameters
[in]p_sleep_cfgPointer to the configuration sleep structure.

◆ nrfx_grtc_sys_counter_cc_enable_check()

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.

Parameters
[in]channelChannel to be checked.
Return values
trueChannel is enabled.
falseChannel is disabled.

◆ nrfx_grtc_sys_counter_cc_get()

NRFX_STATIC_INLINE uint64_t nrfx_grtc_sys_counter_cc_get ( uint8_t channel)

Function for retrieving CC value.

Parameters
[in]channelCompare channel.
Returns
Value read from CC register.

◆ nrfx_grtc_syscounter_capture()

int nrfx_grtc_syscounter_capture ( uint8_t channel)

Function for triggering the SYSCOUNTER capture task.

Note
This function marks the specified channel as used.
Parameters
[in]channelCapture channel number.
Return values
0The procedure was successful.
-EPERMThe domain is not allowed to use specified channel.
-EINVALChannel is not allocated.
-ECANCELEDThe SYSCOUNTER (1 MHz) is not running.

◆ nrfx_grtc_syscounter_cc_abs_set()

void nrfx_grtc_syscounter_cc_abs_set ( uint8_t channel,
uint64_t val,
bool safe_setting )

Function for setting the absolute compare value for the SYSCOUNTER in an optimized way.

Function must be called with interrupts locked. If safe_setting is true then it means that previous CC for that channel did not yet expire and it was set to a value earlier than val so there is a chance that it will expire during setting the new value. In that case compare event may be misinterpreted. Slower but safe procedure is used in that case which ensures that there will be no unexpected user callback triggered. If safe_setting is false then function just sets new CC value.

Parameters
[in]channelChannel.
[in]valAbsolute value to be set in the compare register.
[in]safe_settingTrue if safe procedure is to be used, false otherwise.

◆ nrfx_grtc_syscounter_cc_absolute_set()

int 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.

Note
This function is deprecated. Use nrfx_grtc_syscounter_cc_abs_set instead.
This function marks the specified channel as used.
Parameters
[in]p_chan_dataPointer to the channel data instance structure.
[in]valAbsolute value to be set in the compare register.
[in]enable_irqTrue if interrupt is to be enabled, false otherwise.
Return values
0The procedure was successful.
-EPERMThe domain is not allowed to use specified channel.
-EINVALChannel is not allocated.
-ECANCELEDThe SYSCOUNTER (1 MHz) is not running.

◆ nrfx_grtc_syscounter_cc_disable()

int nrfx_grtc_syscounter_cc_disable ( uint8_t channel)

Function for disabling the SYSCOUNTER CC channel.

Note
This function marks the specified channel as unused.
Parameters
[in]channelChannel to be disabled.
Return values
0The procedure was successful.
-EPERMThe domain is not allowed to use specified channel.
-EINVALThe specified channel is either not allocated or marked as unused.
-ECANCELEDThe SYSCOUNTER (1 MHz) is not running.
-ETIMEDOUTSYSCOUNTER compare interrupt is pending on the requested channel.

◆ nrfx_grtc_syscounter_cc_int_disable()

int nrfx_grtc_syscounter_cc_int_disable ( uint8_t channel)

Function for disabling the SYSCOUNTER compare interrupt.

Parameters
[in]channelCompare channel number.
Return values
0The procedure was successful.
-EPERMThe domain is not allowed to use specified channel.
-EINVALThe specified channel is either not allocated or marked as unused.
-ECANCELEDThe SYSCOUNTER (1 MHz) is not running.

◆ nrfx_grtc_syscounter_cc_int_enable()

int nrfx_grtc_syscounter_cc_int_enable ( uint8_t channel)

Function for enabling the SYSCOUNTER compare interrupt.

Note
This function marks the specified channel as used.
Parameters
[in]channelCompare channel number.
Return values
0The procedure was successful.
-EPERMThe domain is not allowed to use specified channel.
-EINVALChannel is not allocated.
-ECANCELEDThe SYSCOUNTER (1 MHz) is not running.

◆ nrfx_grtc_syscounter_cc_int_enable_check()

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.

Parameters
[in]channelCompare channel number.
Return values
trueThe interrupt is enabled for the specified channel.
falseThe interrupt is disabled for the specified channel.

◆ nrfx_grtc_syscounter_cc_interval_reset()

void nrfx_grtc_syscounter_cc_interval_reset ( uint8_t channel)

Function for resetting the interval compare value for the SYSCOUNTER.

Note
This function stops a periodic compare event mode initiated by nrfx_grtc_syscounter_cc_interval_set.
Parameters
[in]channelChannel.

◆ nrfx_grtc_syscounter_cc_interval_set()

void nrfx_grtc_syscounter_cc_interval_set ( uint8_t channel,
uint32_t start_val,
uint32_t val )

Function for setting the interval compare value for the SYSCOUNTER.

Note
This function configures a periodic compare event for the given channel. If interrupts are to be used, nrfx_grtc_channel_callback_set must also be called. The first event will occur after start_val.
To stop generating periodic event nrfx_grtc_syscounter_cc_interval_reset must be called.
Parameters
[in]channelChannel.
[in]start_valRelative compare value (in SYSCOUNTER ticks) value after which the first interval event is generated.
[in]valRelative interval value (in SYSCOUNTER ticks), that defines the period between consecutive compare events.

◆ nrfx_grtc_syscounter_cc_rel_set()

void nrfx_grtc_syscounter_cc_rel_set ( uint8_t channel,
uint32_t val,
nrfx_grtc_cc_relative_reference_t reference )

Function for setting the relative compare value in an optimized way.

Function just sets CCADD value and does not attempt to enable or disable the interrupt. It assumes that expected channel configuration is done prior to that call. Function assumes that previously used CC value has already expired so new value can be safely set without a risk of spurious CC expiration.

Parameters
[in]channelChannel.
[in]valRelative value to be set in the CCADD register.
[in]referenceReference. Current counter value or current CC value.

◆ nrfx_grtc_syscounter_cc_relative_set()

int 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.

Note
This function is deprecated. Use nrfx_grtc_syscounter_cc_rel_set instead.

Function has no assumptions on the current channel state so channel event is cleared and interrupt can optionally be enabled for that channel.

Note
This function marks the specified channel as used.
Parameters
[in]p_chan_dataPointer to the channel data instance structure.
[in]valRelative value to be set in the compare register.
[in]enable_irqTrue if interrupt is to be enabled, false otherwise.
[in]referenceReference type to be used.
Return values
0The procedure was successful.
-EPERMThe domain is not allowed to use specified channel.
-EINVALChannel is not allocated.
-ECANCELEDThe SYSCOUNTER (1 MHz) is not running.

◆ nrfx_grtc_syscounter_cc_value_read()

int 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.

Parameters
[in]channelCapture channel number.
[out]p_valPointer to the variable where the result is to be stored.
Return values
0The procedure was successful.
-EPERMThe domain is not allowed to use specified channel.
-EINVALThe specified channel is either not allocated or marked as unused.
-ECANCELEDThe SYSCOUNTER (1 MHz) is not running.

◆ nrfx_grtc_syscounter_compare_event_check()

NRFX_STATIC_INLINE bool nrfx_grtc_syscounter_compare_event_check ( uint8_t channel)

Function for retrieving the state of the compare GRTC event.

Parameters
[in]channelCompare channel of the corresponding event to be checked.
Return values
trueThe event has been generated.
falseThe event has not been generated.

◆ nrfx_grtc_syscounter_get()

uint64_t nrfx_grtc_syscounter_get ( void )

Function for reading the GRTC SYSCOUNTER value.

Returns
SYSCOUNTER value.

◆ nrfx_grtc_syscounter_start()

int nrfx_grtc_syscounter_start ( bool busy_wait,
uint8_t * p_main_cc_channel )

Function for starting the 1 MHz SYSCOUNTER.

Note
This function automatically allocates and marks as used the special-purpose main capture/compare channel. It is available only for GRTC manager. It can be freed by nrfx_grtc_channel_free.
Use auxiliary structure of type nrfx_grtc_channel_t when working with SYSCOUNTER.
Parameters
[in]busy_waitTrue if wait for synchronization operation is to be performed, false otherwise.
[out]p_main_cc_channelPointer to the main capture/compare channel.
Return values
0Starting was successful.
-ENOMEMNo resource available to allocate main channel.
-EALREADYThe GRTC is already running.
-ETIMEDOUTThe SYSCOUNTER failed to start due to a timeout.

◆ nrfx_grtc_syscountervalid_int_enable()

void nrfx_grtc_syscountervalid_int_enable ( nrfx_grtc_syscountervalid_handler_t handler,
void * p_context )

Function for enabling the SYSCOUNTERVALID interrupt.

Parameters
[in]handlerHandler provided by the user. May be NULL.
[in]p_contextUser context.

◆ nrfx_grtc_task_address_get()

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.

Parameters
[in]taskGRTC task.
Returns
Task address.

◆ nrfx_grtc_uninit()

void nrfx_grtc_uninit ( void )

Function for uninitializing the GRTC.

Note
This function automatically frees all channels used by the driver. It also marks these channels as unused