| /********************************************************************************* |
| * °æ±¾ËùÓÐ (C)2008ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾ |
| * |
| * ¹¦ÄÜ : ¶¨ÒåͨÓõĶ¨Ê±Æ÷¿â |
| * ×÷Õß : Ö£ÓñæÃ |
| * °æ±¾ : V1.0 |
| * Íê³ÉÈÕÆÚ : 2008.05.05 |
| * ÆäËü˵Ã÷ : |
| * ²ÎÊý : |
| * ÊäÈë : |
| * Êä³ö : |
| * ¸ü¸Ä¼Ç¼ : |
| * ʱ¼ä ×÷Õß ÄÚÈÝ |
| *----------------------------------------------------------------------- |
| * 08/05/05 Ö£ÓñæÃ ´´½¨ |
| * |
| * |
| ***********************************************************************************/ |
| |
| #ifndef _SOFT_TIMER_H_ |
| #define _SOFT_TIMER_H_ |
| |
| #ifdef __cplusplus |
| extern "C" { |
| #endif |
| |
| #include "message.h" |
| //#include "errorcode.h" |
| //#include "zte_log.h" |
| |
| /*¶¨ÒåÓ²¼þ¶¨Ê±Æ÷µÄ²½³¤£¬10ms*/ |
| #define TIMER_STEP 10 |
| |
| /*¶¨ÒåÈí¼þ¶¨Ê±Æ÷µÄ×î´ó¸öÊý*/ |
| #define MAX_SOFT_TIMER_NUM 32 |
| |
| /*¶¨Ê±Æ÷ÀàÐͱê־λucFlagµÄºê*/ |
| #define TIMER_FLAG_ONCE 0 /*´Ë¶¨Ê±Æ÷Ö»´¥·¢Ò»´Î*/ |
| #define TIMER_FLAG_RESTART 1 /*´Ë¶¨Ê±Æ÷³ÖÐøÓÐЧ*/ |
| |
| |
| /*if the thread of soft timer is exist, 0 means not exist*/ |
| #define SOFT_TIMER_THREAD_NULL 0 |
| #define SOFT_TIMER_THREAD_EXIST 1 |
| |
| /*¶¨ÒåÈí¼þ¶¨Ê±Æ÷µÄÊý¾Ý½á¹¹*/ |
| typedef struct tagSOFT_TIMER |
| { |
| struct tagSOFT_TIMER *prev; |
| struct tagSOFT_TIMER *next; |
| int used; |
| int done; |
| int timerValue; |
| |
| USHORT usTimerID; /*¶¨Ê±Æ÷ID,ÓÃÀ´Çø·Ö²»Í¬µÄÈí¼þ¶¨Ê±Æ÷, 0±êʶ*/ |
| UCHAR ucFlag; /*¶¨Ê±Æ÷ÀàÐͱê־λ*/ |
| UCHAR ucReserved; /*±£Áô×Ö¶Î*/ |
| ULONG ulCurInterval; /*µ±Ç°¶¨Ê±Æ÷³¬Ê±Ê£Óàʱ¼ä£¬µ¥Î» ºÁÃë(×¢Òâ²»ÊÇ΢Ãë)£¬±ØÐ붨ÒåΪӲ¼þ¶¨Ê±Æ÷²½³¤µÄ±¶Êý*/ |
| ULONG ulNextInterval; /*³¬Ê±ºó¶¨Ê±Æ÷ÖØÖõļä¸ô£¬µ¥Î» ºÁÃë(×¢Òâ²»ÊÇ΢Ãë)*/ |
| void * (*procCallBack)(void *); /*¶¨Ò嶨ʱÆ÷³¬Ê±ºóµÄ»Øµ÷´¦Àíº¯ÊýÖ¸Õë*/ |
| void *args; /*¶¨Ò嶨ʱÆ÷³¬Ê±ºóµÄ»Øµ÷´¦Àíº¯ÊýµÄ²ÎÊý*/ |
| }SOFT_TIMER; |
| |
| |
| /*Íⲿ½Ó¿Úº¯ÊýÉùÃ÷*/ |
| LONG CreateSoftTimer(USHORT usTimerID, |
| UCHAR ucFlag, |
| ULONG ulInterval, |
| void * (*procCallBack)(void *), |
| void *args); |
| |
| LONG DeleteSoftTimer(USHORT usTimerID); |
| |
| #ifdef __cplusplus |
| } |
| #endif |
| |
| #endif |
| |
| |