STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
semphr.h File Reference
#include "queue.h"
Include dependency graph for semphr.h:
This graph shows which files directly or indirectly include this file:

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 xSemaphoreTake(xSemaphore, xBlockTime)
#define xSemaphoreGive(xSemaphore)
#define xSemaphoreGiveFromISR(xSemaphore, pxHigherPriorityTaskWoken)
#define xSemaphoreTakeFromISR(xSemaphore, pxHigherPriorityTaskWoken)
 semphr.
#define vSemaphoreDelete(xSemaphore)
#define uxSemaphoreGetCount(xSemaphore)
 semphr.h
#define uxSemaphoreGetCountFromISR(xSemaphore)
 semphr.h

Typedefs

typedef QueueHandle_t SemaphoreHandle_t

Macro Definition Documentation

◆ semBINARY_SEMAPHORE_QUEUE_LENGTH

#define semBINARY_SEMAPHORE_QUEUE_LENGTH   ( ( uint8_t ) 1U )

Definition at line 40 of file semphr.h.

◆ semGIVE_BLOCK_TIME

#define semGIVE_BLOCK_TIME   ( ( TickType_t ) 0U )

Definition at line 42 of file semphr.h.

◆ semSEMAPHORE_QUEUE_ITEM_LENGTH

#define semSEMAPHORE_QUEUE_ITEM_LENGTH   ( ( uint8_t ) 0U )

Definition at line 41 of file semphr.h.

◆ uxSemaphoreGetCount

#define uxSemaphoreGetCount ( xSemaphore)
Value:
struct QueueDefinition * QueueHandle_t
Definition queue.h:51
UBaseType_t uxQueueMessagesWaiting(const QueueHandle_t xQueue) PRIVILEGED_FUNCTION
Definition queue.c:2079

semphr.h

TaskHandle_t xSemaphoreGetMutexHolder( SemaphoreHandle_t xMutex );
QueueHandle_t SemaphoreHandle_t
Definition semphr.h:38
struct tskTaskControlBlock * TaskHandle_t
Definition task.h:92

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. semphr.h

TaskHandle_t xSemaphoreGetMutexHolderFromISR( 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. semphr.h

unsigned long UBaseType_t
Definition portmacro.h:60
#define uxSemaphoreGetCount(xSemaphore)
semphr.h
Definition semphr.h:1177

If the semaphore is a counting semaphore then uxSemaphoreGetCount() returns its current count value. If the semaphore is a binary semaphore then uxSemaphoreGetCount() returns 1 if the semaphore is available, and 0 if the semaphore is not available.

Definition at line 1177 of file semphr.h.

Referenced by osSemaphoreGetCount().

◆ uxSemaphoreGetCountFromISR

#define uxSemaphoreGetCountFromISR ( xSemaphore)
Value:
UBaseType_t uxQueueMessagesWaitingFromISR(const QueueHandle_t xQueue) PRIVILEGED_FUNCTION
Definition queue.c:2112

semphr.h

#define uxSemaphoreGetCountFromISR(xSemaphore)
semphr.h
Definition semphr.h:1191

If the semaphore is a counting semaphore then uxSemaphoreGetCountFromISR() returns its current count value. If the semaphore is a binary semaphore then uxSemaphoreGetCountFromISR() returns 1 if the semaphore is available, and 0 if the semaphore is not available.

Definition at line 1191 of file semphr.h.

Referenced by osSemaphoreGetCount().

◆ vSemaphoreDelete

#define vSemaphoreDelete ( xSemaphore)
Value:
vQueueDelete( ( QueueHandle_t ) ( xSemaphore ) )
void vQueueDelete(QueueHandle_t xQueue) PRIVILEGED_FUNCTION
Definition queue.c:2124

Definition at line 1129 of file semphr.h.

Referenced by osSemaphoreDelete(), and osSemaphoreNew().

◆ xSemaphoreGive

#define xSemaphoreGive ( xSemaphore)
Value:
#define NULL
Definition usbd_def.h:44
#define queueSEND_TO_BACK
Definition queue.h:68
BaseType_t xQueueGenericSend(QueueHandle_t xQueue, const void *const pvItemToQueue, TickType_t xTicksToWait, const BaseType_t xCopyPosition) PRIVILEGED_FUNCTION
Definition queue.c:884
#define semGIVE_BLOCK_TIME
Definition semphr.h:42

Definition at line 460 of file semphr.h.

Referenced by osSemaphoreNew(), and osSemaphoreRelease().

◆ xSemaphoreGiveFromISR

#define xSemaphoreGiveFromISR ( xSemaphore,
pxHigherPriorityTaskWoken )
Value:
xQueueGiveFromISR( ( QueueHandle_t ) ( xSemaphore ), ( pxHigherPriorityTaskWoken ) )
BaseType_t xQueueGiveFromISR(QueueHandle_t xQueue, BaseType_t *const pxHigherPriorityTaskWoken) PRIVILEGED_FUNCTION
Definition queue.c:1261

Definition at line 640 of file semphr.h.

Referenced by osSemaphoreRelease().

◆ xSemaphoreTake

#define xSemaphoreTake ( xSemaphore,
xBlockTime )
Value:
xQueueSemaphoreTake( ( xSemaphore ), ( xBlockTime ) )
BaseType_t xQueueSemaphoreTake(QueueHandle_t xQueue, TickType_t xTicksToWait) PRIVILEGED_FUNCTION
Definition queue.c:1570

Definition at line 298 of file semphr.h.

Referenced by osSemaphoreAcquire().

◆ xSemaphoreTakeFromISR

#define xSemaphoreTakeFromISR ( xSemaphore,
pxHigherPriorityTaskWoken )
Value:
xQueueReceiveFromISR( ( QueueHandle_t ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ) )
BaseType_t xQueueReceiveFromISR(QueueHandle_t xQueue, void *const pvBuffer, BaseType_t *const pxHigherPriorityTaskWoken) PRIVILEGED_FUNCTION
Definition queue.c:1931

semphr.

h

SemaphoreHandle_t xSemaphore,
BaseType_t *pxHigherPriorityTaskWoken
);
long BaseType_t
Definition portmacro.h:59
#define xSemaphoreTakeFromISR(xSemaphore, pxHigherPriorityTaskWoken)
semphr.
Definition semphr.h:675

Macro to take a semaphore from an ISR. The semaphore must have previously been created with a call to xSemaphoreCreateBinary() 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 675 of file semphr.h.

Referenced by osSemaphoreAcquire().

Typedef Documentation

◆ SemaphoreHandle_t

Definition at line 38 of file semphr.h.