392 #endif // _TN_TIMER_H
enum TN_RCode tn_timer_cancel(struct TN_Timer *timer)
If timer is active, cancel it.
enum TN_RCode tn_timer_create(struct TN_Timer *timer, TN_TimerFunc *func, void *p_user_data)
Construct the timer.
struct TN_ListItem timer_queue
A list item to be included in the system timer queue.
enum TN_RCode tn_timer_delete(struct TN_Timer *timer)
Destruct the timer.
Circular doubly linked list, for internal kernel usage.
enum TN_RCode tn_timer_is_active(struct TN_Timer *timer, TN_BOOL *p_is_active)
Returns whether given timer is active or inactive.
enum TN_RCode tn_timer_time_left(struct TN_Timer *timer, TN_Timeout *p_time_left)
Returns how many system timer ticks (at most) is left for the timer to expire.
TN_RCode
Result code returned by kernel services.
TN_ObjId
Magic number for object validity verification TODO: use TN_UWord here instead of unsigned int...
unsigned long TN_Timeout
The value representing maximum number of system ticks to wait.
enum TN_RCode tn_timer_set_func(struct TN_Timer *timer, TN_TimerFunc *func, void *p_user_data)
Set user-provided function and pointer to user data for the timer.
Definitions used through the whole kernel.
enum TN_ObjId id_timer
id for object validity verification
TN_Timeout timeout_cur
Current (left) timeout value.
TN_TimerFunc * func
Function to be called by timer.
void * p_user_data
User data pointer that is given to user-provided func.
Circular doubly linked list item, for internal kernel usage.
void( TN_TimerFunc)(struct TN_Timer *timer, void *p_user_data)
Prototype of the function that should be called by timer.
enum TN_RCode tn_timer_start(struct TN_Timer *timer, TN_Timeout timeout)
Start or restart the timer: that is, schedule the timer's function (given to tn_timer_create()) to be...
#define TN_BOOL
boolean type definition