lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /********************************************************************************* |
| 2 | * °æ±¾ËùÓÐ (C)2008ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾ |
| 3 | * |
| 4 | * ¹¦ÄÜ : ¶¨ÒåͨÓõĶ¨Ê±Æ÷¿â |
| 5 | * ×÷Õß : Ö£ÓñæÃ |
| 6 | * °æ±¾ : V1.0 |
| 7 | * Íê³ÉÈÕÆÚ : 2008.05.05 |
| 8 | * ÆäËü˵Ã÷ : |
| 9 | * ²ÎÊý : |
| 10 | * ÊäÈë : |
| 11 | * Êä³ö : |
| 12 | * ¸ü¸Ä¼Ç¼ : |
| 13 | * ʱ¼ä ×÷Õß ÄÚÈÝ |
| 14 | *----------------------------------------------------------------------- |
| 15 | * 08/05/05 Ö£ÓñæÃ ´´½¨ |
| 16 | * |
| 17 | * |
| 18 | ***********************************************************************************/ |
| 19 | |
| 20 | #ifndef _SOFT_TIMER_H_ |
| 21 | #define _SOFT_TIMER_H_ |
| 22 | |
| 23 | #ifdef __cplusplus |
| 24 | extern "C" { |
| 25 | #endif |
| 26 | |
| 27 | #include "message.h" |
| 28 | //#include "errorcode.h" |
| 29 | //#include "zte_log.h" |
| 30 | |
| 31 | /*¶¨ÒåÓ²¼þ¶¨Ê±Æ÷µÄ²½³¤£¬10ms*/ |
| 32 | #define TIMER_STEP 10 |
| 33 | |
| 34 | /*¶¨ÒåÈí¼þ¶¨Ê±Æ÷µÄ×î´ó¸öÊý*/ |
| 35 | #define MAX_SOFT_TIMER_NUM 32 |
| 36 | |
| 37 | /*¶¨Ê±Æ÷ÀàÐͱê־λucFlagµÄºê*/ |
| 38 | #define TIMER_FLAG_ONCE 0 /*´Ë¶¨Ê±Æ÷Ö»´¥·¢Ò»´Î*/ |
| 39 | #define TIMER_FLAG_RESTART 1 /*´Ë¶¨Ê±Æ÷³ÖÐøÓÐЧ*/ |
| 40 | |
| 41 | |
| 42 | /*if the thread of soft timer is exist, 0 means not exist*/ |
| 43 | #define SOFT_TIMER_THREAD_NULL 0 |
| 44 | #define SOFT_TIMER_THREAD_EXIST 1 |
| 45 | |
| 46 | /*¶¨ÒåÈí¼þ¶¨Ê±Æ÷µÄÊý¾Ý½á¹¹*/ |
| 47 | typedef struct tagSOFT_TIMER |
| 48 | { |
| 49 | struct tagSOFT_TIMER *prev; |
| 50 | struct tagSOFT_TIMER *next; |
| 51 | int used; |
| 52 | int done; |
| 53 | int timerValue; |
| 54 | |
| 55 | USHORT usTimerID; /*¶¨Ê±Æ÷ID,ÓÃÀ´Çø·Ö²»Í¬µÄÈí¼þ¶¨Ê±Æ÷, 0±êʶ*/ |
| 56 | UCHAR ucFlag; /*¶¨Ê±Æ÷ÀàÐͱê־λ*/ |
| 57 | UCHAR ucReserved; /*±£Áô×Ö¶Î*/ |
| 58 | ULONG ulCurInterval; /*µ±Ç°¶¨Ê±Æ÷³¬Ê±Ê£Óàʱ¼ä£¬µ¥Î» ºÁÃë(×¢Òâ²»ÊÇ΢Ãë)£¬±ØÐ붨ÒåΪӲ¼þ¶¨Ê±Æ÷²½³¤µÄ±¶Êý*/ |
| 59 | ULONG ulNextInterval; /*³¬Ê±ºó¶¨Ê±Æ÷ÖØÖõļä¸ô£¬µ¥Î» ºÁÃë(×¢Òâ²»ÊÇ΢Ãë)*/ |
| 60 | void * (*procCallBack)(void *); /*¶¨Ò嶨ʱÆ÷³¬Ê±ºóµÄ»Øµ÷´¦Àíº¯ÊýÖ¸Õë*/ |
| 61 | void *args; /*¶¨Ò嶨ʱÆ÷³¬Ê±ºóµÄ»Øµ÷´¦Àíº¯ÊýµÄ²ÎÊý*/ |
| 62 | }SOFT_TIMER; |
| 63 | |
| 64 | |
| 65 | /*Íⲿ½Ó¿Úº¯ÊýÉùÃ÷*/ |
| 66 | LONG CreateSoftTimer(USHORT usTimerID, |
| 67 | UCHAR ucFlag, |
| 68 | ULONG ulInterval, |
| 69 | void * (*procCallBack)(void *), |
| 70 | void *args); |
| 71 | |
| 72 | LONG DeleteSoftTimer(USHORT usTimerID); |
| 73 | |
| 74 | #ifdef __cplusplus |
| 75 | } |
| 76 | #endif |
| 77 | |
| 78 | #endif |
| 79 | |
| 80 | |