]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/Full_Demo/RegTest_IAR.s
Update to MIT licensed FreeRTOS V10.0.0 - see https://www.freertos.org/History.txt
[freertos] / FreeRTOS / Demo / RX200_RX231-RSK_GCC_e2studio_IAR / src / Full_Demo / RegTest_IAR.s
1 /*\r
2  * FreeRTOS Kernel V10.0.0\r
3  * Copyright (C) 2017 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
4  *\r
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
6  * this software and associated documentation files (the "Software"), to deal in\r
7  * the Software without restriction, including without limitation the rights to\r
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
9  * the Software, and to permit persons to whom the Software is furnished to do so,\r
10  * subject to the following conditions:\r
11  *\r
12  * The above copyright notice and this permission notice shall be included in all\r
13  * copies or substantial portions of the Software. If you wish to use our Amazon\r
14  * FreeRTOS name, please do so in a fair use way that does not cause confusion.\r
15  *\r
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
18  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
22  *\r
23  * http://www.FreeRTOS.org\r
24  * http://aws.amazon.com/freertos\r
25  *\r
26  * 1 tab == 4 spaces!\r
27  */\r
28 \r
29         PUBLIC _vRegTest1Implementation\r
30         PUBLIC _vRegTest2Implementation\r
31         \r
32         EXTERN _ulRegTest1LoopCounter\r
33         EXTERN _ulRegTest2LoopCounter\r
34 \r
35         RSEG CODE:CODE(4)\r
36 \r
37 /* This function is explained in the comments at the top of main.c. */\r
38 _vRegTest1Implementation:\r
39 \r
40         ;/* Put a known value in the guard byte of the accumulators. */\r
41         MOV.L   #10, R1\r
42         MVTACGU R1, A0\r
43         MOV.L   #20, R1\r
44         MVTACGU R1, A1\r
45 \r
46         /* Put a known value in each register. */\r
47         MOV     #1, R1                                          \r
48         MOV     #2, R2                                          \r
49         MOV     #3, R3                                          \r
50         MOV     #4, R4                                          \r
51         MOV     #5, R5                                          \r
52         MOV     #6, R6                                          \r
53         MOV     #7, R7                                          \r
54         MOV     #8, R8                                          \r
55         MOV     #9, R9                                          \r
56         MOV     #10, R10                                        \r
57         MOV     #11, R11                                        \r
58         MOV     #12, R12                                        \r
59         MOV     #13, R13                                        \r
60         MOV     #14, R14                                        \r
61         MOV     #15, R15                                        \r
62         \r
63         ;/* Put a known value in the hi and low of the accumulators. */\r
64         MVTACHI R1, A0\r
65         MVTACLO R2, A0\r
66         MVTACHI R3, A1\r
67         MVTACLO R4, A1\r
68         /* Loop, checking each iteration that each register still contains the\r
69         expected value. */\r
70 TestLoop1:                                                              \r
71 \r
72         /* Push the registers that are going to get clobbered. */\r
73         PUSHM   R14-R15                                         \r
74         \r
75         /* Increment the loop counter to show this task is still getting CPU time. */\r
76         MOV     #_ulRegTest1LoopCounter, R14    \r
77         MOV     [ R14 ], R15                            \r
78         ADD     #1, R15                                         \r
79         MOV     R15, [ R14 ]                            \r
80         \r
81         /* Yield to extend the text coverage.  Set the bit in the ITU SWINTR register. */\r
82         MOV     #1, R14                                         \r
83         MOV     #0872E0H, R15                           \r
84         MOV.B   R14, [R15]                                      \r
85         NOP                                                             \r
86         NOP                                                             \r
87         \r
88         ;/* Check accumulators. */\r
89         MVFACHI #0, A0, R15\r
90         CMP #1, R15\r
91         BNE RegTest1Error\r
92         MVFACLO #0, A0, R15\r
93         CMP #2, R15\r
94         BNE RegTest1Error\r
95         MVFACGU #0, A0, R15\r
96         CMP #10, R15\r
97         BNE RegTest1Error\r
98         MVFACHI #0, A1, R15\r
99         CMP #3, R15\r
100         BNE RegTest1Error\r
101         MVFACLO #0, A1, R15\r
102         CMP #4, R15\r
103         BNE RegTest1Error\r
104         MVFACGU #0, A1, R15\r
105         CMP #20, R15\r
106         BNE RegTest1Error\r
107 \r
108         /* Restore the clobbered registers. */\r
109         POPM    R14-R15                                         \r
110         \r
111         /* Now compare each register to ensure it still contains the value that was\r
112         set before this loop was entered. */\r
113         CMP     #1, R1                                          \r
114         BNE     RegTest1Error                           \r
115         CMP     #2, R2                                          \r
116         BNE     RegTest1Error                           \r
117         CMP     #3, R3                                          \r
118         BNE     RegTest1Error                           \r
119         CMP     #4, R4                                          \r
120         BNE     RegTest1Error                           \r
121         CMP     #5, R5                                          \r
122         BNE     RegTest1Error                           \r
123         CMP     #6, R6                                          \r
124         BNE     RegTest1Error                           \r
125         CMP     #7, R7                                          \r
126         BNE     RegTest1Error                           \r
127         CMP     #8, R8                                          \r
128         BNE     RegTest1Error                           \r
129         CMP     #9, R9                                          \r
130         BNE     RegTest1Error                           \r
131         CMP     #10, R10                                        \r
132         BNE     RegTest1Error                           \r
133         CMP     #11, R11                                        \r
134         BNE     RegTest1Error                           \r
135         CMP     #12, R12                                        \r
136         BNE     RegTest1Error                           \r
137         CMP     #13, R13                                        \r
138         BNE     RegTest1Error                           \r
139         CMP     #14, R14                                        \r
140         BNE     RegTest1Error                           \r
141         CMP     #15, R15                                        \r
142         BNE     RegTest1Error                           \r
143 \r
144         /* All comparisons passed, start a new itteratio of this loop. */\r
145         BRA             TestLoop1                               \r
146         \r
147 RegTest1Error:                                                  \r
148         /* A compare failed, just loop here so the loop counter stops incrementing\r
149         - causing the check task to indicate the error. */\r
150         BRA RegTest1Error                                       \r
151 /*-----------------------------------------------------------*/\r
152 \r
153 /* This function is explained in the comments at the top of main.c. */\r
154 _vRegTest2Implementation:\r
155 \r
156         ;/* Put a known value in the guard byte of the accumulators. */\r
157         MOV.L   #1H, R1\r
158         MVTACGU R1, A0\r
159         MOV.L   #2H, R1\r
160         MVTACGU R1, A1\r
161 \r
162         /* Put a known value in each register. */\r
163         MOV     #10H, R1                                        \r
164         MOV     #20H, R2                                        \r
165         MOV     #30H, R3                                        \r
166         MOV     #40H, R4                                        \r
167         MOV     #50H, R5                                        \r
168         MOV     #60H, R6                                        \r
169         MOV     #70H, R7                                        \r
170         MOV     #80H, R8                                        \r
171         MOV     #90H, R9                                        \r
172         MOV     #100H, R10                                      \r
173         MOV     #110H, R11                                      \r
174         MOV     #120H, R12                                      \r
175         MOV     #130H, R13                                      \r
176         MOV     #140H, R14                                      \r
177         MOV     #150H, R15                                      \r
178 \r
179         ;/* Put a known value in the hi and low of the accumulators. */\r
180         MVTACHI R1, A0\r
181         MVTACLO R2, A0\r
182         MVTACHI R3, A1\r
183         MVTACLO R4, A1\r
184 \r
185         /* Loop, checking each iteration that each register still contains the\r
186         expected value. */\r
187 TestLoop2:                                                              \r
188 \r
189         /* Push the registers that are going to get clobbered. */\r
190         PUSHM   R14-R15                                         \r
191         \r
192         /* Increment the loop counter to show this task is still getting CPU time. */\r
193         MOV     #_ulRegTest2LoopCounter, R14    \r
194         MOV     [ R14 ], R15                            \r
195         ADD     #1, R15                                         \r
196         MOV     R15, [ R14 ]                            \r
197         \r
198         ;/* Check accumulators. */\r
199         MVFACHI #0, A0, R15\r
200         CMP #10H, R15\r
201         BNE RegTest1Error\r
202         MVFACLO #0, A0, R15\r
203         CMP #20H, R15\r
204         BNE RegTest1Error\r
205         MVFACGU #0, A0, R15\r
206         CMP #1H, R15\r
207         BNE RegTest1Error\r
208         MVFACHI #0, A1, R15\r
209         CMP #30H, R15\r
210         BNE RegTest1Error\r
211         MVFACLO #0, A1, R15\r
212         CMP #40H, R15\r
213         BNE RegTest1Error\r
214         MVFACGU #0, A1, R15\r
215         CMP #2H, R15\r
216         BNE RegTest1Error\r
217 \r
218         /* Restore the clobbered registers. */\r
219         POPM    R14-R15                                         \r
220         \r
221         /* Now compare each register to ensure it still contains the value that was\r
222         set before this loop was entered. */\r
223         CMP     #10H, R1                                        \r
224         BNE     RegTest2Error                           \r
225         CMP     #20H, R2                                        \r
226         BNE     RegTest2Error                           \r
227         CMP     #30H, R3                                        \r
228         BNE     RegTest2Error                           \r
229         CMP     #40H, R4                                        \r
230         BNE     RegTest2Error                           \r
231         CMP     #50H, R5                                        \r
232         BNE     RegTest2Error                           \r
233         CMP     #60H, R6                                        \r
234         BNE     RegTest2Error                           \r
235         CMP     #70H, R7                                        \r
236         BNE     RegTest2Error                           \r
237         CMP     #80H, R8                                        \r
238         BNE     RegTest2Error                           \r
239         CMP     #90H, R9                                        \r
240         BNE     RegTest2Error                           \r
241         CMP     #100H, R10                                      \r
242         BNE     RegTest2Error                           \r
243         CMP     #110H, R11                                      \r
244         BNE     RegTest2Error                           \r
245         CMP     #120H, R12                                      \r
246         BNE     RegTest2Error                           \r
247         CMP     #130H, R13                                      \r
248         BNE     RegTest2Error                           \r
249         CMP     #140H, R14                                      \r
250         BNE     RegTest2Error                           \r
251         CMP     #150H, R15                                      \r
252         BNE     RegTest2Error                           \r
253 \r
254         /* All comparisons passed, start a new itteratio of this loop. */\r
255         BRA     TestLoop2                                       \r
256         \r
257 RegTest2Error:                                                  \r
258         /* A compare failed, just loop here so the loop counter stops incrementing\r
259         - causing the check task to indicate the error. */\r
260         BRA RegTest2Error                                       \r
261 \r
262         \r
263         END\r