Components/Libraries/XF/FreeRTOS/Semaphore
Sara.chalokh (Talk | contribs) (→Semaphore(baseUInt oMaxCount, baseUInt oInitalCount)) |
Sara.chalokh (Talk | contribs) (→bool isCreated()) |
||
(7 intermediate revisions by one user not shown) | |||
Line 17: | Line 17: | ||
== ~Semaphore() == | == ~Semaphore() == | ||
+ | === Description === | ||
+ | The destructor of the Semaphore. It will delete the free RTOS semaphore | ||
+ | |||
+ | '''IMPORTANT''' : do not delete a semaphore that has thread blocked on it. (tasks that are in the Blocked state waiting for the semaphore to become available) | ||
+ | |||
== baseUInt getCount() == | == baseUInt getCount() == | ||
− | == bool take(timeSize | + | === Description === |
+ | Returns the count of the semaphore | ||
+ | |||
+ | == bool take(timeSize oTimeToWait) == | ||
+ | === Description === | ||
+ | Obtain the semaphore (decrement count value) | ||
+ | === Parameters === | ||
+ | TimeToWait : maximal amount of time (in ticks) that thread should wait if semaphore is not available | ||
+ | === Return === | ||
+ | Returns true if the Semaphore has been obtained successfully, else false | ||
+ | |||
== bool takeFromISR() == | == bool takeFromISR() == | ||
+ | === Description === | ||
+ | Obtain the semaphore (decrement count value) from an ISR | ||
+ | === Return === | ||
+ | Returns true if the Semaphore has been obtained successfully, else false | ||
+ | |||
== bool give() == | == bool give() == | ||
+ | === Description === | ||
+ | Releases the semaphore (increment count value) | ||
+ | === Return === | ||
+ | Returns true if the Semaphore has been released correctly, else false | ||
+ | |||
== bool giveFromISR() == | == bool giveFromISR() == | ||
+ | === Description === | ||
+ | Releases the semaphore (increment count value) from an ISR | ||
+ | === Return === | ||
+ | Returns true if the Semaphore has been released successfully | ||
+ | |||
== bool isCreated() == | == bool isCreated() == | ||
+ | === Description === | ||
+ | This function just return true if the semaphore has been created successfully, else false. |
Latest revision as of 14:04, 10 August 2017
|
Semaphore
This class is a C++ class that manage a FreeRTOS Semaphore.
Member Attibuts
SemaphoreHandle_t _semaphoreHandler : The FreeRTOS semaphore
Member Functions Description
Semaphore(baseUInt oMaxCount, baseUInt oInitalCount)
Description
The constructor of the semaphore. It will create a free RTOS semaphore and initialize it with the given count value
Parameters
oMaxCount : the maximal count value that can be reached
oInitalCount : the count value assigned to the semaphore when it is created
~Semaphore()
Description
The destructor of the Semaphore. It will delete the free RTOS semaphore
IMPORTANT : do not delete a semaphore that has thread blocked on it. (tasks that are in the Blocked state waiting for the semaphore to become available)
baseUInt getCount()
Description
Returns the count of the semaphore
bool take(timeSize oTimeToWait)
Description
Obtain the semaphore (decrement count value)
Parameters
TimeToWait : maximal amount of time (in ticks) that thread should wait if semaphore is not available
Return
Returns true if the Semaphore has been obtained successfully, else false
bool takeFromISR()
Description
Obtain the semaphore (decrement count value) from an ISR
Return
Returns true if the Semaphore has been obtained successfully, else false
bool give()
Description
Releases the semaphore (increment count value)
Return
Returns true if the Semaphore has been released correctly, else false
bool giveFromISR()
Description
Releases the semaphore (increment count value) from an ISR
Return
Returns true if the Semaphore has been released successfully
bool isCreated()
Description
This function just return true if the semaphore has been created successfully, else false.