#define configUSE_ALTERNATIVE_API 0\r
#endif\r
\r
+#ifndef portCRITICAL_NESTING_IN_TCB\r
+ #define portCRITICAL_NESTING_IN_TCB 0\r
+#endif\r
+\r
#if ( configUSE_MUTEXES == 1 )\r
/* xTaskGetCurrentTaskHandle is used by the priority inheritance mechanism\r
within the mutex implementation so must be available if mutexes are used. */\r
portSTACK_TYPE *pxStack; /*< Points to the start of the stack. */\r
signed portCHAR pcTaskName[ configMAX_TASK_NAME_LEN ];/*< Descriptive name given to the task when created. Facilitates debugging only. */\r
\r
+ #if ( portCRITICAL_NESTING_IN_TCB == 1 )\r
+ unsigned portBASE_TYPE uxCriticalNesting;\r
+ #endif\r
+\r
#if ( configUSE_TRACE_FACILITY == 1 )\r
unsigned portBASE_TYPE uxTCBNumber; /*< This is used for tracing the scheduler and making debugging easier only. */\r
#endif \r
strncpy( ( char * ) pxTCB->pcTaskName, ( const char * ) pcName, ( unsigned portSHORT ) configMAX_TASK_NAME_LEN );\r
pxTCB->pcTaskName[ ( unsigned portSHORT ) configMAX_TASK_NAME_LEN - ( unsigned portSHORT ) 1 ] = '\0';\r
\r
+ #if ( portCRITICAL_NESTING_IN_TCB == 1 )\r
+ {\r
+ pxTCB->uxCriticalNesting = ( unsigned portBASE_TYPE ) 0;\r
+ }\r
+ #endif\r
+\r
/* This is used as an array index so must ensure it's not too large. */\r
if( uxPriority >= configMAX_PRIORITIES )\r
{\r
}\r
\r
#endif\r
+/*-----------------------------------------------------------*/\r
\r
#if ( configUSE_MUTEXES == 1 )\r
\r
}\r
\r
#endif\r
+/*-----------------------------------------------------------*/\r
\r
#if ( configUSE_MUTEXES == 1 ) \r
\r
}\r
\r
#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( portCRITICAL_NESTING_IN_TCB == 1 )\r
+\r
+ void vTaskEnterCritical( void )\r
+ {\r
+ portDISABLE_INTERRUPTS();\r
+\r
+ if( xSchedulerRunning != pdFALSE )\r
+ {\r
+ pxCurrentTCB->uxCriticalNesting++;\r
+ }\r
+ }\r
+\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( portCRITICAL_NESTING_IN_TCB == 1 )\r
+\r
+void vTaskExitCritical( void )\r
+{\r
+ if( xSchedulerRunning != pdFALSE )\r
+ {\r
+ if( pxCurrentTCB->uxCriticalNesting > 0 )\r
+ {\r
+ pxCurrentTCB->uxCriticalNesting--;\r
+\r
+ if( pxCurrentTCB->uxCriticalNesting == 0 )\r
+ {\r
+ portENABLE_INTERRUPTS();\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+#endif\r
+/*-----------------------------------------------------------*/\r
\r
- \r
\r
\r
\r