From 1312fada7c2e1122ad0815caee3d77a38e5b13a3 Mon Sep 17 00:00:00 2001 From: Richard Barry Date: Mon, 2 Apr 2012 20:06:52 +0000 Subject: [PATCH] Added traceMOVED_TASK_TO_READY_STATE and portSETUP_TCB macros. Changed uxTCBNumber back to uxTaskNumber in tasks.c to fix IAR plug-in. --- Source/include/FreeRTOS.h | 8 ++++++++ Source/tasks.c | 13 ++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Source/include/FreeRTOS.h b/Source/include/FreeRTOS.h index 9aa736a44..42333497d 100644 --- a/Source/include/FreeRTOS.h +++ b/Source/include/FreeRTOS.h @@ -234,6 +234,10 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * ); #define portCLEAN_UP_TCB( pxTCB ) ( void ) pxTCB #endif +#ifndef portSETUP_TCB + #define portSETUP_TCB( pxTCB ) ( void ) pxTCB +#endif + #ifndef configQUEUE_REGISTRY_SIZE #define configQUEUE_REGISTRY_SIZE 0U #endif @@ -311,6 +315,10 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * ); /* The following event macros are embedded in the kernel API calls. */ +#ifndef traceMOVED_TASK_TO_READY_STATE + #define traceMOVED_TASK_TO_READY_STATE( pxTCB ) +#endif + #ifndef traceQUEUE_CREATE #define traceQUEUE_CREATE( pxNewQueue ) #endif diff --git a/Source/tasks.c b/Source/tasks.c index 2a2e68acb..4d309ba85 100644 --- a/Source/tasks.c +++ b/Source/tasks.c @@ -168,7 +168,7 @@ PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxSchedulerSuspended = PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxMissedTicks = ( unsigned portBASE_TYPE ) 0U; PRIVILEGED_DATA static volatile portBASE_TYPE xMissedYield = ( portBASE_TYPE ) pdFALSE; PRIVILEGED_DATA static volatile portBASE_TYPE xNumOfOverflows = ( portBASE_TYPE ) 0; -PRIVILEGED_DATA static unsigned portBASE_TYPE uxTCBNumber = ( unsigned portBASE_TYPE ) 0U; +PRIVILEGED_DATA static unsigned portBASE_TYPE uxTaskNumber = ( unsigned portBASE_TYPE ) 0U; PRIVILEGED_DATA static portTickType xNextTaskUnblockTime = ( portTickType ) portMAX_DELAY; #if ( configGENERATE_RUN_TIME_STATS == 1 ) @@ -205,6 +205,7 @@ PRIVILEGED_DATA static portTickType xNextTaskUnblockTime = ( portTickType ) * executing task has been rescheduled. */ #define prvAddTaskToReadyQueue( pxTCB ) \ + traceMOVED_TASK_TO_READY_STATE( pxTCB ) \ if( ( pxTCB )->uxPriority > uxTopReadyPriority ) \ { \ uxTopReadyPriority = ( pxTCB )->uxPriority; \ @@ -506,14 +507,15 @@ tskTCB * pxNewTCB; #if ( configUSE_TRACE_FACILITY == 1 ) { /* Add a counter into the TCB for tracing only. */ - pxNewTCB->uxTCBNumber = uxTCBNumber; + pxNewTCB->uxTCBNumber = uxTaskNumber; } #endif - uxTCBNumber++; + uxTaskNumber++; prvAddTaskToReadyQueue( pxNewTCB ); xReturn = pdPASS; + portSETUP_TCB( pxNewTCB ); traceTASK_CREATE( pxNewTCB ); } taskEXIT_CRITICAL(); @@ -580,7 +582,7 @@ tskTCB * pxNewTCB; /* Increment the uxTaskNumberVariable also so kernel aware debuggers can detect that the task lists need re-generating. */ - uxTCBNumber++; + uxTaskNumber++; traceTASK_DELETE( pxTCB ); } @@ -2300,7 +2302,8 @@ tskTCB *pxNewTCB; static void prvDeleteTCB( tskTCB *pxTCB ) { /* This call is required specifically for the TriCore port. It must be - above the vPortFree() calls. */ + above the vPortFree() calls. The call is also used by ports/demos that + want to allocate and clean RAM statically. */ portCLEAN_UP_TCB( pxTCB ); /* Free up the memory allocated by the scheduler for the task. It is up to