![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
CoOS Demonstrator adapted to mbed Hardware.
OsMutex.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 OsMutex.h |
ericebert | 0:57690853989a | 4 | * @version V1.1.3 |
ericebert | 0:57690853989a | 5 | * @date 2010.04.26 |
ericebert | 0:57690853989a | 6 | * @brief Mutex management header file |
ericebert | 0:57690853989a | 7 | * @details This file including some defines and declare related to mutex |
ericebert | 0:57690853989a | 8 | * 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 _MUTEX_H |
ericebert | 0:57690853989a | 20 | #define _MUTEX_H |
ericebert | 0:57690853989a | 21 | |
ericebert | 0:57690853989a | 22 | #include <coocox.h> |
ericebert | 0:57690853989a | 23 | |
ericebert | 0:57690853989a | 24 | #if CFG_MUTEX_EN > 0 |
ericebert | 0:57690853989a | 25 | |
ericebert | 0:57690853989a | 26 | /*---------------------------- Resource status -------------------------------*/ |
ericebert | 0:57690853989a | 27 | #define MUTEX_FREE 0 /*!< Mutex is free */ |
ericebert | 0:57690853989a | 28 | #define MUTEX_OCCUPY 1 /*!< Mutex is occupy */ |
ericebert | 0:57690853989a | 29 | #define WAITING_MUTEX 0x80 |
ericebert | 0:57690853989a | 30 | |
ericebert | 0:57690853989a | 31 | /** |
ericebert | 0:57690853989a | 32 | * @struct Mutex mutex.h |
ericebert | 0:57690853989a | 33 | * @brief Mutex control block |
ericebert | 0:57690853989a | 34 | * @details This struct is use to mutex management. |
ericebert | 0:57690853989a | 35 | */ |
ericebert | 0:57690853989a | 36 | typedef struct Mutex |
ericebert | 0:57690853989a | 37 | { |
ericebert | 0:57690853989a | 38 | U8 originalPrio; /*!< Mutex priority. */ |
ericebert | 0:57690853989a | 39 | U8 mutexFlag; /*!< Mutex flag. */ |
ericebert | 0:57690853989a | 40 | OS_TID taskID; /*!< Task ID. */ |
ericebert | 0:57690853989a | 41 | OS_TID hipriTaskID; /*!< Mutex ID. */ |
ericebert | 0:57690853989a | 42 | P_OSTCB waittingList; /*!< waitting the Mutex. */ |
ericebert | 0:57690853989a | 43 | }MUTEX,*P_MUTEX; |
ericebert | 0:57690853989a | 44 | |
ericebert | 0:57690853989a | 45 | |
ericebert | 0:57690853989a | 46 | /*---------------------------- Variable declare ------------------------------*/ |
ericebert | 0:57690853989a | 47 | /*!< Table use to save mutex control block. */ |
ericebert | 0:57690853989a | 48 | extern MUTEX MutexTbl[CFG_MAX_MUTEX]; |
ericebert | 0:57690853989a | 49 | extern OS_MutexID MutexFreeID; /*!< A pointer to next vliad resource ID. */ |
ericebert | 0:57690853989a | 50 | |
ericebert | 0:57690853989a | 51 | |
ericebert | 0:57690853989a | 52 | /*---------------------------- Function declare ------------------------------*/ |
ericebert | 0:57690853989a | 53 | extern void RemoveMutexList(P_OSTCB ptcb); |
ericebert | 0:57690853989a | 54 | |
ericebert | 0:57690853989a | 55 | #endif /* CFG_MUTEX_EN */ |
ericebert | 0:57690853989a | 56 | |
ericebert | 0:57690853989a | 57 | #endif /* _MUTEX_H */ |