tinyOS  v1.00
计数信号量

tinyOS的计数信号量的实现 More...

Data Structures

struct  _tSem
 
struct  _tSemInfo
 

Typedefs

typedef struct _tSem tSem
 
typedef struct _tSemInfo tSemInfo
 

Functions

void tSemInit (tSem *sem, uint32_t startCount, uint32_t maxCount)
 
uint32_t tSemWait (tSem *sem, uint32_t waitTicks)
 
uint32_t tSemNoWaitGet (tSem *sem)
 
void tSemNotify (tSem *sem)
 
void tSemGetInfo (tSem *sem, tSemInfo *info)
 
uint32_t tSemDestroy (tSem *sem)
 

Detailed Description

tinyOS的计数信号量的实现

Author
01课堂 lishutong
Date
2017-06-01
Version
1.0

Typedef Documentation

◆ tSem

typedef struct _tSem tSem

◆ tSemInfo

typedef struct _tSemInfo tSemInfo

Function Documentation

◆ tSemDestroy()

uint32_t tSemDestroy ( tSem sem)

销毁信号量

Parameters
sem需要销毁的信号量
Returns
因销毁该信号量而唤醒的任务数量

Definition at line 134 of file tSem.c.

Here is the call graph for this function:

◆ tSemGetInfo()

void tSemGetInfo ( tSem sem,
tSemInfo info 
)

查询信号量的状态信息

Parameters
sem查询的信号量
info状态查询存储的位置

Definition at line 118 of file tSem.c.

Here is the call graph for this function:

◆ tSemInit()

void tSemInit ( tSem sem,
uint32_t  startCount,
uint32_t  maxCount 
)

初始化信号量

Parameters
startCount初始的计数
maxCount最大计数,如果为0,则不限数量

Definition at line 24 of file tSem.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tSemNotify()

void tSemNotify ( tSem sem)

通知信号量可用,唤醒等待队列中的一个任务,或者将计数+1

Parameters
sem操作的信号量

Definition at line 88 of file tSem.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tSemNoWaitGet()

uint32_t tSemNoWaitGet ( tSem sem)

获取信号量,如果信号量计数不可用,则立即退回

Parameters
sem等待的信号量
Returns
获取结果, tErrorResourceUnavaliable.tErrorNoError,tErrorTimeout

Definition at line 68 of file tSem.c.

Here is the call graph for this function:

◆ tSemWait()

uint32_t tSemWait ( tSem sem,
uint32_t  waitTicks 
)

等待信号量

Parameters
sem等待的信号量
waitTicks当信号量计数为0时,等待的ticks数,为0时表示永远等待
Returns
等待结果,tErrorResourceUnavaliable.tErrorNoError,tErrorTimeout

Definition at line 41 of file tSem.c.

Here is the call graph for this function:
Here is the caller graph for this function: