AKOS  v1.0.0
Documentation
Loading...
Searching...
No Matches
timer.c File Reference

Software timer pool, lists, and processing loop. More...

#include "core.h"
#include "timer.h"
#include "thread.h"
#include "message.h"
#include "list.h"
Include dependency graph for timer.c:

Go to the source code of this file.

Functions

ak_timer_t * akos_timer_create (timer_id_t id, int32_t sig, timer_cb func_cb, uint8_t des_thread_id, uint32_t period, timer_type_t type)
 Create a timer object from timer pool.
void akos_timer_remove (ak_timer_t *p_timer)
 Remove timer from lists and return it to pool.
void akos_timer_init (void)
 Initialize timer module state.
void akos_timer_processing ()
 Timer-task processing function.
void akos_timer_start (ak_timer_t *p_timer, uint32_t tick_to_wait)
 Start timer with initial delay.
void akos_timer_reset (ak_timer_t *p_timer)
 Reset a running timer to its next period.

Detailed Description

Software timer pool, lists, and processing loop.

Author
Snoopy3921 - AK Foundation
Date
2026/05/08

Definition in file timer.c.

Function Documentation

◆ akos_timer_create()

ak_timer_t * akos_timer_create ( timer_id_t id,
int32_t sig,
timer_cb func_cb,
uint8_t des_thread_id,
uint32_t period,
timer_type_t type )

Create a timer object from timer pool.

Parameters
idTimer ID.
sigSignal posted on timeout.
func_cbOptional callback run on timeout.
des_thread_idDestination thread ID for signal posting.
periodPeriod in ticks for periodic timer.
typeTimer type.
Returns
Timer pointer, or NULL on failure.

Definition at line 146 of file timer.c.

◆ akos_timer_init()

void akos_timer_init ( void )

Initialize timer module state.

Initialize timer module.

Definition at line 234 of file timer.c.

◆ akos_timer_processing()

void akos_timer_processing ( )

Timer-task processing function.

Timer thread processing loop.

Processes expired timers, executes callbacks/posts signals, then blocks until the next timer event (or a wakeup message).

Definition at line 247 of file timer.c.

◆ akos_timer_remove()

void akos_timer_remove ( ak_timer_t * p_timer)

Remove timer from lists and return it to pool.

Remove timer from active lists and return to pool.

Parameters
p_timerTimer object.

Definition at line 211 of file timer.c.

◆ akos_timer_reset()

void akos_timer_reset ( ak_timer_t * p_timer)

Reset a running timer to its next period.

Reset a running timer.

Parameters
p_timerTimer object.

Definition at line 321 of file timer.c.

◆ akos_timer_start()

void akos_timer_start ( ak_timer_t * p_timer,
uint32_t tick_to_wait )

Start timer with initial delay.

Start a timer.

Parameters
p_timerTimer object.
tick_to_waitInitial delay in ticks.

Definition at line 306 of file timer.c.