2 FreeRTOS V6.0.4 - Copyright (C) 2010 Real Time Engineers Ltd.
4 ***************************************************************************
9 * + Wanting to learn FreeRTOS or multitasking in general quickly *
10 * + Looking for basic training, *
11 * + Wanting to improve your FreeRTOS skills and productivity *
13 * then take a look at the FreeRTOS eBook *
15 * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
16 * http://www.FreeRTOS.org/Documentation *
18 * A pdf reference manual is also available. Both are usually delivered *
19 * to your inbox within 20 minutes to two hours when purchased between 8am *
20 * and 8pm GMT (although please allow up to 24 hours in case of *
21 * exceptional circumstances). Thank you for your support! *
23 ***************************************************************************
25 This file is part of the FreeRTOS distribution.
27 FreeRTOS is free software; you can redistribute it and/or modify it under
28 the terms of the GNU General Public License (version 2) as published by the
29 Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
30 ***NOTE*** The exception to the GPL is included to allow you to distribute
31 a combined work that includes FreeRTOS without being obliged to provide the
32 source code for proprietary components outside of the FreeRTOS kernel.
33 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT
34 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
35 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
36 more details. You should have received a copy of the GNU General Public
37 License and the FreeRTOS license exception along with FreeRTOS; if not it
38 can be viewed here: http://www.freertos.org/a00114.html and also obtained
39 by writing to Richard Barry, contact details for whom are available on the
44 http://www.FreeRTOS.org - Documentation, latest information, license and
47 http://www.SafeRTOS.com - A version that is certified for use in safety
50 http://www.OpenRTOS.com - Commercial support, development, porting,
51 licensing and training services.
57 static void vRegTest1( void *pvParameters );// __attribute__((naked));
58 static void vRegTest2( void *pvParameters );// __attribute__((naked));
60 static volatile unsigned long ulRegTest1Counter = 0UL, ulRegTest2Counter = 0UL;
62 void vStartRegTestTasks( void )
64 xTaskCreate( vRegTest1, ( signed char * ) "RTest1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
65 xTaskCreate( vRegTest2, ( signed char * ) "RTest1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
67 /*-----------------------------------------------------------*/
69 static void vRegTest1( void *pvParameters )
73 " mov r2, #0x02 \n" /* Fill the registers with known values, r0 is always 0 and r1 is the stack pointer. */
88 "reg_check_loop_1: \n"
90 " cmp r2, #0x02 \n" /* Check that each register still contains the expected value, jump to an infinite loop if an error is found. */
91 " bne.s reg_check_error_1 \n"
93 " bne.s reg_check_error_1 \n"
95 " bne.s reg_check_error_1 \n"
97 " bne.s reg_check_error_1 \n"
99 " bne.s reg_check_error_1 \n"
101 " bne.s reg_check_error_1 \n"
103 " bne.s reg_check_error_1 \n"
105 " bne.s reg_check_error_1 \n"
107 " bne.s reg_check_error_1 \n"
109 " bne.s reg_check_error_1 \n"
111 " bne.s reg_check_error_1 \n"
113 " bne.s reg_check_error_1 \n"
115 " bne.s reg_check_error_1 \n"
117 " bne.s reg_check_error_1 \n"
119 " ld r2, [r0]+short(ulRegTest1Counter) \n" /* Increment the loop counter to show that this task is still running error free. */
121 " st r2, [r0]+short(ulRegTest1Counter) \n"
124 " bra.s reg_check_loop_1 \n" /* Do it all again. */
126 "reg_check_error_1: \n"
130 /*-----------------------------------------------------------*/
132 static void vRegTest2( void *pvParameters )
136 " mov r2, #0x12 \n" /* Fill the registers with known values, r0 is always 0 and r1 is the stack pointer. */
151 "reg_check_loop_2: \n"
152 " cmp r2, #0x12 \n" /* Check that each register still contains the expected value, jump to an infinite loop if an error is found. */
153 " bne.s reg_check_error_2 \n"
155 " bne.s reg_check_error_2 \n"
157 " bne.s reg_check_error_2 \n"
159 " bne.s reg_check_error_2 \n"
161 " bne.s reg_check_error_2 \n"
163 " bne.s reg_check_error_2 \n"
165 " bne.s reg_check_error_2 \n"
167 " bne.s reg_check_error_2 \n"
169 " bne.s reg_check_error_2 \n"
171 " bne.s reg_check_error_2 \n"
173 " bne.s reg_check_error_2 \n"
175 " bne.s reg_check_error_2 \n"
177 " bne.s reg_check_error_2 \n"
179 " bne.s reg_check_error_2 \n"
181 " ld r2, [r0]+short(ulRegTest2Counter) \n" /* Increment the loop counter to show that this task is still running error free. */
183 " st r2, [r0]+short(ulRegTest2Counter) \n"
186 " bra.s reg_check_loop_2 \n" /* Do it all again. */
188 "reg_check_error_2: \n"
192 /*-----------------------------------------------------------*/
194 portBASE_TYPE xAreRegTestTasksStillRunning( void )
196 static unsigned long ulLastCounter1 = 0UL, ulLastCounter2 = 0UL;
199 /* Check that both loop counters are still incrementing, indicating that
200 both reg test tasks are still running error free. */
201 if( ulLastCounter1 == ulRegTest1Counter )
205 else if( ulLastCounter2 == ulRegTest2Counter )
214 ulLastCounter1 = ulRegTest1Counter;
215 ulLastCounter2 = ulRegTest2Counter;