49 #ifndef BSPACM_DEVICE_NRF51_INTERNAL_UTILITY_UPTIME_H
50 #define BSPACM_DEVICE_NRF51_INTERNAL_UTILITY_UPTIME_H
58 #ifndef BSPACM_UPTIME_RTC_BASE
64 #define BSPACM_UPTIME_RTC_BASE NRF_RTC1_BASE
85 #if NRF_RTC0_BASE == BSPACM_UPTIME_RTC_BASE
86 #define BSPACM_UPTIME_RTC NRF_RTC0
87 #define BSPACM_UPTIME_CC_COUNT 3
88 #elif NRF_RTC1_BASE == BSPACM_UPTIME_RTC_BASE
89 #define BSPACM_UPTIME_RTC NRF_RTC1
90 #define BSPACM_UPTIME_CC_COUNT 4
92 #error Unrecognized uptime RTC
96 #define BSPACM_UPTIME_Hz 32768U
100 #define BSPACM_UPTIME_SLEEP_MINIMUM 2
107 const unsigned int us_per_s = 1000000U;
116 const unsigned int ms_per_s = 1000U;
227 unsigned int when_utt,
228 hBSPACMuptimeAlarm ap);
251 unsigned int prev_ofl;
260 return (((uint64_t)xBSPACMuptimeState_.
last_overflows) << 24) | ctr24;
281 return xBSPACMuptimeState_.
enabled;
#define BSPACM_UPTIME_RTC
Definition: uptime.h:86
unsigned int uiBSPACMuptimeConvert_utt_ms(unsigned int dur_utt)
Definition: uptime.h:131
bool enabled
Definition: uptime.h:202
Common header included by all BSPACM leaf headers.
vBSPACMuptimeAlarmCallback_flih callback_flih
Definition: uptime.h:161
struct sBSPACMuptimeAlarm sBSPACMuptimeAlarm
sBSPACMuptimeAlarm * hBSPACMuptimeAlarm
Definition: uptime.h:174
unsigned int uiBSPACMuptime()
Definition: uptime.h:266
unsigned int uiBSPACMuptimeConvert_us_utt(unsigned int dur_us)
Definition: uptime.h:105
bool bBSPACMuptimeSleep(unsigned int duration_utt)
#define BSPACM_UPTIME_Hz
Definition: uptime.h:96
int iBSPACMuptimeAlarmSet(int ccidx, unsigned int when_utt, hBSPACMuptimeAlarm ap)
#define BSPACM_UPTIME_CC_COUNT
Definition: uptime.h:87
void(* vBSPACMuptimeAlarmCallback_flih)(int ccidx, struct sBSPACMuptimeAlarm *ap)
Definition: uptime.h:154
struct sBSPACMuptimeState sBSPACMuptimeState
void vBSPACMuptimeStart()
unsigned int last_overflows
Definition: uptime.h:196
unsigned long long ullBSPACMuptime()
Definition: uptime.h:249
unsigned int uiBSPACMuptimeConvert_ms_utt(unsigned int dur_ms)
Definition: uptime.h:114
bool bBSPACMuptimeEnabled()
Definition: uptime.h:279
void vBSPACMuptimeSleepCancel(void)
volatile unsigned int overflows
Definition: uptime.h:188
hBSPACMuptimeAlarm hBSPACMuptimeAlarmClear(int ccidx, bool *pendingp)
hBSPACMuptimeAlarm volatile alarm[BSPACM_UPTIME_CC_COUNT]
Definition: uptime.h:199
unsigned int interval_utt
Definition: uptime.h:170
unsigned int uiBSPACMuptimeConvert_utt_us(unsigned int dur_utt)
Definition: uptime.h:123