]> git.sur5r.net Git - freertos/blob - Demo/SuperH_SH7216_Renesas/RTOSDemo/regtest.src
7c6d42285ca6682851f8e399a8e543d8962d4b42
[freertos] / Demo / SuperH_SH7216_Renesas / RTOSDemo / regtest.src
1 ;/*\r
2 ;    FreeRTOS V6.0.2 - Copyright (C) 2009 Real Time Engineers Ltd.\r
3 ;\r
4 ;    ***************************************************************************\r
5 ;    *                                                                         *\r
6 ;    * If you are:                                                             *\r
7 ;    *                                                                         *\r
8 ;    *    + New to FreeRTOS,                                                   *\r
9 ;    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *\r
10 ;    *    + Looking for basic training,                                        *\r
11 ;    *    + Wanting to improve your FreeRTOS skills and productivity           *\r
12 ;    *                                                                         *\r
13 ;    * then take a look at the FreeRTOS eBook                                  *\r
14 ;    *                                                                         *\r
15 ;    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *\r
16 ;    *                  http://www.FreeRTOS.org/Documentation                  *\r
17 ;    *                                                                         *\r
18 ;    * A pdf reference manual is also available.  Both are usually delivered   *\r
19 ;    * to your inbox within 20 minutes to two hours when purchased between 8am *\r
20 ;    * and 8pm GMT (although please allow up to 24 hours in case of            *\r
21 ;    * exceptional circumstances).  Thank you for your support!                *\r
22 ;    *                                                                         *\r
23 ;    ***************************************************************************\r
24 ;\r
25 ;    This file is part of the FreeRTOS distribution.\r
26 ;\r
27 ;    FreeRTOS is free software; you can redistribute it and/or modify it under\r
28 ;    the terms of the GNU General Public License (version 2) as published by the\r
29 ;    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
30 ;    ***NOTE*** The exception to the GPL is included to allow you to distribute\r
31 ;    a combined work that includes FreeRTOS without being obliged to provide the\r
32 ;    source code for proprietary components outside of the FreeRTOS kernel.\r
33 ;    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
34 ;    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
35 ;    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
36 ;    more details. You should have received a copy of the GNU General Public \r
37 ;    License and the FreeRTOS license exception along with FreeRTOS; if not it \r
38 ;    can be viewed here: http://www.freertos.org/a00114.html and also obtained \r
39 ;    by writing to Richard Barry, contact details for whom are available on the\r
40 ;    FreeRTOS WEB site.\r
41 ;\r
42 ;    1 tab == 4 spaces!\r
43 ;\r
44 ;    http://www.FreeRTOS.org - Documentation, latest information, license and\r
45 ;    contact details.\r
46 ;\r
47 ;    http://www.SafeRTOS.com - A version that is certified for use in safety\r
48 ;    critical systems.\r
49 ;\r
50 ;    http://www.OpenRTOS.com - Commercial support, development, porting,\r
51 ;    licensing and training services.\r
52 ;*/\r
53 \r
54         .import _pxCurrentTCB\r
55         .import _vTaskSwitchContext\r
56         .import _ulRegTest1CycleCount\r
57         .import _ulRegTest2CycleCount\r
58 \r
59         .export _vRegTest1Task\r
60         .export _vRegTest2Task\r
61 \r
62     .section    P, code, align=4\r
63         \r
64         \r
65         \r
66 _vRegTest1Task:\r
67 \r
68         ; Fill the registers with known values.\r
69         mov             #2, r1\r
70         mov             #3, r2\r
71         mov             #4, r3\r
72         mov             #5, r4\r
73         mov             #6, r5\r
74         mov             #7, r6\r
75         mov             #8, r7\r
76         mov             #9, r8\r
77         mov             #10, r9\r
78         mov             #11, r10\r
79         mov             #12, r11\r
80         mov             #13, r12\r
81         mov             #14, r13\r
82         mov             #15, r14\r
83 \r
84         mov             #16, r0\r
85         lds             r0, macl\r
86         mov             #17, r0\r
87         lds             r0, mach\r
88         mov             #18, r0\r
89         ldc             r0, gbr\r
90 \r
91         ; Also fill the flop registers with known values.\r
92         lds             r1, fpul\r
93         fsts    fpul, fr1\r
94         lds             r2, fpul\r
95         fsts    fpul, fr2\r
96         lds             r3, fpul\r
97         fsts    fpul, fr3\r
98         lds             r4, fpul\r
99         fsts    fpul, fr4\r
100         lds             r5, fpul\r
101         fsts    fpul, fr5\r
102         lds             r6, fpul\r
103         fsts    fpul, fr6\r
104         lds             r7, fpul\r
105         fsts    fpul, fr7\r
106         lds             r8, fpul\r
107         fsts    fpul, fr8\r
108         lds             r9, fpul\r
109         fsts    fpul, fr9\r
110         lds             r10, fpul\r
111         fsts    fpul, fr10\r
112         lds             r11, fpul\r
113         fsts    fpul, fr11\r
114         lds             r12, fpul\r
115         fsts    fpul, fr12\r
116         lds             r13, fpul\r
117         fsts    fpul, fr13\r
118         lds             r14, fpul\r
119         fsts    fpul, fr14\r
120         \r
121 _vRegTest1Loop:\r
122 \r
123         ; Set FPUL to a known value before the yield.\r
124         mov             #123, r0\r
125         lds             r0, fpul\r
126 \r
127         ; Perform a yield, just for extra test coverage.\r
128         trapa   #33\r
129         \r
130         ; Check fpul still contains the expected value.\r
131         sts             fpul, r1\r
132         cmp/eq  r0, r1\r
133         bf              _vRegTest1Error\r
134         \r
135         ; Reset r1 which was used in the tests.\r
136         mov             #2, r1\r
137 \r
138         ; Test that the registers still contain the expected values.  If not, jump to\r
139         ; vRegTestError, which will stop this function looping and so cause it to stop\r
140         ; incrementing its loop counter.  Both the standard and flop registers are \r
141         ; checked.      \r
142         mov             #2, r0\r
143         cmp/eq  r0, r1\r
144         bf              _vRegTest1Error\r
145         flds    fr1, fpul\r
146         sts             fpul, r1\r
147         cmp/eq  r0, r1\r
148         bf              _vRegTest1Error\r
149         \r
150         mov             #3, r0\r
151         cmp/eq  r0, r2\r
152         bf              _vRegTest1Error\r
153         flds    fr2, fpul\r
154         sts             fpul, r1\r
155         cmp/eq  r0, r1\r
156         bf              _vRegTest1Error\r
157 \r
158         mov             #4, r0\r
159         cmp/eq  r0, r3\r
160         bf              _vRegTest1Error\r
161         flds    fr3, fpul\r
162         sts             fpul, r1\r
163         cmp/eq  r0, r1\r
164         bf              _vRegTest1Error\r
165 \r
166         mov             #5, r0\r
167         cmp/eq  r0, r4\r
168         bf              _vRegTest1Error\r
169         flds    fr4, fpul\r
170         sts             fpul, r1\r
171         cmp/eq  r0, r1\r
172         bf              _vRegTest1Error\r
173 \r
174         mov             #6, r0\r
175         cmp/eq  r0, r5\r
176         bf              _vRegTest1Error\r
177         flds    fr5, fpul\r
178         sts             fpul, r1\r
179         cmp/eq  r0, r1\r
180         bf              _vRegTest1Error\r
181 \r
182         mov             #7, r0\r
183         cmp/eq  r0, r6\r
184         bf              _vRegTest1Error\r
185         flds    fr6, fpul\r
186         sts             fpul, r1\r
187         cmp/eq  r0, r1\r
188         bf              _vRegTest1Error\r
189 \r
190         mov             #8, r0\r
191         cmp/eq  r0, r7\r
192         bf              _vRegTest1Error\r
193         flds    fr7, fpul\r
194         sts             fpul, r1\r
195         cmp/eq  r0, r1\r
196         bf              _vRegTest1Error\r
197 \r
198         mov             #9, r0\r
199         cmp/eq  r0, r8\r
200         bf              _vRegTest1Error\r
201         flds    fr8, fpul\r
202         sts             fpul, r1\r
203         cmp/eq  r0, r1\r
204         bf              _vRegTest1Error\r
205 \r
206         mov             #10, r0\r
207         cmp/eq  r0, r9\r
208         bf              _vRegTest1Error\r
209         flds    fr9, fpul\r
210         sts             fpul, r1\r
211         cmp/eq  r0, r1\r
212         bf              _vRegTest1Error\r
213 \r
214         mov             #11, r0\r
215         cmp/eq  r0, r10\r
216         bf              _vRegTest1Error\r
217         flds    fr10, fpul\r
218         sts             fpul, r1\r
219         cmp/eq  r0, r1\r
220         bf              _vRegTest1Error\r
221 \r
222         mov             #12, r0\r
223         cmp/eq  r0, r11\r
224         bf              _vRegTest1Error\r
225         flds    fr11, fpul\r
226         sts             fpul, r1\r
227         cmp/eq  r0, r1\r
228         bf              _vRegTest1Error\r
229 \r
230         mov             #13, r0\r
231         cmp/eq  r0, r12\r
232         bf              _vRegTest1Error\r
233         flds    fr12, fpul\r
234         sts             fpul, r1\r
235         cmp/eq  r0, r1\r
236         bf              _vRegTest1Error\r
237 \r
238         mov             #14, r0\r
239         cmp/eq  r0, r13\r
240         bf              _vRegTest1Error\r
241         flds    fr13, fpul\r
242         sts             fpul, r1\r
243         cmp/eq  r0, r1\r
244         bf              _vRegTest1Error\r
245 \r
246         mov             #15, r0\r
247         cmp/eq  r0, r14\r
248         bf              _vRegTest1Error\r
249         flds    fr14, fpul\r
250         sts             fpul, r1\r
251         cmp/eq  r0, r1\r
252         bf              _vRegTest1Error\r
253 \r
254         sts             macl, r0\r
255         mov             #16, r1\r
256         cmp/eq  r0, r1\r
257         bf              _vRegTest1Error\r
258 \r
259         sts             mach, r0\r
260         mov             #17, r1\r
261         cmp/eq  r0, r1\r
262         bf              _vRegTest1Error\r
263 \r
264         stc             gbr, r0\r
265         mov             #18, r1\r
266         cmp/eq  r0, r1\r
267         bf              _vRegTest1Error\r
268 \r
269         ; Increment the loop counter to indicate that this task is still running and\r
270         ; still healthy.\r
271         mov.l   #_ulRegTest1CycleCount, r0\r
272         mov.l   @r0, r1\r
273         add             #1, r1\r
274         mov.l   r1, @r0\r
275 \r
276         ; Jump back to test all the registers again.\r
277         bra             _vRegTest1Loop\r
278         nop\r
279 \r
280 ;-----------------------------------------------------------\r
281 \r
282 _vRegTest1Error:\r
283         bra             _vRegTest1Error \r
284         nop\r
285 \r
286 ;-----------------------------------------------------------\r
287 \r
288 _vRegTest2Task:\r
289 \r
290         ; Fill the standard registers with known values.\r
291         mov             #12, r1\r
292         mov             #13, r2\r
293         mov             #14, r3\r
294         mov             #15, r4\r
295         mov             #16, r5\r
296         mov             #17, r6\r
297         mov             #18, r7\r
298         mov             #19, r8\r
299         mov             #110, r9\r
300         mov             #111, r10\r
301         mov             #112, r11\r
302         mov             #113, r12\r
303         mov             #114, r13\r
304 \r
305         mov             #115, r0\r
306         lds             r0, macl\r
307         mov             #116, r0\r
308         lds             r0, mach\r
309         mov             #117, r0\r
310         ldc             r0, gbr\r
311         \r
312         ; Also fill the flop registers with known values.\r
313         lds             r1, fpul\r
314         fsts    fpul, fr1\r
315         lds             r2, fpul\r
316         fsts    fpul, fr2\r
317         lds             r3, fpul\r
318         fsts    fpul, fr3\r
319         lds             r4, fpul\r
320         fsts    fpul, fr4\r
321         lds             r5, fpul\r
322         fsts    fpul, fr5\r
323         lds             r6, fpul\r
324         fsts    fpul, fr6\r
325         lds             r7, fpul\r
326         fsts    fpul, fr7\r
327         lds             r8, fpul\r
328         fsts    fpul, fr8\r
329         lds             r9, fpul\r
330         fsts    fpul, fr9\r
331         lds             r10, fpul\r
332         fsts    fpul, fr10\r
333         lds             r11, fpul\r
334         fsts    fpul, fr11\r
335         lds             r12, fpul\r
336         fsts    fpul, fr12\r
337         lds             r13, fpul\r
338         fsts    fpul, fr13\r
339         lds             r14, fpul\r
340         fsts    fpul, fr14\r
341         \r
342 _vRegTest2Loop:\r
343 \r
344         ; Reset r1 which was used in the tests.\r
345         mov             #12, r1\r
346 \r
347         ; Test that the registers still contain the expected values.  If not, jump to\r
348         ; vRegTestError, which will stop this function looping and so cause it to stop\r
349         ; incrementing its loop counter.  Both the standard and flop registers are \r
350         ; checked.      \r
351         mov             #12, r0\r
352         cmp/eq  r0, r1\r
353         bf              _vRegTest2Error\r
354         flds    fr1, fpul\r
355         sts             fpul, r1\r
356         cmp/eq  r0, r1\r
357         bf              _vRegTest2Error\r
358         \r
359         mov             #13, r0\r
360         cmp/eq  r0, r2\r
361         bf              _vRegTest2Error\r
362         flds    fr2, fpul\r
363         sts             fpul, r1\r
364         cmp/eq  r0, r1\r
365         bf              _vRegTest2Error\r
366 \r
367         mov             #14, r0\r
368         cmp/eq  r0, r3\r
369         bf              _vRegTest2Error\r
370         flds    fr3, fpul\r
371         sts             fpul, r1\r
372         cmp/eq  r0, r1\r
373         bf              _vRegTest2Error\r
374 \r
375         mov             #15, r0\r
376         cmp/eq  r0, r4\r
377         bf              _vRegTest2Error\r
378         flds    fr4, fpul\r
379         sts             fpul, r1\r
380         cmp/eq  r0, r1\r
381         bf              _vRegTest2Error\r
382 \r
383         mov             #16, r0\r
384         cmp/eq  r0, r5\r
385         bf              _vRegTest2Error\r
386         flds    fr5, fpul\r
387         sts             fpul, r1\r
388         cmp/eq  r0, r1\r
389         bf              _vRegTest2Error\r
390 \r
391         mov             #17, r0\r
392         cmp/eq  r0, r6\r
393         bf              _vRegTest2Error\r
394         flds    fr6, fpul\r
395         sts             fpul, r1\r
396         cmp/eq  r0, r1\r
397         bf              _vRegTest2Error\r
398 \r
399         mov             #18, r0\r
400         cmp/eq  r0, r7\r
401         bf              _vRegTest2Error\r
402         flds    fr7, fpul\r
403         sts             fpul, r1\r
404         cmp/eq  r0, r1\r
405         bf              _vRegTest2Error\r
406 \r
407         mov             #19, r0\r
408         cmp/eq  r0, r8\r
409         bf              _vRegTest2Error\r
410         flds    fr8, fpul\r
411         sts             fpul, r1\r
412         cmp/eq  r0, r1\r
413         bf              _vRegTest2Error\r
414 \r
415         mov             #110, r0\r
416         cmp/eq  r0, r9\r
417         bf              _vRegTest2Error\r
418         flds    fr9, fpul\r
419         sts             fpul, r1\r
420         cmp/eq  r0, r1\r
421         bf              _vRegTest2Error\r
422 \r
423         mov             #111, r0\r
424         cmp/eq  r0, r10\r
425         bf              _vRegTest2Error\r
426         flds    fr10, fpul\r
427         sts             fpul, r1\r
428         cmp/eq  r0, r1\r
429         bf              _vRegTest2Error\r
430 \r
431         mov             #112, r0\r
432         cmp/eq  r0, r11\r
433         bf              _vRegTest2Error\r
434         flds    fr11, fpul\r
435         sts             fpul, r1\r
436         cmp/eq  r0, r1\r
437         bf              _vRegTest2Error\r
438 \r
439         mov             #113, r0\r
440         cmp/eq  r0, r12\r
441         bf              _vRegTest2Error\r
442         flds    fr12, fpul\r
443         sts             fpul, r1\r
444         cmp/eq  r0, r1\r
445         bf              _vRegTest2Error\r
446 \r
447         mov             #114, r0\r
448         cmp/eq  r0, r13\r
449         bf              _vRegTest2Error\r
450         flds    fr13, fpul\r
451         sts             fpul, r1\r
452         cmp/eq  r0, r1\r
453         bf              _vRegTest2Error\r
454 \r
455         sts             macl, r0\r
456         mov             #115, r1\r
457         cmp/eq  r0, r1\r
458         bf              _vRegTest2Error\r
459 \r
460         sts             mach, r0\r
461         mov             #116, r1\r
462         cmp/eq  r0, r1\r
463         bf              _vRegTest2Error\r
464 \r
465         stc             gbr, r0\r
466         mov             #117, r1\r
467         cmp/eq  r0, r1\r
468         bf              _vRegTest2Error\r
469 \r
470         ; Increment the loop counter to indicate that this task is still running and\r
471         ; still healthy.\r
472         mov.l   #_ulRegTest2CycleCount, r0\r
473         mov.l   @r0, r1\r
474         add             #1, r1\r
475         mov.l   r1, @r0\r
476 \r
477         ; Jump back to test all the registers again.\r
478         bra             _vRegTest2Loop\r
479         nop\r
480 \r
481 ;-----------------------------------------------------------\r
482 \r
483 _vRegTest2Error:\r
484 \r
485         bra             _vRegTest2Error\r
486         nop     \r
487 \r
488 \r
489         .end\r
490                 \r