]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RX700_RX71M_RSK_GCC_e2studio_IAR/src/Full_Demo/RegTest_GCC.S
Update to MIT licensed FreeRTOS V10.0.0 - see https://www.freertos.org/History.txt
[freertos] / FreeRTOS / Demo / RX700_RX71M_RSK_GCC_e2studio_IAR / src / Full_Demo / RegTest_GCC.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         .global _vRegTest1Implementation\r
30         .global _vRegTest2Implementation\r
31 \r
32         .extern _ulRegTest1LoopCounter\r
33         .extern _ulRegTest2LoopCounter\r
34 \r
35         .text\r
36 \r
37 \r
38 ;/* This function is explained in the comments at the top of main.c. */\r
39 _vRegTest1Implementation:\r
40 \r
41         ;/* Put a known value in the guard byte of the accumulators. */\r
42         MOV.L   #10, R1\r
43         MVTACGU R1, A0\r
44         MOV.L   #20, R1\r
45         MVTACGU R1, A1\r
46 \r
47         ;/* Put a known value in each register. */\r
48         MOV.L   #1, R1\r
49         MOV.L   #2, R2\r
50         MOV.L   #3, R3\r
51         MOV.L   #4, R4\r
52         MOV.L   #5, R5\r
53         MOV.L   #6, R6\r
54         MOV.L   #7, R7\r
55         MOV.L   #8, R8\r
56         MOV.L   #9, R9\r
57         MOV.L   #10, R10\r
58         MOV.L   #11, R11\r
59         MOV.L   #12, R12\r
60         MOV.L   #13, R13\r
61         MOV.L   #14, R14\r
62         MOV.L   #15, R15\r
63 \r
64         ;/* Put a known value in the hi and low of the accumulators. */\r
65         MVTACHI R1, A0\r
66         MVTACLO R2, A0\r
67         MVTACHI R3, A1\r
68         MVTACLO R4, A1\r
69 \r
70         ;/* Loop, checking each iteration that each register still contains the\r
71         ;expected value. */\r
72 TestLoop1:\r
73 \r
74         ;/* Push the registers that are going to get clobbered. */\r
75         PUSHM   R14-R15\r
76 \r
77         ;/* Increment the loop counter to show this task is still getting CPU time. */\r
78         MOV.L   #_ulRegTest1LoopCounter, R14\r
79         MOV.L   [ R14 ], R15\r
80         ADD     #1, R15\r
81         MOV.L   R15, [ R14 ]\r
82 \r
83         ;/* Yield to extend the text coverage.  Set the bit in the ITU SWINTR register. */\r
84         MOV.L   #1, R14\r
85         MOV.L   #0872E0H, R15\r
86         MOV.B   R14, [R15]\r
87         NOP\r
88         NOP\r
89 \r
90         ;/* Check accumulators. */\r
91         MVFACHI #0, A0, R15\r
92         CMP #1, R15\r
93         BNE RegTest1Error\r
94         MVFACLO #0, A0, R15\r
95         CMP #2, R15\r
96         BNE RegTest1Error\r
97         MVFACGU #0, A0, R15\r
98         CMP #10, R15\r
99         BNE RegTest1Error\r
100         MVFACHI #0, A1, R15\r
101         CMP #3, R15\r
102         BNE RegTest1Error\r
103         MVFACLO #0, A1, R15\r
104         CMP #4, R15\r
105         BNE RegTest1Error\r
106         MVFACGU #0, A1, R15\r
107         CMP #20, R15\r
108         BNE RegTest1Error\r
109 \r
110         ;/* Restore the clobbered registers. */\r
111         POPM    R14-R15\r
112 \r
113         ;/* Now compare each register to ensure it still contains the value that was\r
114         ;set before this loop was entered. */\r
115         CMP     #1, R1\r
116         BNE     RegTest1Error\r
117         CMP     #2, R2\r
118         BNE     RegTest1Error\r
119         CMP     #3, R3\r
120         BNE     RegTest1Error\r
121         CMP     #4, R4\r
122         BNE     RegTest1Error\r
123         CMP     #5, R5\r
124         BNE     RegTest1Error\r
125         CMP     #6, R6\r
126         BNE     RegTest1Error\r
127         CMP     #7, R7\r
128         BNE     RegTest1Error\r
129         CMP     #8, R8\r
130         BNE     RegTest1Error\r
131         CMP     #9, R9\r
132         BNE     RegTest1Error\r
133         CMP     #10, R10\r
134         BNE     RegTest1Error\r
135         CMP     #11, R11\r
136         BNE     RegTest1Error\r
137         CMP     #12, R12\r
138         BNE     RegTest1Error\r
139         CMP     #13, R13\r
140         BNE     RegTest1Error\r
141         CMP     #14, R14\r
142         BNE     RegTest1Error\r
143         CMP     #15, R15\r
144         BNE     RegTest1Error\r
145 \r
146         ;/* All comparisons passed, start a new itteratio of this loop. */\r
147         BRA             TestLoop1\r
148 \r
149 RegTest1Error:\r
150         ;/* A compare failed, just loop here so the loop counter stops incrementing\r
151         ;- causing the check task to indicate the error. */\r
152         BRA RegTest1Error\r
153 ;/*-----------------------------------------------------------*/\r
154 \r
155 ;/* This function is explained in the comments at the top of main.c. */\r
156 _vRegTest2Implementation:\r
157 \r
158         ;/* Put a known value in the guard byte of the accumulators. */\r
159         MOV.L   #1H, R1\r
160         MVTACGU R1, A0\r
161         MOV.L   #2H, R1\r
162         MVTACGU R1, A1\r
163 \r
164         ;/* Put a known value in each general purpose register. */\r
165         MOV.L   #10H, R1\r
166         MOV.L   #20H, R2\r
167         MOV.L   #30H, R3\r
168         MOV.L   #40H, R4\r
169         MOV.L   #50H, R5\r
170         MOV.L   #60H, R6\r
171         MOV.L   #70H, R7\r
172         MOV.L   #80H, R8\r
173         MOV.L   #90H, R9\r
174         MOV.L   #100H, R10\r
175         MOV.L   #110H, R11\r
176         MOV.L   #120H, R12\r
177         MOV.L   #130H, R13\r
178         MOV.L   #140H, R14\r
179         MOV.L   #150H, R15\r
180 \r
181         ;/* Put a known value in the hi and low of the accumulators. */\r
182         MVTACHI R1, A0\r
183         MVTACLO R2, A0\r
184         MVTACHI R3, A1\r
185         MVTACLO R4, A1\r
186 \r
187         ;/* Loop, checking each iteration that each register still contains the\r
188         ;expected value. */\r
189 TestLoop2:\r
190 \r
191         ;/* Push the registers that are going to get clobbered. */\r
192         PUSHM   R14-R15\r
193 \r
194         ;/* Increment the loop counter to show this task is still getting CPU time. */\r
195         MOV.L   #_ulRegTest2LoopCounter, R14\r
196         MOV.L   [ R14 ], R15\r
197         ADD     #1, R15\r
198         MOV.L   R15, [ R14 ]\r
199 \r
200         ;/* Check accumulators. */\r
201         MVFACHI #0, A0, R15\r
202         CMP #10H, R15\r
203         BNE RegTest1Error\r
204         MVFACLO #0, A0, R15\r
205         CMP #20H, R15\r
206         BNE RegTest1Error\r
207         MVFACGU #0, A0, R15\r
208         CMP #1H, R15\r
209         BNE RegTest1Error\r
210         MVFACHI #0, A1, R15\r
211         CMP #30H, R15\r
212         BNE RegTest1Error\r
213         MVFACLO #0, A1, R15\r
214         CMP #40H, R15\r
215         BNE RegTest1Error\r
216         MVFACGU #0, A1, R15\r
217         CMP #2H, R15\r
218         BNE RegTest1Error\r
219 \r
220         ;/* Restore the clobbered registers. */\r
221         POPM    R14-R15\r
222 \r
223         ;/* Now compare each register to ensure it still contains the value that was\r
224         ;set before this loop was entered. */\r
225         CMP     #10H, R1\r
226         BNE     RegTest2Error\r
227         CMP     #20H, R2\r
228         BNE     RegTest2Error\r
229         CMP     #30H, R3\r
230         BNE     RegTest2Error\r
231         CMP     #40H, R4\r
232         BNE     RegTest2Error\r
233         CMP     #50H, R5\r
234         BNE     RegTest2Error\r
235         CMP     #60H, R6\r
236         BNE     RegTest2Error\r
237         CMP     #70H, R7\r
238         BNE     RegTest2Error\r
239         CMP     #80H, R8\r
240         BNE     RegTest2Error\r
241         CMP     #90H, R9\r
242         BNE     RegTest2Error\r
243         CMP     #100H, R10\r
244         BNE     RegTest2Error\r
245         CMP     #110H, R11\r
246         BNE     RegTest2Error\r
247         CMP     #120H, R12\r
248         BNE     RegTest2Error\r
249         CMP     #130H, R13\r
250         BNE     RegTest2Error\r
251         CMP     #140H, R14\r
252         BNE     RegTest2Error\r
253         CMP     #150H, R15\r
254         BNE     RegTest2Error\r
255 \r
256         ;/* All comparisons passed, start a new itteratio of this loop. */\r
257         BRA     TestLoop2\r
258 \r
259 RegTest2Error:\r
260         ;/* A compare failed, just loop here so the loop counter stops incrementing\r
261         ;- causing the check task to indicate the error. */\r
262         BRA RegTest2Error\r
263 \r
264 \r
265         .END\r