|
72 | 72 |
|
73 | 73 | /*-----------------------------------------------------------*/
|
74 | 74 |
|
| 75 | +/* |
| 76 | + * When the port is using granular locks, the critical sections are replaced |
| 77 | + * with the granular lock API. |
| 78 | + */ |
| 79 | + #if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) |
| 80 | + #undef taskENTER_CRITICAL |
| 81 | + #undef taskEXIT_CRITICAL |
| 82 | + #undef taskENTER_CRITICAL_FROM_ISR |
| 83 | + #undef taskEXIT_CRITICAL_FROM_ISR |
| 84 | + |
| 85 | + #define taskENTER_CRITICAL() taskLOCK_DATA_GROUP( &( pxEventBits->xTaskSpinlock ), &( pxEventBits->xISRSpinlock ) ) |
| 86 | + #define taskEXIT_CRITICAL() taskUNLOCK_DATA_GROUP( &( pxEventBits->xTaskSpinlock ), &( pxEventBits->xISRSpinlock ) ) |
| 87 | + #define taskENTER_CRITICAL_FROM_ISR() taskLOCK_DATA_GROUP_FROM_ISR( &( pxEventBits->xISRSpinlock ) ) |
| 88 | + #define taskEXIT_CRITICAL_FROM_ISR( x ) taskUNLOCK_DATA_GROUP_FROM_ISR( x, &( pxEventBits->xISRSpinlock ) ) |
| 89 | + #endif /* #if ( ( portUSING_GRANULAR_LOCKS == 1 ) && ( configNUMBER_OF_CORES > 1 ) ) */ |
| 90 | + |
75 | 91 | /*
|
76 | 92 | * Suspends an event group. Prevents other tasks from accessing the queue but allows
|
77 | 93 | * ISRs to pend access to the queue. Caller cannot be preempted by other tasks
|
|
327 | 343 | if( ( uxReturn & eventUNBLOCKED_DUE_TO_BIT_SET ) == ( EventBits_t ) 0 )
|
328 | 344 | {
|
329 | 345 | /* The task timed out, just return the current event bit value. */
|
330 |
| - taskLOCK_DATA_GROUP( &( pxEventBits->xTaskSpinlock ), &( pxEventBits->xISRSpinlock ) ); |
| 346 | + taskENTER_CRITICAL(); |
331 | 347 | {
|
332 | 348 | uxReturn = pxEventBits->uxEventBits;
|
333 | 349 |
|
|
344 | 360 | mtCOVERAGE_TEST_MARKER();
|
345 | 361 | }
|
346 | 362 | }
|
347 |
| - taskUNLOCK_DATA_GROUP( &( pxEventBits->xTaskSpinlock ), &( pxEventBits->xISRSpinlock ) ); |
| 363 | + taskEXIT_CRITICAL(); |
348 | 364 |
|
349 | 365 | xTimeoutOccurred = pdTRUE;
|
350 | 366 | }
|
|
482 | 498 |
|
483 | 499 | if( ( uxReturn & eventUNBLOCKED_DUE_TO_BIT_SET ) == ( EventBits_t ) 0 )
|
484 | 500 | {
|
485 |
| - taskLOCK_DATA_GROUP( &( pxEventBits->xTaskSpinlock ), &( pxEventBits->xISRSpinlock ) ); |
| 501 | + taskENTER_CRITICAL(); |
486 | 502 | {
|
487 | 503 | /* The task timed out, just return the current event bit value. */
|
488 | 504 | uxReturn = pxEventBits->uxEventBits;
|
|
507 | 523 |
|
508 | 524 | xTimeoutOccurred = pdTRUE;
|
509 | 525 | }
|
510 |
| - taskUNLOCK_DATA_GROUP( &( pxEventBits->xTaskSpinlock ), &( pxEventBits->xISRSpinlock ) ); |
| 526 | + taskEXIT_CRITICAL(); |
511 | 527 | }
|
512 | 528 | else
|
513 | 529 | {
|
|
542 | 558 | configASSERT( xEventGroup );
|
543 | 559 | configASSERT( ( uxBitsToClear & eventEVENT_BITS_CONTROL_BYTES ) == 0 );
|
544 | 560 |
|
545 |
| - taskLOCK_DATA_GROUP( &( pxEventBits->xTaskSpinlock ), &( pxEventBits->xISRSpinlock ) ); |
| 561 | + taskENTER_CRITICAL(); |
546 | 562 | {
|
547 | 563 | traceEVENT_GROUP_CLEAR_BITS( xEventGroup, uxBitsToClear );
|
548 | 564 |
|
|
553 | 569 | /* Clear the bits. */
|
554 | 570 | pxEventBits->uxEventBits &= ~uxBitsToClear;
|
555 | 571 | }
|
556 |
| - taskUNLOCK_DATA_GROUP( &( pxEventBits->xTaskSpinlock ), &( pxEventBits->xISRSpinlock ) ); |
| 572 | + taskEXIT_CRITICAL(); |
557 | 573 |
|
558 | 574 | traceRETURN_xEventGroupClearBits( uxReturn );
|
559 | 575 |
|
|
592 | 608 | /* MISRA Ref 4.7.1 [Return value shall be checked] */
|
593 | 609 | /* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#dir-47 */
|
594 | 610 | /* coverity[misra_c_2012_directive_4_7_violation] */
|
595 |
| - uxSavedInterruptStatus = taskLOCK_DATA_GROUP_FROM_ISR( &( pxEventBits->xISRSpinlock ) ); |
| 611 | + uxSavedInterruptStatus = taskENTER_CRITICAL_FROM_ISR(); |
596 | 612 | {
|
597 | 613 | uxReturn = pxEventBits->uxEventBits;
|
598 | 614 | }
|
599 |
| - taskUNLOCK_DATA_GROUP_FROM_ISR( uxSavedInterruptStatus, &( pxEventBits->xISRSpinlock ) ); |
| 615 | + taskEXIT_CRITICAL_FROM_ISR( uxSavedInterruptStatus ); |
600 | 616 |
|
601 | 617 | traceRETURN_xEventGroupGetBitsFromISR( uxReturn );
|
602 | 618 |
|
|
0 commit comments