]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/SuperH_SH7216_Renesas/RTOSDemo/main.c
Update license information text files for the CLI, TCP and UDP products to be correct...
[freertos] / FreeRTOS / Demo / SuperH_SH7216_Renesas / RTOSDemo / main.c
1 /*\r
2  * FreeRTOS Kernel V10.0.0\r
3  * Copyright (C) 2017 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
4  *\r
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
6  * this software and associated documentation files (the "Software"), to deal in\r
7  * the Software without restriction, including without limitation the rights to\r
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
9  * the Software, and to permit persons to whom the Software is furnished to do so,\r
10  * subject to the following conditions:\r
11  *\r
12  * The above copyright notice and this permission notice shall be included in all\r
13  * copies or substantial portions of the Software. If you wish to use our Amazon\r
14  * FreeRTOS name, please do so in a fair use way that does not cause confusion.\r
15  *\r
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
18  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
22  *\r
23  * http://www.FreeRTOS.org\r
24  * http://aws.amazon.com/freertos\r
25  *\r
26  * 1 tab == 4 spaces!\r
27  */\r
28 \r
29 \r
30 \r
31 /*\r
32  * Creates all the demo application tasks, then starts the scheduler.  The WEB\r
33  * documentation provides more details of the standard demo application tasks,\r
34  * which provide no particular functionality but do provide a good example of\r
35  * how to use the FreeRTOS API.  In addition to the standard demo tasks, the \r
36  * following tasks and tests are defined and/or created within this file:\r
37  *\r
38  * Webserver ("uIP") task - This serves a number of dynamically generated WEB\r
39  * pages to a standard WEB browser.  The IP and MAC addresses are configured by\r
40  * constants defined at the bottom of FreeRTOSConfig.h.  Use either a standard\r
41  * Ethernet cable to connect through a hug, or a cross over (point to point)\r
42  * cable to connect directly.  Ensure the IP address used is compatible with the\r
43  * IP address of the machine running the browser - the easiest way to achieve\r
44  * this is to ensure the first three octets of the IP addresses are the same.\r
45  *\r
46  * "Reg test" tasks - These fill the registers with known values, then check\r
47  * that each register still contains its expected value.  Each task uses\r
48  * different values.  The tasks run with very low priority so get preempted very\r
49  * frequently.  A register containing an unexpected value is indicative of an\r
50  * error in the context switching mechanism.  Both standard and floating point\r
51  * registers are checked.  The nature of the reg test tasks necessitates that\r
52  * they are written in assembly code.  They are defined in regtest.src.\r
53  *\r
54  * "math" tasks - These are a set of 8 tasks that perform various double\r
55  * precision floating point calculations in order to check that the tasks \r
56  * floating point registers are being correctly saved and restored during\r
57  * context switches.  The math tasks are defined in flop.c.\r
58  *\r
59  * "Check" task - This only executes every five seconds but has a high priority\r
60  * to ensure it gets processor time.  Its main function is to check that all the\r
61  * standard demo tasks are still operational.  While no errors have been\r
62  * discovered the check task will toggle an LED every 5 seconds - the toggle\r
63  * rate increasing to 200ms being a visual indication that at least one task has\r
64  * reported unexpected behaviour.\r
65  *\r
66  * *NOTE 1* If LED5 is toggling every 5 seconds then all the demo application\r
67  * tasks are executing as expected and no errors have been reported in any \r
68  * tasks.  The toggle rate increasing to 200ms indicates that at least one task\r
69  * has reported unexpected behaviour.\r
70  * \r
71  * *NOTE 2* This file and flop.c both demonstrate the use of \r
72  * xPortUsesFloatingPoint() which informs the kernel that a task should maintain\r
73  * a floating point context.\r
74  *\r
75  * *NOTE 3* vApplicationSetupTimerInterrupt() is called by the kernel to let\r
76  * the application set up a timer to generate the tick interrupt.  In this\r
77  * example a compare match timer is used for this purpose.  \r
78  * vApplicationTickHook() is used to clear the timer interrupt and relies on\r
79  * configUSE_TICK_HOOK being set to 1 in FreeRTOSConfig.h.\r
80  *\r
81  * *NOTE 4* The traceTASK_SWITCHED_IN and traceTASK_SWITCHED_OUT trace hooks\r
82  * are used to save and restore the floating point context respectively for\r
83  * those tasks that require it (those for which xPortUsesFloatingPoint() has\r
84  * been called).\r
85  * \r
86  * *NOTE 5* Any interrupt that can cause a context switch requires an asm \r
87  * wrapper and must be assigned an interrupt priority of \r
88  * portKERNEL_INTERRUPT_PRIORITY.\r
89  *\r
90  * *NOTE 6* vSetupClockForRunTimeStats() is called by the kernel (via the \r
91  * portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()) macro to configure an MTU channel\r
92  * to produce a time base that is used to log how much processor time each task\r
93  * is consuming.  The MTU is used to generate a high(ish) frequency interrupt,\r
94  * and so also provides an example of how interrupts that don't make use of the\r
95  * FreeRTOS kernel can be assigned a priority above any priority used by the\r
96  * kernel itself.\r
97  */\r
98 \r
99 /* Kernel includes. */\r
100 #include "FreeRTOS.h"\r
101 #include "task.h"\r
102 \r
103 /* Demo application includes. */\r
104 #include "BlockQ.h"\r
105 #include "death.h"\r
106 #include "integer.h"\r
107 #include "blocktim.h"\r
108 #include "flash.h"\r
109 #include "partest.h"\r
110 #include "semtest.h"\r
111 #include "PollQ.h"\r
112 #include "GenQTest.h"\r
113 #include "QPeek.h"\r
114 #include "recmutex.h"\r
115 #include "flop.h"\r
116 \r
117 /* Constants required to configure the hardware. */\r
118 #define mainFRQCR_VALUE                                         ( 0x0303 )      /* Input = 12.5MHz, I Clock = 200MHz, B Clock = 50MHz, P Clock = 50MHz */\r
119 \r
120 /* Task priorities. */\r
121 #define mainQUEUE_POLL_PRIORITY                         ( tskIDLE_PRIORITY + 1 )\r
122 #define mainCHECK_TASK_PRIORITY                         ( tskIDLE_PRIORITY + 3 )\r
123 #define mainSEM_TEST_PRIORITY                           ( tskIDLE_PRIORITY + 1 )\r
124 #define mainBLOCK_Q_PRIORITY                            ( tskIDLE_PRIORITY + 2 )\r
125 #define mainCREATOR_TASK_PRIORITY           ( tskIDLE_PRIORITY + 3 )\r
126 #define mainFLASH_TASK_PRIORITY                         ( tskIDLE_PRIORITY + 1 )\r
127 #define mainuIP_TASK_PRIORITY                           ( tskIDLE_PRIORITY + 2 )\r
128 #define mainINTEGER_TASK_PRIORITY           ( tskIDLE_PRIORITY )\r
129 #define mainGEN_QUEUE_TASK_PRIORITY                     ( tskIDLE_PRIORITY )\r
130 #define mainFLOP_TASK_PRIORITY                          ( tskIDLE_PRIORITY )\r
131 \r
132 /* The WEB server uses string handling functions, which in turn use a bit more\r
133 stack than most of the other tasks. */\r
134 #define mainuIP_STACK_SIZE                                      ( configMINIMAL_STACK_SIZE * 3 )\r
135 \r
136 /* The LED toggled by the check task. */\r
137 #define mainCHECK_LED                                           ( 5 )\r
138 \r
139 /* The rate at which mainCHECK_LED will toggle when all the tasks are running\r
140 without error. */\r
141 #define mainNO_ERROR_CYCLE_TIME                         ( 5000 / portTICK_PERIOD_MS )\r
142 \r
143 /* The rate at which mainCHECK_LED will toggle when an error has been reported\r
144 by at least one task. */\r
145 #define mainERROR_CYCLE_TIME                            ( 200 / portTICK_PERIOD_MS )\r
146 \r
147 /*\r
148  * vApplicationMallocFailedHook() will only be called if\r
149  * configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h.  It is a hook\r
150  * function that will execute if a call to pvPortMalloc() fails.\r
151  * pvPortMalloc() is called internally by the kernel whenever a task, queue or\r
152  * semaphore is created.  It is also called by various parts of the demo\r
153  * application.  \r
154  */\r
155 void vApplicationMallocFailedHook( void );\r
156 \r
157 /*\r
158  * vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set to 1\r
159  * in FreeRTOSConfig.h.  It is a hook function that is called on each iteration\r
160  * of the idle task.  It is essential that code added to this hook function\r
161  * never attempts to block in any way (for example, call xQueueReceive() with\r
162  * a block time specified).  If the application makes use of the vTaskDelete()\r
163  * API function (as this demo application does) then it is also important that\r
164  * vApplicationIdleHook() is permitted to return to its calling function because\r
165  * it is the responsibility of the idle task to clean up memory allocated by the\r
166  * kernel to any task that has since been deleted.\r
167  */\r
168 void vApplicationIdleHook( void );\r
169 \r
170 /*\r
171  * Just sets up clocks, ports, etc. used by the demo application.\r
172  */\r
173 static void prvSetupHardware( void );\r
174 \r
175 /*\r
176  * The check task as described at the top of this file.\r
177  */\r
178 static void prvCheckTask( void *pvParameters );\r
179 \r
180 /*\r
181  * The reg test tasks as described at the top of this file.\r
182  */\r
183 extern void vRegTest1Task( void *pvParameters );\r
184 extern void vRegTest2Task( void *pvParameters );\r
185 \r
186 /*\r
187  * Contains the implementation of the WEB server.\r
188  */\r
189 extern void vuIP_Task( void *pvParameters );\r
190 \r
191 /*\r
192  * The interrupt handler for the MTU - which is used to maintain the time base\r
193  * used by the run time stats.\r
194  */\r
195 #pragma interrupt MTU_Match\r
196 void MTU_Match( void );\r
197 \r
198 /*-----------------------------------------------------------*/\r
199 \r
200 /* Variables that are incremented on each iteration of the reg test tasks - \r
201 provided the tasks have not reported any errors.  The check task inspects these\r
202 variables to ensure they are still incrementing as expected. */\r
203 volatile unsigned long ulRegTest1CycleCount = 0UL, ulRegTest2CycleCount = 0UL;\r
204 \r
205 /* The status message that is displayed at the bottom of the "task stats" WEB\r
206 page, which is served by the uIP task. */\r
207 const char *pcStatusMessage = "All tasks executing without error.";\r
208 \r
209 /* The time use for the run time stats. */\r
210 unsigned long ulRunTime = 0UL;\r
211 \r
212 /*-----------------------------------------------------------*/\r
213 \r
214 /*\r
215  * Creates the majority of the demo application tasks before starting the\r
216  * scheduler.\r
217  */\r
218 void main(void)\r
219 {\r
220 TaskHandle_t xCreatedTask;\r
221 \r
222         prvSetupHardware();\r
223 \r
224         /* Start the reg test tasks which test the context switching mechanism. */\r
225         xTaskCreate( vRegTest1Task, "RegTst1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, &xCreatedTask );\r
226         xPortUsesFloatingPoint( xCreatedTask );\r
227         \r
228         xTaskCreate( vRegTest2Task, "RegTst2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, &xCreatedTask );\r
229         xPortUsesFloatingPoint( xCreatedTask );\r
230 \r
231         xTaskCreate( vuIP_Task, "uIP", mainuIP_STACK_SIZE, NULL, mainuIP_TASK_PRIORITY, NULL );\r
232 \r
233         /* Start the check task as described at the top of this file. */\r
234         xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
235 \r
236         /* Start the standard demo tasks.  These don't perform any particular useful\r
237         functionality, other than to demonstrate the FreeRTOS API being used. */\r
238         vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
239         vCreateBlockTimeTasks();\r
240     vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
241     vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
242     vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );\r
243     vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
244         vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );\r
245     vStartQueuePeekTasks();\r
246         vStartRecursiveMutexTasks();\r
247         \r
248         /* Start the math tasks as described at the top of this file. */\r
249         vStartMathTasks( mainFLOP_TASK_PRIORITY );\r
250 \r
251         /* The suicide tasks must be created last as they need to know how many\r
252         tasks were running prior to their creation in order to ascertain whether\r
253         or not the correct/expected number of tasks are running at any given time. */\r
254     vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
255 \r
256         /* Start the tasks running. */\r
257         vTaskStartScheduler();\r
258 \r
259         /* Will only get here if there was insufficient heap memory to create the idle\r
260     task.  Increase the configTOTAL_HEAP_SIZE setting in FreeRTOSConfig.h. */\r
261         for( ;; );\r
262 }\r
263 /*-----------------------------------------------------------*/\r
264 \r
265 static void prvCheckTask( void *pvParameter )\r
266 {\r
267 TickType_t xNextWakeTime, xCycleFrequency = mainNO_ERROR_CYCLE_TIME;\r
268 unsigned long ulLastRegTest1CycleCount = 0UL, ulLastRegTest2CycleCount = 0UL;\r
269 \r
270         /* Just to remove compiler warning. */\r
271         ( void ) pvParameter;\r
272 \r
273         /* Initialise xNextWakeTime - this only needs to be done once. */\r
274         xNextWakeTime = xTaskGetTickCount();\r
275 \r
276         for( ;; )\r
277         {\r
278                 /* Place this task in the blocked state until it is time to run again. */\r
279                 vTaskDelayUntil( &xNextWakeTime, xCycleFrequency );\r
280                 \r
281                 /* Inspect all the other tasks to ensure none have experienced any errors. */\r
282                 if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
283                 {\r
284                         /* Increase the rate at which this task cycles, which will increase the\r
285                         rate at which mainCHECK_LED flashes to give visual feedback that an error\r
286                         has occurred. */\r
287                         xCycleFrequency = mainERROR_CYCLE_TIME;\r
288                         pcStatusMessage = "Error in GenQ test.";\r
289                 }\r
290                 else if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
291                 {\r
292                         xCycleFrequency = mainERROR_CYCLE_TIME;\r
293                         pcStatusMessage = "Error in Queue Peek test.";\r
294                 }\r
295                 else if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
296                 {\r
297                         xCycleFrequency = mainERROR_CYCLE_TIME;\r
298                         pcStatusMessage = "Error in Blocking Queue test.";\r
299                 }\r
300                 else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
301                 {\r
302                         xCycleFrequency = mainERROR_CYCLE_TIME;\r
303                         pcStatusMessage = "Error in BlockTim test.";\r
304                 }\r
305             else if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
306             {\r
307                 xCycleFrequency = mainERROR_CYCLE_TIME;\r
308                         pcStatusMessage = "Error in Semaphore test.";\r
309             }\r
310             else if( xArePollingQueuesStillRunning() != pdTRUE )\r
311             {\r
312                 xCycleFrequency = mainERROR_CYCLE_TIME;\r
313                         pcStatusMessage = "Error in Polling Queue test.";\r
314             }\r
315             else if( xIsCreateTaskStillRunning() != pdTRUE )\r
316             {\r
317                 xCycleFrequency = mainERROR_CYCLE_TIME;\r
318                         pcStatusMessage = "Error in Create test.";\r
319             }\r
320             else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
321             {\r
322                 xCycleFrequency = mainERROR_CYCLE_TIME;\r
323                         pcStatusMessage = "Error in integer Math test.";\r
324             }\r
325             else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
326             {\r
327                 xCycleFrequency = mainERROR_CYCLE_TIME;\r
328                         pcStatusMessage = "Error in recursive mutex test.";\r
329             }\r
330                 else if( xAreMathsTaskStillRunning() != pdTRUE )\r
331                 {\r
332                         xCycleFrequency = mainERROR_CYCLE_TIME;\r
333                         pcStatusMessage = "Error in floating point Math test.";\r
334                 }\r
335 \r
336                 /* Check the reg test tasks are still cycling.  They will stop incrementing\r
337                 their loop counters if they encounter an error. */\r
338                 if( ulRegTest1CycleCount == ulLastRegTest1CycleCount )\r
339                 {\r
340                         xCycleFrequency = mainERROR_CYCLE_TIME;\r
341                         pcStatusMessage = "Error in RegTest.";\r
342                 }\r
343 \r
344                 if( ulRegTest2CycleCount == ulLastRegTest2CycleCount )\r
345                 {\r
346                         xCycleFrequency = mainERROR_CYCLE_TIME;\r
347                         pcStatusMessage = "Error in RegTest.";\r
348                 }\r
349                 \r
350                 ulLastRegTest1CycleCount = ulRegTest1CycleCount;\r
351                 ulLastRegTest2CycleCount = ulRegTest2CycleCount;\r
352                 \r
353                 /* Toggle the check LED to give an indication of the system status.  If the\r
354                 LED toggles every 5 seconds then everything is ok.  A faster toggle indicates\r
355                 an error. */\r
356                 vParTestToggleLED( mainCHECK_LED );\r
357         }\r
358 }\r
359 /*-----------------------------------------------------------*/\r
360 \r
361 void vApplicationMallocFailedHook( void )\r
362 {\r
363         /* A call to vPortMalloc() failed, probably during the creation of a task,\r
364         queue or semaphore.  Inspect pxCurrentTCB to find which task is currently\r
365         executing. */\r
366         for( ;; );\r
367 }\r
368 /*-----------------------------------------------------------*/\r
369 \r
370 void vApplicationIdleHook( void )\r
371 {\r
372         /* Code can be added to the idle task here.  This function must *NOT* attempt\r
373         to block.  Also, if the application uses the vTaskDelete() API function then\r
374         this function must return regularly to ensure the idle task gets a chance to\r
375         clean up the memory used by deleted tasks. */\r
376 }\r
377 /*-----------------------------------------------------------*/\r
378 \r
379 void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )\r
380 {\r
381         /* Just to remove compiler warnings.  This function will only actually\r
382         get called if configCHECK_FOR_STACK_OVERFLOW is set to a non zero value.\r
383         By default this demo does not use the stack overflow checking functionality\r
384         as the SuperH will normally execute an exception if the stack overflows. */\r
385         ( void ) pxTask;\r
386         ( void ) pcTaskName;\r
387         \r
388         taskDISABLE_INTERRUPTS();\r
389         for( ;; );\r
390 }\r
391 /*-----------------------------------------------------------*/\r
392 \r
393 static void prvSetupHardware( void )\r
394 {\r
395 volatile unsigned long ul;\r
396 \r
397         /* Set the CPU and peripheral clocks. */\r
398         CPG.FRQCR.WORD = mainFRQCR_VALUE;\r
399         \r
400         /* Wait for the clock to settle. */\r
401         for( ul = 0; ul < 99; ul++ )\r
402         {\r
403                 nop();\r
404         }\r
405 \r
406         /* Initialise the ports used to toggle LEDs. */\r
407         vParTestInitialise();   \r
408 }\r
409 /*-----------------------------------------------------------*/\r
410 \r
411 void vApplicationSetupTimerInterrupt( void )\r
412 {\r
413 /* The peripheral clock is divided by 32 before feeding the compare match\r
414 peripheral (CMT). */\r
415 const unsigned long ulCompareMatch = ( configPERIPHERAL_CLOCK_HZ / ( configTICK_RATE_HZ * 32 ) ) + 1;\r
416 \r
417         /* Configure a timer to create the RTOS tick interrupt.  This example uses\r
418         the compare match timer, but the multi function timer or possible even the\r
419         watchdog timer could also be used.  Ensure vPortTickInterrupt() is installed\r
420         as the interrupt handler for whichever peripheral is used. */\r
421         \r
422         /* Turn the CMT on. */\r
423         STB.CR4.BIT._CMT = 0;\r
424         \r
425         /* Set the compare match value for the required tick frequency. */\r
426         CMT0.CMCOR = ( unsigned short ) ulCompareMatch;\r
427         \r
428         /* Divide the peripheral clock by 32. */\r
429         CMT0.CMCSR.BIT.CKS = 0x01;\r
430         \r
431         /* Set the CMT interrupt priority - the interrupt priority must be\r
432         configKERNEL_INTERRUPT_PRIORITY no matter which peripheral is used to generate\r
433         the tick interrupt. */\r
434         INTC.IPR08.BIT._CMT0 = portKERNEL_INTERRUPT_PRIORITY;\r
435         \r
436         /* Clear the interrupt flag. */\r
437         CMT0.CMCSR.BIT.CMF = 0;\r
438         \r
439         /* Enable the compare match interrupt. */\r
440         CMT0.CMCSR.BIT.CMIE = 0x01;\r
441         \r
442         /* Start the timer. */\r
443         CMT.CMSTR.BIT.STR0 = 0x01;\r
444 }\r
445 /*-----------------------------------------------------------*/\r
446 \r
447 void vApplicationTickHook( void )\r
448 {\r
449         /* Clear the tick inerrupt.  This is called from an interrupt context. */\r
450         CMT0.CMCSR.BIT.CMF = 0;\r
451 }\r
452 /*-----------------------------------------------------------*/\r
453 \r
454 void vSetupClockForRunTimeStats( void )\r
455 {\r
456         /* Configure an MTU channel to generate a periodic interrupt that is used\r
457         as the run time stats time base.  The run time stats keep a track of how\r
458         much processing time each task is using. */\r
459 \r
460         /* Turn the MTU2 on. */\r
461         STB.CR3.BIT._MTU2 = 0;\r
462                 \r
463         /* Clear counter on compare match A. */\r
464         MTU20.TCR.BIT.CCLR = 0x01;\r
465         \r
466         /* Compare match value to give very approximately 10 interrupts per \r
467         millisecond. */\r
468         MTU20.TGRA = 5000;\r
469         \r
470         /* Ensure the interrupt is clear. */\r
471         MTU20.TSR.BIT.TGFA = 0;\r
472                 \r
473         /* Enable the compare match interrupt. */\r
474         MTU20.TIER.BIT.TGIEA = 0x01;    \r
475         \r
476         /* Set the interrupt priority. */\r
477         INTC.IPR09.BIT._MTU20G = portKERNEL_INTERRUPT_PRIORITY + 1;\r
478         \r
479         /* Start the count. */\r
480         MTU2.TSTR.BIT.CST0 = 1;\r
481 }\r
482 /*-----------------------------------------------------------*/\r
483 \r
484 void MTU_Match( void )\r
485 {\r
486 volatile unsigned char ucStatus;\r
487 \r
488         /* Increment the run time stats time base. */\r
489         ulRunTime++;\r
490 \r
491         /* Clear the interrupt. */\r
492         ucStatus = MTU20.TSR.BYTE;\r
493         MTU20.TSR.BIT.TGFA = 0;\r
494 }\r
495 /*-----------------------------------------------------------*/\r
496 \r
497 char *pcGetTaskStatusMessage( void )\r
498 {\r
499         /* Not bothered about a critical section here.  This just returns a string\r
500         that is displaed on the "Task Stats" WEB page served by this demo. */\r
501         return pcStatusMessage;\r
502 }\r
503 /*-----------------------------------------------------------*/\r