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