]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M4F_ATSAM4E_Atmel_Studio/src/main_full.c
Update version numbers in preparation for a new release.
[freertos] / FreeRTOS / Demo / CORTEX_M4F_ATSAM4E_Atmel_Studio / src / main_full.c
1 /*\r
2  * FreeRTOS Kernel V10.1.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.\r
14  *\r
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
21  *\r
22  * http://www.FreeRTOS.org\r
23  * http://aws.amazon.com/freertos\r
24  *\r
25  * 1 tab == 4 spaces!\r
26  */\r
27 \r
28 /******************************************************************************\r
29  * NOTE 1:  This project provides two demo applications.  A simple blinky style\r
30  * project, and a more comprehensive test and demo application that makes use of\r
31  * the FreeRTOS+CLI, FreeRTOS+UDP and FreeRTOS+FAT SL components.  The\r
32  * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select\r
33  * between the two.  See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY\r
34  * in main.c.  This file implements the comprehensive test and demo version,\r
35  * which is fully documented on the following URL:\r
36  * http://www.FreeRTOS.org/Atmel_SAM4E_RTOS_Demo.html\r
37  *\r
38  * NOTE 2:  This file only contains the source code that is specific to the\r
39  * full demo.  Generic functions, such FreeRTOS hook functions, and functions\r
40  * required to configure the hardware, are defined in main.c.\r
41  ******************************************************************************\r
42  *\r
43  * Full user instructions are provided on the following URL:\r
44  * http://www.FreeRTOS.org/Atmel_SAM4E_RTOS_Demo.html\r
45  *\r
46  * main_full():\r
47  *      + Uses FreeRTOS+FAT SL to create a set of example files on a RAM disk.\r
48  *  + Displays some bitmaps on the LCD.\r
49  *  + Registers sample generic, file system related and UDP related commands\r
50  *        with FreeRTOS+CLI.\r
51  *      + Creates all the standard demo application tasks and software timers.\r
52  *      + Starts the scheduler.\r
53  *\r
54  * A UDP command server and optionally two UDP echo client tasks are created\r
55  * from the network event hook after an IP address has been obtained.  The IP\r
56  * address is displayed on the LCD.\r
57  *\r
58  * A "check software timer" is created to provide visual feedback of the system\r
59  * status.  The timer's period is initially set to three seconds.  The callback\r
60  * function associated with the timer checks all the standard demo tasks are not\r
61  * only still executed, but are executing without reporting any errors.  If the\r
62  * timer discovers a task has either stalled, or reported an error, then it\r
63  * changes its own period from the initial three seconds, to just 200ms.  The\r
64  * check software timer also toggles the LED marked D4 - so if the LED toggles\r
65  * every three seconds then no potential errors have been found, and if the LED\r
66  * toggles every 200ms then a potential error has been found in at least one\r
67  * task.\r
68  *\r
69  * Information on accessing the CLI and file system, and using the UDP echo\r
70  * tasks is provided on http://www.FreeRTOS.org/Atmel_SAM4E_RTOS_Demo.html\r
71  *\r
72  */\r
73 \r
74 /* FreeRTOS includes. */\r
75 #include "FreeRTOS.h"\r
76 #include "task.h"\r
77 #include "timers.h"\r
78 \r
79 /* FreeRTOS+UDP includes. */\r
80 #include "FreeRTOS_UDP_IP.h"\r
81 #include "FreeRTOS_Sockets.h"\r
82 \r
83 /* UDP demo includes. */\r
84 #include "UDPCommandInterpreter.h"\r
85 #include "TwoEchoClients.h"\r
86 \r
87 /* Standard demo includes. */\r
88 #include "partest.h"\r
89 #include "blocktim.h"\r
90 #include "flash_timer.h"\r
91 #include "semtest.h"\r
92 #include "GenQTest.h"\r
93 #include "QPeek.h"\r
94 #include "IntQueue.h"\r
95 #include "countsem.h"\r
96 #include "dynamic.h"\r
97 #include "QueueOverwrite.h"\r
98 #include "QueueSet.h"\r
99 #include "recmutex.h"\r
100 #include "EventGroupsDemo.h"\r
101 #include "TaskNotify.h"\r
102 #include "IntSemTest.h"\r
103 #include "TimerDemo.h"\r
104 #include "IntQueue.h"\r
105 \r
106 /* The period after which the check timer will expire, in ms, provided no errors\r
107 have been reported by any of the standard demo tasks.  ms are converted to the\r
108 equivalent in ticks using the portTICK_PERIOD_MS constant. */\r
109 #define mainCHECK_TIMER_PERIOD_MS                       ( 3000UL / portTICK_PERIOD_MS )\r
110 \r
111 /* The period at which the check timer will expire, in ms, if an error has been\r
112 reported in one of the standard demo tasks.  ms are converted to the equivalent\r
113 in ticks using the portTICK_PERIOD_MS constant. */\r
114 #define mainERROR_CHECK_TIMER_PERIOD_MS         ( 200UL / portTICK_PERIOD_MS )\r
115 \r
116 /* The priorities of the various demo application tasks. */\r
117 #define mainSEM_TEST_PRIORITY                           ( tskIDLE_PRIORITY + 1 )\r
118 #define mainBLOCK_Q_PRIORITY                            ( tskIDLE_PRIORITY + 2 )\r
119 #define mainCOM_TEST_PRIORITY                           ( tskIDLE_PRIORITY + 2 )\r
120 #define mainINTEGER_TASK_PRIORITY           ( tskIDLE_PRIORITY )\r
121 #define mainGEN_QUEUE_TASK_PRIORITY                     ( tskIDLE_PRIORITY )\r
122 #define mainQUEUE_OVERWRITE_TASK_PRIORITY       ( tskIDLE_PRIORITY )\r
123 \r
124 /* The LED controlled by the 'check' software timer. */\r
125 #define mainCHECK_LED                                           ( 2 )\r
126 \r
127 /* The number of LEDs that should be controlled by the flash software timer\r
128 standard demo.  In this case it is only 1 as the starter kit has three LEDs, one\r
129 of which is controlled by the check timer and one of which is controlled by the\r
130 ISR triggered task. */\r
131 #define mainNUM_FLASH_TIMER_LEDS                        ( 1 )\r
132 \r
133 /* Misc. */\r
134 #define mainDONT_BLOCK                                          ( 0 )\r
135 \r
136 /* Note:  If the application is started without the network cable plugged in\r
137 then ipconfigUDP_TASK_PRIORITY should be set to 0 in FreeRTOSIPConfig.h to\r
138 ensure the IP task is created at the idle priority.  This is because the Atmel\r
139 ASF GMAC driver polls the GMAC looking for a connection, and doing so will\r
140 prevent any lower priority tasks from executing.  In this demo the IP task is\r
141 started at the idle priority, then set to configMAX_PRIORITIES - 2 in the\r
142 network event hook only after a connection has been established (when the event\r
143 passed into the network event hook is eNetworkUp).\r
144 http://www.FreeRTOS.org/udp */\r
145 #define mainCONNECTED_IP_TASK_PRIORITY          ( configMAX_PRIORITIES - 1 )\r
146 #define mainDISCONNECTED_IP_TASK_PRIORITY       ( tskIDLE_PRIORITY )\r
147 \r
148 /* UDP command server and echo task parameters. */\r
149 #define mainUDP_CLI_TASK_PRIORITY                       ( tskIDLE_PRIORITY )\r
150 #define mainUDP_CLI_PORT_NUMBER                         ( 5001UL )\r
151 #define mainUDP_CLI_TASK_STACK_SIZE                     ( configMINIMAL_STACK_SIZE + 90 )\r
152 #define mainECHO_CLIENT_STACK_SIZE                      ( configMINIMAL_STACK_SIZE + 30 )\r
153 \r
154 /* Set to 1 to include the UDP echo client tasks in the build.  The echo clients\r
155 require the IP address of the echo server to be defined using the\r
156 configECHO_SERVER_ADDR0 to configECHO_SERVER_ADDR3 constants in\r
157 FreeRTOSConfig.h. */\r
158 #define mainINCLUDE_ECHO_CLIENT_TASKS           1\r
159 \r
160 /* Used by the standard demo timer tasks. */\r
161 #define mainTIMER_TEST_PERIOD                           ( 50 )\r
162 \r
163 /*-----------------------------------------------------------*/\r
164 \r
165 /*\r
166  * The check timer callback function, as described at the top of this file.\r
167  */\r
168 static void prvCheckTimerCallback( TimerHandle_t xTimer );\r
169 \r
170 /*\r
171  * Creates a set of sample files on a RAM disk.  http://www.FreeRTOS.org/fat_sl\r
172  */\r
173 extern void vCreateAndVerifySampleFiles( void );\r
174 \r
175 /*\r
176  * Register sample generic commands that can be used with FreeRTOS+CLI.  Type\r
177  * 'help' in the command line to see a list of registered commands.\r
178  * http://www.FreeRTOS.org/cli\r
179  */\r
180 extern void vRegisterSampleCLICommands( void );\r
181 \r
182 /*\r
183  * Register sample file system commands that can be used with FreeRTOS+CLI.\r
184  */\r
185 extern void vRegisterFileSystemCLICommands( void );\r
186 \r
187 /*\r
188  * Register sample UDP related commands that can be used with FreeRTOS+CLI.\r
189  */\r
190 extern void vRegisterUDPCLICommands( void );\r
191 \r
192 /*\r
193  * Initialise the LCD and output a bitmap.\r
194  */\r
195 extern void vInitialiseLCD( void );\r
196 \r
197 /*\r
198  * Register check tasks, and the tasks used to write over and check the contents\r
199  * of the FPU registers, as described at the top of this file.  The nature of\r
200  * these files necessitates that they are written in an assembly file.\r
201  */\r
202 static void prvRegTest1Task( void *pvParameters ) __attribute__((naked));\r
203 static void prvRegTest2Task( void *pvParameters ) __attribute__((naked));\r
204 \r
205 /*-----------------------------------------------------------*/\r
206 \r
207 /* The default IP and MAC address used by the demo.  The address configuration\r
208 defined here will be used if ipconfigUSE_DHCP is 0, or if ipconfigUSE_DHCP is\r
209 1 but a DHCP server could not be contacted.  See the online documentation for\r
210 more information. */\r
211 static const uint8_t ucIPAddress[ 4 ] = { configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 };\r
212 static const uint8_t ucNetMask[ 4 ] = { configNET_MASK0, configNET_MASK1, configNET_MASK2, configNET_MASK3 };\r
213 static const uint8_t ucGatewayAddress[ 4 ] = { configGATEWAY_ADDR0, configGATEWAY_ADDR1, configGATEWAY_ADDR2, configGATEWAY_ADDR3 };\r
214 static const uint8_t ucDNSServerAddress[ 4 ] = { configDNS_SERVER_ADDR0, configDNS_SERVER_ADDR1, configDNS_SERVER_ADDR2, configDNS_SERVER_ADDR3 };\r
215 \r
216 /* The MAC address used by the demo.  In production units the MAC address would\r
217 probably be read from flash memory or an EEPROM.  Here it is just hard coded.\r
218 Note each node on a network must have a unique MAC address. */\r
219 const uint8_t ucMACAddress[ 6 ] = { configMAC_ADDR0, configMAC_ADDR1, configMAC_ADDR2, configMAC_ADDR3, configMAC_ADDR4, configMAC_ADDR5 };\r
220 \r
221 /* The following two variables are used to communicate the status of the\r
222 register check tasks to the check software timer.  If the variables keep\r
223 incrementing, then the register check tasks have not discovered any errors.  If\r
224 a variable stops incrementing, then an error has been found. */\r
225 volatile unsigned long ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL;\r
226 \r
227 /*-----------------------------------------------------------*/\r
228 \r
229 int main_full( void )\r
230 {\r
231         /* Usage instructions on http://www.FreeRTOS.org/Atmel_SAM4E_RTOS_Demo.html */\r
232 \r
233         /* Initialise the LCD and output a bitmap.  The IP address will also be\r
234         displayed on the LCD when it has been obtained. */\r
235         vInitialiseLCD();\r
236 \r
237         /* If the file system is only going to be accessed from one task then\r
238         F_FS_THREAD_AWARE can be set to 0 and the set of example files are created\r
239         before the RTOS scheduler is started.  If the file system is going to be\r
240         access from more than one task then F_FS_THREAD_AWARE must be set to 1 and\r
241         the     set of sample files are created from the idle task hook function\r
242         vApplicationIdleHook(). */\r
243         #if( F_FS_THREAD_AWARE == 0 )\r
244         {\r
245                 /* Initialise the drive and file system, then create a few example\r
246                 files.  The files can be viewed and accessed via the CLI.  View the\r
247                 documentation page for this demo (link at the top of this file) for more\r
248                 information. */\r
249                 vCreateAndVerifySampleFiles();\r
250         }\r
251         #endif\r
252 \r
253         /* Register example generic, file system related and UDP related CLI\r
254         commands respectively.  Type 'help' into the command console to view a list\r
255         of registered commands. */\r
256         vRegisterSampleCLICommands();\r
257         vRegisterFileSystemCLICommands();\r
258         vRegisterUDPCLICommands();\r
259 \r
260         /* Initialise the network interface.  Tasks that use the network are\r
261         created in the network event hook when the network is connected and ready\r
262         for use.  The address values passed in here are used if ipconfigUSE_DHCP is\r
263         set to 0, or if ipconfigUSE_DHCP is set to 1 but a DHCP server cannot be\r
264         contacted.  The IP address actually used is displayed on the LCD (after DHCP\r
265         has completed if DHCP is used). */\r
266         FreeRTOS_IPInit( ucIPAddress, ucNetMask, ucGatewayAddress, ucDNSServerAddress, ucMACAddress );\r
267 \r
268         /* Create all the other standard demo tasks. */ \r
269         vCreateBlockTimeTasks();\r
270         vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
271         vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
272         vStartQueuePeekTasks();\r
273         vStartCountingSemaphoreTasks();\r
274         vStartDynamicPriorityTasks();\r
275         vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_TASK_PRIORITY );\r
276         vStartQueueSetTasks();\r
277         vStartRecursiveMutexTasks();\r
278         vStartEventGroupTasks();\r
279         vStartTaskNotifyTask();\r
280         vStartInterruptSemaphoreTasks();\r
281         vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
282         vStartInterruptQueueTasks();\r
283 \r
284         /* Create the register check tasks, as described at the top of this\r
285         file */\r
286         xTaskCreate( prvRegTest1Task, "Reg1", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );\r
287         xTaskCreate( prvRegTest2Task, "Reg2", configMINIMAL_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, NULL );\r
288 \r
289         /* Start the scheduler itself. */\r
290         vTaskStartScheduler();\r
291 \r
292         /* If all is well, the scheduler will now be running, and the following line\r
293         will never be reached.  If the following line does execute, then there was\r
294         insufficient FreeRTOS heap memory available for the idle and/or timer tasks\r
295         to be created.  See the memory management section on the FreeRTOS web site\r
296         for more details. */\r
297         for( ;; );\r
298 }\r
299 /*-----------------------------------------------------------*/\r
300 \r
301 static void prvCheckTimerCallback( TimerHandle_t xTimer )\r
302 {\r
303 static long lChangedTimerPeriodAlready = pdFALSE;\r
304 static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0;\r
305 unsigned long ulErrorOccurred = pdFALSE;\r
306 \r
307         /* Avoid compiler warnings. */\r
308         ( void ) xTimer;\r
309 \r
310         /* Have any of the standard demo tasks detected an error in their\r
311         operation? */\r
312         if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
313         {\r
314                 ulErrorOccurred |= ( 0x01UL << 3UL );\r
315         }\r
316         else if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
317         {\r
318                 ulErrorOccurred |= ( 0x01UL << 4UL );\r
319         }\r
320         else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
321         {\r
322                 ulErrorOccurred |= ( 0x01UL << 5UL );\r
323         }\r
324         else if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
325         {\r
326                 ulErrorOccurred |= ( 0x01UL << 6UL );\r
327         }\r
328         else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )\r
329         {\r
330                 ulErrorOccurred |= ( 0x01UL << 8UL );\r
331         }\r
332         else if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
333         {\r
334                 ulErrorOccurred |= ( 0x01UL << 9UL );\r
335         }\r
336         else if( xIsQueueOverwriteTaskStillRunning() != pdTRUE )\r
337         {\r
338                 ulErrorOccurred |= ( 0x01UL << 10UL );\r
339         }\r
340         else if( xAreQueueSetTasksStillRunning() != pdTRUE )\r
341         {\r
342                 ulErrorOccurred |= ( 0x01UL << 11UL );\r
343         }\r
344         else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
345         {\r
346                 ulErrorOccurred |= ( 0x01UL << 12UL );\r
347         }\r
348         else if( xAreEventGroupTasksStillRunning() != pdTRUE )\r
349         {\r
350                 ulErrorOccurred |= ( 0x01UL << 13UL );\r
351         }\r
352         else if( xAreTaskNotificationTasksStillRunning() != pdTRUE )\r
353         {\r
354                 ulErrorOccurred |= ( 0x01UL << 14UL );\r
355         }\r
356         else if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE )\r
357         {\r
358                 ulErrorOccurred |= ( 0x01UL << 15UL );\r
359         }\r
360         else if( xAreTimerDemoTasksStillRunning( mainCHECK_TIMER_PERIOD_MS ) != pdTRUE )\r
361         {\r
362                 ulErrorOccurred |= 1UL << 16UL;\r
363         }       \r
364         else if( xAreIntQueueTasksStillRunning() != pdTRUE )\r
365         {\r
366                 ulErrorOccurred |= 1UL << 17UL;\r
367         }\r
368 \r
369         \r
370         /* Check that the register test 1 task is still running. */\r
371         if( ulLastRegTest1Value == ulRegTest1LoopCounter )\r
372         {\r
373                 ulErrorOccurred |= 1UL << 18UL;\r
374         }\r
375         ulLastRegTest1Value = ulRegTest1LoopCounter;\r
376 \r
377         /* Check that the register test 2 task is still running. */\r
378         if( ulLastRegTest2Value == ulRegTest2LoopCounter )\r
379         {\r
380                 ulErrorOccurred |= 1UL << 19UL;\r
381         }\r
382         ulLastRegTest2Value = ulRegTest2LoopCounter;\r
383 \r
384         if( ulErrorOccurred != pdFALSE )\r
385         {\r
386                 /* An error occurred.  Increase the frequency at which the check timer\r
387                 toggles its LED to give visual feedback of the potential error\r
388                 condition. */\r
389                 if( lChangedTimerPeriodAlready == pdFALSE )\r
390                 {\r
391                         lChangedTimerPeriodAlready = pdTRUE;\r
392 \r
393                         /* This call to xTimerChangePeriod() uses a zero block time.\r
394                         Functions called from inside of a timer callback function must\r
395                         *never* attempt to block as to do so could impact other software\r
396                         timers. */\r
397                         xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK );\r
398                 }\r
399         }\r
400 \r
401         /* Toggle the LED to give visual feedback of the system status.  The rate at\r
402         which the LED toggles will increase to mainERROR_CHECK_TIMER_PERIOD_MS if a\r
403         suspected error has been found in any of the standard demo tasks. */\r
404         vParTestToggleLED( mainCHECK_LED );\r
405 }\r
406 /*-----------------------------------------------------------*/\r
407 \r
408 /* Called by FreeRTOS+UDP when the network connects. */\r
409 void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )\r
410 {\r
411 static long lTasksAlreadyCreated = pdFALSE;\r
412 const unsigned long ulXCoord = 3, ulYCoord = 3, ulIPAddressOffset = 45;\r
413 unsigned long ulIPAddress;\r
414 char cIPAddress[ 20 ];\r
415 \r
416         /* Note:  If the application is started without the network cable plugged in\r
417         then ipconfigUDP_TASK_PRIORITY should be set to 0 in FreeRTOSIPConfig.h to\r
418         ensure the IP task is created at the idle priority.  This is because the Atmel\r
419         ASF GMAC driver polls the GMAC looking for a connection, and doing so will\r
420         prevent any lower priority tasks from executing.  In this demo the IP task is\r
421         started at the idle priority, then set to configMAX_PRIORITIES - 2 in the\r
422         network event hook only after a connection has been established (when the event\r
423         passed into the network event hook is eNetworkUp). */\r
424         if( eNetworkEvent == eNetworkUp )\r
425         {\r
426                 /* Ensure tasks are only created once. */\r
427                 if( lTasksAlreadyCreated == pdFALSE )\r
428                 {\r
429                         /* Create the task that handles the CLI on a UDP port.  The port\r
430                         number is set using the configUDP_CLI_PORT_NUMBER setting in\r
431                         FreeRTOSConfig.h. */\r
432                         vStartUDPCommandInterpreterTask( mainUDP_CLI_TASK_STACK_SIZE, mainUDP_CLI_PORT_NUMBER, mainUDP_CLI_TASK_PRIORITY );\r
433 \r
434                         #if( mainINCLUDE_ECHO_CLIENT_TASKS == 1 )\r
435                         {\r
436                                 /* Create the UDP echo tasks.  The UDP echo tasks require the IP\r
437                                 address of the echo server to be defined using the\r
438                                 configECHO_SERVER_ADDR0 to configECHO_SERVER_ADDR3 constants in\r
439                                 FreeRTOSConfig.h. */\r
440                                 vStartEchoClientTasks( mainECHO_CLIENT_STACK_SIZE, tskIDLE_PRIORITY );\r
441                         }\r
442                         #endif\r
443                 }\r
444 \r
445                 /* Obtain the IP address, convert it to a string, then display it on the\r
446                 LCD. */\r
447                 FreeRTOS_GetAddressConfiguration( &ulIPAddress, NULL, NULL, NULL );\r
448                 FreeRTOS_inet_ntoa( ulIPAddress, cIPAddress );\r
449                 ili93xx_draw_string( ulXCoord, ulYCoord, ( uint8_t * ) "IP: " );\r
450                 ili93xx_draw_string( ulXCoord + ulIPAddressOffset, ulYCoord, ( uint8_t * ) cIPAddress );\r
451 \r
452                 /* Set the priority of the IP task up to the desired priority now it has\r
453                 connected. */\r
454                 vTaskPrioritySet( NULL, mainCONNECTED_IP_TASK_PRIORITY );\r
455         }\r
456 \r
457         /* NOTE:  At the time of writing the Ethernet driver does not report the\r
458         cable being unplugged - so the following if() condition will never be met.\r
459         It is included for possible future updates to the driver. */\r
460         if( eNetworkEvent == eNetworkDown )\r
461         {\r
462                 /* Ensure the Atmel GMAC drivers don't hog all the CPU time as they look\r
463                 for a new connection by lowering the priority of the IP task to that of\r
464                 the Idle task. */\r
465                 vTaskPrioritySet( NULL, tskIDLE_PRIORITY );\r
466 \r
467                 /* Disconnected - so no IP address. */\r
468                 ili93xx_draw_string( ulXCoord, ulYCoord, ( uint8_t * ) "IP:                  " );\r
469         }\r
470 }\r
471 /*-----------------------------------------------------------*/\r
472 \r
473 void vFullDemoIdleHook( void )\r
474 {\r
475 static TimerHandle_t xCheckTimer = NULL;\r
476                 \r
477         if( xCheckTimer == NULL )\r
478         {\r
479                 /* Create the software timer that performs the 'check' \r
480                 functionality, in the full demo.  This is not done before the\r
481                 scheduler is started as to do so would prevent the standard demo\r
482                 timer tasks from passing their tests (they expect the timer\r
483                 command queue to be empty. */\r
484                 xCheckTimer = xTimerCreate( "CheckTimer",                                       /* A text name, purely to help debugging. */\r
485                                                                         ( mainCHECK_TIMER_PERIOD_MS ),  /* The timer period, in this case 3000ms (3s). */\r
486                                                                         pdTRUE,                                                 /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */\r
487                                                                         ( void * ) 0,                                   /* The ID is not used, so can be set to anything. */\r
488                                                                         prvCheckTimerCallback );                /* The callback function that inspects the status of all the other tasks. */\r
489 \r
490                 if( xCheckTimer != NULL )\r
491                 {\r
492                         xTimerStart( xCheckTimer, mainDONT_BLOCK );\r
493                 }\r
494                 \r
495                 /* Also start some timers that just flash LEDs. */\r
496                 vStartLEDFlashTimers( mainNUM_FLASH_TIMER_LEDS );\r
497         }\r
498         \r
499         /* If the file system is only going to be accessed from one task then\r
500         F_FS_THREAD_AWARE can be set to 0 and the set of example files is created\r
501         before the RTOS scheduler is started.  If the file system is going to be\r
502         access from more than one task then F_FS_THREAD_AWARE must be set to 1 and\r
503         the     set of sample files are created from the idle task hook function. */\r
504         #if( F_FS_THREAD_AWARE == 1 )\r
505         {\r
506                 static portBASE_TYPE xCreatedSampleFiles = pdFALSE;\r
507 \r
508                 /* Initialise the drive and file system, then create a few example\r
509                 files.  The output from this function just goes to the stdout window,\r
510                 allowing the output to be viewed when the UDP command console is not\r
511                 connected. */\r
512                 if( xCreatedSampleFiles == pdFALSE )\r
513                 {\r
514                         vCreateAndVerifySampleFiles();\r
515                         xCreatedSampleFiles = pdTRUE;\r
516                 }\r
517         }\r
518         #endif\r
519 }\r
520 /*-----------------------------------------------------------*/\r
521 \r
522 void vFullDemoTickHook( void )\r
523 {\r
524         /* Call the periodic queue overwrite from ISR test function. */\r
525         vQueueOverwritePeriodicISRDemo();\r
526 \r
527         /* Call the periodic queue set ISR test function. */\r
528         vQueueSetAccessQueueSetFromISR();\r
529         \r
530         /* Call the event group ISR tests. */\r
531         vPeriodicEventGroupsProcessing();\r
532         \r
533         /* Exercise task notifications from interrupts. */\r
534         xNotifyTaskFromISR();\r
535         \r
536         /* Use mutexes from interrupts. */\r
537         vInterruptSemaphorePeriodicTest();\r
538         \r
539         /* Use timers from an interrupt. */\r
540         vTimerPeriodicISRTests();\r
541 }\r
542 /*-----------------------------------------------------------*/\r
543 \r
544 /* Called automatically when a reply to an outgoing ping is received. */\r
545 void vApplicationPingReplyHook( ePingReplyStatus_t eStatus, uint16_t usIdentifier )\r
546 {\r
547         /* This demo has nowhere to output any information so does nothing, but the\r
548         IP address resolved for the pined URL is displayed in the CLI. */\r
549         ( void ) usIdentifier;\r
550         ( void ) eStatus;\r
551 }\r
552 /*-----------------------------------------------------------*/\r
553 \r
554 /* This is a naked function. */\r
555 static void prvRegTest1Task( void *pvParameters )\r
556 {\r
557         __asm volatile\r
558         (\r
559                 "       /* Fill the core registers with known values. */                \n"\r
560                 "       mov r0, #100                                                                                    \n"\r
561                 "       mov r1, #101                                                                                    \n"\r
562                 "       mov r2, #102                                                                                    \n"\r
563                 "       mov r3, #103                                                                                    \n"\r
564                 "       mov     r4, #104                                                                                        \n"\r
565                 "       mov     r5, #105                                                                                        \n"\r
566                 "       mov     r6, #106                                                                                        \n"\r
567                 "       mov r7, #107                                                                                    \n"\r
568                 "       mov     r8, #108                                                                                        \n"\r
569                 "       mov     r9, #109                                                                                        \n"\r
570                 "       mov     r10, #110                                                                                       \n"\r
571                 "       mov     r11, #111                                                                                       \n"\r
572                 "       mov r12, #112                                                                                   \n"\r
573                 "                                                                                                                       \n"\r
574                 "       /* Fill the VFP registers with known values. */                 \n"\r
575                 "       vmov d0, r0, r1                                                                                 \n"\r
576                 "       vmov d1, r2, r3                                                                                 \n"\r
577                 "       vmov d2, r4, r5                                                                                 \n"\r
578                 "       vmov d3, r6, r7                                                                                 \n"\r
579                 "       vmov d4, r8, r9                                                                                 \n"\r
580                 "       vmov d5, r10, r11                                                                               \n"\r
581                 "       vmov d6, r0, r1                                                                                 \n"\r
582                 "       vmov d7, r2, r3                                                                                 \n"\r
583                 "       vmov d8, r4, r5                                                                                 \n"\r
584                 "       vmov d9, r6, r7                                                                                 \n"\r
585                 "       vmov d10, r8, r9                                                                                \n"\r
586                 "       vmov d11, r10, r11                                                                              \n"\r
587                 "       vmov d12, r0, r1                                                                                \n"\r
588                 "       vmov d13, r2, r3                                                                                \n"\r
589                 "       vmov d14, r4, r5                                                                                \n"\r
590                 "       vmov d15, r6, r7                                                                                \n"\r
591                 "                                                                                                                       \n"\r
592                 "reg1_loop:                                                                                                     \n"\r
593                 "       /* Check all the VFP registers still contain the values set above.\n"\r
594                 "       First save registers that are clobbered by the test. */ \n"\r
595                 "       push { r0-r1 }                                                                                  \n"\r
596                 "                                                                                                                       \n"\r
597                 "       vmov r0, r1, d0                                                                                 \n"\r
598                 "       cmp r0, #100                                                                                    \n"\r
599                 "       bne reg1_error_loopf                                                                    \n"\r
600                 "       cmp r1, #101                                                                                    \n"\r
601                 "       bne reg1_error_loopf                                                                    \n"\r
602                 "       vmov r0, r1, d1                                                                                 \n"\r
603                 "       cmp r0, #102                                                                                    \n"\r
604                 "       bne reg1_error_loopf                                                                    \n"\r
605                 "       cmp r1, #103                                                                                    \n"\r
606                 "       bne reg1_error_loopf                                                                    \n"\r
607                 "       vmov r0, r1, d2                                                                                 \n"\r
608                 "       cmp r0, #104                                                                                    \n"\r
609                 "       bne reg1_error_loopf                                                                    \n"\r
610                 "       cmp r1, #105                                                                                    \n"\r
611                 "       bne reg1_error_loopf                                                                    \n"\r
612                 "       vmov r0, r1, d3                                                                                 \n"\r
613                 "       cmp r0, #106                                                                                    \n"\r
614                 "       bne reg1_error_loopf                                                                    \n"\r
615                 "       cmp r1, #107                                                                                    \n"\r
616                 "       bne reg1_error_loopf                                                                    \n"\r
617                 "       vmov r0, r1, d4                                                                                 \n"\r
618                 "       cmp r0, #108                                                                                    \n"\r
619                 "       bne reg1_error_loopf                                                                    \n"\r
620                 "       cmp r1, #109                                                                                    \n"\r
621                 "       bne reg1_error_loopf                                                                    \n"\r
622                 "       vmov r0, r1, d5                                                                                 \n"\r
623                 "       cmp r0, #110                                                                                    \n"\r
624                 "       bne reg1_error_loopf                                                                    \n"\r
625                 "       cmp r1, #111                                                                                    \n"\r
626                 "       bne reg1_error_loopf                                                                    \n"\r
627                 "       vmov r0, r1, d6                                                                                 \n"\r
628                 "       cmp r0, #100                                                                                    \n"\r
629                 "       bne reg1_error_loopf                                                                    \n"\r
630                 "       cmp r1, #101                                                                                    \n"\r
631                 "       bne reg1_error_loopf                                                                    \n"\r
632                 "       vmov r0, r1, d7                                                                                 \n"\r
633                 "       cmp r0, #102                                                                                    \n"\r
634                 "       bne reg1_error_loopf                                                                    \n"\r
635                 "       cmp r1, #103                                                                                    \n"\r
636                 "       bne reg1_error_loopf                                                                    \n"\r
637                 "       vmov r0, r1, d8                                                                                 \n"\r
638                 "       cmp r0, #104                                                                                    \n"\r
639                 "       bne reg1_error_loopf                                                                    \n"\r
640                 "       cmp r1, #105                                                                                    \n"\r
641                 "       bne reg1_error_loopf                                                                    \n"\r
642                 "       vmov r0, r1, d9                                                                                 \n"\r
643                 "       cmp r0, #106                                                                                    \n"\r
644                 "       bne reg1_error_loopf                                                                    \n"\r
645                 "       cmp r1, #107                                                                                    \n"\r
646                 "       bne reg1_error_loopf                                                                    \n"\r
647                 "       vmov r0, r1, d10                                                                                \n"\r
648                 "       cmp r0, #108                                                                                    \n"\r
649                 "       bne reg1_error_loopf                                                                    \n"\r
650                 "       cmp r1, #109                                                                                    \n"\r
651                 "       bne reg1_error_loopf                                                                    \n"\r
652                 "       vmov r0, r1, d11                                                                                \n"\r
653                 "       cmp r0, #110                                                                                    \n"\r
654                 "       bne reg1_error_loopf                                                                    \n"\r
655                 "       cmp r1, #111                                                                                    \n"\r
656                 "       bne reg1_error_loopf                                                                    \n"\r
657                 "       vmov r0, r1, d12                                                                                \n"\r
658                 "       cmp r0, #100                                                                                    \n"\r
659                 "       bne reg1_error_loopf                                                                    \n"\r
660                 "       cmp r1, #101                                                                                    \n"\r
661                 "       bne reg1_error_loopf                                                                    \n"\r
662                 "       vmov r0, r1, d13                                                                                \n"\r
663                 "       cmp r0, #102                                                                                    \n"\r
664                 "       bne reg1_error_loopf                                                                    \n"\r
665                 "       cmp r1, #103                                                                                    \n"\r
666                 "       bne reg1_error_loopf                                                                    \n"\r
667                 "       vmov r0, r1, d14                                                                                \n"\r
668                 "       cmp r0, #104                                                                                    \n"\r
669                 "       bne reg1_error_loopf                                                                    \n"\r
670                 "       cmp r1, #105                                                                                    \n"\r
671                 "       bne reg1_error_loopf                                                                    \n"\r
672                 "       vmov r0, r1, d15                                                                                \n"\r
673                 "       cmp r0, #106                                                                                    \n"\r
674                 "       bne reg1_error_loopf                                                                    \n"\r
675                 "       cmp r1, #107                                                                                    \n"\r
676                 "       bne reg1_error_loopf                                                                    \n"\r
677                 "                                                                                                                       \n"\r
678                 "       /* Restore the registers that were clobbered by the test. */\n"\r
679                 "       pop {r0-r1}                                                                                             \n"\r
680                 "                                                                                                                       \n"\r
681                 "       /* VFP register test passed.  Jump to the core register test. */\n"\r
682                 "       b reg1_loopf_pass                                                                               \n"\r
683                 "                                                                                                                       \n"\r
684                 "reg1_error_loopf:                                                                                      \n"\r
685                 "       /* If this line is hit then a VFP register value was found to be\n"\r
686                 "       incorrect. */                                                                                   \n"\r
687                 "       b reg1_error_loopf                                                                              \n"\r
688                 "                                                                                                                       \n"\r
689                 "reg1_loopf_pass:                                                                                       \n"\r
690                 "                                                                                                                       \n"\r
691                 "       cmp     r0, #100                                                                                        \n"\r
692                 "       bne     reg1_error_loop                                                                         \n"\r
693                 "       cmp     r1, #101                                                                                        \n"\r
694                 "       bne     reg1_error_loop                                                                         \n"\r
695                 "       cmp     r2, #102                                                                                        \n"\r
696                 "       bne     reg1_error_loop                                                                         \n"\r
697                 "       cmp r3, #103                                                                                    \n"\r
698                 "       bne     reg1_error_loop                                                                         \n"\r
699                 "       cmp     r4, #104                                                                                        \n"\r
700                 "       bne     reg1_error_loop                                                                         \n"\r
701                 "       cmp     r5, #105                                                                                        \n"\r
702                 "       bne     reg1_error_loop                                                                         \n"\r
703                 "       cmp     r6, #106                                                                                        \n"\r
704                 "       bne     reg1_error_loop                                                                         \n"\r
705                 "       cmp     r7, #107                                                                                        \n"\r
706                 "       bne     reg1_error_loop                                                                         \n"\r
707                 "       cmp     r8, #108                                                                                        \n"\r
708                 "       bne     reg1_error_loop                                                                         \n"\r
709                 "       cmp     r9, #109                                                                                        \n"\r
710                 "       bne     reg1_error_loop                                                                         \n"\r
711                 "       cmp     r10, #110                                                                                       \n"\r
712                 "       bne     reg1_error_loop                                                                         \n"\r
713                 "       cmp     r11, #111                                                                                       \n"\r
714                 "       bne     reg1_error_loop                                                                         \n"\r
715                 "       cmp     r12, #112                                                                                       \n"\r
716                 "       bne     reg1_error_loop                                                                         \n"\r
717                 "                                                                                                                       \n"\r
718                 "       /* Everything passed, increment the loop counter. */    \n"\r
719                 "       push { r0-r1 }                                                                                  \n"\r
720                 "       ldr     r0, =ulRegTest1LoopCounter                                                      \n"\r
721                 "       ldr r1, [r0]                                                                                    \n"\r
722                 "       adds r1, r1, #1                                                                                 \n"\r
723                 "       str r1, [r0]                                                                                    \n"\r
724                 "       pop { r0-r1 }                                                                                   \n"\r
725                 "                                                                                                                       \n"\r
726                 "       /* Start again. */                                                                              \n"\r
727                 "       b reg1_loop                                                                                             \n"\r
728                 "                                                                                                                       \n"\r
729                 "reg1_error_loop:                                                                                       \n"\r
730                 "       /* If this line is hit then there was an error in a core register value.\n"\r
731                 "       The loop ensures the loop counter stops incrementing. */\n"\r
732                 "       b reg1_error_loop                                                                               \n"\r
733                 "       nop                                                                                                             "\r
734         );\r
735         \r
736         /* Remove compiler warnings about unused parameters. */\r
737         ( void ) pvParameters;\r
738 }\r
739 /*-----------------------------------------------------------*/\r
740 \r
741 /* This is a naked function. */\r
742 static void prvRegTest2Task( void *pvParameters )\r
743 {\r
744         __asm volatile\r
745         (\r
746                 "       /* Set all the core registers to known values. */               \n"\r
747                 "       mov r0, #-1                                                                                             \n"\r
748                 "       mov r1, #1                                                                                              \n"\r
749                 "       mov r2, #2                                                                                              \n"\r
750                 "       mov r3, #3                                                                                              \n"\r
751                 "       mov     r4, #4                                                                                          \n"\r
752                 "       mov     r5, #5                                                                                          \n"\r
753                 "       mov     r6, #6                                                                                          \n"\r
754                 "       mov r7, #7                                                                                              \n"\r
755                 "       mov     r8, #8                                                                                          \n"\r
756                 "       mov     r9, #9                                                                                          \n"\r
757                 "       mov     r10, #10                                                                                        \n"\r
758                 "       mov     r11, #11                                                                                        \n"\r
759                 "       mov r12, #12                                                                                    \n"\r
760                 "                                                                                                                       \n"\r
761                 "       /* Set all the VFP to known values. */                                  \n"\r
762                 "       vmov d0, r0, r1                                                                                 \n"\r
763                 "       vmov d1, r2, r3                                                                                 \n"\r
764                 "       vmov d2, r4, r5                                                                                 \n"\r
765                 "       vmov d3, r6, r7                                                                                 \n"\r
766                 "       vmov d4, r8, r9                                                                                 \n"\r
767                 "       vmov d5, r10, r11                                                                               \n"\r
768                 "       vmov d6, r0, r1                                                                                 \n"\r
769                 "       vmov d7, r2, r3                                                                                 \n"\r
770                 "       vmov d8, r4, r5                                                                                 \n"\r
771                 "       vmov d9, r6, r7                                                                                 \n"\r
772                 "       vmov d10, r8, r9                                                                                \n"\r
773                 "       vmov d11, r10, r11                                                                              \n"\r
774                 "       vmov d12, r0, r1                                                                                \n"\r
775                 "       vmov d13, r2, r3                                                                                \n"\r
776                 "       vmov d14, r4, r5                                                                                \n"\r
777                 "       vmov d15, r6, r7                                                                                \n"\r
778                 "                                                                                                                       \n"\r
779                 "reg2_loop:                                                                                                     \n"\r
780                 "                                                                                                                       \n"\r
781                 "       /* Check all the VFP registers still contain the values set above.\n"\r
782                 "       First save registers that are clobbered by the test. */ \n"\r
783                 "       push { r0-r1 }                                                                                  \n"\r
784                 "                                                                                                                       \n"\r
785                 "       vmov r0, r1, d0                                                                                 \n"\r
786                 "       cmp r0, #-1                                                                                             \n"\r
787                 "       bne reg2_error_loopf                                                                    \n"\r
788                 "       cmp r1, #1                                                                                              \n"\r
789                 "       bne reg2_error_loopf                                                                    \n"\r
790                 "       vmov r0, r1, d1                                                                                 \n"\r
791                 "       cmp r0, #2                                                                                              \n"\r
792                 "       bne reg2_error_loopf                                                                    \n"\r
793                 "       cmp r1, #3                                                                                              \n"\r
794                 "       bne reg2_error_loopf                                                                    \n"\r
795                 "       vmov r0, r1, d2                                                                                 \n"\r
796                 "       cmp r0, #4                                                                                              \n"\r
797                 "       bne reg2_error_loopf                                                                    \n"\r
798                 "       cmp r1, #5                                                                                              \n"\r
799                 "       bne reg2_error_loopf                                                                    \n"\r
800                 "       vmov r0, r1, d3                                                                                 \n"\r
801                 "       cmp r0, #6                                                                                              \n"\r
802                 "       bne reg2_error_loopf                                                                    \n"\r
803                 "       cmp r1, #7                                                                                              \n"\r
804                 "       bne reg2_error_loopf                                                                    \n"\r
805                 "       vmov r0, r1, d4                                                                                 \n"\r
806                 "       cmp r0, #8                                                                                              \n"\r
807                 "       bne reg2_error_loopf                                                                    \n"\r
808                 "       cmp r1, #9                                                                                              \n"\r
809                 "       bne reg2_error_loopf                                                                    \n"\r
810                 "       vmov r0, r1, d5                                                                                 \n"\r
811                 "       cmp r0, #10                                                                                             \n"\r
812                 "       bne reg2_error_loopf                                                                    \n"\r
813                 "       cmp r1, #11                                                                                             \n"\r
814                 "       bne reg2_error_loopf                                                                    \n"\r
815                 "       vmov r0, r1, d6                                                                                 \n"\r
816                 "       cmp r0, #-1                                                                                             \n"\r
817                 "       bne reg2_error_loopf                                                                    \n"\r
818                 "       cmp r1, #1                                                                                              \n"\r
819                 "       bne reg2_error_loopf                                                                    \n"\r
820                 "       vmov r0, r1, d7                                                                                 \n"\r
821                 "       cmp r0, #2                                                                                              \n"\r
822                 "       bne reg2_error_loopf                                                                    \n"\r
823                 "       cmp r1, #3                                                                                              \n"\r
824                 "       bne reg2_error_loopf                                                                    \n"\r
825                 "       vmov r0, r1, d8                                                                                 \n"\r
826                 "       cmp r0, #4                                                                                              \n"\r
827                 "       bne reg2_error_loopf                                                                    \n"\r
828                 "       cmp r1, #5                                                                                              \n"\r
829                 "       bne reg2_error_loopf                                                                    \n"\r
830                 "       vmov r0, r1, d9                                                                                 \n"\r
831                 "       cmp r0, #6                                                                                              \n"\r
832                 "       bne reg2_error_loopf                                                                    \n"\r
833                 "       cmp r1, #7                                                                                              \n"\r
834                 "       bne reg2_error_loopf                                                                    \n"\r
835                 "       vmov r0, r1, d10                                                                                \n"\r
836                 "       cmp r0, #8                                                                                              \n"\r
837                 "       bne reg2_error_loopf                                                                    \n"\r
838                 "       cmp r1, #9                                                                                              \n"\r
839                 "       bne reg2_error_loopf                                                                    \n"\r
840                 "       vmov r0, r1, d11                                                                                \n"\r
841                 "       cmp r0, #10                                                                                             \n"\r
842                 "       bne reg2_error_loopf                                                                    \n"\r
843                 "       cmp r1, #11                                                                                             \n"\r
844                 "       bne reg2_error_loopf                                                                    \n"\r
845                 "       vmov r0, r1, d12                                                                                \n"\r
846                 "       cmp r0, #-1                                                                                             \n"\r
847                 "       bne reg2_error_loopf                                                                    \n"\r
848                 "       cmp r1, #1                                                                                              \n"\r
849                 "       bne reg2_error_loopf                                                                    \n"\r
850                 "       vmov r0, r1, d13                                                                                \n"\r
851                 "       cmp r0, #2                                                                                              \n"\r
852                 "       bne reg2_error_loopf                                                                    \n"\r
853                 "       cmp r1, #3                                                                                              \n"\r
854                 "       bne reg2_error_loopf                                                                    \n"\r
855                 "       vmov r0, r1, d14                                                                                \n"\r
856                 "       cmp r0, #4                                                                                              \n"\r
857                 "       bne reg2_error_loopf                                                                    \n"\r
858                 "       cmp r1, #5                                                                                              \n"\r
859                 "       bne reg2_error_loopf                                                                    \n"\r
860                 "       vmov r0, r1, d15                                                                                \n"\r
861                 "       cmp r0, #6                                                                                              \n"\r
862                 "       bne reg2_error_loopf                                                                    \n"\r
863                 "       cmp r1, #7                                                                                              \n"\r
864                 "       bne reg2_error_loopf                                                                    \n"\r
865                 "                                                                                                                       \n"\r
866                 "       /* Restore the registers that were clobbered by the test. */\n"\r
867                 "       pop {r0-r1}                                                                                             \n"\r
868                 "                                                                                                                       \n"\r
869                 "       /* VFP register test passed.  Jump to the core register test. */\n"\r
870                 "       b reg2_loopf_pass                                                                               \n"\r
871                 "                                                                                                                       \n"\r
872                 "reg2_error_loopf:                                                                                      \n"\r
873                 "       /* If this line is hit then a VFP register value was found to be\n"\r
874                 "       incorrect. */                                                                                   \n"\r
875                 "       b reg2_error_loopf                                                                              \n"\r
876                 "                                                                                                                       \n"\r
877                 "reg2_loopf_pass:                                                                                       \n"\r
878                 "                                                                                                                       \n"\r
879                 "       cmp     r0, #-1                                                                                         \n"\r
880                 "       bne     reg2_error_loop                                                                         \n"\r
881                 "       cmp     r1, #1                                                                                          \n"\r
882                 "       bne     reg2_error_loop                                                                         \n"\r
883                 "       cmp     r2, #2                                                                                          \n"\r
884                 "       bne     reg2_error_loop                                                                         \n"\r
885                 "       cmp r3, #3                                                                                              \n"\r
886                 "       bne     reg2_error_loop                                                                         \n"\r
887                 "       cmp     r4, #4                                                                                          \n"\r
888                 "       bne     reg2_error_loop                                                                         \n"\r
889                 "       cmp     r5, #5                                                                                          \n"\r
890                 "       bne     reg2_error_loop                                                                         \n"\r
891                 "       cmp     r6, #6                                                                                          \n"\r
892                 "       bne     reg2_error_loop                                                                         \n"\r
893                 "       cmp     r7, #7                                                                                          \n"\r
894                 "       bne     reg2_error_loop                                                                         \n"\r
895                 "       cmp     r8, #8                                                                                          \n"\r
896                 "       bne     reg2_error_loop                                                                         \n"\r
897                 "       cmp     r9, #9                                                                                          \n"\r
898                 "       bne     reg2_error_loop                                                                         \n"\r
899                 "       cmp     r10, #10                                                                                        \n"\r
900                 "       bne     reg2_error_loop                                                                         \n"\r
901                 "       cmp     r11, #11                                                                                        \n"\r
902                 "       bne     reg2_error_loop                                                                         \n"\r
903                 "       cmp     r12, #12                                                                                        \n"\r
904                 "       bne     reg2_error_loop                                                                         \n"\r
905                 "                                                                                                                       \n"\r
906                 "       /* Increment the loop counter to indicate this test is still functioning\n"\r
907                 "       correctly. */                                                                                   \n"\r
908                 "       push { r0-r1 }                                                                                  \n"\r
909                 "       ldr     r0, =ulRegTest2LoopCounter                                                      \n"\r
910                 "       ldr r1, [r0]                                                                                    \n"\r
911                 "       adds r1, r1, #1                                                                                 \n"\r
912                 "       str r1, [r0]                                                                                    \n"\r
913                 "                                                                                                                       \n"\r
914                 "       /* Yield to increase test coverage. */                                  \n"\r
915                 "       movs r0, #0x01                                                                                  \n"\r
916                 "       ldr r1, =0xe000ed04                                                                     \n" /* NVIC_INT_CTRL */\r
917                 "       lsl r0, #28                                                                                     \n" /* Shift to PendSV bit */\r
918                 "       str r0, [r1]                                                                                    \n"\r
919                 "       dsb                                                                                                             \n"\r
920                 "       pop { r0-r1 }                                                                                   \n"\r
921                 "                                                                                                                       \n"\r
922                 "       /* Start again. */                                                                              \n"\r
923                 "       b reg2_loop                                                                                             \n"\r
924                 "                                                                                                                       \n"\r
925                 "reg2_error_loop:                                                                                       \n"\r
926                 "       /* If this line is hit then there was an error in a core register value.\n"\r
927                 "       This loop ensures the loop counter variable stops incrementing. */\n"\r
928                 "       b reg2_error_loop                                                                               \n"\r
929                 "       nop                                                                                                             \n"\r
930         );\r
931 \r
932         /* Remove compiler warnings about unused parameters. */\r
933         ( void ) pvParameters;\r
934 }\r