nRF5 SDK v17.1.0
Macros | Typedefs | Functions
MAC Time API

Module to declare MAC Time API. More...

Macros

#define MAC_TIME_MASK   0xFFFFFFULL
 This mask shall always be used after any mathematical operation on mac_time_t to avoid overflow.
 

Typedefs

typedef uint32_t mac_time_t
 Type of MAC time in symbols.
 
typedef uint32_t mac_timestamp_t
 Type is used to save timestamps with microsecond precision.
 

Functions

static mac_timestamp_t mac_timestamp_from_systime (sys_time_t time_us)
 Gets timestamp from system time. More...
 
static mac_time_t mac_time_from_us (sys_time_t time_us)
 Converts microseconds to symbol time. More...
 
static sys_time_t mac_time_to_us (mac_time_t time_symbol)
 Converts symbol time to microseconds. More...
 
static void mac_timer_critical_start (sys_time_t interval_us, void(*callback)(void))
 Starts the critical MAC timer. More...
 
static void mac_timer_critical_stop (void)
 Stops the critical MAC timer. More...
 

Detailed Description

Module to declare MAC Time API.

The MAC Time module declares some useful macros/types and routines that deal with the MAC timer. More specifically, some convertion routines such as mac_timestamp_from_systime(), mac_time_from_us(), and mac_time_to_us() are declared here.

Function Documentation

static mac_time_t mac_time_from_us ( sys_time_t  time_us)
inlinestatic

Converts microseconds to symbol time.

Symbol time is measured in PHY Symbol Periods (16 us).

Parameters
[in]time_usTime in microseconds.
Returns
Time in PHY Symbol Periods (16 us).
static sys_time_t mac_time_to_us ( mac_time_t  time_symbol)
inlinestatic

Converts symbol time to microseconds.

Symbol time is measured in PHY Symbol Periods (16 us).

Parameters
[in]time_symbolTime in PHY Symbol Periods (16 us).
Returns
Time in microseconds.
static void mac_timer_critical_start ( sys_time_t  interval_us,
void(*)(void)  callback 
)
inlinestatic

Starts the critical MAC timer.

The callback function of the critical MAC timer will be called from the timer's interrupt routine. Only one critical MAC timer can run at the same time.

Warning
This is internal MAC functionality, needed for the realtime channel access. This function must not be used by other modules.
Parameters
[in]interval_usInterval in microseconds, after which the callback function will be called.
[in]callbackCallback function to be called after the specified inteval.
static void mac_timer_critical_stop ( void  )
inlinestatic

Stops the critical MAC timer.

After critical MAC timer is stopped with this function, its callback will not be called.

Warning
This is internal MAC functionality, needed for the realtime channel access. This function must not be used by other modules.
static mac_timestamp_t mac_timestamp_from_systime ( sys_time_t  time_us)
inlinestatic

Gets timestamp from system time.

Parameters
[in]time_usSystem time.
Returns
Time in us but smaller type size.

Documentation feedback | Developer Zone | Subscribe | Updated