Skip to content

Commit

Permalink
Add configUSE_MUTEXES to function declarations in header (FreeRTOS#504)
Browse files Browse the repository at this point in the history
This commit adds the configUSE_MUTEXES guard to the function
declarations in semphr.h which are only available when configUSE_MUTEXES
is set to 1.

It was reported here - https://forums.freertos.org/t/mutex-missing-reference-to-configuse-mutexes-on-the-online-documentation/15231

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
  • Loading branch information
aggarg authored Jun 21, 2022
1 parent 0b46492 commit d5771a7
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions include/semphr.h
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* \defgroup xSemaphoreCreateMutex xSemaphoreCreateMutex
* \ingroup Semaphores
*/
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
#if ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configUSE_MUTEXES == 1 ) )
#define xSemaphoreCreateMutex() xQueueCreateMutex( queueQUEUE_TYPE_MUTEX )
#endif

Expand Down Expand Up @@ -794,9 +794,9 @@ typedef QueueHandle_t SemaphoreHandle_t;
* \defgroup xSemaphoreCreateMutexStatic xSemaphoreCreateMutexStatic
* \ingroup Semaphores
*/
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
#if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_MUTEXES == 1 ) )
#define xSemaphoreCreateMutexStatic( pxMutexBuffer ) xQueueCreateMutexStatic( queueQUEUE_TYPE_MUTEX, ( pxMutexBuffer ) )
#endif /* configSUPPORT_STATIC_ALLOCATION */
#endif


/**
Expand Down Expand Up @@ -1126,7 +1126,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* \defgroup vSemaphoreDelete vSemaphoreDelete
* \ingroup Semaphores
*/
#define vSemaphoreDelete( xSemaphore ) vQueueDelete( ( QueueHandle_t ) ( xSemaphore ) )
#define vSemaphoreDelete( xSemaphore ) vQueueDelete( ( QueueHandle_t ) ( xSemaphore ) )

/**
* semphr.h
Expand All @@ -1143,7 +1143,9 @@ typedef QueueHandle_t SemaphoreHandle_t;
* the holder may change between the function exiting and the returned value
* being tested.
*/
#define xSemaphoreGetMutexHolder( xSemaphore ) xQueueGetMutexHolder( ( xSemaphore ) )
#if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) )
#define xSemaphoreGetMutexHolder( xSemaphore ) xQueueGetMutexHolder( ( xSemaphore ) )
#endif

/**
* semphr.h
Expand All @@ -1156,7 +1158,9 @@ typedef QueueHandle_t SemaphoreHandle_t;
* by a task), return NULL.
*
*/
#define xSemaphoreGetMutexHolderFromISR( xSemaphore ) xQueueGetMutexHolderFromISR( ( xSemaphore ) )
#if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) )
#define xSemaphoreGetMutexHolderFromISR( xSemaphore ) xQueueGetMutexHolderFromISR( ( xSemaphore ) )
#endif

/**
* semphr.h
Expand All @@ -1170,7 +1174,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* semaphore is not available.
*
*/
#define uxSemaphoreGetCount( xSemaphore ) uxQueueMessagesWaiting( ( QueueHandle_t ) ( xSemaphore ) )
#define uxSemaphoreGetCount( xSemaphore ) uxQueueMessagesWaiting( ( QueueHandle_t ) ( xSemaphore ) )

/**
* semphr.h
Expand All @@ -1184,6 +1188,6 @@ typedef QueueHandle_t SemaphoreHandle_t;
* semaphore is not available.
*
*/
#define uxSemaphoreGetCountFromISR( xSemaphore ) uxQueueMessagesWaitingFromISR( ( QueueHandle_t ) ( xSemaphore ) )
#define uxSemaphoreGetCountFromISR( xSemaphore ) uxQueueMessagesWaitingFromISR( ( QueueHandle_t ) ( xSemaphore ) )

#endif /* SEMAPHORE_H */

0 comments on commit d5771a7

Please sign in to comment.