|
|
|
@ -155,6 +155,19 @@ typedef xQueueHandle xSemaphoreHandle;
|
|
|
|
|
* \ingroup Semaphores
|
|
|
|
|
*/
|
|
|
|
|
#define xSemaphoreTake( xSemaphore, xBlockTime ) xQueueGenericReceive( ( xQueueHandle ) xSemaphore, NULL, xBlockTime, pdFALSE )
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* xSemaphoreAltTake() is an alternative version of xSemaphoreTake().
|
|
|
|
|
*
|
|
|
|
|
* The source code that implements the alternative (Alt) API is much
|
|
|
|
|
* simpler because it executes everything from within a critical section.
|
|
|
|
|
* This is the approach taken by many other RTOSes, but FreeRTOS.org has the
|
|
|
|
|
* preferred fully featured API too. The fully featured API has more
|
|
|
|
|
* complex code that takes longer to execute, but makes much less use of
|
|
|
|
|
* critical sections. Therefore the alternative API sacrifices interrupt
|
|
|
|
|
* responsiveness to gain execution speed, whereas the fully featured API
|
|
|
|
|
* sacrifices execution speed to ensure better interrupt responsiveness.
|
|
|
|
|
*/
|
|
|
|
|
#define xSemaphoreAltTake( xSemaphore, xBlockTime ) xQueueAltGenericReceive( ( xQueueHandle ) xSemaphore, NULL, xBlockTime, pdFALSE )
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -215,6 +228,19 @@ typedef xQueueHandle xSemaphoreHandle;
|
|
|
|
|
* \ingroup Semaphores
|
|
|
|
|
*/
|
|
|
|
|
#define xSemaphoreGive( xSemaphore ) xQueueGenericSend( ( xQueueHandle ) xSemaphore, NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* xSemaphoreAltGive() is an alternative version of xSemaphoreGive().
|
|
|
|
|
*
|
|
|
|
|
* The source code that implements the alternative (Alt) API is much
|
|
|
|
|
* simpler because it executes everything from within a critical section.
|
|
|
|
|
* This is the approach taken by many other RTOSes, but FreeRTOS.org has the
|
|
|
|
|
* preferred fully featured API too. The fully featured API has more
|
|
|
|
|
* complex code that takes longer to execute, but makes much less use of
|
|
|
|
|
* critical sections. Therefore the alternative API sacrifices interrupt
|
|
|
|
|
* responsiveness to gain execution speed, whereas the fully featured API
|
|
|
|
|
* sacrifices execution speed to ensure better interrupt responsiveness.
|
|
|
|
|
*/
|
|
|
|
|
#define xSemaphoreAltGive( xSemaphore ) xQueueAltGenericSend( ( xQueueHandle ) xSemaphore, NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -313,7 +339,7 @@ typedef xQueueHandle xSemaphoreHandle;
|
|
|
|
|
*
|
|
|
|
|
* Mutex type semaphores cannot be used from within interrupt service routines.
|
|
|
|
|
*
|
|
|
|
|
* See xSemaphoreCreateBinary() for an alternative implemnetation that can be
|
|
|
|
|
* See xSemaphoreCreateBinary() for an alternative implementation that can be
|
|
|
|
|
* used for pure synchronisation (where one task or interrupt always 'gives' the
|
|
|
|
|
* semaphore and another always 'takes' the semaphore) and from within interrupt
|
|
|
|
|
* service routines.
|
|
|
|
|