/* Called from vApplicationIdleHook(), which is defined in main.c. */ void vFullDemoIdleFunction( void ) { const unsigned long ulMSToSleep = 15; const unsigned char ucConstQueueNumber = 0xaaU; void *pvAllocated; /* These three functions are only meant for use by trace code, and not for direct use from application code, hence their prototypes are not in queue.h. */ extern void vQueueSetQueueNumber( xQueueHandle pxQueue, unsigned char ucQueueNumber ); extern unsigned char ucQueueGetQueueNumber( xQueueHandle pxQueue ); extern unsigned char ucQueueGetQueueType( xQueueHandle pxQueue ); extern void vTaskSetTaskNumber( xTaskHandle xTask, unsigned portBASE_TYPE uxHandle ); extern unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask ); /* Sleep to reduce CPU load, but don't sleep indefinitely in case there are tasks waiting to be terminated by the idle task. */ Sleep( ulMSToSleep ); /* Demonstrate a few utility functions that are not demonstrated by any of the standard demo tasks. */ prvDemonstrateTaskStateAndHandleGetFunctions(); /* If xMutexToDelete has not already been deleted, then delete it now. This is done purely to demonstrate the use of, and test, the vSemaphoreDelete() macro. Care must be taken not to delete a semaphore that has tasks blocked on it. */ if( xMutexToDelete != NULL ) { /* Before deleting the semaphore, test the function used to set its number. This would normally only be done from trace software, rather than application code. */ vQueueSetQueueNumber( xMutexToDelete, ucConstQueueNumber ); /* Before deleting the semaphore, test the functions used to get its type and number. Again, these would normally only be done from trace software, rather than application code. */ configASSERT( ucQueueGetQueueNumber( xMutexToDelete ) == ucConstQueueNumber ); configASSERT( ucQueueGetQueueType( xMutexToDelete ) == queueQUEUE_TYPE_MUTEX ); vSemaphoreDelete( xMutexToDelete ); xMutexToDelete = NULL; } /* Exercise heap_4 a bit. The malloc failed hook will trap failed allocations so there is no need to test here. */ pvAllocated = pvPortMalloc( ( rand() % 100 ) + 1 ); vPortFree( pvAllocated ); }
objectHandleType prvTraceGetObjectNumber(void* handle) { return (objectHandleType) ucQueueGetQueueNumber(handle); }
traceHandle prvTraceGetObjectNumber(void* handle) { return (traceHandle) ucQueueGetQueueNumber(handle); }
uint32_t prvTraceGetQueueNumber(void* handle) { return (uint32_t)ucQueueGetQueueNumber(handle); }