Loading...
Searching...
No Matches

uwb-core DPL (Decawave Porting Layer) cputime abstraction More...

Detailed Description

uwb-core DPL (Decawave Porting Layer) cputime abstraction

Author
Francisco Molina franc.nosp@m.ois-.nosp@m.xavie.nosp@m.r.mo.nosp@m.lina@.nosp@m.inri.nosp@m.a.fr

Definition in file dpl_cputime.h.

#include "os/os_cputime.h"
+ Include dependency graph for dpl_cputime.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static uint32_t dpl_cputime_get32 (void)
 Returns the low 32 bits of cputime.
 
static uint32_t dpl_cputime_usecs_to_ticks (uint32_t usecs)
 Converts the given number of microseconds into cputime ticks.
 
static uint32_t dpl_cputime_ticks_to_usecs (uint32_t ticks)
 Convert the given number of ticks into microseconds.
 
static void dpl_cputime_delay_ticks (uint32_t ticks)
 Wait until the number of ticks has elapsed.
 
static void dpl_cputime_delay_usecs (uint32_t usecs)
 Wait until 'usecs' microseconds has elapsed.
 
static void dpl_cputime_timer_init (struct hal_timer *timer, hal_timer_cb fp, void *arg)
 Initialize a CPU timer, using the given HAL timer.
 
static int dpl_cputime_timer_start (struct hal_timer *timer, uint32_t cputime)
 Start a cputimer that will expire at 'cputime'.
 
static int dpl_cputime_timer_relative (struct hal_timer *timer, uint32_t usecs)
 Sets a cpu timer that will expire 'usecs' microseconds from the current cputime.
 
static void dpl_cputime_timer_stop (struct hal_timer *timer)
 Stops a cputimer from running.
 

Function Documentation

◆ dpl_cputime_delay_ticks()

static void dpl_cputime_delay_ticks ( uint32_t  ticks)
inlinestatic

Wait until the number of ticks has elapsed.

This is a blocking delay.

Parameters
ticksThe number of ticks to wait.

Definition at line 68 of file dpl_cputime.h.

◆ dpl_cputime_delay_usecs()

static void dpl_cputime_delay_usecs ( uint32_t  usecs)
inlinestatic

Wait until 'usecs' microseconds has elapsed.

This is a blocking delay.

Parameters
usecsThe number of usecs to wait.

Definition at line 78 of file dpl_cputime.h.

◆ dpl_cputime_get32()

static uint32_t dpl_cputime_get32 ( void  )
inlinestatic

Returns the low 32 bits of cputime.

Returns
uint32_t The lower 32 bits of cputime

Definition at line 34 of file dpl_cputime.h.

◆ dpl_cputime_ticks_to_usecs()

static uint32_t dpl_cputime_ticks_to_usecs ( uint32_t  ticks)
inlinestatic

Convert the given number of ticks into microseconds.

Parameters
ticksThe number of ticks to convert to microseconds.
Returns
uint32_t The number of microseconds corresponding to 'ticks'

Definition at line 58 of file dpl_cputime.h.

◆ dpl_cputime_timer_init()

static void dpl_cputime_timer_init ( struct hal_timer *  timer,
hal_timer_cb  fp,
void *  arg 
)
inlinestatic

Initialize a CPU timer, using the given HAL timer.

Parameters
timerThe timer to initialize. Cannot be NULL.
fpThe timer callback function. Cannot be NULL.
argPointer to data object to pass to timer.

Definition at line 90 of file dpl_cputime.h.

◆ dpl_cputime_timer_relative()

static int dpl_cputime_timer_relative ( struct hal_timer *  timer,
uint32_t  usecs 
)
inlinestatic

Sets a cpu timer that will expire 'usecs' microseconds from the current cputime.

NOTE: This must be called when the timer is stopped.

Parameters
timerPointer to timer. Cannot be NULL.
usecsThe number of usecs from now at which the timer will expire.
Returns
int 0 on success; EINVAL if timer already started or timer struct invalid

Definition at line 126 of file dpl_cputime.h.

◆ dpl_cputime_timer_start()

static int dpl_cputime_timer_start ( struct hal_timer *  timer,
uint32_t  cputime 
)
inlinestatic

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.

Parameters
timerPointer to timer to start. Cannot be NULL.
cputimeThe cputime at which the timer should expire. time
Returns
int 0 on success; EINVAL if timer already started or timer struct invalid

Definition at line 109 of file dpl_cputime.h.

◆ dpl_cputime_timer_stop()

static void dpl_cputime_timer_stop ( struct hal_timer *  timer)
inlinestatic

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.

Parameters
timerPointer to cputimer to stop. Cannot be NULL.

Definition at line 140 of file dpl_cputime.h.

◆ dpl_cputime_usecs_to_ticks()

static uint32_t dpl_cputime_usecs_to_ticks ( uint32_t  usecs)
inlinestatic

Converts the given number of microseconds into cputime ticks.

Parameters
usecsThe number of microseconds to convert to ticks
Returns
uint32_t The number of ticks corresponding to 'usecs'

Definition at line 46 of file dpl_cputime.h.