]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M4_ATSAM4E_Atmel_Studio/src/main_full.c
d248bbb04babf115524ddcc21805dd1d0390061f
[freertos] / FreeRTOS / Demo / CORTEX_M4_ATSAM4E_Atmel_Studio / src / main_full.c
1 /*\r
2     FreeRTOS V8.0.0:rc1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
3     All rights reserved\r
4 \r
5     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
6 \r
7     ***************************************************************************\r
8      *                                                                       *\r
9      *    FreeRTOS provides completely free yet professionally developed,    *\r
10      *    robust, strictly quality controlled, supported, and cross          *\r
11      *    platform software that has become a de facto standard.             *\r
12      *                                                                       *\r
13      *    Help yourself get started quickly and support the FreeRTOS         *\r
14      *    project by purchasing a FreeRTOS tutorial book, reference          *\r
15      *    manual, or both from: http://www.FreeRTOS.org/Documentation        *\r
16      *                                                                       *\r
17      *    Thank you!                                                         *\r
18      *                                                                       *\r
19     ***************************************************************************\r
20 \r
21     This file is part of the FreeRTOS distribution.\r
22 \r
23     FreeRTOS is free software; you can redistribute it and/or modify it under\r
24     the terms of the GNU General Public License (version 2) as published by the\r
25     Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
26 \r
27     >>! NOTE: The modification to the GPL is included to allow you to distribute\r
28     >>! a combined work that includes FreeRTOS without being obliged to provide\r
29     >>! the source code for proprietary components outside of the FreeRTOS\r
30     >>! kernel.\r
31 \r
32     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
33     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
34     FOR A PARTICULAR PURPOSE.  Full license text is available from the following\r
35     link: http://www.freertos.org/a00114.html\r
36 \r
37     1 tab == 4 spaces!\r
38 \r
39     ***************************************************************************\r
40      *                                                                       *\r
41      *    Having a problem?  Start by reading the FAQ "My application does   *\r
42      *    not run, what could be wrong?"                                     *\r
43      *                                                                       *\r
44      *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
45      *                                                                       *\r
46     ***************************************************************************\r
47 \r
48     http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
49     license and Real Time Engineers Ltd. contact details.\r
50 \r
51     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
52     including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
53     compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
54 \r
55     http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
56     Integrity Systems to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
57     licenses offer ticketed support, indemnification and middleware.\r
58 \r
59     http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
60     engineered and independently SIL3 certified version for use in safety and\r
61     mission critical applications that require provable dependability.\r
62 \r
63     1 tab == 4 spaces!\r
64 */\r
65 \r
66 /******************************************************************************\r
67  * NOTE 1:  This project provides two demo applications.  A simple blinky style\r
68  * project, and a more comprehensive test and demo application that makes use of\r
69  * the FreeRTOS+CLI, FreeRTOS+UDP and FreeRTOS+FAT SL components.  The\r
70  * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select\r
71  * between the two.  See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY\r
72  * in main.c.  This file implements the comprehensive test and demo version,\r
73  * which is fully documented on the following URL:\r
74  * http://www.FreeRTOS.org/Atmel_SAM4E_RTOS_Demo.html\r
75  *\r
76  * NOTE 2:  This file only contains the source code that is specific to the\r
77  * full demo.  Generic functions, such FreeRTOS hook functions, and functions\r
78  * required to configure the hardware, are defined in main.c.\r
79  ******************************************************************************\r
80  *\r
81  * Full user instructions are provided on the following URL:\r
82  * http://www.FreeRTOS.org/Atmel_SAM4E_RTOS_Demo.html\r
83  *\r
84  * main_full():\r
85  *      + Uses FreeRTOS+FAT SL to create a set of example files on a RAM disk.\r
86  *  + Displays some bitmaps on the LCD.\r
87  *  + Registers sample generic, file system related and UDP related commands\r
88  *        with FreeRTOS+CLI.\r
89  *      + Creates all the standard demo application tasks and software timers.\r
90  *      + Starts the scheduler.\r
91  *\r
92  * A UDP command server and optionally two UDP echo client tasks are created\r
93  * from the network event hook after an IP address has been obtained.  The IP\r
94  * address is displayed on the LCD.\r
95  *\r
96  * A "check software timer" is created to provide visual feedback of the system\r
97  * status.  The timer's period is initially set to three seconds.  The callback\r
98  * function associated with the timer checks all the standard demo tasks are not\r
99  * only still executed, but are executing without reporting any errors.  If the\r
100  * timer discovers a task has either stalled, or reported an error, then it\r
101  * changes its own period from the initial three seconds, to just 200ms.  The\r
102  * check software timer also toggles the LED marked D4 - so if the LED toggles\r
103  * every three seconds then no potential errors have been found, and if the LED\r
104  * toggles every 200ms then a potential error has been found in at least one\r
105  * task.\r
106  *\r
107  * Information on accessing the CLI and file system, and using the UDP echo\r
108  * tasks is provided on http://www.FreeRTOS.org/Atmel_SAM4E_RTOS_Demo.html\r
109  *\r
110  */\r
111 \r
112 /* FreeRTOS includes. */\r
113 #include "FreeRTOS.h"\r
114 #include "task.h"\r
115 #include "timers.h"\r
116 \r
117 /* FreeRTOS+UDP includes. */\r
118 #include "FreeRTOS_UDP_IP.h"\r
119 #include "FreeRTOS_Sockets.h"\r
120 \r
121 /* UDP demo includes. */\r
122 #include "UDPCommandInterpreter.h"\r
123 #include "TwoEchoClients.h"\r
124 \r
125 /* Standard demo includes. */\r
126 #include "partest.h"\r
127 #include "blocktim.h"\r
128 #include "flash_timer.h"\r
129 #include "semtest.h"\r
130 #include "GenQTest.h"\r
131 #include "QPeek.h"\r
132 #include "IntQueue.h"\r
133 #include "countsem.h"\r
134 #include "dynamic.h"\r
135 #include "QueueOverwrite.h"\r
136 #include "QueueSet.h"\r
137 #include "recmutex.h"\r
138 \r
139 /* The period after which the check timer will expire, in ms, provided no errors\r
140 have been reported by any of the standard demo tasks.  ms are converted to the\r
141 equivalent in ticks using the portTICK_RATE_MS constant. */\r
142 #define mainCHECK_TIMER_PERIOD_MS                       ( 3000UL / portTICK_RATE_MS )\r
143 \r
144 /* The period at which the check timer will expire, in ms, if an error has been\r
145 reported in one of the standard demo tasks.  ms are converted to the equivalent\r
146 in ticks using the portTICK_RATE_MS constant. */\r
147 #define mainERROR_CHECK_TIMER_PERIOD_MS         ( 200UL / portTICK_RATE_MS )\r
148 \r
149 /* The priorities of the various demo application tasks. */\r
150 #define mainSEM_TEST_PRIORITY                           ( tskIDLE_PRIORITY + 1 )\r
151 #define mainBLOCK_Q_PRIORITY                            ( tskIDLE_PRIORITY + 2 )\r
152 #define mainCOM_TEST_PRIORITY                           ( tskIDLE_PRIORITY + 2 )\r
153 #define mainINTEGER_TASK_PRIORITY           ( tskIDLE_PRIORITY )\r
154 #define mainGEN_QUEUE_TASK_PRIORITY                     ( tskIDLE_PRIORITY )\r
155 #define mainQUEUE_OVERWRITE_TASK_PRIORITY       ( tskIDLE_PRIORITY )\r
156 \r
157 /* The LED controlled by the 'check' software timer. */\r
158 #define mainCHECK_LED                                           ( 2 )\r
159 \r
160 /* The number of LEDs that should be controlled by the flash software timer\r
161 standard demo.  In this case it is only 1 as the starter kit has three LEDs, one\r
162 of which is controlled by the check timer and one of which is controlled by the\r
163 ISR triggered task. */\r
164 #define mainNUM_FLASH_TIMER_LEDS                        ( 1 )\r
165 \r
166 /* Misc. */\r
167 #define mainDONT_BLOCK                                          ( 0 )\r
168 \r
169 /* Note:  If the application is started without the network cable plugged in\r
170 then ipconfigUDP_TASK_PRIORITY should be set to 0 in FreeRTOSIPConfig.h to\r
171 ensure the IP task is created at the idle priority.  This is because the Atmel\r
172 ASF GMAC driver polls the GMAC looking for a connection, and doing so will\r
173 prevent any lower priority tasks from executing.  In this demo the IP task is\r
174 started at the idle priority, then set to configMAX_PRIORITIES - 2 in the\r
175 network event hook only after a connection has been established (when the event\r
176 passed into the network event hook is eNetworkUp).\r
177 http://www.FreeRTOS.org/udp */\r
178 #define mainCONNECTED_IP_TASK_PRIORITY          ( configMAX_PRIORITIES - 1 )\r
179 #define mainDISCONNECTED_IP_TASK_PRIORITY       ( tskIDLE_PRIORITY )\r
180 \r
181 /* UDP command server task parameters. */\r
182 #define mainUDP_CLI_TASK_PRIORITY                       ( tskIDLE_PRIORITY )\r
183 #define mainUDP_CLI_PORT_NUMBER                         ( 5001UL )\r
184 #define mainUDP_CLI_TASK_STACK_SIZE                     ( configMINIMAL_STACK_SIZE * 2U )\r
185 \r
186 /* Set to 1 to include the UDP echo client tasks in the build.  The echo clients\r
187 require the IP address of the echo server to be defined using the\r
188 configECHO_SERVER_ADDR0 to configECHO_SERVER_ADDR3 constants in\r
189 FreeRTOSConfig.h. */\r
190 #define mainINCLUDE_ECHO_CLIENT_TASKS           1\r
191 \r
192 /*-----------------------------------------------------------*/\r
193 \r
194 /*\r
195  * The check timer callback function, as described at the top of this file.\r
196  */\r
197 static void prvCheckTimerCallback( xTimerHandle xTimer );\r
198 \r
199 /*\r
200  * Creates a set of sample files on a RAM disk.  http://www.FreeRTOS.org/fat_sl\r
201  */\r
202 extern void vCreateAndVerifySampleFiles( void );\r
203 \r
204 /*\r
205  * Register sample generic commands that can be used with FreeRTOS+CLI.  Type\r
206  * 'help' in the command line to see a list of registered commands.\r
207  * http://www.FreeRTOS.org/cli\r
208  */\r
209 extern void vRegisterSampleCLICommands( void );\r
210 \r
211 /*\r
212  * Register sample file system commands that can be used with FreeRTOS+CLI.\r
213  */\r
214 extern void vRegisterFileSystemCLICommands( void );\r
215 \r
216 /*\r
217  * Register sample UDP related commands that can be used with FreeRTOS+CLI.\r
218  */\r
219 extern void vRegisterUDPCLICommands( void );\r
220 \r
221 /*\r
222  * Initialise the LCD and output a bitmap.\r
223  */\r
224 extern void vInitialiseLCD( void );\r
225 \r
226 /*-----------------------------------------------------------*/\r
227 \r
228 /* The default IP and MAC address used by the demo.  The address configuration\r
229 defined here will be used if ipconfigUSE_DHCP is 0, or if ipconfigUSE_DHCP is\r
230 1 but a DHCP server could not be contacted.  See the online documentation for\r
231 more information. */\r
232 static const uint8_t ucIPAddress[ 4 ] = { configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 };\r
233 static const uint8_t ucNetMask[ 4 ] = { configNET_MASK0, configNET_MASK1, configNET_MASK2, configNET_MASK3 };\r
234 static const uint8_t ucGatewayAddress[ 4 ] = { configGATEWAY_ADDR0, configGATEWAY_ADDR1, configGATEWAY_ADDR2, configGATEWAY_ADDR3 };\r
235 static const uint8_t ucDNSServerAddress[ 4 ] = { configDNS_SERVER_ADDR0, configDNS_SERVER_ADDR1, configDNS_SERVER_ADDR2, configDNS_SERVER_ADDR3 };\r
236 \r
237 /* The MAC address used by the demo.  In production units the MAC address would\r
238 probably be read from flash memory or an EEPROM.  Here it is just hard coded.\r
239 Note each node on a network must have a unique MAC address. */\r
240 const uint8_t ucMACAddress[ 6 ] = { configMAC_ADDR0, configMAC_ADDR1, configMAC_ADDR2, configMAC_ADDR3, configMAC_ADDR4, configMAC_ADDR5 };\r
241 \r
242 /*-----------------------------------------------------------*/\r
243 \r
244 int main_full( void )\r
245 {\r
246 xTimerHandle xTimer = NULL;\r
247 \r
248         /* Usage instructions on http://www.FreeRTOS.org/Atmel_SAM4E_RTOS_Demo.html */\r
249 \r
250         /* Initialise the LCD and output a bitmap.  The IP address will also be\r
251         displayed on the LCD when it has been obtained. */\r
252         vInitialiseLCD();\r
253 \r
254         /* If the file system is only going to be accessed from one task then\r
255         F_FS_THREAD_AWARE can be set to 0 and the set of example files are created\r
256         before the RTOS scheduler is started.  If the file system is going to be\r
257         access from more than one task then F_FS_THREAD_AWARE must be set to 1 and\r
258         the     set of sample files are created from the idle task hook function\r
259         vApplicationIdleHook(). */\r
260         #if( F_FS_THREAD_AWARE == 0 )\r
261         {\r
262                 /* Initialise the drive and file system, then create a few example\r
263                 files.  The files can be viewed and accessed via the CLI.  View the\r
264                 documentation page for this demo (link at the top of this file) for more\r
265                 information. */\r
266                 vCreateAndVerifySampleFiles();\r
267         }\r
268         #endif\r
269 \r
270         /* Register example generic, file system related and UDP related CLI\r
271         commands respectively.  Type 'help' into the command console to view a list\r
272         of registered commands. */\r
273         vRegisterSampleCLICommands();\r
274         vRegisterFileSystemCLICommands();\r
275         vRegisterUDPCLICommands();\r
276 \r
277         /* Initialise the network interface.  Tasks that use the network are\r
278         created in the network event hook when the network is connected and ready\r
279         for use.  The address values passed in here are used if ipconfigUSE_DHCP is\r
280         set to 0, or if ipconfigUSE_DHCP is set to 1 but a DHCP server cannot be\r
281         contacted.  The IP address actually used is displayed on the LCD (after DHCP\r
282         has completed if DHCP is used). */\r
283         FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );\r
284 \r
285         /* Create all the other standard demo tasks. */\r
286         vStartLEDFlashTimers( mainNUM_FLASH_TIMER_LEDS );\r
287         vCreateBlockTimeTasks();\r
288         vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
289         vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
290         vStartQueuePeekTasks();\r
291         vStartCountingSemaphoreTasks();\r
292         vStartDynamicPriorityTasks();\r
293         vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_TASK_PRIORITY );\r
294         vStartQueueSetTasks();\r
295         vStartRecursiveMutexTasks();\r
296 \r
297         /* Create the software timer that performs the 'check' functionality, as\r
298         described at the top of this file. */\r
299         xTimer = xTimerCreate(  "CheckTimer",                                   /* A text name, purely to help debugging. */\r
300                                                         ( mainCHECK_TIMER_PERIOD_MS ),  /* The timer period, in this case 3000ms (3s). */\r
301                                                         pdTRUE,                                                 /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */\r
302                                                         ( void * ) 0,                                   /* The ID is not used, so can be set to anything. */\r
303                                                         prvCheckTimerCallback );                /* The callback function that inspects the status of all the other tasks. */\r
304 \r
305         if( xTimer != NULL )\r
306         {\r
307                 xTimerStart( xTimer, mainDONT_BLOCK );\r
308         }\r
309 \r
310         /* Start the scheduler itself. */\r
311         vTaskStartScheduler();\r
312 \r
313         /* If all is well, the scheduler will now be running, and the following line\r
314         will never be reached.  If the following line does execute, then there was\r
315         insufficient FreeRTOS heap memory available for the idle and/or timer tasks\r
316         to be created.  See the memory management section on the FreeRTOS web site\r
317         for more details. */\r
318         for( ;; );\r
319 }\r
320 /*-----------------------------------------------------------*/\r
321 \r
322 static void prvCheckTimerCallback( xTimerHandle xTimer )\r
323 {\r
324 static long lChangedTimerPeriodAlready = pdFALSE;\r
325 unsigned long ulErrorOccurred = pdFALSE;\r
326 \r
327         /* Avoid compiler warnings. */\r
328         ( void ) xTimer;\r
329 \r
330         /* Have any of the standard demo tasks detected an error in their\r
331         operation? */\r
332         if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
333         {\r
334                 ulErrorOccurred |= ( 0x01UL << 3UL );\r
335         }\r
336         else if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
337         {\r
338                 ulErrorOccurred |= ( 0x01UL << 4UL );\r
339         }\r
340         else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
341         {\r
342                 ulErrorOccurred |= ( 0x01UL << 5UL );\r
343         }\r
344         else if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
345         {\r
346                 ulErrorOccurred |= ( 0x01UL << 6UL );\r
347         }\r
348         else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )\r
349         {\r
350                 ulErrorOccurred |= ( 0x01UL << 8UL );\r
351         }\r
352         else if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
353         {\r
354                 ulErrorOccurred |= ( 0x01UL << 9UL );\r
355         }\r
356         else if( xIsQueueOverwriteTaskStillRunning() != pdTRUE )\r
357         {\r
358                 ulErrorOccurred |= ( 0x01UL << 10UL );\r
359         }\r
360         else if( xAreQueueSetTasksStillRunning() != pdTRUE )\r
361         {\r
362                 ulErrorOccurred |= ( 0x01UL << 11UL );\r
363         }\r
364         else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
365         {\r
366                 ulErrorOccurred |= ( 0x01UL << 12UL );\r
367         }\r
368 \r
369         if( ulErrorOccurred != pdFALSE )\r
370         {\r
371                 /* An error occurred.  Increase the frequency at which the check timer\r
372                 toggles its LED to give visual feedback of the potential error\r
373                 condition. */\r
374                 if( lChangedTimerPeriodAlready == pdFALSE )\r
375                 {\r
376                         lChangedTimerPeriodAlready = pdTRUE;\r
377 \r
378                         /* This call to xTimerChangePeriod() uses a zero block time.\r
379                         Functions called from inside of a timer callback function must\r
380                         *never* attempt to block as to do so could impact other software\r
381                         timers. */\r
382                         xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK );\r
383                 }\r
384         }\r
385 \r
386         /* Toggle the LED to give visual feedback of the system status.  The rate at\r
387         which the LED toggles will increase to mainERROR_CHECK_TIMER_PERIOD_MS if a\r
388         suspected error has been found in any of the standard demo tasks. */\r
389         vParTestToggleLED( mainCHECK_LED );\r
390 }\r
391 /*-----------------------------------------------------------*/\r
392 \r
393 /* Called by FreeRTOS+UDP when the network connects. */\r
394 void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )\r
395 {\r
396 static long lTasksAlreadyCreated = pdFALSE;\r
397 const unsigned long ulXCoord = 3, ulYCoord = 3, ulIPAddressOffset = 45;\r
398 unsigned long ulIPAddress;\r
399 char cIPAddress[ 20 ];\r
400 \r
401         /* Note:  If the application is started without the network cable plugged in\r
402         then ipconfigUDP_TASK_PRIORITY should be set to 0 in FreeRTOSIPConfig.h to\r
403         ensure the IP task is created at the idle priority.  This is because the Atmel\r
404         ASF GMAC driver polls the GMAC looking for a connection, and doing so will\r
405         prevent any lower priority tasks from executing.  In this demo the IP task is\r
406         started at the idle priority, then set to configMAX_PRIORITIES - 2 in the\r
407         network event hook only after a connection has been established (when the event\r
408         passed into the network event hook is eNetworkUp). */\r
409         if( eNetworkEvent == eNetworkUp )\r
410         {\r
411                 /* Ensure tasks are only created once. */\r
412                 if( lTasksAlreadyCreated == pdFALSE )\r
413                 {\r
414                         /* Create the task that handles the CLI on a UDP port.  The port\r
415                         number is set using the configUDP_CLI_PORT_NUMBER setting in\r
416                         FreeRTOSConfig.h. */\r
417                         vStartUDPCommandInterpreterTask( mainUDP_CLI_TASK_STACK_SIZE, mainUDP_CLI_PORT_NUMBER, mainUDP_CLI_TASK_PRIORITY );\r
418 \r
419                         #if( mainINCLUDE_ECHO_CLIENT_TASKS == 1 )\r
420                         {\r
421                                 /* Create the UDP echo tasks.  The UDP echo tasks require the IP\r
422                                 address of the echo server to be defined using the\r
423                                 configECHO_SERVER_ADDR0 to configECHO_SERVER_ADDR3 constants in\r
424                                 FreeRTOSConfig.h. */\r
425                                 vStartEchoClientTasks( configMINIMAL_STACK_SIZE, tskIDLE_PRIORITY );\r
426                         }\r
427                         #endif\r
428                 }\r
429 \r
430                 /* Obtain the IP address, convert it to a string, then display it on the\r
431                 LCD. */\r
432                 FreeRTOS_GetAddressConfiguration( &ulIPAddress, NULL, NULL, NULL );\r
433                 FreeRTOS_inet_ntoa( ulIPAddress, cIPAddress );\r
434                 ili93xx_draw_string( ulXCoord, ulYCoord, ( uint8_t * ) "IP: " );\r
435                 ili93xx_draw_string( ulXCoord + ulIPAddressOffset, ulYCoord, ( uint8_t * ) cIPAddress );\r
436 \r
437                 /* Set the priority of the IP task up to the desired priority now it has\r
438                 connected. */\r
439                 vTaskPrioritySet( NULL, mainCONNECTED_IP_TASK_PRIORITY );\r
440         }\r
441 \r
442         /* NOTE:  At the time of writing the Ethernet driver does not report the\r
443         cable being unplugged - so the following if() condition will never be met.\r
444         It is included for possible future updates to the driver. */\r
445         if( eNetworkEvent == eNetworkDown )\r
446         {\r
447                 /* Ensure the Atmel GMAC drivers don't hog all the CPU time as they look\r
448                 for a new connection by lowering the priority of the IP task to that of\r
449                 the Idle task. */\r
450                 vTaskPrioritySet( NULL, tskIDLE_PRIORITY );\r
451 \r
452                 /* Disconnected - so no IP address. */\r
453                 ili93xx_draw_string( ulXCoord, ulYCoord, ( uint8_t * ) "IP:                  " );\r
454         }\r
455 }\r
456 /*-----------------------------------------------------------*/\r
457 \r
458 void vFullDemoIdleHook( void )\r
459 {\r
460         /* If the file system is only going to be accessed from one task then\r
461         F_FS_THREAD_AWARE can be set to 0 and the set of example files is created\r
462         before the RTOS scheduler is started.  If the file system is going to be\r
463         access from more than one task then F_FS_THREAD_AWARE must be set to 1 and\r
464         the     set of sample files are created from the idle task hook function. */\r
465         #if( F_FS_THREAD_AWARE == 1 )\r
466         {\r
467                 static portBASE_TYPE xCreatedSampleFiles = pdFALSE;\r
468 \r
469                 /* Initialise the drive and file system, then create a few example\r
470                 files.  The output from this function just goes to the stdout window,\r
471                 allowing the output to be viewed when the UDP command console is not\r
472                 connected. */\r
473                 if( xCreatedSampleFiles == pdFALSE )\r
474                 {\r
475                         vCreateAndVerifySampleFiles();\r
476                         xCreatedSampleFiles = pdTRUE;\r
477                 }\r
478         }\r
479         #endif\r
480 }\r
481 /*-----------------------------------------------------------*/\r
482 \r
483 void vFullDemoTickHook( void )\r
484 {\r
485         /* Call the periodic queue overwrite from ISR test function. */\r
486         vQueueOverwritePeriodicISRDemo();\r
487 \r
488         /* Call the periodic queue set ISR test function. */\r
489         vQueueSetAccessQueueSetFromISR();\r
490 }\r
491 /*-----------------------------------------------------------*/\r
492 \r
493 /* Called automatically when a reply to an outgoing ping is received. */\r
494 void vApplicationPingReplyHook( ePingReplyStatus_t eStatus, uint16_t usIdentifier )\r
495 {\r
496         /* This demo has nowhere to output any information so does nothing, but the\r
497         IP address resolved for the pined URL is displayed in the CLI. */\r
498         ( void ) usIdentifier;\r
499         ( void ) eStatus;\r
500 }\r
501 /*-----------------------------------------------------------*/\r
502 \r