]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RX600_RX62N-RDK_IAR/RegTest.s
e979638ab8990435c9a00adb85b7a1880053edbf
[freertos] / FreeRTOS / Demo / RX600_RX62N-RDK_IAR / RegTest.s
1 /*\r
2     FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
3 \r
4     FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME.  PLEASE VISIT\r
5     http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
6 \r
7     ***************************************************************************\r
8      *                                                                       *\r
9      *    FreeRTOS tutorial books are available in pdf and paperback.        *\r
10      *    Complete, revised, and edited pdf reference manuals are also       *\r
11      *    available.                                                         *\r
12      *                                                                       *\r
13      *    Purchasing FreeRTOS documentation will not only help you, by       *\r
14      *    ensuring you get running as quickly as possible and with an        *\r
15      *    in-depth knowledge of how to use FreeRTOS, it will also help       *\r
16      *    the FreeRTOS project to continue with its mission of providing     *\r
17      *    professional grade, cross platform, de facto standard solutions    *\r
18      *    for microcontrollers - completely free of charge!                  *\r
19      *                                                                       *\r
20      *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *\r
21      *                                                                       *\r
22      *    Thank you for using FreeRTOS, and thank you for your support!      *\r
23      *                                                                       *\r
24     ***************************************************************************\r
25 \r
26 \r
27     This file is part of the FreeRTOS distribution.\r
28 \r
29     FreeRTOS is free software; you can redistribute it and/or modify it under\r
30     the terms of the GNU General Public License (version 2) as published by the\r
31     Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
32 \r
33     >>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to\r
34     distribute a combined work that includes FreeRTOS without being obliged to\r
35     provide the source code for proprietary components outside of the FreeRTOS\r
36     kernel.\r
37 \r
38     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
39     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
40     FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\r
41     details. You should have received a copy of the GNU General Public License\r
42     and the FreeRTOS license exception along with FreeRTOS; if not itcan be\r
43     viewed here: http://www.freertos.org/a00114.html and also obtained by\r
44     writing to Real Time Engineers Ltd., contact details for whom are available\r
45     on the FreeRTOS WEB site.\r
46 \r
47     1 tab == 4 spaces!\r
48 \r
49     ***************************************************************************\r
50      *                                                                       *\r
51      *    Having a problem?  Start by reading the FAQ "My application does   *\r
52      *    not run, what could be wrong?"                                     *\r
53      *                                                                       *\r
54      *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
55      *                                                                       *\r
56     ***************************************************************************\r
57 \r
58 \r
59     http://www.FreeRTOS.org - Documentation, books, training, latest versions, \r
60     license and Real Time Engineers Ltd. contact details.\r
61 \r
62     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
63     including FreeRTOS+Trace - an indispensable productivity tool, and our new\r
64     fully thread aware and reentrant UDP/IP stack.\r
65 \r
66     http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High \r
67     Integrity Systems, who sell the code with commercial support, \r
68     indemnification and middleware, under the OpenRTOS brand.\r
69     \r
70     http://www.SafeRTOS.com - High Integrity Systems also provide a safety \r
71     engineered and independently SIL3 certified version for use in safety and \r
72     mission critical applications that require provable dependability.\r
73 */\r
74 \r
75         PUBLIC _prvRegTest1Implementation\r
76         PUBLIC _prvRegTest2Implementation\r
77         \r
78         EXTERN _ulRegTest1CycleCount\r
79         EXTERN _ulRegTest2CycleCount\r
80 \r
81         RSEG CODE:CODE(4)\r
82 \r
83 /* This function is explained in the comments at the top of main.c. */\r
84 _prvRegTest1Implementation:\r
85 \r
86         /* Put a known value in each register. */\r
87         MOV     #1, R1                                          \r
88         MOV     #2, R2                                          \r
89         MOV     #3, R3                                          \r
90         MOV     #4, R4                                          \r
91         MOV     #5, R5                                          \r
92         MOV     #6, R6                                          \r
93         MOV     #7, R7                                          \r
94         MOV     #8, R8                                          \r
95         MOV     #9, R9                                          \r
96         MOV     #10, R10                                        \r
97         MOV     #11, R11                                        \r
98         MOV     #12, R12                                        \r
99         MOV     #13, R13                                        \r
100         MOV     #14, R14                                        \r
101         MOV     #15, R15                                        \r
102         \r
103         /* Loop, checking each itteration that each register still contains the\r
104         expected value. */\r
105 TestLoop1:                                                              \r
106 \r
107         /* Push the registers that are going to get clobbered. */\r
108         PUSHM   R14-R15                                         \r
109         \r
110         /* Increment the loop counter to show this task is still getting CPU time. */\r
111         MOV     #_ulRegTest1CycleCount, R14     \r
112         MOV     [ R14 ], R15                            \r
113         ADD     #1, R15                                         \r
114         MOV     R15, [ R14 ]                            \r
115         \r
116         /* Yield to extend the text coverage.  Set the bit in the ITU SWINTR register. */\r
117         MOV     #1, R14                                         \r
118         MOV     #0872E0H, R15                           \r
119         MOV.B   R14, [R15]                                      \r
120         NOP                                                             \r
121         NOP                                                             \r
122         \r
123         /* Restore the clobbered registers. */\r
124         POPM    R14-R15                                         \r
125         \r
126         /* Now compare each register to ensure it still contains the value that was\r
127         set before this loop was entered. */\r
128         CMP     #1, R1                                          \r
129         BNE     RegTest1Error                           \r
130         CMP     #2, R2                                          \r
131         BNE     RegTest1Error                           \r
132         CMP     #3, R3                                          \r
133         BNE     RegTest1Error                           \r
134         CMP     #4, R4                                          \r
135         BNE     RegTest1Error                           \r
136         CMP     #5, R5                                          \r
137         BNE     RegTest1Error                           \r
138         CMP     #6, R6                                          \r
139         BNE     RegTest1Error                           \r
140         CMP     #7, R7                                          \r
141         BNE     RegTest1Error                           \r
142         CMP     #8, R8                                          \r
143         BNE     RegTest1Error                           \r
144         CMP     #9, R9                                          \r
145         BNE     RegTest1Error                           \r
146         CMP     #10, R10                                        \r
147         BNE     RegTest1Error                           \r
148         CMP     #11, R11                                        \r
149         BNE     RegTest1Error                           \r
150         CMP     #12, R12                                        \r
151         BNE     RegTest1Error                           \r
152         CMP     #13, R13                                        \r
153         BNE     RegTest1Error                           \r
154         CMP     #14, R14                                        \r
155         BNE     RegTest1Error                           \r
156         CMP     #15, R15                                        \r
157         BNE     RegTest1Error                           \r
158 \r
159         /* All comparisons passed, start a new itteratio of this loop. */\r
160         BRA             TestLoop1                               \r
161         \r
162 RegTest1Error:                                                  \r
163         /* A compare failed, just loop here so the loop counter stops incrementing\r
164         - causing the check task to indicate the error. */\r
165         BRA RegTest1Error                                       \r
166 /*-----------------------------------------------------------*/\r
167 \r
168 /* This function is explained in the comments at the top of main.c. */\r
169 _prvRegTest2Implementation:\r
170 \r
171         /* Put a known value in each register. */\r
172         MOV     #10H, R1                                        \r
173         MOV     #20H, R2                                        \r
174         MOV     #30H, R3                                        \r
175         MOV     #40H, R4                                        \r
176         MOV     #50H, R5                                        \r
177         MOV     #60H, R6                                        \r
178         MOV     #70H, R7                                        \r
179         MOV     #80H, R8                                        \r
180         MOV     #90H, R9                                        \r
181         MOV     #100H, R10                                      \r
182         MOV     #110H, R11                                      \r
183         MOV     #120H, R12                                      \r
184         MOV     #130H, R13                                      \r
185         MOV     #140H, R14                                      \r
186         MOV     #150H, R15                                      \r
187         \r
188         /* Loop, checking each itteration that each register still contains the\r
189         expected value. */\r
190 TestLoop2:                                                              \r
191 \r
192         /* Push the registers that are going to get clobbered. */\r
193         PUSHM   R14-R15                                         \r
194         \r
195         /* Increment the loop counter to show this task is still getting CPU time. */\r
196         MOV     #_ulRegTest2CycleCount, R14     \r
197         MOV     [ R14 ], R15                            \r
198         ADD     #1, R15                                         \r
199         MOV     R15, [ R14 ]                            \r
200         \r
201         /* Restore the clobbered registers. */\r
202         POPM    R14-R15                                         \r
203         \r
204         /* Now compare each register to ensure it still contains the value that was\r
205         set before this loop was entered. */\r
206         CMP     #10H, R1                                        \r
207         BNE     RegTest2Error                           \r
208         CMP     #20H, R2                                        \r
209         BNE     RegTest2Error                           \r
210         CMP     #30H, R3                                        \r
211         BNE     RegTest2Error                           \r
212         CMP     #40H, R4                                        \r
213         BNE     RegTest2Error                           \r
214         CMP     #50H, R5                                        \r
215         BNE     RegTest2Error                           \r
216         CMP     #60H, R6                                        \r
217         BNE     RegTest2Error                           \r
218         CMP     #70H, R7                                        \r
219         BNE     RegTest2Error                           \r
220         CMP     #80H, R8                                        \r
221         BNE     RegTest2Error                           \r
222         CMP     #90H, R9                                        \r
223         BNE     RegTest2Error                           \r
224         CMP     #100H, R10                                      \r
225         BNE     RegTest2Error                           \r
226         CMP     #110H, R11                                      \r
227         BNE     RegTest2Error                           \r
228         CMP     #120H, R12                                      \r
229         BNE     RegTest2Error                           \r
230         CMP     #130H, R13                                      \r
231         BNE     RegTest2Error                           \r
232         CMP     #140H, R14                                      \r
233         BNE     RegTest2Error                           \r
234         CMP     #150H, R15                                      \r
235         BNE     RegTest2Error                           \r
236 \r
237         /* All comparisons passed, start a new itteratio of this loop. */\r
238         BRA     TestLoop2                                       \r
239         \r
240 RegTest2Error:                                                  \r
241         /* A compare failed, just loop here so the loop counter stops incrementing\r
242         - causing the check task to indicate the error. */\r
243         BRA RegTest2Error                                       \r
244 \r
245         \r
246         END\r