[nrf528xx] add nrf5AlarmGetRawCounter (#4287)

This commit is contained in:
Kamil Sroka
2019-10-30 11:00:30 -07:00
committed by Jonathan Hui
parent fce4508e2f
commit f24b1860a9
2 changed files with 18 additions and 0 deletions
+12
View File
@@ -66,6 +66,8 @@
#define US_PER_S NRF_802154_US_PER_S
#define US_PER_OVERFLOW (512UL * NRF_802154_US_PER_S) ///< Time that has passed between overflow events. On full RTC speed, it occurs every 512 s.
#define RTC_COUNTER_BITS 24 ///< Number of bits in RTC COUNTER register.
#define MS_PER_S 1000UL
#define MIN_RTC_COMPARE_EVENT_TICKS 2 ///< Minimum number of RTC ticks delay that guarantees that RTC compare event will fire.
@@ -523,6 +525,16 @@ inline uint64_t nrf5AlarmGetCurrentTime(void)
return GetCurrentTime(kUsTimer);
}
uint64_t nrf5AlarmGetRawCounter(void)
{
uint32_t offset = 0;
uint32_t counter = 0;
GetOffsetAndCounter(&offset, &counter);
return (((uint64_t)offset) << RTC_COUNTER_BITS) | counter;
}
uint32_t otPlatAlarmMilliGetNow(void)
{
return (uint32_t)(nrf5AlarmGetCurrentTime() / US_PER_MS);
@@ -89,6 +89,12 @@ void nrf5AlarmProcess(otInstance *aInstance);
*/
uint64_t nrf5AlarmGetCurrentTime(void);
/**
* Function for getting raw counter value in RTC ticks.
*
*/
uint64_t nrf5AlarmGetRawCounter(void);
/**
* Initialization of Random Number Generator.
*