NimBLE-Arduino 2.1.2
|
Macros | |
#define | CPUTIME_LT(__t1, __t2) ((int32_t) ((__t1) - (__t2)) < 0) |
#define | CPUTIME_GT(__t1, __t2) ((int32_t) ((__t1) - (__t2)) > 0) |
#define | CPUTIME_GEQ(__t1, __t2) ((int32_t) ((__t1) - (__t2)) >= 0) |
#define | CPUTIME_LEQ(__t1, __t2) ((int32_t) ((__t1) - (__t2)) <= 0) |
Functions | |
int | os_cputime_init (uint32_t clock_freq) |
uint32_t | os_cputime_get32 (void) |
uint32_t | os_cputime_nsecs_to_ticks (uint32_t nsecs) |
uint32_t | os_cputime_ticks_to_nsecs (uint32_t ticks) |
void | os_cputime_delay_nsecs (uint32_t nsecs) |
uint32_t | os_cputime_usecs_to_ticks (uint32_t usecs) |
uint32_t | os_cputime_ticks_to_usecs (uint32_t ticks) |
void | os_cputime_delay_ticks (uint32_t ticks) |
void | os_cputime_delay_usecs (uint32_t usecs) |
void | os_cputime_timer_init (struct hal_timer *timer, hal_timer_cb fp, void *arg) |
int | os_cputime_timer_start (struct hal_timer *timer, uint32_t cputime) |
int | os_cputime_timer_relative (struct hal_timer *timer, uint32_t usecs) |
void | os_cputime_timer_stop (struct hal_timer *timer) |
#define CPUTIME_GEQ | ( | __t1, | |
__t2 | |||
) | ((int32_t) ((__t1) - (__t2)) >= 0) |
evaluates to true if t1 is on or after t2 in time
#define CPUTIME_GT | ( | __t1, | |
__t2 | |||
) | ((int32_t) ((__t1) - (__t2)) > 0) |
evaluates to true if t1 is after t2 in time
#define CPUTIME_LEQ | ( | __t1, | |
__t2 | |||
) | ((int32_t) ((__t1) - (__t2)) <= 0) |
evaluates to true if t1 is on or before t2 in time
#define CPUTIME_LT | ( | __t1, | |
__t2 | |||
) | ((int32_t) ((__t1) - (__t2)) < 0) |
evaluates to true if t1 is before t2 in time
void os_cputime_delay_nsecs | ( | uint32_t | nsecs | ) |
Wait until 'nsecs' nanoseconds has elapsed. This is a blocking delay. Not defined if OS_CPUTIME_FREQ_PWR2 is defined.
nsecs | The number of nanoseconds to wait. |
void os_cputime_delay_ticks | ( | uint32_t | ticks | ) |
Wait until the number of ticks has elapsed. This is a blocking delay.
ticks | The number of ticks to wait. |
void os_cputime_delay_usecs | ( | uint32_t | usecs | ) |
Wait until 'usecs' microseconds has elapsed. This is a blocking delay.
usecs | The number of usecs to wait. |
uint32_t os_cputime_get32 | ( | void | ) |
Returns the low 32 bits of cputime.
int os_cputime_init | ( | uint32_t | clock_freq | ) |
Initialize the cputime module. This must be called after os_init is called and before any other timer API are used. This should be called only once and should be called before the hardware timer is used.
clock_freq | The desired cputime frequency, in hertz (Hz). |
uint32_t os_cputime_nsecs_to_ticks | ( | uint32_t | nsecs | ) |
Converts the given number of nanoseconds into cputime ticks. Not defined if OS_CPUTIME_FREQ_PWR2 is defined.
usecs | The number of nanoseconds to convert to ticks |
uint32_t os_cputime_ticks_to_nsecs | ( | uint32_t | ticks | ) |
Convert the given number of ticks into nanoseconds. Not defined if OS_CPUTIME_FREQ_PWR2 is defined.
ticks | The number of ticks to convert to nanoseconds. |
uint32_t os_cputime_ticks_to_usecs | ( | uint32_t | ticks | ) |
Convert the given number of ticks into microseconds.
ticks | The number of ticks to convert to microseconds. |
void os_cputime_timer_init | ( | struct hal_timer * | timer, |
hal_timer_cb | fp, | ||
void * | arg | ||
) |
Initialize a CPU timer, using the given HAL timer.
timer | The timer to initialize. Cannot be NULL. |
fp | The timer callback function. Cannot be NULL. |
arg | Pointer to data object to pass to timer. |
int os_cputime_timer_relative | ( | struct hal_timer * | timer, |
uint32_t | usecs | ||
) |
Sets a cpu timer that will expire 'usecs' microseconds from the current cputime.
NOTE: This must be called when the timer is stopped.
timer | Pointer to timer. Cannot be NULL. |
usecs | The number of usecs from now at which the timer will expire. |
int os_cputime_timer_start | ( | struct hal_timer * | timer, |
uint32_t | cputime | ||
) |
Start a cputimer that will expire at 'cputime'. If cputime has already passed, the timer callback will still be called (at interrupt context).
NOTE: This must be called when the timer is stopped.
timer | Pointer to timer to start. Cannot be NULL. |
cputime | The cputime at which the timer should expire. |
void os_cputime_timer_stop | ( | struct hal_timer * | timer | ) |
Stops a cputimer from running. The timer is removed from the timer queue and interrupts are disabled if no timers are left on the queue. Can be called even if timer is not running.
timer | Pointer to cputimer to stop. Cannot be NULL. |
uint32_t os_cputime_usecs_to_ticks | ( | uint32_t | usecs | ) |
Converts the given number of microseconds into cputime ticks.
usecs | The number of microseconds to convert to ticks |