1 /*
2  * Copyright (c) 2017 Oticon A/S
3  * Copyright (c) 2023 Nordic Semiconductor ASA
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 #ifndef _NRF_HW_MODEL_RTC_H
8 #define _NRF_HW_MODEL_RTC_H
9 
10 #include "bs_types.h"
11 
12 #ifdef __cplusplus
13 extern "C"{
14 #endif
15 
16 void nhw_rtc_update_COUNTER(uint rtc);
17 void nhw_rtc_regw_sideeffect_TASKS_START(uint i);
18 void nhw_rtc_regw_sideeffect_TASKS_STOP(uint i);
19 void nhw_rtc_regw_sideeffect_TASKS_CLEAR(uint i);
20 void nhw_rtc_regw_sideeffect_TASKS_TRIGOVRFLW(uint i);
21 void nhw_rtc_regw_sideeffect_TASKS_CAPTURE(uint i, uint cc);
22 void nhw_rtc_regw_sideeffect_INTENSET(uint i);
23 void nhw_rtc_regw_sideeffect_INTENCLR(uint i);
24 void nhw_rtc_regw_sideeffect_EVTENSET(uint i);
25 void nhw_rtc_regw_sideeffect_EVTENCLR(uint i);
26 void nhw_rtc_regw_sideeffects_EVENTS_all(uint rtc);
27 void nhw_rtc_regw_sideeffects_CC(uint rtc, uint cc_n);
28 void nhw_rtc_regw_sideeffects_SUBSCRIBE_START(uint inst);
29 void nhw_rtc_regw_sideeffects_SUBSCRIBE_STOP(uint inst);
30 void nhw_rtc_regw_sideeffects_SUBSCRIBE_CLEAR(uint inst);
31 void nhw_rtc_regw_sideeffects_SUBSCRIBE_TRIGOVRFLW(uint inst);
32 void nhw_rtc_regw_sideeffects_SUBSCRIBE_CAPTURE(uint inst, uint cc);
33 void nhw_rtc_notify_first_lf_tick(void);
34 
35 #if (NHW_HAS_PPI)
36 void nhw_rtc0_TASKS_START(void);
37 void nhw_rtc0_TASKS_STOP(void);
38 void nhw_rtc0_TASKS_CLEAR(void);
39 void nhw_rtc0_TASKS_TRIGOVRFLW(void);
40 void nhw_rtc1_TASKS_START(void);
41 void nhw_rtc1_TASKS_STOP(void);
42 void nhw_rtc1_TASKS_CLEAR(void);
43 void nhw_rtc1_TASKS_TRIGOVRFLW(void);
44 void nhw_rtc2_TASKS_START(void);
45 void nhw_rtc2_TASKS_STOP(void);
46 void nhw_rtc2_TASKS_CLEAR(void);
47 void nhw_rtc2_TASKS_TRIGOVRFLW(void);
48 #endif /* NHW_HAS_PPI */
49 
50 /**
51  * Return the time when the provided RTC would have had a COUNTER value of 0
52  *
53  * @param rtc RTC index
54  *
55  * @returns The time in microseconds that corresponds to the time in the past
56  *          when the RTC COUNTER would have been 0.
57  *          The value can be negative (that is before time 0), as the RTC could
58  *          have been started very early with COUNTER > 0.
59  */
60 int64_t nhw_rtc_start_time_get(uint rtc);
61 
62 #ifdef __cplusplus
63 }
64 #endif
65 
66 #endif
67