]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS-Plus/Demo/FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator/main.c
Update the FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator demo to use the latest...
[freertos] / FreeRTOS-Plus / Demo / FreeRTOS_Plus_CLI_with_Trace_Windows_Simulator / main.c
index dccaf0e1bddeefe9b8ebd9c9ffd97876704a45dd..e6d919dbce5cb8af4d30643f64594257e9a9c239 100644 (file)
@@ -84,6 +84,9 @@
  * meaningful units.  See the documentation page for the Windows simulator for\r
  * an explanation of the slow timing:\r
  * http://www.freertos.org/FreeRTOS-Windows-Simulator-Emulator-for-Visual-Studio-and-Eclipse-MingW.html\r
+ *\r
+ * Documentation for this demo can be found on:\r
+ * http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_Trace/Free_RTOS_Plus_Trace_CLI_Example.shtml\r
  ******************************************************************************\r
  *\r
  * This is a simple FreeRTOS Windows simulator project that makes it easy to\r
  * the screen before returning to block on the queue once again.  This\r
  * sequencing is clearly visible in the recorded FreeRTOS+Trace data.\r
  *\r
- * Finally, a trace monitoring task is also created that prints out a message\r
- * when it determines that the status of the trace has changed since it last\r
- * executed.  It prints out a message when the trace has started, when the\r
- * trace has stopped, and periodically when the trace is executing.\r
- *\r
  */\r
 \r
 /* Standard includes. */\r
@@ -167,12 +165,23 @@ extern void vRegisterCLICommands( void );
 /* The queue used by both tasks. */\r
 static xQueueHandle xQueue = NULL;\r
 \r
+/* The user trace event posted to the trace recording on each tick interrupt.\r
+Note tick events will not appear in the trace recording with regular period\r
+because this project runs in a Windows simulator, and does not therefore\r
+exhibit deterministic behaviour. */\r
+traceLabel xTickTraceUserEvent;\r
+\r
 /*-----------------------------------------------------------*/\r
 \r
 int main( void )\r
 {\r
 const uint32_t ulLongTime_ms = 250UL;\r
 \r
+       /* Initialise the trace recorder and create the label used to post user\r
+       events to the trace recording on each tick interrupt. */\r
+       vTraceInitTraceData();\r
+       xTickTraceUserEvent = xTraceOpenLabel( "tick" );\r
+\r
        /* Create the queue used to pass messages from the queue send task to the\r
        queue receive task. */\r
        xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) );\r
@@ -195,10 +204,6 @@ const uint32_t ulLongTime_ms = 250UL;
        is set using the configUDP_CLI_PORT_NUMBER setting in FreeRTOSConfig.h. */\r
        xTaskCreate( vUDPCommandInterpreterTask, ( signed char * ) "CLI", configMINIMAL_STACK_SIZE, NULL, mainUDP_CLI_TASK_PRIORITY, NULL );\r
 \r
-       /* Create the task that monitors the trace recording status, printing\r
-       periodic information to the display. */\r
-       vTraceStartStatusMonitor();\r
-\r
        /* Register commands with the FreeRTOS+CLI command interpreter. */\r
        vRegisterCLICommands();\r
 \r
@@ -294,3 +299,12 @@ const unsigned long ulLongSleep = 1000UL;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
+void vApplicationTickHook( void )\r
+{\r
+       /* Write a user event to the trace log.  \r
+       Note tick events will not appear in the trace recording with regular period\r
+       because this project runs in a Windows simulator, and does not therefore\r
+       exhibit deterministic behaviour. */\r
+       vTraceUserEvent( xTickTraceUserEvent );                                 \r
+}\r
+\r