@@ -299,11 +299,11 @@ typedef enum
299
299
{ \
300
300
const BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID (); \
301
301
/* Task spinlock is always taken first */ \
302
- portGET_SPINLOCK ( xCoreID , ( portSPINLOCK_TYPE * ) pxTaskSpinlock ); \
302
+ portGET_SPINLOCK ( xCoreID , ( portSPINLOCK_TYPE * ) ( pxTaskSpinlock ) ); \
303
303
/* Disable interrupts */ \
304
304
portDISABLE_INTERRUPTS (); \
305
305
/* Take the ISR spinlock next */ \
306
- portGET_SPINLOCK ( xCoreID , ( portSPINLOCK_TYPE * ) pxISRSpinlock ); \
306
+ portGET_SPINLOCK ( xCoreID , ( portSPINLOCK_TYPE * ) ( pxISRSpinlock ) ); \
307
307
/* Increment the critical nesting count */ \
308
308
portINCREMENT_CRITICAL_NESTING_COUNT ( xCoreID ); \
309
309
} \
@@ -322,11 +322,13 @@ typedef enum
322
322
#define taskDATA_GROUP_ENTER_CRITICAL_FROM_ISR ( pxISRSpinlock , puxSavedInterruptStatus ) \
323
323
do { \
324
324
*( puxSavedInterruptStatus ) = portSET_INTERRUPT_MASK_FROM_ISR(); \
325
- const BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID(); \
326
- /* Take the ISR spinlock */ \
327
- portGET_SPINLOCK ( xCoreID , ( portSPINLOCK_TYPE * ) pxISRSpinlock ); \
328
- /* Increment the critical nesting count */ \
329
- portINCREMENT_CRITICAL_NESTING_COUNT ( xCoreID ); \
325
+ { \
326
+ const BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID(); \
327
+ /* Take the ISR spinlock */ \
328
+ portGET_SPINLOCK ( xCoreID , ( portSPINLOCK_TYPE * ) ( pxISRSpinlock ) ); \
329
+ /* Increment the critical nesting count */ \
330
+ portINCREMENT_CRITICAL_NESTING_COUNT ( xCoreID ); \
331
+ } \
330
332
} while ( 0 )
331
333
#endif /* #if ( portUSING_GRANULAR_LOCKS == 1 ) */
332
334
@@ -339,27 +341,27 @@ typedef enum
339
341
* \ingroup GranularLocks
340
342
*/
341
343
#if ( portUSING_GRANULAR_LOCKS == 1 )
342
- #define taskDATA_GROUP_EXIT_CRITICAL ( pxTaskSpinlock , pxISRSpinlock ) \
343
- do { \
344
- const BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID(); \
345
- configASSERT( portGET_CRITICAL_NESTING_COUNT( xCoreID ) > 0U ); \
346
- /* Release the ISR spinlock */ \
347
- portRELEASE_SPINLOCK ( xCoreID , ( portSPINLOCK_TYPE * ) pxISRSpinlock ); \
348
- /* Release the task spinlock */ \
349
- portRELEASE_SPINLOCK ( xCoreID , ( portSPINLOCK_TYPE * ) pxTaskSpinlock ); \
350
- /* Decrement the critical nesting count */ \
351
- portDECREMENT_CRITICAL_NESTING_COUNT ( xCoreID ); \
352
- /* Enable interrupts only if the critical nesting count is 0 */ \
353
- if ( portGET_CRITICAL_NESTING_COUNT ( xCoreID ) == 0 ) \
354
- { \
355
- portENABLE_INTERRUPTS (); \
356
- } \
357
- else \
358
- { \
359
- mtCOVERAGE_TEST_MARKER (); \
360
- } \
361
- /* Re-enable preemption */ \
362
- vTaskPreemptionEnable ( NULL ); \
344
+ #define taskDATA_GROUP_EXIT_CRITICAL ( pxTaskSpinlock , pxISRSpinlock ) \
345
+ do { \
346
+ const BaseType_t xCoreID = ( BaseType_t ) portGET_CORE_ID(); \
347
+ configASSERT( portGET_CRITICAL_NESTING_COUNT( xCoreID ) > 0U ); \
348
+ /* Release the ISR spinlock */ \
349
+ portRELEASE_SPINLOCK ( xCoreID , ( portSPINLOCK_TYPE * ) ( pxISRSpinlock ) ); \
350
+ /* Release the task spinlock */ \
351
+ portRELEASE_SPINLOCK ( xCoreID , ( portSPINLOCK_TYPE * ) ( pxTaskSpinlock ) ); \
352
+ /* Decrement the critical nesting count */ \
353
+ portDECREMENT_CRITICAL_NESTING_COUNT ( xCoreID ); \
354
+ /* Enable interrupts only if the critical nesting count is 0 */ \
355
+ if ( portGET_CRITICAL_NESTING_COUNT ( xCoreID ) == 0 ) \
356
+ { \
357
+ portENABLE_INTERRUPTS (); \
358
+ } \
359
+ else \
360
+ { \
361
+ mtCOVERAGE_TEST_MARKER (); \
362
+ } \
363
+ /* Re-enable preemption */ \
364
+ vTaskPreemptionEnable ( NULL ); \
363
365
} while ( 0 )
364
366
#endif /* #if ( portUSING_GRANULAR_LOCKS == 1 ) */
365
367
@@ -379,14 +381,52 @@ typedef enum
379
381
/* Decrement the critical nesting count */ \
380
382
portDECREMENT_CRITICAL_NESTING_COUNT ( xCoreID ); \
381
383
/* Release the ISR spinlock */ \
382
- portRELEASE_SPINLOCK ( xCoreID , ( portSPINLOCK_TYPE * ) pxISRSpinlock ); \
384
+ portRELEASE_SPINLOCK ( xCoreID , ( portSPINLOCK_TYPE * ) ( pxISRSpinlock ) ); \
383
385
if ( portGET_CRITICAL_NESTING_COUNT ( xCoreID ) == 0 ) \
384
386
{ \
385
387
portCLEAR_INTERRUPT_MASK_FROM_ISR ( uxSavedInterruptStatus ); \
386
388
} \
387
389
} while ( 0 )
388
390
#endif /* #if ( portUSING_GRANULAR_LOCKS == 1 ) */
389
391
392
+ /**
393
+ * task. h
394
+ *
395
+ * Macros to lock a data group (task-level lock only).
396
+ *
397
+ * \defgroup taskDATA_GROUP_LOCK taskDATA_GROUP_LOCK
398
+ * \ingroup GranularLocks
399
+ */
400
+ #if ( portUSING_GRANULAR_LOCKS == 1 )
401
+ #define taskDATA_GROUP_LOCK ( pxTaskSpinlock ) \
402
+ do { \
403
+ /* Disable preemption while holding the task spinlock. */ \
404
+ vTaskPreemptionDisable ( NULL ); \
405
+ { \
406
+ portGET_SPINLOCK ( portGET_CORE_ID (), ( portSPINLOCK_TYPE * ) ( pxTaskSpinlock ) ); \
407
+ } \
408
+ } while ( 0 )
409
+ #endif /* #if ( portUSING_GRANULAR_LOCKS == 1 ) */
410
+
411
+ /**
412
+ * task. h
413
+ *
414
+ * Macros to unlock a data group (task-level lock only).
415
+ *
416
+ * \defgroup taskDATA_GROUP_UNLOCK taskDATA_GROUP_UNLOCK
417
+ * \ingroup GranularLocks
418
+ */
419
+ #if ( portUSING_GRANULAR_LOCKS == 1 )
420
+ #define taskDATA_GROUP_UNLOCK ( pxTaskSpinlock ) \
421
+ do { \
422
+ { \
423
+ portRELEASE_SPINLOCK( portGET_CORE_ID(), ( portSPINLOCK_TYPE * ) ( pxTaskSpinlock ) ); \
424
+ } \
425
+ /* Re-enable preemption after releasing the task spinlock. */ \
426
+ vTaskPreemptionEnable ( NULL ); \
427
+ } while ( 0 )
428
+ #endif /* #if ( portUSING_GRANULAR_LOCKS == 1 ) */
429
+
390
430
/*-----------------------------------------------------------
391
431
* TASK CREATION API
392
432
*----------------------------------------------------------*/
0 commit comments