@@ -222,7 +222,20 @@ static void prvCopyDataFromQueue( Queue_t * const pxQueue,
222
222
* the queue set that the queue contains data.
223
223
*/
224
224
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 ) */
226
239
227
240
/*
228
241
* Called after a Queue_t structure has been allocated either statically or
@@ -1294,7 +1307,7 @@ BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue,
1294
1307
* in the queue has not changed. */
1295
1308
mtCOVERAGE_TEST_MARKER ();
1296
1309
}
1297
- else if ( prvNotifyQueueSetContainer ( pxQueue ) != pdFALSE )
1310
+ else if ( prvNotifyQueueSetContainerFromISR ( pxQueue ) != pdFALSE )
1298
1311
{
1299
1312
/* The queue is a member of a queue set, and posting
1300
1313
* to the queue set caused a higher priority task to
@@ -1317,7 +1330,7 @@ BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue,
1317
1330
{
1318
1331
if ( listLIST_IS_EMPTY ( & ( pxQueue -> xTasksWaitingToReceive ) ) == pdFALSE )
1319
1332
{
1320
- if ( xTaskRemoveFromEventList ( & ( pxQueue -> xTasksWaitingToReceive ) ) != pdFALSE )
1333
+ if ( xTaskRemoveFromEventListFromISR ( & ( pxQueue -> xTasksWaitingToReceive ) ) != pdFALSE )
1321
1334
{
1322
1335
/* The task waiting has a higher priority so
1323
1336
* record that a context switch is required. */
@@ -1345,7 +1358,7 @@ BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue,
1345
1358
{
1346
1359
if ( listLIST_IS_EMPTY ( & ( pxQueue -> xTasksWaitingToReceive ) ) == pdFALSE )
1347
1360
{
1348
- if ( xTaskRemoveFromEventList ( & ( pxQueue -> xTasksWaitingToReceive ) ) != pdFALSE )
1361
+ if ( xTaskRemoveFromEventListFromISR ( & ( pxQueue -> xTasksWaitingToReceive ) ) != pdFALSE )
1349
1362
{
1350
1363
/* The task waiting has a higher priority so record that a
1351
1364
* context switch is required. */
@@ -1468,7 +1481,7 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
1468
1481
{
1469
1482
if ( pxQueue -> pxQueueSetContainer != NULL )
1470
1483
{
1471
- if ( prvNotifyQueueSetContainer ( pxQueue ) != pdFALSE )
1484
+ if ( prvNotifyQueueSetContainerFromISR ( pxQueue ) != pdFALSE )
1472
1485
{
1473
1486
/* The semaphore is a member of a queue set, and
1474
1487
* posting to the queue set caused a higher priority
@@ -1491,7 +1504,7 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
1491
1504
{
1492
1505
if ( listLIST_IS_EMPTY ( & ( pxQueue -> xTasksWaitingToReceive ) ) == pdFALSE )
1493
1506
{
1494
- if ( xTaskRemoveFromEventList ( & ( pxQueue -> xTasksWaitingToReceive ) ) != pdFALSE )
1507
+ if ( xTaskRemoveFromEventListFromISR ( & ( pxQueue -> xTasksWaitingToReceive ) ) != pdFALSE )
1495
1508
{
1496
1509
/* The task waiting has a higher priority so
1497
1510
* record that a context switch is required. */
@@ -1519,7 +1532,7 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
1519
1532
{
1520
1533
if ( listLIST_IS_EMPTY ( & ( pxQueue -> xTasksWaitingToReceive ) ) == pdFALSE )
1521
1534
{
1522
- if ( xTaskRemoveFromEventList ( & ( pxQueue -> xTasksWaitingToReceive ) ) != pdFALSE )
1535
+ if ( xTaskRemoveFromEventListFromISR ( & ( pxQueue -> xTasksWaitingToReceive ) ) != pdFALSE )
1523
1536
{
1524
1537
/* The task waiting has a higher priority so record that a
1525
1538
* context switch is required. */
@@ -2111,7 +2124,7 @@ BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue,
2111
2124
{
2112
2125
if ( listLIST_IS_EMPTY ( & ( pxQueue -> xTasksWaitingToSend ) ) == pdFALSE )
2113
2126
{
2114
- if ( xTaskRemoveFromEventList ( & ( pxQueue -> xTasksWaitingToSend ) ) != pdFALSE )
2127
+ if ( xTaskRemoveFromEventListFromISR ( & ( pxQueue -> xTasksWaitingToSend ) ) != pdFALSE )
2115
2128
{
2116
2129
/* The task waiting has a higher priority than us so
2117
2130
* force a context switch. */
@@ -3354,6 +3367,19 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
3354
3367
#if ( configUSE_QUEUE_SETS == 1 )
3355
3368
3356
3369
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 )
3357
3383
{
3358
3384
Queue_t * pxQueueSetContainer = pxQueue -> pxQueueSetContainer ;
3359
3385
BaseType_t xReturn = pdFALSE ;
@@ -3379,7 +3405,18 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
3379
3405
{
3380
3406
if ( listLIST_IS_EMPTY ( & ( pxQueueSetContainer -> xTasksWaitingToReceive ) ) == pdFALSE )
3381
3407
{
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 )
3383
3420
{
3384
3421
/* The task waiting has a higher priority. */
3385
3422
xReturn = pdTRUE ;
0 commit comments