GRTC HAL
- group nrf_grtc_hal
Hardware access layer for managing the Global Real Time Counter (GRTC) peripheral.
Defines
-
NRF_GRTC_HAS_PWM
Symbol indicating whether GRTC has PWM registers.
-
NRF_GRTC_HAS_CLKOUT
Symbol indicating whether GRTC has clock output registers.
-
NRF_GRTC_HAS_CLKSEL
Symbol indicating whether GRTC has clock source selection.
-
NRF_GRTC_HAS_SYSCOUNTER_ARRAY
Symbol indicating whether GRTC has multiple SYSCOUNTER registers.
-
NRF_GRTC_HAS_RTCOUNTER
Symbol indicating whether GRTC has RTCOUNTER.
-
NRF_GRTC_HAS_EXTENDED
Symbol indicating whether GRTC has extended functionality.
-
NRF_GRTC_DOMAIN_INDEX
Symbol indicating actual domain index.
-
GRTC_SYSCOUNTER
Symbol indicating actual SYSCOUNTER index.
-
GRTC_INTEN
Interrupts INTEN register definition.
-
GRTC_INTENSET
Interrupts INTENSET register definition.
-
GRTC_INTENCLR
Interrupts INTENCLR register definition.
-
GRTC_INTPEND
Interrupts INTPEND register definition.
-
NRF_GRTC_SYSCOUNTER_MAIN_FREQUENCY_HZ
Main SYSCOUNTER frequency in Hz.
-
NRF_GRTC_SYSCOUNTER_CC_COUNT
Number of capture/compare channels for SYSCOUNTER.
-
NRF_GRTC_SYSCOUNTER_CCH_MASK
Bitmask of the higher 32-bits of capture/compare register for the SYSCOUNTER.
-
NRF_GRTC_SYSCOUNTER_CCADD_MASK
Bitmask of CCADD register for the SYSCOUNTER.
-
NRF_GRTC_SYSCOUNTERL_VALUE_MASK
Bitmask of the lower part of the SYSCOUNTER value.
-
NRF_GRTC_SYSCOUNTERH_VALUE_MASK
Bitmask of the higher part of the SYSCOUNTER value.
-
NRF_GRTC_RTCOUNTER_CCH_MASK
Bitmask of the higher 32-bits of capture/compare register for the RTCOUNTER.
-
NRF_GRTC_SYSCOUNTERH_OVERFLOW_MASK
Bitmask of the OVERFLOW bit.
-
NRF_GRTC_SYSCOUNTERH_BUSY_MASK
Bitmask of the BUSY bit.
-
NRF_GRTC_TIMEOUT_MAX_VALUE
Maximum value of TIMEOUT register content.
-
NRF_GRTC_WAKETIME_MAX_VALUE
Maximum value of WAKETIME register content.
-
NRF_GRTC_CLKCFG_CLKFASTDIV_MAX_VALUE
Maximum value of CLKFASTDIV register content.
-
NRF_GRTC_CHANNEL_INT_MASK(ch)
Macro for creating the interrupt bitmask for the specified compare channel.
-
NRF_GRTC_MAIN_CC_CHANNEL
Main channel that can be used only by the owner of GRTC.
-
NRF_GRTC_INTEN_MASK
Bitmask of interrupt enable.
-
NRF_GRTC_SYSCOUNTER_ALL_CHANNELS_INT_MASK
Mask for all channels represented by CC channels.
Enums
-
enum nrf_grtc_task_t
GRTC tasks.
Values:
-
enumerator NRF_GRTC_TASK_START
Start.
-
enumerator NRF_GRTC_TASK_STOP
Stop.
-
enumerator NRF_GRTC_TASK_CLEAR
Clear.
-
enumerator NRF_GRTC_TASK_PWM_START
Start the PWM.
-
enumerator NRF_GRTC_TASK_PWM_STOP
Stop the PWM.
-
enumerator NRF_GRTC_TASK_CAPTURE_0
Capture the counter value on channel 0.
-
enumerator NRF_GRTC_TASK_CAPTURE_1
Capture the counter value on channel 1.
-
enumerator NRF_GRTC_TASK_CAPTURE_2
Capture the counter value on channel 2.
-
enumerator NRF_GRTC_TASK_CAPTURE_3
Capture the counter value on channel 3.
-
enumerator NRF_GRTC_TASK_CAPTURE_4
Capture the counter value on channel 4.
-
enumerator NRF_GRTC_TASK_CAPTURE_5
Capture the counter value on channel 5.
-
enumerator NRF_GRTC_TASK_CAPTURE_6
Capture the counter value on channel 6.
-
enumerator NRF_GRTC_TASK_CAPTURE_7
Capture the counter value on channel 7.
-
enumerator NRF_GRTC_TASK_CAPTURE_8
Capture the counter value on channel 8.
-
enumerator NRF_GRTC_TASK_CAPTURE_9
Capture the counter value on channel 9.
-
enumerator NRF_GRTC_TASK_CAPTURE_10
Capture the counter value on channel 10.
-
enumerator NRF_GRTC_TASK_CAPTURE_11
Capture the counter value on channel 11.
-
enumerator NRF_GRTC_TASK_START
-
enum nrf_grtc_event_t
GRTC events.
Values:
-
enumerator NRF_GRTC_EVENT_COMPARE_0
Compare 0 event.
-
enumerator NRF_GRTC_EVENT_COMPARE_1
Compare 1 event.
-
enumerator NRF_GRTC_EVENT_COMPARE_2
Compare 2 event.
-
enumerator NRF_GRTC_EVENT_COMPARE_3
Compare 3 event.
-
enumerator NRF_GRTC_EVENT_COMPARE_4
Compare 4 event.
-
enumerator NRF_GRTC_EVENT_COMPARE_5
Compare 5 event.
-
enumerator NRF_GRTC_EVENT_COMPARE_6
Compare 6 event.
-
enumerator NRF_GRTC_EVENT_COMPARE_7
Compare 7 event.
-
enumerator NRF_GRTC_EVENT_COMPARE_8
Compare 8 event.
-
enumerator NRF_GRTC_EVENT_COMPARE_9
Compare 9 event.
-
enumerator NRF_GRTC_EVENT_COMPARE_10
Compare 10 event.
-
enumerator NRF_GRTC_EVENT_COMPARE_11
Compare 11 event.
-
enumerator NRF_GRTC_EVENT_COMPARE_12
Compare 12 event.
-
enumerator NRF_GRTC_EVENT_RTCOMPARE
RTCOUNTER compare event.
-
enumerator NRF_GRTC_EVENT_RTCOMPARESYNC
RTCOUNTER synchronized compare event.
-
enumerator NRF_GRTC_EVENT_SYSCOUNTERVALID
SYSCOUNTER value valid event.
-
enumerator NRF_GRTC_EVENT_PWM_PERIOD_END
End of PWM period event.
-
enumerator NRF_GRTC_EVENT_COMPARE_0
-
enum nrf_grtc_short_mask_t
Types of GRTC shortcuts.
Values:
-
enumerator NRF_GRTC_SHORT_RTCOMPARE_CLEAR_MASK
Shortcut between RTCOMPARE event and CLEAR task.
-
enumerator NRF_GRTC_SHORT_RTCOMPARE_CLEAR_MASK
-
enum nrf_grtc_cc_add_reference_t
Types of GRTC CC references.
Values:
-
enumerator NRF_GRTC_CC_ADD_REFERENCE_SYSCOUNTER
The SYSCOUNTER register’s content will be used as the reference.
-
enumerator NRF_GRTC_CC_ADD_REFERENCE_CC
The CC[n] register’s content will be used as the reference.
-
enumerator NRF_GRTC_CC_ADD_REFERENCE_SYSCOUNTER
-
enum nrf_grtc_int_mask_t
GRTC interrupts.
Values:
-
enumerator NRF_GRTC_INT_COMPARE0_MASK
GRTC interrupt from compare event on channel 0.
-
enumerator NRF_GRTC_INT_COMPARE1_MASK
GRTC interrupt from compare event on channel 1.
-
enumerator NRF_GRTC_INT_COMPARE2_MASK
GRTC interrupt from compare event on channel 2.
-
enumerator NRF_GRTC_INT_COMPARE3_MASK
GRTC interrupt from compare event on channel 3.
-
enumerator NRF_GRTC_INT_COMPARE4_MASK
GRTC interrupt from compare event on channel 4.
-
enumerator NRF_GRTC_INT_COMPARE5_MASK
GRTC interrupt from compare event on channel 5.
-
enumerator NRF_GRTC_INT_COMPARE6_MASK
GRTC interrupt from compare event on channel 6.
-
enumerator NRF_GRTC_INT_COMPARE7_MASK
GRTC interrupt from compare event on channel 7.
-
enumerator NRF_GRTC_INT_COMPARE8_MASK
GRTC interrupt from compare event on channel 8.
-
enumerator NRF_GRTC_INT_COMPARE9_MASK
GRTC interrupt from compare event on channel 9.
-
enumerator NRF_GRTC_INT_COMPARE10_MASK
GRTC interrupt from compare event on channel 10.
-
enumerator NRF_GRTC_INT_COMPARE11_MASK
GRTC interrupt from compare event on channel 11.
-
enumerator NRF_GRTC_INT_RTCOMPARE_MASK
GRTC interrupt from RTCOUNTER compare event.
-
enumerator NRF_GRTC_INT_RTCOMPARESYNC_MASK
GRTC interrupt from RTCOUNTER synchronized compare event.
-
enumerator NRF_GRTC_INT_SYSCOUNTERVALID_MASK
GRTC interrupt from SYSCOUNTER valid event.
-
enumerator NRF_GRTC_INT_COMPARE0_MASK
Functions
-
NRF_STATIC_INLINE void nrf_grtc_sys_counter_cc_set(NRF_GRTC_Type *p_reg, uint8_t cc_channel, uint64_t cc_value)
Function for setting the compare value of channel for the SYSCOUNTER.
Note
The corresponding event is automatically disabled by hardware during the operation.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
cc_channel – [in] The specified capture/compare channel.
cc_value – [in] Compare value to be set in 1 MHz units.
-
NRF_STATIC_INLINE uint64_t nrf_grtc_sys_counter_cc_get(NRF_GRTC_Type const *p_reg, uint8_t cc_channel)
Function for getting the capture/compare value of channel for the SYSCOUNTER.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
cc_channel – [in] The specified capture/compare channel.
- Returns:
Value from the specified capture/compare register in 1MHz units.
-
NRF_STATIC_INLINE void nrf_grtc_sys_counter_cc_add_set(NRF_GRTC_Type *p_reg, uint8_t cc_channel, uint32_t value, nrf_grtc_cc_add_reference_t reference)
Function for setting the value to be added to capture/compare register for the SYSCOUNTER.
Note
There are two available configurations of adding operation: When
reference
value equals NRF_GRTC_CC_ADD_REFERENCE_SYSCOUNTER then the final value of capture/compare register is a sum of SYSCOUNTER current value andvalue
. Whenreference
value equals NRF_GRTC_CC_ADD_REFERENCE_CC then the final value of capture/compare register is a sum of current capture/compare value andvalue
. If the capture/compare register overflows after this write, then the corresponding event is generated immediately.- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
cc_channel – [in] The specified capture/compare channel.
value – [in] Value to be added in 1 MHz units.
reference – [in] Configuration of adding mode.
-
NRF_STATIC_INLINE void nrf_grtc_rt_counter_cc_set(NRF_GRTC_Type *p_reg, uint64_t cc_value, bool sync)
Function for setting a compare value for the RTCOUNTER.
Note
The internal synchronization mechanism ensures that the desired value will be properly latched by the GRTC. However when
sync
parameter is true then the process of capturing the value lasts up to two 32 kHz cycles. If thesync
parameter is false then the capturing the value will occur on the following rising edge of 32 kHz clock. In this case it is user’s responsibility to execute the function between the 32 kHz rising edges.- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
cc_value – [in] Compare value to be set in 32 kHz units.
sync – [in] True if the internal synchronization mechanism shall be used, false otherwise.
-
NRF_STATIC_INLINE uint64_t nrf_grtc_rt_counter_cc_get(NRF_GRTC_Type const *p_reg)
Function for returning the compare value for the RTCOUNTER.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns:
Value from the capture/compare register in 32 kHz units.
-
NRF_STATIC_INLINE void nrf_grtc_int_enable(NRF_GRTC_Type *p_reg, uint32_t mask)
Function for enabling specified interrupts.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
mask – [in] Mask of interrupts to be enabled. Use nrf_grtc_int_mask_t values for bit masking.
-
NRF_STATIC_INLINE void nrf_grtc_int_disable(NRF_GRTC_Type *p_reg, uint32_t mask)
Function for disabling specified interrupts.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
mask – [in] Mask of interrupts to be disabled. Use nrf_grtc_int_mask_t values for bit masking.
-
NRF_STATIC_INLINE uint32_t nrf_grtc_int_enable_check(NRF_GRTC_Type const *p_reg, uint32_t mask)
Function for checking if the specified interrupts are enabled.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
mask – [in] Mask of interrupts to be checked. Use nrf_grtc_int_mask_t values for bit masking.
- Returns:
Mask of enabled interrupts.
-
NRF_STATIC_INLINE uint32_t nrf_grtc_int_pending_get(NRF_GRTC_Type const *p_reg)
Function for retrieving the state of pending interrupts.
Note
States of pending interrupt are saved as a bitmask. One set at particular position means that interrupt for event is pending.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns:
Bitmask with information about pending interrupts. Use nrf_grtc_int_mask_t values for bit masking.
-
NRF_STATIC_INLINE void nrf_grtc_event_enable(NRF_GRTC_Type *p_reg, uint32_t mask)
Function for enabling events.
Note
Only specific events can be individually enabled or disabled.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
mask – [in] Mask of event flags to be enabled.
-
NRF_STATIC_INLINE void nrf_grtc_event_disable(NRF_GRTC_Type *p_reg, uint32_t mask)
Function for disabling events.
Note
Only specific events can be individually enabled or disabled.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
mask – [in] Mask of event flags to be disabled.
-
NRF_STATIC_INLINE void nrf_grtc_shorts_enable(NRF_GRTC_Type *p_reg, uint32_t mask)
Function for enabling the specified shortcuts.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
mask – [in] Bitmask of shortcuts to be enabled.
-
NRF_STATIC_INLINE void nrf_grtc_shorts_disable(NRF_GRTC_Type *p_reg, uint32_t mask)
Function for disabling the specified shortcuts.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
mask – [in] Bitmask of shortcuts to be disabled.
-
NRF_STATIC_INLINE void nrf_grtc_shorts_set(NRF_GRTC_Type *p_reg, uint32_t mask)
Function for setting the specified shortcuts.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
mask – [in] Bitmask of shortcuts to be set.
-
NRF_STATIC_INLINE void nrf_grtc_subscribe_set(NRF_GRTC_Type *p_reg, nrf_grtc_task_t task, uint8_t channel)
Function for setting the subscribe configuration for a given GRTC task.
Note
Not every task has its corresponding subscribe register. Refer to the Product Specification for more information.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
task – [in] Task for which to set the configuration.
channel – [in] Channel through which to subscribe events.
-
NRF_STATIC_INLINE void nrf_grtc_subscribe_clear(NRF_GRTC_Type *p_reg, nrf_grtc_task_t task)
Function for clearing the subscribe configuration for a given GRTC task.
Note
Not every task has its corresponding subscribe register. Refer to the Product Specification for more information.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
task – [in] Task for which to clear the configuration.
-
NRF_STATIC_INLINE void nrf_grtc_publish_set(NRF_GRTC_Type *p_reg, nrf_grtc_event_t event, uint8_t channel)
Function for setting the publish configuration for a given GRTC event.
Note
Not every event has its corresponding publish register. Refer to the Product Specification for more information.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
event – [in] Event for which to set the configuration.
channel – [in] Channel through which to publish the event.
-
NRF_STATIC_INLINE void nrf_grtc_publish_clear(NRF_GRTC_Type *p_reg, nrf_grtc_event_t event)
Function for clearing the publish configuration for a given GRTC event.
Note
Not every event has its corresponding publish register. Refer to the Product Specification for more information.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
event – [in] Event for which to clear the configuration.
-
NRF_STATIC_INLINE bool nrf_grtc_event_check(NRF_GRTC_Type const *p_reg, nrf_grtc_event_t event)
Function for retrieving the state of the GRTC event.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
event – [in] Event to be checked.
- Return values:
true – The event has been generated.
false – The event has not been generated.
-
NRF_STATIC_INLINE void nrf_grtc_event_clear(NRF_GRTC_Type *p_reg, nrf_grtc_event_t event)
Function for clearing an event.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
event – [in] Event to be cleared.
-
NRF_STATIC_INLINE uint32_t nrf_grtc_rt_counter_low_get(NRF_GRTC_Type const *p_reg)
Function for returning the lower 32-bits of RTCOUNTER value.
Note
The whole RTCOUNTER value is latched when nrf_grtc_rt_counter_low_get function is executed. Thus nrf_grtc_rt_counter_low_get must be executed before calling nrf_grtc_rt_counter_high_get.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns:
Lower part of RTCOUNTER value.
-
NRF_STATIC_INLINE uint32_t nrf_grtc_rt_counter_high_get(NRF_GRTC_Type const *p_reg)
Function for returning the higher 32-bits of RTCOUNTER value.
Note
The whole RTCOUNTER value is latched when nrf_grtc_rt_counter_low_get function is executed. Thus nrf_grtc_rt_counter_low_get must be executed before calling nrf_grtc_rt_counter_high_get.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns:
Higher part of RTCOUNTER value.
-
NRF_STATIC_INLINE uint32_t nrf_grtc_sys_counter_low_get(NRF_GRTC_Type const *p_reg)
Function for returning the lower 32-bits of SYSCOUNTER value.
Note
nrf_grtc_sys_counter_low_get must be executed before calling nrf_grtc_sys_counter_high_get. In addition, after this, nrf_grtc_sys_counter_overflow_check should be called. If it retuns true, whole procedure should be repeated.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns:
Lower part of SYSCOUNTER value.
-
NRF_STATIC_INLINE uint32_t nrf_grtc_sys_counter_high_get(NRF_GRTC_Type const *p_reg)
Function for returning the higher 32-bits of SYSCOUNTER value.
Note
nrf_grtc_sys_counter_low_get must be executed before calling nrf_grtc_sys_counter_high_get. In addition, after this, nrf_grtc_sys_counter_overflow_check should be called. If it retuns true, whole procedure should be repeated.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns:
Higher part SYSCOUNTER value.
-
NRF_STATIC_INLINE uint64_t nrf_grtc_sys_counter_get(NRF_GRTC_Type const *p_reg)
Function for returning the 64-bit SYSCOUNTER value.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns:
SYSCOUNTER value.
-
NRF_STATIC_INLINE bool nrf_grtc_sys_counter_overflow_check(NRF_GRTC_Type const *p_reg)
Function for checking whether the lower 32-bits of SYSCOUNTER overflowed after last execution of nrf_grtc_sys_counter_low_get.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Return values:
True – if the lower 32-bits of SYSCOUNTER overflowed, false otherwise.
-
NRF_STATIC_INLINE void nrf_grtc_sys_counter_active_set(NRF_GRTC_Type *p_reg, bool enable)
Function for setting the request to keep the specified SYSCOUNTER channel active.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
enable – [in] True if the SYSCOUNTER channel is to be kept active, false otherwise.
-
NRF_STATIC_INLINE bool nrf_grtc_sys_counter_active_check(NRF_GRTC_Type const *p_reg)
Function for checking whether the specified SYSCOUNTER channel is requested to remain active.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Return values:
True – if SYSCOUNTER channel is requested to remain active, false otherwise.
-
NRF_STATIC_INLINE uint32_t nrf_grtc_event_address_get(NRF_GRTC_Type const *p_reg, nrf_grtc_event_t event)
Function for returning the address of an event.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
event – [in] Requested event.
- Returns:
Address of the requested event register.
-
NRF_STATIC_INLINE uint32_t nrf_grtc_task_address_get(NRF_GRTC_Type const *p_reg, nrf_grtc_task_t task)
Function for returning the address of a task.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
task – [in] Requested task.
- Returns:
Address of the requested task register.
-
NRF_STATIC_INLINE void nrf_grtc_task_trigger(NRF_GRTC_Type *p_reg, nrf_grtc_task_t task)
Function for starting a task.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
task – [in] Requested task.
-
NRF_STATIC_INLINE nrf_grtc_task_t nrf_grtc_sys_counter_capture_task_get(uint8_t cc_channel)
Function for getting the 1 MHz SYSCOUNTER timer capture task associated with the specified channel.
- Parameters:
cc_channel – [in] Capture channel.
- Returns:
Capture task.
-
NRF_STATIC_INLINE void nrf_grtc_sys_counter_compare_event_enable(NRF_GRTC_Type *p_reg, uint8_t cc_channel)
Function for enabling SYSCOUNTER compare event.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
cc_channel – [in] Channel number of compare event to be enabled.
-
NRF_STATIC_INLINE void nrf_grtc_sys_counter_compare_event_disable(NRF_GRTC_Type *p_reg, uint8_t cc_channel)
Function for disabling SYSCOUNTER compare event.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
cc_channel – [in] Channel number of compare event to be disabled.
-
NRF_STATIC_INLINE nrf_grtc_event_t nrf_grtc_sys_counter_compare_event_get(uint8_t cc_channel)
Function for getting the SYSCOUNTER compare event associated with the specified compare cc_channel.
- Parameters:
cc_channel – [in] Compare channel number.
- Returns:
Requested compare event.
-
NRF_STATIC_INLINE bool nrf_grtc_sys_counter_cc_enable_check(NRF_GRTC_Type const *p_reg, uint8_t cc_channel)
Function for checking whether the specified capture/compare channel is enabled.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
cc_channel – [in] Channel to be checked.
- Return values:
true – Specified channel is enabled.
false – Specified channel is disabled.
-
NRF_STATIC_INLINE void nrf_grtc_sys_counter_set(NRF_GRTC_Type *p_reg, bool enable)
Function for setting the SYSCOUNTER.
Note
When the SYSCOUNTER is disabled the GRTC uses RTCOUNTER by default.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
enable – [in] True if SYSCOUNTER is to be enabled, false otherwise.
-
NRF_STATIC_INLINE void nrf_grtc_sys_counter_auto_mode_set(NRF_GRTC_Type *p_reg, bool enable)
Function for setting automatic mode for the SYSCOUNTER.
Note
When
enable
is false then the SYSCOUNTER remains active when KEEPRUNNING is set, or any task register, INT register or SYSCOUNTER register is being accessed. Whenenable
is true then in addition the SYSCOUNTER remains active when any local CPU that is not sleeping keeps the SYSCOUNTER active.- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
enable – [in] True if the automatic mode is to be enabled, false otherwise.
-
NRF_STATIC_INLINE bool nrf_grtc_sys_counter_auto_mode_check(NRF_GRTC_Type *p_reg)
Function for checking whether the SYSCOUNTER has automatic mode enabled.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns:
True Automatic mode is enabled.
- Returns:
False Automatic mode is disabled.
-
NRF_STATIC_INLINE bool nrf_grtc_sys_counter_check(NRF_GRTC_Type const *p_reg)
Function for checking whether the SYSCOUNTER is in active state.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Return values:
True – if the SYSCOUNTER is active, false otherwise.
-
NRF_STATIC_INLINE void nrf_grtc_sys_counter_active_state_request_set(NRF_GRTC_Type *p_reg, bool enable)
Function for setting the request to keep the SYSCOUNTER active.
Note
This function modifies the KEEPRUNNING register, which possesses information whether any local CPU needs keeping the SYSCOUNTER active.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
enable – [in] True if the automatic mode is to be enabled, false otherwise.
-
NRF_STATIC_INLINE bool nrf_grtc_sys_counter_active_state_request_check(NRF_GRTC_Type const *p_reg)
Function for checking whether the SYSCOUNTER is requested to remain active.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Return values:
True – if request for keeping the SYSCOUNTER is active, false otherwise.
-
NRF_STATIC_INLINE uint32_t nrf_grtc_sys_counter_active_state_request_get(NRF_GRTC_Type const *p_reg, uint32_t mask)
Function for getting the domains that requested the SYSCOUNTER to remain active.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
mask – [in] Domains mask.
- Return values:
Bitmask – of domains that keep the SYSCOUNTER active.
-
NRF_STATIC_INLINE void nrf_grtc_sys_counter_interval_set(NRF_GRTC_Type *p_reg, uint32_t value)
Function for setting the periodic compare event for capture/compare channel 0.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
value – [in] Period value in 1 MHz units.
-
NRF_STATIC_INLINE uint32_t nrf_grtc_sys_counter_interval_get(NRF_GRTC_Type const *p_reg)
Function for getting the value of interval for periodic capture/compare event for channel 0.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Return values:
Value – of the interval in 1 MHz units.
-
NRF_STATIC_INLINE void nrf_grtc_timeout_set(NRF_GRTC_Type *p_reg, uint32_t value)
Function for setting the timeout value for GRTC.
Note
Timeout between all CPUs going to sleep and stopping the SYSCOUNTER.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
value – [in] Timeout value in 32 kHz units.
-
NRF_STATIC_INLINE uint32_t nrf_grtc_timeout_get(NRF_GRTC_Type const *p_reg)
Function for getting the value of the timeout value for GRTC.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Return values:
Value – of the timeout in 32 kHz units.
-
NRF_STATIC_INLINE void nrf_grtc_waketime_set(NRF_GRTC_Type *p_reg, uint32_t value)
Function for setting the wake time value for GRTC.
Note
The wake time is maximum number of 32 kHz cycles takes to restore the APB registers when waking from sleep state.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
value – [in] Wake time value in 32 kHz units.
-
NRF_STATIC_INLINE uint32_t nrf_grtc_waketime_get(NRF_GRTC_Type const *p_reg)
Function for getting the wake time value.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Return values:
Value – of wake time in 32 kHz units.
-
NRF_STATIC_INLINE void nrf_grtc_pwm_compare_set(NRF_GRTC_Type *p_reg, uint32_t value)
Function for setting the PWM compare value.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
value – [in] PWM compare value.
-
NRF_STATIC_INLINE uint32_t nrf_grtc_pwm_compare_get(NRF_GRTC_Type const *p_reg)
Function for getting the PWM compare value.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Return values:
Value – of PWM compare.
-
NRF_STATIC_INLINE void nrf_grtc_clkout_set(NRF_GRTC_Type *p_reg, nrf_grtc_clkout_t clkout, bool enable)
Function for setting the specified clock source to be connected to output pin.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
clkout – [in] Selected clkout source.
enable – [in] True if the clkout source is to be enabled, false otherwise.
-
NRF_STATIC_INLINE bool nrf_grtc_clkout_enable_check(NRF_GRTC_Type const *p_reg, nrf_grtc_clkout_t clkout)
Function for checking whether clock source is connected to clkout pin.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
clkout – [in] Selected clkout source.
- Return values:
True – if the clkout source is enabled, false otherwise.
-
NRF_STATIC_INLINE void nrf_grtc_clkout_divider_set(NRF_GRTC_Type *p_reg, uint32_t value)
Function for setting the fast clock divisor value of clock output.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
value – [in] Fast clock divisor value.
-
NRF_STATIC_INLINE uint32_t nrf_grtc_clkout_divider_get(NRF_GRTC_Type const *p_reg)
Function for getting the fast clock divisor value of clock output.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Return values:
Fast – clock divisor value.
-
NRF_STATIC_INLINE void nrf_grtc_clksel_set(NRF_GRTC_Type *p_reg, nrf_grtc_clksel_t clksel)
Function for setting the clock source for the GRTC low-frequency clock.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
clksel – [in] Selected clock source.
-
NRF_STATIC_INLINE nrf_grtc_clksel_t nrf_grtc_clksel_get(NRF_GRTC_Type const *p_reg)
Function for getting the clock source of the GRTC low-frequency clock.
- Parameters:
p_reg – [in] Pointer to the structure of registers of the peripheral.
- Returns:
Clock source configuration.
-
NRF_GRTC_HAS_PWM