#include "flop.h"\r
#include "TimerDemo.h"\r
#include "countsem.h"\r
+#include "death.h"\r
+#include "dynamic.h"\r
\r
/* Priorities at which the tasks are created. */\r
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )\r
/* The variable into which error messages are latched. */\r
static char *pcStatusMessage = "OK";\r
\r
-/* This semaphore is created purely to test using the vSemaphoreDelete() API\r
-function. It has no other purpose. */\r
-static xSemaphoreHandle xSemaphoreToDelete = NULL;\r
+/* This semaphore is created purely to test using the vSemaphoreDelete() and\r
+semaphore tracing API functions. It has no other purpose. */\r
+static xSemaphoreHandle xMutexToDelete = NULL;\r
\r
/*-----------------------------------------------------------*/\r
\r
vStartRecursiveMutexTasks();\r
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
vStartCountingSemaphoreTasks();\r
+ vStartDynamicPriorityTasks();\r
+\r
+ /* The suicide tasks must be created last as they need to know how many\r
+ tasks were running prior to their creation. This then allows them to \r
+ ascertain whether or not the correct/expected number of tasks are running at \r
+ any given time. */\r
+ vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
\r
/* Create the semaphore that will be deleted in the idle task hook. This\r
is done purely to test the use of vSemaphoreDelete(). */\r
- xSemaphoreToDelete = xSemaphoreCreateMutex();\r
+ xMutexToDelete = xSemaphoreCreateMutex();\r
\r
/* Start the scheduler itself. */\r
vTaskStartScheduler();\r
{\r
pcStatusMessage = "Error: CountSem";\r
}\r
+ else if( xIsCreateTaskStillRunning() != pdTRUE )\r
+ {\r
+ pcStatusMessage = "Error: Death";\r
+ }\r
+ else if( xAreDynamicPriorityTasksStillRunning() != pdPASS )\r
+ {\r
+ pcStatusMessage = "Error: Dynamic\r\n";\r
+ }\r
\r
/* This is the only task that uses stdout so its ok to call printf() \r
directly. */\r
const unsigned long ulMSToSleep = 5;\r
xTaskHandle xIdleTaskHandle, xTimerTaskHandle;\r
signed char *pcTaskName;\r
+const unsigned char ucConstQueueNumber = 0xaaU, ucConstTaskNumber = 0x55U;\r
+\r
+/* These three functions are only meant for use by trace code, and not for\r
+direct use from application code, hence their prototypes are not in queue.h. */\r
+extern void vQueueSetQueueNumber( xQueueHandle pxQueue, unsigned char ucQueueNumber );\r
+extern unsigned char ucQueueGetQueueNumber( xQueueHandle pxQueue );\r
+extern unsigned char ucQueueGetQueueType( xQueueHandle pxQueue );\r
+extern void vTaskSetTaskNumber( xTaskHandle xTask, unsigned portBASE_TYPE uxHandle );\r
+extern unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask );\r
\r
/* Sleep to reduce CPU load, but don't sleep indefinitely in case there are\r
tasks waiting to be terminated by the idle task. */\r
Sleep( ulMSToSleep );\r
\r
/* Demonstrate the use of the xTimerGetTimerDaemonTaskHandle() and \r
- xTaskGetIdleTaskHandle() functions. */\r
+ xTaskGetIdleTaskHandle() functions. Also try using the function that sets\r
+ the task number. */\r
xIdleTaskHandle = xTaskGetIdleTaskHandle();\r
xTimerTaskHandle = xTimerGetTimerDaemonTaskHandle();\r
+ vTaskSetTaskNumber( xIdleTaskHandle, ( unsigned long ) ucConstTaskNumber );\r
+ configASSERT( uxTaskGetTaskNumber( xIdleTaskHandle ) == ucConstTaskNumber );\r
\r
/* This is the idle hook, so the current task handle should equal the \r
returned idle task handle. */\r
pcStatusMessage = "Error: Returned timer task handle was incorrect";\r
}\r
\r
- /* If xSemaphoreToDelete has not already been deleted, then delete it now.\r
+ /* If xMutexToDelete has not already been deleted, then delete it now.\r
This is done purely to demonstrate the use of, and test, the \r
vSemaphoreDelete() macro. Care must be taken not to delete a semaphore\r
that has tasks blocked on it. */\r
- if( xSemaphoreToDelete != NULL )\r
+ if( xMutexToDelete != NULL )\r
{\r
- vSemaphoreDelete( xSemaphoreToDelete );\r
- xSemaphoreToDelete = NULL;\r
+ /* Before deleting the semaphore, test the function used to set its\r
+ number. This would normally only be done from trace software, rather\r
+ than application code. */\r
+ vQueueSetQueueNumber( xMutexToDelete, ucConstQueueNumber );\r
+\r
+ /* Before deleting the semaphore, test the functions used to get its\r
+ type and number. Again, these would normally only be done from trace\r
+ software, rather than application code. */\r
+ configASSERT( ucQueueGetQueueNumber( xMutexToDelete ) == ucConstQueueNumber );\r
+ configASSERT( ucQueueGetQueueType( xMutexToDelete ) == queueQUEUE_TYPE_MUTEX );\r
+ vSemaphoreDelete( xMutexToDelete );\r
+ xMutexToDelete = NULL;\r
}\r
}\r
/*-----------------------------------------------------------*/\r