]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/Full_Demo/RegisterTests.S
Final V8.2.1 release ready for tagging:
[freertos] / FreeRTOS / Demo / MicroBlaze_Kintex7_EthernetLite / RTOSDemo / src / Full_Demo / RegisterTests.S
1 /*\r
2     FreeRTOS V8.2.1 - Copyright (C) 2015 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     This file is part of the FreeRTOS distribution.\r
8 \r
9     FreeRTOS is free software; you can redistribute it and/or modify it under\r
10     the terms of the GNU General Public License (version 2) as published by the\r
11     Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
12 \r
13     ***************************************************************************\r
14     >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
15     >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
16     >>!   obliged to provide the source code for proprietary components     !<<\r
17     >>!   outside of the FreeRTOS kernel.                                   !<<\r
18     ***************************************************************************\r
19 \r
20     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
21     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
22     FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
23     link: http://www.freertos.org/a00114.html\r
24 \r
25     ***************************************************************************\r
26      *                                                                       *\r
27      *    FreeRTOS provides completely free yet professionally developed,    *\r
28      *    robust, strictly quality controlled, supported, and cross          *\r
29      *    platform software that is more than just the market leader, it     *\r
30      *    is the industry's de facto standard.                               *\r
31      *                                                                       *\r
32      *    Help yourself get started quickly while simultaneously helping     *\r
33      *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
34      *    tutorial book, reference manual, or both:                          *\r
35      *    http://www.FreeRTOS.org/Documentation                              *\r
36      *                                                                       *\r
37     ***************************************************************************\r
38 \r
39     http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
40     the FAQ page "My application does not run, what could be wrong?".  Have you\r
41     defined configASSERT()?\r
42 \r
43     http://www.FreeRTOS.org/support - In return for receiving this top quality\r
44     embedded software for free we request you assist our global community by\r
45     participating in the support forum.\r
46 \r
47     http://www.FreeRTOS.org/training - Investing in training allows your team to\r
48     be as productive as possible as early as possible.  Now you can receive\r
49     FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
50     Ltd, and the world's leading authority on the world's leading RTOS.\r
51 \r
52     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
53     including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
54     compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
55 \r
56     http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
57     Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
58 \r
59     http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
60     Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
61     licenses offer ticketed support, indemnification and commercial middleware.\r
62 \r
63     http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
64     engineered and independently SIL3 certified version for use in safety and\r
65     mission critical applications that require provable dependability.\r
66 \r
67     1 tab == 4 spaces!\r
68 */\r
69 \r
70 \r
71 /*\r
72  * The register test task as described in the comments at the top of main-full.c.\r
73  */\r
74 .global vRegTest1Implementation\r
75 .global vRegTest2Implementation\r
76 \r
77 /* Variables that are incremented on each iteration of the reg test tasks -\r
78 provided the tasks have not reported any errors.  The check timer inspects these\r
79 variables to ensure they are still incrementing as expected.  If a variable\r
80 stops incrementing then it is likely that its associate task has stalled or\r
81 detected an error. */\r
82 .extern ulRegTest1LoopCounter\r
83 .extern ulRegTest2LoopCounter\r
84 \r
85 /*-----------------------------------------------------------*/\r
86 \r
87 .section .text\r
88 .align 2\r
89 vRegTest1Implementation:\r
90         /* First fill the relevant registers with known values.  r0 is always 0, r1\r
91         is the stack pointer, and r3 is a read only small data area pointer. */\r
92         addi r3, r0, 3\r
93         addi r4, r0, 4\r
94         addi r5, r0, 5\r
95         addi r6, r0, 6\r
96         addi r7, r0, 7\r
97         addi r8, r0, 8\r
98         addi r9, r0, 9\r
99         addi r10, r0, 10\r
100         addi r11, r0, 11\r
101         addi r12, r0, 12\r
102         /* R13 = read write small data area anchour. */\r
103         /* R14 = return address for interrupt. */\r
104         /* R15 = return address for sub-routine. */\r
105         /* R16 = return address for trap. */\r
106         /* R17 = return address for exceptions. */\r
107         /* R18 = reserved for assembler and compiler temporaries. */\r
108         addi r19, r0, 19\r
109         addi r20, r0, 20\r
110         addi r21, r0, 21\r
111         addi r22, r0, 22\r
112         addi r23, r0, 23\r
113         addi r24, r0, 24\r
114         addi r25, r0, 25\r
115         addi r26, r0, 26\r
116         addi r27, r0, 27\r
117         addi r28, r0, 28\r
118         addi r29, r0, 29\r
119         addi r30, r0, 30\r
120         addi r31, r0, 31\r
121 \r
122         /* Now test the register values to ensure they contain the same value that\r
123         was written to them above.       This task will get preempted frequently so\r
124         other tasks are likely to have executed since the register values were\r
125         written.  If any register contains an unexpected value then the task will\r
126         branch to Error_Loop_1, which in turn prevents it from incrementing its\r
127         loop counter, enabling the check timer to determine that all is not as it\r
128         should be. */\r
129 \r
130 Loop_Start_1:\r
131         xori r18, r3, 3\r
132         bnei r18, Error_Loop_1\r
133         xori r18, r4, 4\r
134         bnei r18, Error_Loop_1\r
135         xori r18, r6, 6\r
136         bnei r18, Error_Loop_1\r
137         xori r18, r7, 7\r
138         bnei r18, Error_Loop_1\r
139         xori r18, r8, 8\r
140         bnei r18, Error_Loop_1\r
141         xori r18, r9, 9\r
142         bnei r18, Error_Loop_1\r
143         xori r18, r10, 10\r
144         bnei r18, Error_Loop_1\r
145         xori r18, r11, 11\r
146         bnei r18, Error_Loop_1\r
147         xori r18, r12, 12\r
148         bnei r18, Error_Loop_1\r
149         xori r18, r19, 19\r
150         bnei r18, Error_Loop_1\r
151         xori r18, r20, 20\r
152         bnei r18, Error_Loop_1\r
153         xori r18, r21, 21\r
154         bnei r18, Error_Loop_1\r
155         xori r18, r22, 22\r
156         bnei r18, Error_Loop_1\r
157         xori r18, r23, 23\r
158         bnei r18, Error_Loop_1\r
159         xori r18, r24, 24\r
160         bnei r18, Error_Loop_1\r
161         xori r18, r25, 25\r
162         bnei r18, Error_Loop_1\r
163         xori r18, r26, 26\r
164         bnei r18, Error_Loop_1\r
165         xori r18, r27, 27\r
166         bnei r18, Error_Loop_1\r
167         xori r18, r28, 28\r
168         bnei r18, Error_Loop_1\r
169         xori r18, r29, 29\r
170         bnei r18, Error_Loop_1\r
171         xori r18, r30, 30\r
172         bnei r18, Error_Loop_1\r
173         xori r18, r31, 31\r
174         bnei r18, Error_Loop_1\r
175 \r
176         /* If this task has not branched to the error loop, then everything is ok,\r
177         and the check variable can be incremented to indicate that this task\r
178         is still running.  Then, brach back to the top to check the register\r
179         contents again. */\r
180         lwi r18, r0, ulRegTest1LoopCounter\r
181         addik r18, r18, 1\r
182         swi r18, r0, ulRegTest1LoopCounter\r
183 \r
184         bri Loop_Start_1\r
185 \r
186         /* The test function will branch here if it discovers an error.  This part\r
187         of the code just sits in a NULL loop, which prevents the check variable\r
188         incrementing any further to allow the check timer to recognize that this\r
189         test has failed. */\r
190 Error_Loop_1:\r
191         bri 0\r
192         nop\r
193 \r
194 /*-----------------------------------------------------------*/\r
195 \r
196 .section .text\r
197 .align 2\r
198 vRegTest2Implementation:\r
199         /* First fill the relevant registers with known values.  r0 is always 0, r1\r
200         is the stack pointer, and r3 is a read only small data area pointer. */\r
201         addi r3, r0, 30000\r
202         addi r4, r0, 40000\r
203         addi r5, r0, 50000\r
204         addi r6, r0, 60000\r
205         addi r7, r0, 70000\r
206         addi r8, r0, 80000\r
207         addi r9, r0, 90000\r
208         addi r10, r0, 100000\r
209         addi r11, r0, 110000\r
210         addi r12, r0, 120000\r
211         /* R13 = read write small data area anchour. */\r
212         /* R14 = return address for interrupt. */\r
213         /* R15 = return address for sub-routine. */\r
214         /* R16 = return address for trap. */\r
215         /* R17 = return address for exceptions. */\r
216         /* R18 = reserved for assembler and compiler temporaries. */\r
217         addi r19, r0, 190000\r
218         addi r20, r0, 200000\r
219         addi r21, r0, 210000\r
220         addi r22, r0, 220000\r
221         addi r23, r0, 230000\r
222         addi r24, r0, 240000\r
223         addi r25, r0, 250000\r
224         addi r26, r0, 260000\r
225         addi r27, r0, 270000\r
226         addi r28, r0, 280000\r
227         addi r29, r0, 290000\r
228         addi r30, r0, 300000\r
229         addi r31, r0, 310000\r
230 \r
231         /* Now test the register values to ensure they contain the same value that\r
232         was written to them above.       This task will get preempted frequently so\r
233         other tasks are likely to have executed since the register values were\r
234         written.  If any register contains an unexpected value then the task will\r
235         branch to Error_Loop_2, which in turn prevents it from incrementing its\r
236         loop counter, enabling the check timer to determine that all is not as it\r
237         should be. */\r
238 \r
239 Loop_Start_2:\r
240         xori r18, r3, 30000\r
241         bnei r18, Error_Loop_2\r
242         xori r18, r4, 40000\r
243         bnei r18, Error_Loop_2\r
244         xori r18, r6, 60000\r
245         bnei r18, Error_Loop_2\r
246         xori r18, r7, 70000\r
247         bnei r18, Error_Loop_2\r
248         xori r18, r8, 80000\r
249         bnei r18, Error_Loop_2\r
250         xori r18, r9, 90000\r
251         bnei r18, Error_Loop_2\r
252         xori r18, r10, 100000\r
253         bnei r18, Error_Loop_2\r
254         xori r18, r11, 110000\r
255         bnei r18, Error_Loop_2\r
256         xori r18, r12, 120000\r
257         bnei r18, Error_Loop_2\r
258         xori r18, r19, 190000\r
259         bnei r18, Error_Loop_2\r
260         xori r18, r20, 200000\r
261         bnei r18, Error_Loop_2\r
262         xori r18, r21, 210000\r
263         bnei r18, Error_Loop_2\r
264         xori r18, r22, 220000\r
265         bnei r18, Error_Loop_2\r
266         xori r18, r23, 230000\r
267         bnei r18, Error_Loop_2\r
268         xori r18, r24, 240000\r
269         bnei r18, Error_Loop_2\r
270         xori r18, r25, 250000\r
271         bnei r18, Error_Loop_2\r
272         xori r18, r26, 260000\r
273         bnei r18, Error_Loop_2\r
274         xori r18, r27, 270000\r
275         bnei r18, Error_Loop_2\r
276         xori r18, r28, 280000\r
277         bnei r18, Error_Loop_2\r
278         xori r18, r29, 290000\r
279         bnei r18, Error_Loop_2\r
280         xori r18, r30, 300000\r
281         bnei r18, Error_Loop_2\r
282         xori r18, r31, 310000\r
283         bnei r18, Error_Loop_2\r
284 \r
285         /* If this task has not branched to the error loop, then everything is ok,\r
286         and the check variable can be incremented to indicate that this task\r
287         is still running.  Then, brach back to the top to check the register\r
288         contents again. */\r
289         lwi r18, r0, ulRegTest2LoopCounter\r
290         addik r18, r18, 1\r
291         swi r18, r0, ulRegTest2LoopCounter\r
292 \r
293         bri Loop_Start_2\r
294 \r
295         /* The test function will branch here if it discovers an error.  This part\r
296         of the code just sits in a NULL loop, which prevents the check variable\r
297         incrementing any further to allow the check timer to recognize that this\r
298         test has failed. */\r
299 Error_Loop_2:\r
300         bri 0\r
301         nop\r
302 \r