-
Notifications
You must be signed in to change notification settings - Fork 0
/
OsMutex.h
57 lines (45 loc) · 1.94 KB
/
OsMutex.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
*******************************************************************************
* @file OsMutex.h
* @version V1.1.4
* @date 2011.04.20
* @brief Mutex management header file
* @details This file including some defines and declare related to mutex
* management.
*******************************************************************************
* @copy
*
* INTERNAL FILE,DON'T PUBLIC.
*
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
*******************************************************************************
*/
#ifndef _MUTEX_H
#define _MUTEX_H
#include <coocox.h>
#if CFG_MUTEX_EN > 0
/*---------------------------- Resource status -------------------------------*/
#define MUTEX_FREE 0 /*!< Mutex is free */
#define MUTEX_OCCUPY 1 /*!< Mutex is occupy */
#define WAITING_MUTEX 0x80
/**
* @struct Mutex mutex.h
* @brief Mutex control block
* @details This struct is use to mutex management.
*/
typedef struct Mutex
{
U8 originalPrio; /*!< Mutex priority. */
U8 mutexFlag; /*!< Mutex flag. */
OS_TID taskID; /*!< Task ID. */
OS_TID hipriTaskID; /*!< Mutex ID. */
P_OSTCB waittingList; /*!< waitting the Mutex. */
}MUTEX,*P_MUTEX;
/*---------------------------- Variable declare ------------------------------*/
/*!< Table use to save mutex control block. */
extern MUTEX MutexTbl[CFG_MAX_MUTEX];
extern OS_MutexID MutexFreeID; /*!< A pointer to next vliad resource ID. */
/*---------------------------- Function declare ------------------------------*/
extern void RemoveMutexList(P_OSTCB ptcb);
#endif /* CFG_MUTEX_EN */
#endif /* _MUTEX_H */