SAM4S-EK_FreeRTOS+FAT-SL  1.0
An example project to test the functionality of FreeRTOS+FAT-SL using SD card as data storage medium
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
semphr.h File Reference
#include "queue.h"

Go to the source code of this file.

Macros

#define semBINARY_SEMAPHORE_QUEUE_LENGTH   ( ( uint8_t ) 1U )
 
#define semSEMAPHORE_QUEUE_ITEM_LENGTH   ( ( uint8_t ) 0U )
 
#define semGIVE_BLOCK_TIME   ( ( TickType_t ) 0U )
 
#define vSemaphoreCreateBinary(xSemaphore)
 
#define xSemaphoreCreateBinary()   xQueueGenericCreate( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE )
 
#define xSemaphoreTake(xSemaphore, xBlockTime)   xQueueGenericReceive( ( QueueHandle_t ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
 
#define xSemaphoreTakeRecursive(xMutex, xBlockTime)   xQueueTakeMutexRecursive( ( xMutex ), ( xBlockTime ) )
 
#define xSemaphoreAltTake(xSemaphore, xBlockTime)   xQueueAltGenericReceive( ( QueueHandle_t ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
 
#define xSemaphoreGive(xSemaphore)   xQueueGenericSend( ( QueueHandle_t ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )
 
#define xSemaphoreGiveRecursive(xMutex)   xQueueGiveMutexRecursive( ( xMutex ) )
 
#define xSemaphoreAltGive(xSemaphore)   xQueueAltGenericSend( ( QueueHandle_t ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )
 
#define xSemaphoreGiveFromISR(xSemaphore, pxHigherPriorityTaskWoken)   xQueueGenericSendFromISR( ( QueueHandle_t ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ), queueSEND_TO_BACK )
 
#define xSemaphoreTakeFromISR(xSemaphore, pxHigherPriorityTaskWoken)   xQueueReceiveFromISR( ( QueueHandle_t ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ) )
 
#define xSemaphoreCreateMutex()   xQueueCreateMutex( queueQUEUE_TYPE_MUTEX )
 
#define xSemaphoreCreateRecursiveMutex()   xQueueCreateMutex( queueQUEUE_TYPE_RECURSIVE_MUTEX )
 
#define xSemaphoreCreateCounting(uxMaxCount, uxInitialCount)   xQueueCreateCountingSemaphore( ( uxMaxCount ), ( uxInitialCount ) )
 
#define vSemaphoreDelete(xSemaphore)   vQueueDelete( ( QueueHandle_t ) ( xSemaphore ) )
 
#define xSemaphoreGetMutexHolder(xSemaphore)   xQueueGetMutexHolder( ( xSemaphore ) )
 

Typedefs

typedef QueueHandle_t SemaphoreHandle_t
 

Macro Definition Documentation

#define semBINARY_SEMAPHORE_QUEUE_LENGTH   ( ( uint8_t ) 1U )

Definition at line 77 of file semphr.h.

#define semGIVE_BLOCK_TIME   ( ( TickType_t ) 0U )

Definition at line 79 of file semphr.h.

#define semSEMAPHORE_QUEUE_ITEM_LENGTH   ( ( uint8_t ) 0U )

Definition at line 78 of file semphr.h.

#define vSemaphoreCreateBinary (   xSemaphore)
Value:
{ \
if( ( xSemaphore ) != NULL ) \
{ \
( void ) xSemaphoreGive( ( xSemaphore ) ); \
} \
}
#define semSEMAPHORE_QUEUE_ITEM_LENGTH
Definition: semphr.h:78
unsigned long UBaseType_t
Definition: portmacro.h:95
#define queueQUEUE_TYPE_BINARY_SEMAPHORE
Definition: queue.h:110
#define xSemaphoreGive(xSemaphore)
Definition: semphr.h:419
QueueHandle_t xQueueGenericCreate(const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, const uint8_t ucQueueType) PRIVILEGED_FUNCTION
Definition: queue.c:308

Definition at line 127 of file semphr.h.

#define vSemaphoreDelete (   xSemaphore)    vQueueDelete( ( QueueHandle_t ) ( xSemaphore ) )

