tinyOS  v1.00
tSem.h
Go to the documentation of this file.
1 
14 #ifndef TSEM_H
15 #define TSEM_H
16 
17 #include "tConfig.h"
18 
19 #if !defined(TINYOS_ENABLE_SEM) || TINYOS_ENABLE_SEM == 1
20 
21 #include "tEvent.h"
22 
23 // 信号量类型
24 typedef struct _tSem {
26  uint32_t count;
27  uint32_t maxCount;
28 } tSem;
29 
30 // 信号量的信息类型
31 typedef struct _tSemInfo {
32  uint32_t count;
33  uint32_t maxCount;
34  uint32_t taskCount;
35 } tSemInfo;
36 
37 void tSemInit (tSem *sem, uint32_t startCount, uint32_t maxCount);
38 uint32_t tSemWait (tSem *sem, uint32_t waitTicks);
39 uint32_t tSemNoWaitGet (tSem *sem);
40 void tSemNotify (tSem *sem);
41 void tSemGetInfo (tSem *sem, tSemInfo *info);
42 uint32_t tSemDestroy (tSem *sem);
43 
44 #endif // TINYOS_ENABLE_SEM
45 
46 #endif /* TSEM_H */
47 
Definition: tSem.h:24
uint32_t maxCount
Definition: tSem.h:27
uint32_t taskCount
Definition: tSem.h:34
uint32_t count
Definition: tSem.h:32
struct _tSem tSem
void tSemInit(tSem *sem, uint32_t startCount, uint32_t maxCount)
Definition: tSem.c:24
void tSemGetInfo(tSem *sem, tSemInfo *info)
Definition: tSem.c:118
uint32_t tSemDestroy(tSem *sem)
Definition: tSem.c:134
uint32_t tSemWait(tSem *sem, uint32_t waitTicks)
Definition: tSem.c:41
uint32_t tSemNoWaitGet(tSem *sem)
Definition: tSem.c:68
Definition: tEvent.h:32
tEvent event
Definition: tSem.h:25
Definition: tSem.h:31
void tSemNotify(tSem *sem)
Definition: tSem.c:88
uint32_t count
Definition: tSem.h:26
uint32_t maxCount
Definition: tSem.h:33
struct _tSemInfo tSemInfo