Hardware Abstraction Layer for FreeRTOS
Collaboration diagram for Timer Subsystem:

Data Structures

struct  timer_generic
 

Functions

struct timer * timer_init (uint32_t index, uint32_t prescaler, uint64_t basetime, int64_t adjust)
 
int32_t timer_deinit (struct timer *timer)
 
int32_t timer_setOverflowCallback (struct timer *timer, bool(*callback)(struct timer *timer, void *data), void *data)
 
int32_t timer_start (struct timer *timer)
 
int32_t timer_stop (struct timer *timer)
 
int32_t timer_oneshot (struct timer *timer, uint64_t us)
 
int32_t timer_periodic (struct timer *timer, uint64_t us)
 
uint64_t timer_getTime (struct timer *timer)
 

Detailed Description

#include <timer.h>

This is the Timer Subsystem for controlling Timer of a SOC.

Function Documentation

◆ timer_deinit()

int32_t timer_deinit ( struct timer *  timer)

Deinit Timer

Parameters
timerTimer instance
Returns
-1 on error 0 on ok

◆ timer_getTime()

uint64_t timer_getTime ( struct timer *  timer)

Get Time

Parameters
timerTimer instance
Returns
time

◆ timer_init()

struct timer* timer_init ( uint32_t  index,
uint32_t  prescaler,
uint64_t  basetime,
int64_t  adjust 
)

Init Timer

Parameters
indexIndex of timer
prescalerPrescaler of Timer 0 if only get Timer Instants timer must initialized
basetimeBase time of adjustment for example 20ms
adjustDiff to basetime for example 10us
Returns
Timer instance NULL on Error or not init if prescaler = 0

◆ timer_oneshot()

int32_t timer_oneshot ( struct timer *  timer,
uint64_t  us 
)

Set timer in oneshot mode, stop after us

Parameters
timerTimer instance
usTimerout
Returns
-1 on error 0 on ok

◆ timer_periodic()

int32_t timer_periodic ( struct timer *  timer,
uint64_t  us 
)

Set timer in periodic mode

Parameters
timerTimer instance
usTimerout
Returns
-1 on error 0 on ok

◆ timer_setOverflowCallback()

int32_t timer_setOverflowCallback ( struct timer *  timer,
bool(*)(struct timer *timer, void *data)  callback,
void *  data 
)

Set Overflow Callback

Parameters
timerTimer instance
callbackCallback used if Timer Overflow
dataData passed to Callback
Returns
-1 on error 0 on ok

◆ timer_start()

int32_t timer_start ( struct timer *  timer)

Start timer

Parameters
timerTimer instance
Returns
-1 on error 0 on ok

◆ timer_stop()

int32_t timer_stop ( struct timer *  timer)

Stop timer

Parameters
timerTimer instance
Returns
-1 on error 0 on ok
timer.h