xref: /nrf52832-nimble/nordic/nrfx/drivers/include/nrfx_rtc.h (revision 150812a83cab50279bd772ef6db1bfaf255f2c5b)
1*150812a8SEvalZero /*
2*150812a8SEvalZero  * Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
3*150812a8SEvalZero  * All rights reserved.
4*150812a8SEvalZero  *
5*150812a8SEvalZero  * Redistribution and use in source and binary forms, with or without
6*150812a8SEvalZero  * modification, are permitted provided that the following conditions are met:
7*150812a8SEvalZero  *
8*150812a8SEvalZero  * 1. Redistributions of source code must retain the above copyright notice, this
9*150812a8SEvalZero  *    list of conditions and the following disclaimer.
10*150812a8SEvalZero  *
11*150812a8SEvalZero  * 2. Redistributions in binary form must reproduce the above copyright
12*150812a8SEvalZero  *    notice, this list of conditions and the following disclaimer in the
13*150812a8SEvalZero  *    documentation and/or other materials provided with the distribution.
14*150812a8SEvalZero  *
15*150812a8SEvalZero  * 3. Neither the name of the copyright holder nor the names of its
16*150812a8SEvalZero  *    contributors may be used to endorse or promote products derived from this
17*150812a8SEvalZero  *    software without specific prior written permission.
18*150812a8SEvalZero  *
19*150812a8SEvalZero  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20*150812a8SEvalZero  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21*150812a8SEvalZero  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22*150812a8SEvalZero  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23*150812a8SEvalZero  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*150812a8SEvalZero  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*150812a8SEvalZero  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*150812a8SEvalZero  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27*150812a8SEvalZero  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28*150812a8SEvalZero  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29*150812a8SEvalZero  * POSSIBILITY OF SUCH DAMAGE.
30*150812a8SEvalZero  */
31*150812a8SEvalZero 
32*150812a8SEvalZero #ifndef NRFX_RTC_H__
33*150812a8SEvalZero #define NRFX_RTC_H__
34*150812a8SEvalZero 
35*150812a8SEvalZero #include <nrfx.h>
36*150812a8SEvalZero #include <hal/nrf_rtc.h>
37*150812a8SEvalZero 
38*150812a8SEvalZero #ifdef __cplusplus
39*150812a8SEvalZero extern "C" {
40*150812a8SEvalZero #endif
41*150812a8SEvalZero 
42*150812a8SEvalZero /**
43*150812a8SEvalZero  * @defgroup nrfx_rtc RTC driver
44*150812a8SEvalZero  * @{
45*150812a8SEvalZero  * @ingroup nrf_rtc
46*150812a8SEvalZero  * @brief   Real Timer Counter (RTC) peripheral driver.
47*150812a8SEvalZero  */
48*150812a8SEvalZero 
49*150812a8SEvalZero /**@brief Macro to convert microseconds into ticks. */
50*150812a8SEvalZero #define NRFX_RTC_US_TO_TICKS(us,freq) (((us) * (freq)) / 1000000U)
51*150812a8SEvalZero 
52*150812a8SEvalZero /**@brief RTC driver interrupt types. */
53*150812a8SEvalZero typedef enum
54*150812a8SEvalZero {
55*150812a8SEvalZero     NRFX_RTC_INT_COMPARE0 = 0, /**< Interrupt from COMPARE0 event. */
56*150812a8SEvalZero     NRFX_RTC_INT_COMPARE1 = 1, /**< Interrupt from COMPARE1 event. */
57*150812a8SEvalZero     NRFX_RTC_INT_COMPARE2 = 2, /**< Interrupt from COMPARE2 event. */
58*150812a8SEvalZero     NRFX_RTC_INT_COMPARE3 = 3, /**< Interrupt from COMPARE3 event. */
59*150812a8SEvalZero     NRFX_RTC_INT_TICK     = 4, /**< Interrupt from TICK event. */
60*150812a8SEvalZero     NRFX_RTC_INT_OVERFLOW = 5  /**< Interrupt from OVERFLOW event. */
61*150812a8SEvalZero } nrfx_rtc_int_type_t;
62*150812a8SEvalZero 
63*150812a8SEvalZero /**@brief RTC driver instance  structure. */
64*150812a8SEvalZero typedef struct
65*150812a8SEvalZero {
66*150812a8SEvalZero     NRF_RTC_Type  * p_reg;            /**< Pointer to instance register set. */
67*150812a8SEvalZero     IRQn_Type       irq;              /**< Instance IRQ ID. */
68*150812a8SEvalZero     uint8_t         instance_id;      /**< Instance index. */
69*150812a8SEvalZero     uint8_t         cc_channel_count; /**< Number of capture/compare channels. */
70*150812a8SEvalZero } nrfx_rtc_t;
71*150812a8SEvalZero 
72*150812a8SEvalZero /**@brief Macro for creating RTC driver instance.*/
73*150812a8SEvalZero #define NRFX_RTC_INSTANCE(id)                                   \
74*150812a8SEvalZero {                                                               \
75*150812a8SEvalZero     .p_reg            = NRFX_CONCAT_2(NRF_RTC, id),             \
76*150812a8SEvalZero     .irq              = NRFX_CONCAT_3(RTC, id, _IRQn),          \
77*150812a8SEvalZero     .instance_id      = NRFX_CONCAT_3(NRFX_RTC, id, _INST_IDX), \
78*150812a8SEvalZero     .cc_channel_count = NRF_RTC_CC_CHANNEL_COUNT(id),           \
79*150812a8SEvalZero }
80*150812a8SEvalZero 
81*150812a8SEvalZero enum {
82*150812a8SEvalZero #if NRFX_CHECK(NRFX_RTC0_ENABLED)
83*150812a8SEvalZero     NRFX_RTC0_INST_IDX,
84*150812a8SEvalZero #endif
85*150812a8SEvalZero #if NRFX_CHECK(NRFX_RTC1_ENABLED)
86*150812a8SEvalZero     NRFX_RTC1_INST_IDX,
87*150812a8SEvalZero #endif
88*150812a8SEvalZero #if NRFX_CHECK(NRFX_RTC2_ENABLED)
89*150812a8SEvalZero     NRFX_RTC2_INST_IDX,
90*150812a8SEvalZero #endif
91*150812a8SEvalZero     NRFX_RTC_ENABLED_COUNT
92*150812a8SEvalZero };
93*150812a8SEvalZero 
94*150812a8SEvalZero /**@brief RTC driver instance configuration structure. */
95*150812a8SEvalZero typedef struct
96*150812a8SEvalZero {
97*150812a8SEvalZero     uint16_t prescaler;          /**< Prescaler. */
98*150812a8SEvalZero     uint8_t  interrupt_priority; /**< Interrupt priority. */
99*150812a8SEvalZero     uint8_t  tick_latency;       /**< Maximum length of interrupt handler in ticks (max 7.7 ms). */
100*150812a8SEvalZero     bool     reliable;           /**< Reliable mode flag. */
101*150812a8SEvalZero } nrfx_rtc_config_t;
102*150812a8SEvalZero 
103*150812a8SEvalZero /**@brief RTC instance default configuration. */
104*150812a8SEvalZero #define NRFX_RTC_DEFAULT_CONFIG                                                     \
105*150812a8SEvalZero {                                                                                   \
106*150812a8SEvalZero     .prescaler          = RTC_FREQ_TO_PRESCALER(NRFX_RTC_DEFAULT_CONFIG_FREQUENCY), \
107*150812a8SEvalZero     .interrupt_priority = NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY,                     \
108*150812a8SEvalZero     .reliable           = NRFX_RTC_DEFAULT_CONFIG_RELIABLE,                         \
109*150812a8SEvalZero     .tick_latency       = NRFX_RTC_US_TO_TICKS(NRFX_RTC_MAXIMUM_LATENCY_US,         \
110*150812a8SEvalZero                                                NRFX_RTC_DEFAULT_CONFIG_FREQUENCY),  \
111*150812a8SEvalZero }
112*150812a8SEvalZero 
113*150812a8SEvalZero /**@brief RTC driver instance handler type. */
114*150812a8SEvalZero typedef void (*nrfx_rtc_handler_t)(nrfx_rtc_int_type_t int_type);
115*150812a8SEvalZero 
116*150812a8SEvalZero /**@brief Function for initializing the RTC driver instance.
117*150812a8SEvalZero  *
118*150812a8SEvalZero  * After initialization, the instance is in power off state.
119*150812a8SEvalZero  *
120*150812a8SEvalZero  * @param[in]  p_instance   Pointer to the driver instance structure.
121*150812a8SEvalZero  * @param[in]  p_config     Pointer to the structure with initial configuration.
122*150812a8SEvalZero  * @param[in]  handler      Event handler provided by the user.
123*150812a8SEvalZero  *                          Must not be NULL.
124*150812a8SEvalZero  *
125*150812a8SEvalZero  * @retval     NRFX_SUCCESS             If successfully initialized.
126*150812a8SEvalZero  * @retval     NRFX_ERROR_INVALID_STATE If the instance is already initialized.
127*150812a8SEvalZero  */
128*150812a8SEvalZero nrfx_err_t nrfx_rtc_init(nrfx_rtc_t const * const  p_instance,
129*150812a8SEvalZero                          nrfx_rtc_config_t const * p_config,
130*150812a8SEvalZero                          nrfx_rtc_handler_t        handler);
131*150812a8SEvalZero 
132*150812a8SEvalZero /**@brief Function for uninitializing the RTC driver instance.
133*150812a8SEvalZero  *
134*150812a8SEvalZero  * After uninitialization, the instance is in idle state. The hardware should return to the state
135*150812a8SEvalZero  *       before initialization. The function asserts if the instance is in idle state.
136*150812a8SEvalZero  *
137*150812a8SEvalZero  * @param[in]  p_instance         Pointer to the driver instance structure.
138*150812a8SEvalZero  */
139*150812a8SEvalZero void nrfx_rtc_uninit(nrfx_rtc_t const * const p_instance);
140*150812a8SEvalZero 
141*150812a8SEvalZero /**@brief Function for enabling the RTC driver instance.
142*150812a8SEvalZero  *
143*150812a8SEvalZero  * @note Function asserts if instance is enabled.
144*150812a8SEvalZero  *
145*150812a8SEvalZero  * @param[in]  p_instance         Pointer to the driver instance structure.
146*150812a8SEvalZero  */
147*150812a8SEvalZero void nrfx_rtc_enable(nrfx_rtc_t const * const p_instance);
148*150812a8SEvalZero 
149*150812a8SEvalZero /**@brief Function for disabling the RTC driver instance.
150*150812a8SEvalZero  *
151*150812a8SEvalZero  * @note Function asserts if instance is disabled.
152*150812a8SEvalZero  *
153*150812a8SEvalZero  * @param[in]  p_instance         Pointer to the driver instance structure.
154*150812a8SEvalZero  */
155*150812a8SEvalZero void nrfx_rtc_disable(nrfx_rtc_t const * const p_instance);
156*150812a8SEvalZero 
157*150812a8SEvalZero /**@brief Function for setting a compare channel.
158*150812a8SEvalZero  *
159*150812a8SEvalZero  * The function asserts if the instance is not initialized or if the channel parameter is
160*150812a8SEvalZero  *       wrong. The function powers on the instance if the instance was in power off state.
161*150812a8SEvalZero  *
162*150812a8SEvalZero  * The driver is not entering a critical section when configuring RTC, which means that it can be
163*150812a8SEvalZero  *       preempted for a certain amount of time. When the driver was preempted and the value to be set
164*150812a8SEvalZero  *       is short in time, there is a risk that the driver sets a compare value that is
165*150812a8SEvalZero  *       behind. If RTCn_CONFIG_RELIABLE is 1 for the given instance, the Reliable mode handles that case.
166*150812a8SEvalZero  *       However, to detect if the requested value is behind, this mode makes the following assumptions:
167*150812a8SEvalZero  *        -  The maximum preemption time in ticks (8 - bit value) is known and is less than 7.7 ms
168*150812a8SEvalZero  *         (for prescaler = 0, RTC frequency 32 kHz).
169*150812a8SEvalZero  *        -  The requested absolute compare value is not bigger than (0x00FFFFFF) - tick_latency. It is
170*150812a8SEvalZero  *         the user's responsibility to ensure that.
171*150812a8SEvalZero  *
172*150812a8SEvalZero  * @param[in]  p_instance         Pointer to the driver instance structure.
173*150812a8SEvalZero  * @param[in]  channel            One of the instance's channels.
174*150812a8SEvalZero  * @param[in]  val                Absolute value to be set in the compare register.
175*150812a8SEvalZero  * @param[in]  enable_irq         True to enable the interrupt. False to disable the interrupt.
176*150812a8SEvalZero  *
177*150812a8SEvalZero  * @retval     NRFX_SUCCESS         If the procedure was successful.
178*150812a8SEvalZero  * @retval     NRFX_ERROR_TIMEOUT   If the compare was not set because the request value is behind the current counter
179*150812a8SEvalZero  *                                  value. This error can only be reported if RTCn_CONFIG_RELIABLE = 1.
180*150812a8SEvalZero  */
181*150812a8SEvalZero nrfx_err_t nrfx_rtc_cc_set(nrfx_rtc_t const * const p_instance,
182*150812a8SEvalZero                            uint32_t                 channel,
183*150812a8SEvalZero                            uint32_t                 val,
184*150812a8SEvalZero                            bool                     enable_irq);
185*150812a8SEvalZero 
186*150812a8SEvalZero /**@brief Function for disabling a channel.
187*150812a8SEvalZero  *
188*150812a8SEvalZero  * This function disables channel events and channel interrupts. The function asserts if the instance is not
189*150812a8SEvalZero  *       initialized or if the channel parameter is wrong.
190*150812a8SEvalZero  *
191*150812a8SEvalZero  * @param[in]  p_instance          Pointer to the driver instance structure.
192*150812a8SEvalZero  * @param[in]  channel             One of the instance's channels.
193*150812a8SEvalZero  *
194*150812a8SEvalZero  * @retval     NRFX_SUCCESS         If the procedure was successful.
195*150812a8SEvalZero  * @retval     NRFX_ERROR_TIMEOUT   If an interrupt was pending on the requested channel.
196*150812a8SEvalZero  */
197*150812a8SEvalZero nrfx_err_t nrfx_rtc_cc_disable(nrfx_rtc_t const * const p_instance, uint32_t channel);
198*150812a8SEvalZero 
199*150812a8SEvalZero /**@brief Function for enabling tick.
200*150812a8SEvalZero  *
201*150812a8SEvalZero  * This function enables the tick event and optionally the interrupt. The function asserts if the instance is not
202*150812a8SEvalZero  *       powered on.
203*150812a8SEvalZero  *
204*150812a8SEvalZero  * @param[in]  p_instance         Pointer to the driver instance structure.
205*150812a8SEvalZero  * @param[in]  enable_irq         True to enable the interrupt. False to disable the interrupt.
206*150812a8SEvalZero  */
207*150812a8SEvalZero void nrfx_rtc_tick_enable(nrfx_rtc_t const * const p_instance, bool enable_irq);
208*150812a8SEvalZero 
209*150812a8SEvalZero /**@brief Function for disabling tick.
210*150812a8SEvalZero  *
211*150812a8SEvalZero  * This function disables the tick event and interrupt.
212*150812a8SEvalZero  *
213*150812a8SEvalZero  * @param[in]  p_instance         Pointer to the driver instance structure.
214*150812a8SEvalZero  */
215*150812a8SEvalZero void nrfx_rtc_tick_disable(nrfx_rtc_t const * const p_instance);
216*150812a8SEvalZero 
217*150812a8SEvalZero /**@brief Function for enabling overflow.
218*150812a8SEvalZero  *
219*150812a8SEvalZero  * This function enables the overflow event and optionally the interrupt. The function asserts if the instance is
220*150812a8SEvalZero  *       not powered on.
221*150812a8SEvalZero  *
222*150812a8SEvalZero  * @param[in]  p_instance         Pointer to the driver instance structure.
223*150812a8SEvalZero  * @param[in]  enable_irq         True to enable the interrupt. False to disable the interrupt.
224*150812a8SEvalZero  */
225*150812a8SEvalZero void nrfx_rtc_overflow_enable(nrfx_rtc_t const * const p_instance, bool enable_irq);
226*150812a8SEvalZero 
227*150812a8SEvalZero /**@brief Function for disabling overflow.
228*150812a8SEvalZero  *
229*150812a8SEvalZero  * This function disables the overflow event and interrupt.
230*150812a8SEvalZero  *
231*150812a8SEvalZero  * @param[in]  p_instance         Pointer to the driver instance structure.
232*150812a8SEvalZero  */
233*150812a8SEvalZero void nrfx_rtc_overflow_disable(nrfx_rtc_t const * const p_instance);
234*150812a8SEvalZero 
235*150812a8SEvalZero /**@brief Function for getting the maximum relative ticks value that can be set in the compare channel.
236*150812a8SEvalZero  *
237*150812a8SEvalZero  * When a stack (for example SoftDevice) is used and it occupies high priority interrupts,
238*150812a8SEvalZero  * the application code can be interrupted at any moment for a certain period of time.
239*150812a8SEvalZero  * If Reliable mode is enabled, the provided maximum latency is taken into account
240*150812a8SEvalZero  * and the return value is smaller than the RTC counter resolution.
241*150812a8SEvalZero  * If Reliable mode is disabled, the return value equals the counter resolution.
242*150812a8SEvalZero  *
243*150812a8SEvalZero  * @param[in]  p_instance  Pointer to the driver instance structure.
244*150812a8SEvalZero  *
245*150812a8SEvalZero  * @retval     ticks         Maximum ticks value.
246*150812a8SEvalZero  */
247*150812a8SEvalZero uint32_t nrfx_rtc_max_ticks_get(nrfx_rtc_t const * const p_instance);
248*150812a8SEvalZero 
249*150812a8SEvalZero /**@brief Function for disabling all instance interrupts.
250*150812a8SEvalZero   *
251*150812a8SEvalZero  * @param[in]  p_instance          Pointer to the driver instance structure.
252*150812a8SEvalZero  * @param[in]  p_mask              Pointer to the location where the mask is filled.
253*150812a8SEvalZero  */
254*150812a8SEvalZero __STATIC_INLINE void nrfx_rtc_int_disable(nrfx_rtc_t const * const p_instance,
255*150812a8SEvalZero                                           uint32_t               * p_mask);
256*150812a8SEvalZero 
257*150812a8SEvalZero /**@brief Function for enabling instance interrupts.
258*150812a8SEvalZero  *
259*150812a8SEvalZero  * @param[in]  p_instance         Pointer to the driver instance structure.
260*150812a8SEvalZero  * @param[in]  mask               Mask of interrupts to enable.
261*150812a8SEvalZero  */
262*150812a8SEvalZero __STATIC_INLINE void nrfx_rtc_int_enable(nrfx_rtc_t const * const p_instance, uint32_t mask);
263*150812a8SEvalZero 
264*150812a8SEvalZero /**@brief Function for retrieving the current counter value.
265*150812a8SEvalZero  *
266*150812a8SEvalZero  * This function asserts if the instance is not powered on or if p_val is NULL.
267*150812a8SEvalZero  *
268*150812a8SEvalZero  * @param[in]  p_instance    Pointer to the driver instance structure.
269*150812a8SEvalZero  *
270*150812a8SEvalZero  * @retval     value         Counter value.
271*150812a8SEvalZero  */
272*150812a8SEvalZero __STATIC_INLINE uint32_t nrfx_rtc_counter_get(nrfx_rtc_t const * const p_instance);
273*150812a8SEvalZero 
274*150812a8SEvalZero /**@brief Function for clearing the counter value.
275*150812a8SEvalZero  *
276*150812a8SEvalZero  * This function asserts if the instance is not powered on.
277*150812a8SEvalZero  *
278*150812a8SEvalZero  * @param[in]  p_instance         Pointer to the driver instance structure.
279*150812a8SEvalZero  */
280*150812a8SEvalZero __STATIC_INLINE void nrfx_rtc_counter_clear(nrfx_rtc_t const * const p_instance);
281*150812a8SEvalZero 
282*150812a8SEvalZero /**@brief Function for returning a requested task address for the RTC driver instance.
283*150812a8SEvalZero  *
284*150812a8SEvalZero  * This function asserts if the output pointer is NULL. The task address can be used by the PPI module.
285*150812a8SEvalZero  *
286*150812a8SEvalZero  * @param[in]  p_instance         Pointer to the instance.
287*150812a8SEvalZero  * @param[in]  task                One of the peripheral tasks.
288*150812a8SEvalZero  *
289*150812a8SEvalZero  * @retval     Address of task register.
290*150812a8SEvalZero  */
291*150812a8SEvalZero __STATIC_INLINE uint32_t nrfx_rtc_task_address_get(nrfx_rtc_t const * const p_instance,
292*150812a8SEvalZero                                                    nrf_rtc_task_t           task);
293*150812a8SEvalZero 
294*150812a8SEvalZero /**@brief Function for returning a requested event address for the RTC driver instance.
295*150812a8SEvalZero  *
296*150812a8SEvalZero  * This function asserts if the output pointer is NULL. The event address can be used by the PPI module.
297*150812a8SEvalZero  *
298*150812a8SEvalZero  * @param[in]  p_instance          Pointer to the driver instance structure.
299*150812a8SEvalZero  * @param[in]  event               One of the peripheral events.
300*150812a8SEvalZero  *
301*150812a8SEvalZero  * @retval     Address of event register.
302*150812a8SEvalZero  */
303*150812a8SEvalZero __STATIC_INLINE uint32_t nrfx_rtc_event_address_get(nrfx_rtc_t const * const p_instance,
304*150812a8SEvalZero                                                     nrf_rtc_event_t          event);
305*150812a8SEvalZero 
306*150812a8SEvalZero #ifndef SUPPRESS_INLINE_IMPLEMENTATION
307*150812a8SEvalZero 
nrfx_rtc_int_disable(nrfx_rtc_t const * const p_instance,uint32_t * p_mask)308*150812a8SEvalZero __STATIC_INLINE void nrfx_rtc_int_disable(nrfx_rtc_t const * const p_instance,
309*150812a8SEvalZero                                           uint32_t               * p_mask)
310*150812a8SEvalZero {
311*150812a8SEvalZero     *p_mask = nrf_rtc_int_get(p_instance->p_reg);
312*150812a8SEvalZero     nrf_rtc_int_disable(p_instance->p_reg, NRF_RTC_INT_TICK_MASK |
313*150812a8SEvalZero                                            NRF_RTC_INT_OVERFLOW_MASK |
314*150812a8SEvalZero                                            NRF_RTC_INT_COMPARE0_MASK |
315*150812a8SEvalZero                                            NRF_RTC_INT_COMPARE1_MASK |
316*150812a8SEvalZero                                            NRF_RTC_INT_COMPARE2_MASK |
317*150812a8SEvalZero                                            NRF_RTC_INT_COMPARE3_MASK);
318*150812a8SEvalZero }
319*150812a8SEvalZero 
nrfx_rtc_int_enable(nrfx_rtc_t const * const p_instance,uint32_t mask)320*150812a8SEvalZero __STATIC_INLINE void nrfx_rtc_int_enable(nrfx_rtc_t const * const p_instance, uint32_t mask)
321*150812a8SEvalZero {
322*150812a8SEvalZero     nrf_rtc_int_enable(p_instance->p_reg, mask);
323*150812a8SEvalZero }
324*150812a8SEvalZero 
nrfx_rtc_counter_get(nrfx_rtc_t const * const p_instance)325*150812a8SEvalZero __STATIC_INLINE uint32_t nrfx_rtc_counter_get(nrfx_rtc_t const * const p_instance)
326*150812a8SEvalZero {
327*150812a8SEvalZero     return nrf_rtc_counter_get(p_instance->p_reg);
328*150812a8SEvalZero }
329*150812a8SEvalZero 
nrfx_rtc_counter_clear(nrfx_rtc_t const * const p_instance)330*150812a8SEvalZero __STATIC_INLINE void nrfx_rtc_counter_clear(nrfx_rtc_t const * const p_instance)
331*150812a8SEvalZero {
332*150812a8SEvalZero     nrf_rtc_task_trigger(p_instance->p_reg, NRF_RTC_TASK_CLEAR);
333*150812a8SEvalZero }
334*150812a8SEvalZero 
nrfx_rtc_task_address_get(nrfx_rtc_t const * const p_instance,nrf_rtc_task_t task)335*150812a8SEvalZero __STATIC_INLINE uint32_t nrfx_rtc_task_address_get(nrfx_rtc_t const * const p_instance,
336*150812a8SEvalZero                                                    nrf_rtc_task_t           task)
337*150812a8SEvalZero {
338*150812a8SEvalZero     return nrf_rtc_task_address_get(p_instance->p_reg, task);
339*150812a8SEvalZero }
340*150812a8SEvalZero 
nrfx_rtc_event_address_get(nrfx_rtc_t const * const p_instance,nrf_rtc_event_t event)341*150812a8SEvalZero __STATIC_INLINE uint32_t nrfx_rtc_event_address_get(nrfx_rtc_t const * const p_instance,
342*150812a8SEvalZero                                                     nrf_rtc_event_t          event)
343*150812a8SEvalZero {
344*150812a8SEvalZero     return nrf_rtc_event_address_get(p_instance->p_reg, event);
345*150812a8SEvalZero }
346*150812a8SEvalZero #endif // SUPPRESS_INLINE_IMPLEMENTATION
347*150812a8SEvalZero 
348*150812a8SEvalZero 
349*150812a8SEvalZero void nrfx_rtc_0_irq_handler(void);
350*150812a8SEvalZero void nrfx_rtc_1_irq_handler(void);
351*150812a8SEvalZero void nrfx_rtc_2_irq_handler(void);
352*150812a8SEvalZero 
353*150812a8SEvalZero 
354*150812a8SEvalZero /** @} */
355*150812a8SEvalZero 
356*150812a8SEvalZero #ifdef __cplusplus
357*150812a8SEvalZero }
358*150812a8SEvalZero #endif
359*150812a8SEvalZero 
360*150812a8SEvalZero #endif // NRFX_RTC_H__
361