Go to the source code of this file.
Data Structures | |
struct | _timer_list |
struct | timer |
Defines | |
#define | MSIM_FREQUENCY_USEC 1 |
#define | MSIM_FREQUENCY (MSIM_FREQUENCY_USEC*1000000) |
Typedefs | |
typedef _timer_list | timer_list |
typedef timer_list | timer_list_t |
typedef timer | timer_t |
Functions | |
int | timer_init (timer_t *tmr, const unsigned int usec, void(*handler)(timer_t *, void *), void *data) |
void | timer_start (timer_t *tmr) |
Function activate timer. | |
void | timer_destroy (timer_t *tmr) |
Function deactivate timer. | |
int | timer_pending (timer_t *tmr) |
Function return that the timer is pending. | |
void | timer_check () |
Function is searching for timers with runned out delay. | |
unsigned | get_sysutime () |
Function returns count of microseconds from cpu start. | |
int | init_timers () |
Function initialized list of timers. | |
void | timer_debug (void) |
Debug walk trough. |
Timers are system structures, that allows threads raise asynchronous event. There is no need to allocate memory for this event, like threads must when creating new thread. The timer handling function is called after delay, that thread can specified. Timers handling functions runs in context of thread, that was interuppted. Timers are storage in list, where timer structure has pointer to next timer.
#define MSIM_FREQUENCY (MSIM_FREQUENCY_USEC*1000000) |
Count of procesor ticks per a second
#define MSIM_FREQUENCY_USEC 1 |
Count of procesor ticks per a microsecond
typedef struct _timer_list timer_list |
usual notation with .._t
typedef struct timer_list timer_list_t |
usual notation with .._t
unsigned get_sysutime | ( | ) |
Function returns count of microseconds from cpu start.
int init_timers | ( | ) |
Function initialized list of timers.
void timer_check | ( | ) |
Function is searching for timers with runned out delay.
Function walk trough the list of timers. If the delay is runned out (count of cpu cycles is less than stop_cycle) the timer is destroyed and handle function is called with parametres, that point to timer and inserted data.
void timer_debug | ( | void | ) |
Debug walk trough.
Walk trough list of timers and print timers pointer and next pointer.
void timer_destroy | ( | struct timer * | tmr | ) |
Function deactivate timer.
tmr | - pointer to timer structure |
int timer_pending | ( | struct timer * | tmr | ) |
Function return that the timer is pending.
tmr | - pointer to timer structure |
void timer_start | ( | struct timer * | tmr | ) |
Function activate timer.
tmr | - pointer to timer structure |