Definition at line 821 of file semphr.h.

#define xSemaphoreAltGive (   xSemaphore)    xQueueAltGenericSend( ( QueueHandle_t ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )

Definition at line 517 of file semphr.h.

#define xSemaphoreAltTake (   xSemaphore,
  xBlockTime 
)    xQueueAltGenericReceive( ( QueueHandle_t ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )

Definition at line 356 of file semphr.h.

Definition at line 181 of file semphr.h.

#define xSemaphoreCreateCounting (   uxMaxCount,
  uxInitialCount 
)    xQueueCreateCountingSemaphore( ( uxMaxCount ), ( uxInitialCount ) )

Definition at line 807 of file semphr.h.

#define xSemaphoreCreateMutex ( )    xQueueCreateMutex( queueQUEUE_TYPE_MUTEX )

Definition at line 689 of file semphr.h.

#define xSemaphoreCreateRecursiveMutex ( )    xQueueCreateMutex( queueQUEUE_TYPE_RECURSIVE_MUTEX )

Definition at line 744 of file semphr.h.

#define xSemaphoreGetMutexHolder (   xSemaphore)    xQueueGetMutexHolder( ( xSemaphore ) )

semphr.h

TaskHandle_t xSemaphoreGetMutexHolder( SemaphoreHandle_t xMutex );

If xMutex is indeed a mutex type semaphore, return the current mutex holder. If xMutex is not a mutex type semaphore, or the mutex is available (not held by a task), return NULL.

Note: This is a good way of determining if the calling task is the mutex holder, but not a good way of determining the identity of the mutex holder as the holder may change between the function exiting and the returned value being tested.

Definition at line 836 of file semphr.h.

#define xSemaphoreGive (   xSemaphore)    xQueueGenericSend( ( QueueHandle_t ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )

Definition at line 419 of file semphr.h.

#define xSemaphoreGiveFromISR (   xSemaphore,
  pxHigherPriorityTaskWoken 
)    xQueueGenericSendFromISR( ( QueueHandle_t ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ), queueSEND_TO_BACK )

Definition at line 608 of file semphr.h.

#define xSemaphoreGiveRecursive (   xMutex)    xQueueGiveMutexRecursive( ( xMutex ) )

Definition at line 503 of file semphr.h.

#define xSemaphoreTake (   xSemaphore,
  xBlockTime 
)    xQueueGenericReceive( ( QueueHandle_t ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )

Definition at line 248 of file semphr.h.

#define xSemaphoreTakeFromISR (   xSemaphore,
  pxHigherPriorityTaskWoken 
)    xQueueReceiveFromISR( ( QueueHandle_t ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ) )

semphr. h

xSemaphoreTakeFromISR(
                         SemaphoreHandle_t xSemaphore,
                         BaseType_t *pxHigherPriorityTaskWoken
                     )

Macro to take a semaphore from an ISR. The semaphore must have previously been created with a call to vSemaphoreCreateBinary() or xSemaphoreCreateCounting().

Mutex type semaphores (those created using a call to xSemaphoreCreateMutex()) must not be used with this macro.

This macro can be used from an ISR, however taking a semaphore from an ISR is not a common operation. It is likely to only be useful when taking a counting semaphore when an interrupt is obtaining an object from a resource pool (when the semaphore count indicates the number of resources available).

Parameters
xSemaphoreA handle to the semaphore being taken. This is the handle returned when the semaphore was created.
pxHigherPriorityTaskWokenxSemaphoreTakeFromISR() will set *pxHigherPriorityTaskWoken to pdTRUE if taking the semaphore caused a task to unblock, and the unblocked task has a priority higher than the currently running task. If xSemaphoreTakeFromISR() sets this value to pdTRUE then a context switch should be requested before the interrupt is exited.
Returns
pdTRUE if the semaphore was successfully taken, otherwise pdFALSE

Definition at line 642 of file semphr.h.

#define xSemaphoreTakeRecursive (   xMutex,
  xBlockTime 
)    xQueueTakeMutexRecursive( ( xMutex ), ( xBlockTime ) )

Definition at line 341 of file semphr.h.

Typedef Documentation

Definition at line 75 of file semphr.h.