@@ -222,7 +222,20 @@ static void prvCopyDataFromQueue( Queue_t * const pxQueue,
222222 * the queue set that the queue contains data.
223223 */
224224 static BaseType_t prvNotifyQueueSetContainer ( const Queue_t * const pxQueue ) PRIVILEGED_FUNCTION ;
225- #endif
225+
226+ /*
227+ * A version of prvNotifyQueueSetContainer() that can be called from an
228+ * interrupt service routine (ISR).
229+ */
230+ static BaseType_t prvNotifyQueueSetContainerFromISR ( const Queue_t * const pxQueue ) PRIVILEGED_FUNCTION ;
231+
232+ /*
233+ * This function serves as a generic implementation for prvNotifyQueueSetContainer()
234+ * and prvNotifyQueueSetContainerFromISR().
235+ */
236+ static BaseType_t prvNotifyQueueSetContainerGeneric ( const Queue_t * const pxQueue ,
237+ const BaseType_t xIsISR ) PRIVILEGED_FUNCTION ;
238+ #endif /* if ( configUSE_QUEUE_SETS == 1 ) */
226239
227240/*
228241 * Called after a Queue_t structure has been allocated either statically or
@@ -1294,7 +1307,7 @@ BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue,
12941307 * in the queue has not changed. */
12951308 mtCOVERAGE_TEST_MARKER ();
12961309 }
1297- else if ( prvNotifyQueueSetContainer ( pxQueue ) != pdFALSE )
1310+ else if ( prvNotifyQueueSetContainerFromISR ( pxQueue ) != pdFALSE )
12981311 {
12991312 /* The queue is a member of a queue set, and posting
13001313 * to the queue set caused a higher priority task to
@@ -1317,7 +1330,7 @@ BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue,
13171330 {
13181331 if ( listLIST_IS_EMPTY ( & ( pxQueue -> xTasksWaitingToReceive ) ) == pdFALSE )
13191332 {
1320- if ( xTaskRemoveFromEventList ( & ( pxQueue -> xTasksWaitingToReceive ) ) != pdFALSE )
1333+ if ( xTaskRemoveFromEventListFromISR ( & ( pxQueue -> xTasksWaitingToReceive ) ) != pdFALSE )
13211334 {
13221335 /* The task waiting has a higher priority so
13231336 * record that a context switch is required. */
@@ -1345,7 +1358,7 @@ BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue,
13451358 {
13461359 if ( listLIST_IS_EMPTY ( & ( pxQueue -> xTasksWaitingToReceive ) ) == pdFALSE )
13471360 {
1348- if ( xTaskRemoveFromEventList ( & ( pxQueue -> xTasksWaitingToReceive ) ) != pdFALSE )
1361+ if ( xTaskRemoveFromEventListFromISR ( & ( pxQueue -> xTasksWaitingToReceive ) ) != pdFALSE )
13491362 {
13501363 /* The task waiting has a higher priority so record that a
13511364 * context switch is required. */
@@ -1468,7 +1481,7 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
14681481 {
14691482 if ( pxQueue -> pxQueueSetContainer != NULL )
14701483 {
1471- if ( prvNotifyQueueSetContainer ( pxQueue ) != pdFALSE )
1484+ if ( prvNotifyQueueSetContainerFromISR ( pxQueue ) != pdFALSE )
14721485 {
14731486 /* The semaphore is a member of a queue set, and
14741487 * posting to the queue set caused a higher priority
@@ -1491,7 +1504,7 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
14911504 {
14921505 if ( listLIST_IS_EMPTY ( & ( pxQueue -> xTasksWaitingToReceive ) ) == pdFALSE )
14931506 {
1494- if ( xTaskRemoveFromEventList ( & ( pxQueue -> xTasksWaitingToReceive ) ) != pdFALSE )
1507+ if ( xTaskRemoveFromEventListFromISR ( & ( pxQueue -> xTasksWaitingToReceive ) ) != pdFALSE )
14951508 {
14961509 /* The task waiting has a higher priority so
14971510 * record that a context switch is required. */
@@ -1519,7 +1532,7 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
15191532 {
15201533 if ( listLIST_IS_EMPTY ( & ( pxQueue -> xTasksWaitingToReceive ) ) == pdFALSE )
15211534 {
1522- if ( xTaskRemoveFromEventList ( & ( pxQueue -> xTasksWaitingToReceive ) ) != pdFALSE )
1535+ if ( xTaskRemoveFromEventListFromISR ( & ( pxQueue -> xTasksWaitingToReceive ) ) != pdFALSE )
15231536 {
15241537 /* The task waiting has a higher priority so record that a
15251538 * context switch is required. */
@@ -2111,7 +2124,7 @@ BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue,
21112124 {
21122125 if ( listLIST_IS_EMPTY ( & ( pxQueue -> xTasksWaitingToSend ) ) == pdFALSE )
21132126 {
2114- if ( xTaskRemoveFromEventList ( & ( pxQueue -> xTasksWaitingToSend ) ) != pdFALSE )
2127+ if ( xTaskRemoveFromEventListFromISR ( & ( pxQueue -> xTasksWaitingToSend ) ) != pdFALSE )
21152128 {
21162129 /* The task waiting has a higher priority than us so
21172130 * force a context switch. */
@@ -3354,6 +3367,19 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
33543367#if ( configUSE_QUEUE_SETS == 1 )
33553368
33563369 static BaseType_t prvNotifyQueueSetContainer ( const Queue_t * const pxQueue )
3370+ {
3371+ /* Call the generic version with xIsISR = pdFALSE to indicate task context */
3372+ return prvNotifyQueueSetContainerGeneric ( pxQueue , pdFALSE );
3373+ }
3374+
3375+ static BaseType_t prvNotifyQueueSetContainerFromISR ( const Queue_t * const pxQueue )
3376+ {
3377+ /* Call the generic version with xIsISR = pdTRUE to indicate ISR context */
3378+ return prvNotifyQueueSetContainerGeneric ( pxQueue , pdTRUE );
3379+ }
3380+
3381+ static BaseType_t prvNotifyQueueSetContainerGeneric ( const Queue_t * const pxQueue ,
3382+ const BaseType_t xIsISR )
33573383 {
33583384 Queue_t * pxQueueSetContainer = pxQueue -> pxQueueSetContainer ;
33593385 BaseType_t xReturn = pdFALSE ;
@@ -3379,7 +3405,18 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
33793405 {
33803406 if ( listLIST_IS_EMPTY ( & ( pxQueueSetContainer -> xTasksWaitingToReceive ) ) == pdFALSE )
33813407 {
3382- if ( xTaskRemoveFromEventList ( & ( pxQueueSetContainer -> xTasksWaitingToReceive ) ) != pdFALSE )
3408+ BaseType_t xHigherPriorityTaskWoken ;
3409+
3410+ if ( xIsISR == pdTRUE )
3411+ {
3412+ xHigherPriorityTaskWoken = xTaskRemoveFromEventListFromISR ( & ( pxQueueSetContainer -> xTasksWaitingToReceive ) );
3413+ }
3414+ else
3415+ {
3416+ xHigherPriorityTaskWoken = xTaskRemoveFromEventList ( & ( pxQueueSetContainer -> xTasksWaitingToReceive ) );
3417+ }
3418+
3419+ if ( xHigherPriorityTaskWoken != pdFALSE )
33833420 {
33843421 /* The task waiting has a higher priority. */
33853422 xReturn = pdTRUE ;
0 commit comments