mirror of
https://github.com/espressif/openthread.git
synced 2026-10-12 02:37:37 +00:00
[nrf528xx] add nrf5AlarmGetRawCounter (#4287)
This commit is contained in:
committed by
Jonathan Hui
parent
fce4508e2f
commit
f24b1860a9
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user