]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/MicroBlaze_Kintex7_EthernetLite/RTOSDemo/src/Full_Demo/RegisterTests.S
Add the beginnings of a Microblaze project for the KC705.
[freertos] / FreeRTOS / Demo / MicroBlaze_Kintex7_EthernetLite / RTOSDemo / src / Full_Demo / RegisterTests.S
1 /*\r
2     FreeRTOS V8.2.0 - 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 #warning Does not seem to test the floating point context register.\r
86 /*-----------------------------------------------------------*/\r
87 \r
88 .section .text\r
89 .align 2\r
90 vRegTest1Implementation:\r
91         /* First fill the relevant registers with known values.  r0 is always 0, r1\r
92         is the stack pointer, and r3 is a read only small data area pointer. */\r
93         addi r3, r0, 3\r
94         addi r4, r0, 4\r
95         addi r5, r0, 5\r
96         addi r6, r0, 6\r
97         addi r7, r0, 7\r
98         addi r8, r0, 8\r
99         addi r9, r0, 9\r
100         addi r10, r0, 10\r
101         addi r11, r0, 11\r
102         addi r12, r0, 12\r
103         /* R13 = read write small data area anchour. */\r
104         /* R14 = return address for interrupt. */\r
105         /* R15 = return address for sub-routine. */\r
106         /* R16 = return address for trap. */\r
107         /* R17 = return address for exceptions. */\r
108         /* R18 = reserved for assembler and compiler temporaries. */\r
109         addi r19, r0, 19\r
110         addi r20, r0, 20\r
111         addi r21, r0, 21\r
112         addi r22, r0, 22\r
113         addi r23, r0, 23\r
114         addi r24, r0, 24\r
115         addi r25, r0, 25\r
116         addi r26, r0, 26\r
117         addi r27, r0, 27\r
118         addi r28, r0, 28\r
119         addi r29, r0, 29\r
120         addi r30, r0, 30\r
121         addi r31, r0, 31\r
122 \r
123         /* Now test the register values to ensure they contain the same value that\r
124         was written to them above.       This task will get preempted frequently so\r
125         other tasks are likely to have executed since the register values were\r
126         written.  If any register contains an unexpected value then the task will\r
127         branch to Error_Loop_1, which in turn prevents it from incrementing its\r
128         loop counter, enabling the check timer to determine that all is not as it\r
129         should be. */\r
130 \r
131 Loop_Start_1:\r
132         xori r18, r3, 3\r
133         bnei r18, Error_Loop_1\r
134         xori r18, r4, 4\r
135         bnei r18, Error_Loop_1\r
136         xori r18, r6, 6\r
137         bnei r18, Error_Loop_1\r
138         xori r18, r7, 7\r
139         bnei r18, Error_Loop_1\r
140         xori r18, r8, 8\r
141         bnei r18, Error_Loop_1\r
142         xori r18, r9, 9\r
143         bnei r18, Error_Loop_1\r
144         xori r18, r10, 10\r
145         bnei r18, Error_Loop_1\r
146         xori r18, r11, 11\r
147         bnei r18, Error_Loop_1\r
148         xori r18, r12, 12\r
149         bnei r18, Error_Loop_1\r
150         xori r18, r19, 19\r
151         bnei r18, Error_Loop_1\r
152         xori r18, r20, 20\r
153         bnei r18, Error_Loop_1\r
154         xori r18, r21, 21\r
155         bnei r18, Error_Loop_1\r
156         xori r18, r22, 22\r
157         bnei r18, Error_Loop_1\r
158         xori r18, r23, 23\r
159         bnei r18, Error_Loop_1\r
160         xori r18, r24, 24\r
161         bnei r18, Error_Loop_1\r
162         xori r18, r25, 25\r
163         bnei r18, Error_Loop_1\r
164         xori r18, r26, 26\r
165         bnei r18, Error_Loop_1\r
166         xori r18, r27, 27\r
167         bnei r18, Error_Loop_1\r
168         xori r18, r28, 28\r
169         bnei r18, Error_Loop_1\r
170         xori r18, r29, 29\r
171         bnei r18, Error_Loop_1\r
172         xori r18, r30, 30\r
173         bnei r18, Error_Loop_1\r
174         xori r18, r31, 31\r
175         bnei r18, Error_Loop_1\r
176 \r
177         /* If this task has not branched to the error loop, then everything is ok,\r
178         and the check variable can be incremented to indicate that this task\r
179         is still running.  Then, brach back to the top to check the register\r
180         contents again. */\r
181         lwi r18, r0, ulRegTest1LoopCounter\r
182         addik r18, r18, 1\r
183         swi r18, r0, ulRegTest1LoopCounter\r
184 \r
185         bri Loop_Start_1\r
186 \r
187         /* The test function will branch here if it discovers an error.  This part\r
188         of the code just sits in a NULL loop, which prevents the check variable\r
189         incrementing any further to allow the check timer to recognize that this\r
190         test has failed. */\r
191 Error_Loop_1:\r
192         bri 0\r
193         nop\r
194 \r
195 /*-----------------------------------------------------------*/\r
196 \r
197 .section .text\r
198 .align 2\r
199 vRegTest2Implementation:\r
200         /* First fill the relevant registers with known values.  r0 is always 0, r1\r
201         is the stack pointer, and r3 is a read only small data area pointer. */\r
202         addi r3, r0, 30000\r
203         addi r4, r0, 40000\r
204         addi r5, r0, 50000\r
205         addi r6, r0, 60000\r
206         addi r7, r0, 70000\r
207         addi r8, r0, 80000\r
208         addi r9, r0, 90000\r
209         addi r10, r0, 100000\r
210         addi r11, r0, 110000\r
211         addi r12, r0, 120000\r
212         /* R13 = read write small data area anchour. */\r
213         /* R14 = return address for interrupt. */\r
214         /* R15 = return address for sub-routine. */\r
215         /* R16 = return address for trap. */\r
216         /* R17 = return address for exceptions. */\r
217         /* R18 = reserved for assembler and compiler temporaries. */\r
218         addi r19, r0, 190000\r
219         addi r20, r0, 200000\r
220         addi r21, r0, 210000\r
221         addi r22, r0, 220000\r
222         addi r23, r0, 230000\r
223         addi r24, r0, 240000\r
224         addi r25, r0, 250000\r
225         addi r26, r0, 260000\r
226         addi r27, r0, 270000\r
227         addi r28, r0, 280000\r
228         addi r29, r0, 290000\r
229         addi r30, r0, 300000\r
230         addi r31, r0, 310000\r
231 \r
232         /* Now test the register values to ensure they contain the same value that\r
233         was written to them above.       This task will get preempted frequently so\r
234         other tasks are likely to have executed since the register values were\r
235         written.  If any register contains an unexpected value then the task will\r
236         branch to Error_Loop_2, which in turn prevents it from incrementing its\r
237         loop counter, enabling the check timer to determine that all is not as it\r
238         should be. */\r
239 \r
240 Loop_Start_2:\r
241         xori r18, r3, 30000\r
242         bnei r18, Error_Loop_2\r
243         xori r18, r4, 40000\r
244         bnei r18, Error_Loop_2\r
245         xori r18, r6, 60000\r
246         bnei r18, Error_Loop_2\r
247         xori r18, r7, 70000\r
248         bnei r18, Error_Loop_2\r
249         xori r18, r8, 80000\r
250         bnei r18, Error_Loop_2\r
251         xori r18, r9, 90000\r
252         bnei r18, Error_Loop_2\r
253         xori r18, r10, 100000\r
254         bnei r18, Error_Loop_2\r
255         xori r18, r11, 110000\r
256         bnei r18, Error_Loop_2\r
257         xori r18, r12, 120000\r
258         bnei r18, Error_Loop_2\r
259         xori r18, r19, 190000\r
260         bnei r18, Error_Loop_2\r
261         xori r18, r20, 200000\r
262         bnei r18, Error_Loop_2\r
263         xori r18, r21, 210000\r
264         bnei r18, Error_Loop_2\r
265         xori r18, r22, 220000\r
266         bnei r18, Error_Loop_2\r
267         xori r18, r23, 230000\r
268         bnei r18, Error_Loop_2\r
269         xori r18, r24, 240000\r
270         bnei r18, Error_Loop_2\r
271         xori r18, r25, 250000\r
272         bnei r18, Error_Loop_2\r
273         xori r18, r26, 260000\r
274         bnei r18, Error_Loop_2\r
275         xori r18, r27, 270000\r
276         bnei r18, Error_Loop_2\r
277         xori r18, r28, 280000\r
278         bnei r18, Error_Loop_2\r
279         xori r18, r29, 290000\r
280         bnei r18, Error_Loop_2\r
281         xori r18, r30, 300000\r
282         bnei r18, Error_Loop_2\r
283         xori r18, r31, 310000\r
284         bnei r18, Error_Loop_2\r
285 \r
286         /* If this task has not branched to the error loop, then everything is ok,\r
287         and the check variable can be incremented to indicate that this task\r
288         is still running.  Then, brach back to the top to check the register\r
289         contents again. */\r
290         lwi r18, r0, ulRegTest2LoopCounter\r
291         addik r18, r18, 1\r
292         swi r18, r0, ulRegTest2LoopCounter\r
293 \r
294         bri Loop_Start_2\r
295 \r
296         /* The test function will branch here if it discovers an error.  This part\r
297         of the code just sits in a NULL loop, which prevents the check variable\r
298         incrementing any further to allow the check timer to recognize that this\r
299         test has failed. */\r
300 Error_Loop_2:\r
301         bri 0\r
302         nop\r
303 \r