Failure case of Semaphore in FreeRTOS

krishnae019 wrote on Thursday, October 10, 2019:

How can we check Failure caseses of Semaphore in FreeRTOS. By using Mutex lock and xsemaphoreGive and XsemaphoreTake with RoundRobin and Priority based Scheduling in Stm32H743zI board and Autollic studion Environment.

rtel wrote on Thursday, October 10, 2019:

Sorry but you question is not clear to me. Which failures do you wish to detect? Did you find the api documentation where the function return values are described.

krishnae019 wrote on Friday, October 11, 2019:

Thanks for the response Richard, I want list of all failure case for semaphore is not working properly in FreeRTOS. In API documentation success criteria are mentioned.

rtel wrote on Friday, October 11, 2019:

Ok - which type of semaphore (what function did you use to create the
semaphore), and which API function do you want to know the failure cases
for?

krishnae019 wrote on Friday, October 11, 2019:

Thanks Richard. We using (mutex and Binary Semaphore) and API we using asr xSemaphoreTake() and xSemaphoregive(). I Want how to check failure of above mentioned API function.

krishnae019 wrote on Friday, October 11, 2019:

Thanks Richard. We using (mutex and Binary Semaphore) and API we using are xSemaphoreTake() and xSemaphoregive(). I Want how to check failure of above mentioned API function.

rtel wrote on Friday, October 11, 2019:

xSemaphoreTake() calls xQueueSemaphoreTake(), which is here at the time
of writing:
https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Source/queue.c#l1414
At the top of that function you can see the asserts that are checking
for errors. The item size is checked against 0 as if it is not zero
then the structure is a queue not a semaphore.

https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Source/queue.c#l1621
you can see pdFALSE is returned when the semaphore could not be obtained
after any specified timeout has expired, and here
https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Source/queue.c#l1513
false (same as queue empty) if the semaphore was not available when a
block time of 0 was specified (so the task does not wait).

You can see these return values described here
https://www.freertos.org/a00122.html - although that page does not
describe the asserts.