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