pdTASK_HOOK_CODE MPU_xTaskGetApplicationTaskTag( xTaskHandle xTask ) { pdTASK_HOOK_CODE xReturn; portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); xReturn = xTaskGetApplicationTaskTag( xTask ); portRESET_PRIVILEGE( xRunningPrivileged ); return xReturn; }
TaskHookFunction_t MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask ) { TaskHookFunction_t xReturn; BaseType_t xRunningPrivileged = prvRaisePrivilege(); xReturn = xTaskGetApplicationTaskTag( xTask ); portRESET_PRIVILEGE( xRunningPrivileged ); return xReturn; }
TaskHookFunction_t MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask ) { TaskHookFunction_t xReturn; BaseType_t xRunningPrivileged = xPortRaisePrivilege(); xReturn = xTaskGetApplicationTaskTag( xTask ); vPortResetPrivilege( xRunningPrivileged ); return xReturn; }
static void vErrorChecks( void *pvParameters ) { portTickType xExpectedWakeTime; const portTickType xPrintRate = ( portTickType ) 5000 / portTICK_RATE_MS; const long lMaxAllowableTimeDifference = ( long ) 0; portTickType xWakeTime; long lTimeDifference; const char *pcReceivedMessage; const char * const pcTaskBlockedTooLongMsg = "Print task blocked too long!\r\n"; const char * const pcUnexpectedHookValueMsg = "Task hook has unexpected value!\r\n"; ( void ) pvParameters; /* Register our callback function. */ vTaskSetApplicationTaskTag( NULL, prvExampleTaskHook ); /* Just for test purposes. */ if( xTaskGetApplicationTaskTag( NULL ) != prvExampleTaskHook ) { vPrintDisplayMessage( &pcUnexpectedHookValueMsg ); } /* Loop continuously, blocking, then checking all the other tasks are still running, before blocking once again. This task blocks on the queue of messages that require displaying so will wake either by its time out expiring, or a message becoming available. */ for( ;; ) { /* Calculate the time we will unblock if no messages are received on the queue. This is used to check that we have not blocked for too long. */ xExpectedWakeTime = xTaskGetTickCount(); xExpectedWakeTime += xPrintRate; /* Block waiting for either a time out or a message to be posted that required displaying. */ pcReceivedMessage = pcPrintGetNextMessage( xPrintRate ); /* Was a message received? */ if( pcReceivedMessage == NULL ) { /* A message was not received so we timed out, did we unblock at the expected time? */ xWakeTime = xTaskGetTickCount(); /* Calculate the difference between the time we unblocked and the time we should have unblocked. */ if( xWakeTime > xExpectedWakeTime ) { lTimeDifference = ( long ) ( xWakeTime - xExpectedWakeTime ); } else { lTimeDifference = ( long ) ( xExpectedWakeTime - xWakeTime ); } if( lTimeDifference > lMaxAllowableTimeDifference ) { /* We blocked too long - create a message that will get printed out the next time around. If we are not using preemption then we won't expect the timing to be so accurate. */ if( sUsingPreemption == pdTRUE ) { vPrintDisplayMessage( &pcTaskBlockedTooLongMsg ); } } /* Check the other tasks are still running, just in case. */ prvCheckOtherTasksAreStillRunning(); } else { /* We unblocked due to a message becoming available. Send the message for printing. */ vDisplayMessage( pcReceivedMessage ); } /* Key presses are used to invoke the trace visualisation utility, or end the program. */ prvCheckForKeyPresses(); } }
void *BT_kGetThreadTag(void *pThreadID) { return xTaskGetApplicationTaskTag((xTaskHandle) pThreadID); }
void* OsThreadTls() { return xTaskGetApplicationTaskTag(NULL); }