astroboy astroboy
/
CoOS_LWIP
Quick and dirty CoOS + LWIP ( Webserver )
CoOS/kernel/OsEvent.h@0:94897d537b31, 2011-09-10 (annotated)
- Committer:
- astroboy
- Date:
- Sat Sep 10 22:41:10 2011 +0000
- Revision:
- 0:94897d537b31
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
astroboy | 0:94897d537b31 | 1 | /** |
astroboy | 0:94897d537b31 | 2 | ******************************************************************************* |
astroboy | 0:94897d537b31 | 3 | * @file OsEvent.h |
astroboy | 0:94897d537b31 | 4 | * @version V1.1.4 |
astroboy | 0:94897d537b31 | 5 | * @date 2011.04.20 |
astroboy | 0:94897d537b31 | 6 | * @brief Event management header file |
astroboy | 0:94897d537b31 | 7 | * @details This file including some defines and declares related to event |
astroboy | 0:94897d537b31 | 8 | * (semaphore,mailbox,queque) management. |
astroboy | 0:94897d537b31 | 9 | ******************************************************************************* |
astroboy | 0:94897d537b31 | 10 | * @copy |
astroboy | 0:94897d537b31 | 11 | * |
astroboy | 0:94897d537b31 | 12 | * INTERNAL FILE,DON'T PUBLIC. |
astroboy | 0:94897d537b31 | 13 | * |
astroboy | 0:94897d537b31 | 14 | * <h2><center>© COPYRIGHT 2009 CooCox </center></h2> |
astroboy | 0:94897d537b31 | 15 | ******************************************************************************* |
astroboy | 0:94897d537b31 | 16 | */ |
astroboy | 0:94897d537b31 | 17 | |
astroboy | 0:94897d537b31 | 18 | |
astroboy | 0:94897d537b31 | 19 | #ifndef _EVENT_H |
astroboy | 0:94897d537b31 | 20 | #define _EVENT_H |
astroboy | 0:94897d537b31 | 21 | |
astroboy | 0:94897d537b31 | 22 | #define EVENT_TYPE_SEM (U8)0x01 /*!< Event type:Semaphore. */ |
astroboy | 0:94897d537b31 | 23 | #define EVENT_TYPE_MBOX (U8)0x02 /*!< Event type:Mailbox. */ |
astroboy | 0:94897d537b31 | 24 | #define EVENT_TYPE_QUEUE (U8)0x03 /*!< Event type:Queue. */ |
astroboy | 0:94897d537b31 | 25 | #define EVENT_TYPE_INVALID (U8)0x04 /*!< Invalid event type. */ |
astroboy | 0:94897d537b31 | 26 | |
astroboy | 0:94897d537b31 | 27 | |
astroboy | 0:94897d537b31 | 28 | /** |
astroboy | 0:94897d537b31 | 29 | * @struct EventCtrBlk event.h |
astroboy | 0:94897d537b31 | 30 | * @brief Event control block |
astroboy | 0:94897d537b31 | 31 | * @details This struct is use to manage event, |
astroboy | 0:94897d537b31 | 32 | * e.g. semaphore,mailbox,queue. |
astroboy | 0:94897d537b31 | 33 | */ |
astroboy | 0:94897d537b31 | 34 | typedef struct EventCtrBlk |
astroboy | 0:94897d537b31 | 35 | { |
astroboy | 0:94897d537b31 | 36 | void* eventPtr; /*!< Point to mailbox or queue struct */ |
astroboy | 0:94897d537b31 | 37 | U8 id; /*!< ECB id */ |
astroboy | 0:94897d537b31 | 38 | U8 eventType:4; /*!< Type of event */ |
astroboy | 0:94897d537b31 | 39 | U8 eventSortType:4; /*!< 0:FIFO 1: Preemptive by prio */ |
astroboy | 0:94897d537b31 | 40 | U16 eventCounter; /*!< Counter of semaphore. */ |
astroboy | 0:94897d537b31 | 41 | U16 initialEventCounter; /*!< Initial counter of semaphore. */ |
astroboy | 0:94897d537b31 | 42 | P_OSTCB eventTCBList; /*!< Task waitting list. */ |
astroboy | 0:94897d537b31 | 43 | }ECB,*P_ECB; |
astroboy | 0:94897d537b31 | 44 | |
astroboy | 0:94897d537b31 | 45 | /*---------------------------- Variable declare ------------------------------*/ |
astroboy | 0:94897d537b31 | 46 | extern ECB EventTbl[CFG_MAX_EVENT]; /*!< Table use to save TCB. */ |
astroboy | 0:94897d537b31 | 47 | |
astroboy | 0:94897d537b31 | 48 | /*---------------------------- Function declare ------------------------------*/ |
astroboy | 0:94897d537b31 | 49 | /*!< Create a event */ |
astroboy | 0:94897d537b31 | 50 | extern P_ECB CreatEvent(U8 eventType,U8 eventSortType,void* eventPtr); |
astroboy | 0:94897d537b31 | 51 | |
astroboy | 0:94897d537b31 | 52 | /*!< Remove a task from wait list */ |
astroboy | 0:94897d537b31 | 53 | extern void EventTaskToWait(P_ECB pecb,P_OSTCB ptcb); |
astroboy | 0:94897d537b31 | 54 | extern StatusType DeleteEvent(P_ECB pecb,U8 opt); /*!< Delete a event. */ |
astroboy | 0:94897d537b31 | 55 | extern void EventTaskToRdy(P_ECB pecb); /*!< Insert a task to ready list*/ |
astroboy | 0:94897d537b31 | 56 | extern void CreateEventList(void); /*!< Create a event list. */ |
astroboy | 0:94897d537b31 | 57 | extern void RemoveEventWaittingList(P_OSTCB ptcb); |
astroboy | 0:94897d537b31 | 58 | #endif |