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