📄 timer.h
字号:
/* *---------------------------------------------------------------------- * T-Kernel * * Copyright (C) 2004 by Ken Sakamura. All rights reserved. * T-Kernel is distributed under the T-License. *---------------------------------------------------------------------- * * Version: 1.01.00 * Released by T-Engine Forum(http://www.t-engine.org) at 2004/6/28. * *---------------------------------------------------------------------- *//* * timer.h (T-Kernel/OS) * Timer Module Definition */#ifndef _TIMER_#define _TIMER_#include <longlong.h>/* * SYSTIM internal expression and conversion */typedef longlong LSYSTIM; /* SYSTIM int. expression*/Inline LSYSTIM toLSYSTIM( SYSTIM *time ){ LSYSTIM ltime; hilo_ll(ltime, time->hi, time->lo); return ltime;}Inline SYSTIM toSYSTIM( LSYSTIM ltime ){ SYSTIM time; ll_hilo(time.hi, time.lo, ltime); return time;}/* * Definition of timer event block */typedef void (*CBACK)(VP); /* Type of callback function */typedef struct timer_event_block { QUEUE queue; /* Timer event queue */ LSYSTIM time; /* Event time */ CBACK callback; /* Callback function */ VP arg; /* Argument to be sent to callback function*/} TMEB;/* * Timer interrupt interval (millisecond) */IMPORT UINT TIMER_PERIOD;/* * Current time (Software clock) */IMPORT LSYSTIM current_time; /* System operation time */IMPORT LSYSTIM real_time_ofs; /* Difference from actual time *//* Actual time */#define real_time() ( ll_add(current_time, real_time_ofs) )/* * Timer initialization and stop */IMPORT ER timer_initialize( void );IMPORT void timer_shutdown( void );/* * Register timer event onto timer queue */IMPORT void timer_insert( TMEB *evt, TMO tmout, CBACK cback, VP arg );IMPORT void timer_insert_abs( TMEB *evt, LSYSTIM time, CBACK cback, VP arg );/* * Delete from timer queue */Inline void timer_delete( TMEB *event ){ QueRemove(&event->queue);}#endif /* _TIMER_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -