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