timer.h
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:1k
- #ifndef __TIMER_H
- #define __TIMER_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include "gendef.h"
- #define KB_TIMER_INVALID_ID (0xFFFFFFFF)
- typedef void (*KB_TIMER_FUNC_POINTER)(void*);
- typedef enum
- {
- KB_TIMER_REPEAT = 0,
- KB_TIMER_ONCE,
- KB_TIMER_MAX
- }KB_TimerMode;
- #define TIMER_TICK_INT_PERIOD (100)
- #ifdef ST_OS21
- #define TIMER_STACK_SIZE (1024 * 16)
- #else
- #define TIMER_STACK_SIZE (1024 * 2)
- #endif
- #define CHECK_TIMER_ID(n)
- if((n) == KB_TIMER_INVALID_ID)
- return RETFAIL3
- typedef enum
- {
- TIMER_FINISH_NORMAL = 0,
- TIMER_FINISH_ENABLE,
- TIMER_FINISH_DISABLE,
- TIMER_FINISH_DELETE
- }TIMR_FINISH_t;
-
- typedef struct TIMER_STRUCT T_TIMER_st;
- struct TIMER_STRUCT
- {
- UINT32 current_count;
- UINT32 initial_ms;
- T_TIMER_st *next;
- T_TIMER_st *prev;
- KB_TimerMode mode;
- KB_TIMER_FUNC_POINTER entry;
- void *param; /* the parameter of entry */
- UINT8 valid;
- UINT8 enabled;
- UINT8 repeat1;
- };
- INT32 KB_TimerInit(void);
- UINT32 KB_TimerCreate(KB_TimerMode mode, KB_TIMER_FUNC_POINTER entry, void *param);
- INT32 KB_TimerDel(UINT32 timerId);
- INT32 KB_TimerEnable(UINT32 timerId, UINT32 ms);
- INT32 KB_TimerDisable(UINT32 timerId);
-
- #ifdef __cplusplus
- }
- #endif
- #endif /* __TIMER_H */