]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Full_Demo/RegTest_GCC.S
1220cf992ce3aef6cce069a0f5d5ca6fdef18267
[freertos] / FreeRTOS / Demo / RX100_RX113-RSK_GCC_e2studio_IAR / src / Full_Demo / RegTest_GCC.S
1 ;/*\r
2 ; * FreeRTOS Kernel V10.3.0\r
3 ; * Copyright (C) 2020 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.\r
14 ; *\r
15 ; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
16 ; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
17 ; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
18 ; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
19 ; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
20 ; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
21 ; *\r
22 ; * http://www.FreeRTOS.org\r
23 ; * http://aws.amazon.com/freertos\r
24 ; *\r
25 ; * 1 tab == 4 spaces!\r
26 ; */\r
27 \r
28         .global _vRegTest1Implementation\r
29         .global _vRegTest2Implementation\r
30 \r
31         .extern _ulRegTest1LoopCounter\r
32         .extern _ulRegTest2LoopCounter\r
33 \r
34         .text\r
35 \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 each register.\r
41         MOV.L   #1, R1\r
42         MOV.L   #2, R2\r
43         MOV.L   #3, R3\r
44         MOV.L   #4, R4\r
45         MOV.L   #5, R5\r
46         MOV.L   #6, R6\r
47         MOV.L   #7, R7\r
48         MOV.L   #8, R8\r
49         MOV.L   #9, R9\r
50         MOV.L   #10, R10\r
51         MOV.L   #11, R11\r
52         MOV.L   #12, R12\r
53         MOV.L   #13, R13\r
54         MOV.L   #14, R14\r
55         MOV.L   #15, R15\r
56 \r
57         ; Loop, checking each iteration that each register still contains the\r
58         ; expected value.\r
59 TestLoop1:\r
60 \r
61         ; Push the registers that are going to get clobbered.\r
62         PUSHM   R14-R15\r
63 \r
64         ; Increment the loop counter to show this task is still getting CPU time.\r
65         MOV.L   #_ulRegTest1LoopCounter, R14\r
66         MOV.L   [ R14 ], R15\r
67         ADD             #1, R15\r
68         MOV.L   R15, [ R14 ]\r
69 \r
70         ; Yield to extend the text coverage.  Set the bit in the ITU SWINTR register.\r
71         MOV.L   #1, R14\r
72         MOV.L   #0872E0H, R15\r
73         MOV.B   R14, [R15]\r
74         NOP\r
75         NOP\r
76 \r
77         ; Restore the clobbered registers.\r
78         POPM    R14-R15\r
79 \r
80         ; Now compare each register to ensure it still contains the value that was\r
81         ; set before this loop was entered.\r
82         CMP             #1, R1\r
83         BNE             RegTest1Error\r
84         CMP             #2, R2\r
85         BNE             RegTest1Error\r
86         CMP             #3, R3\r
87         BNE             RegTest1Error\r
88         CMP             #4, R4\r
89         BNE             RegTest1Error\r
90         CMP             #5, R5\r
91         BNE             RegTest1Error\r
92         CMP             #6, R6\r
93         BNE             RegTest1Error\r
94         CMP             #7, R7\r
95         BNE             RegTest1Error\r
96         CMP             #8, R8\r
97         BNE             RegTest1Error\r
98         CMP             #9, R9\r
99         BNE             RegTest1Error\r
100         CMP             #10, R10\r
101         BNE             RegTest1Error\r
102         CMP             #11, R11\r
103         BNE             RegTest1Error\r
104         CMP             #12, R12\r
105         BNE             RegTest1Error\r
106         CMP             #13, R13\r
107         BNE             RegTest1Error\r
108         CMP             #14, R14\r
109         BNE             RegTest1Error\r
110         CMP             #15, R15\r
111         BNE             RegTest1Error\r
112 \r
113         ; All comparisons passed, start a new itteratio of this loop.\r
114         BRA             TestLoop1\r
115 \r
116 RegTest1Error:\r
117         ; A compare failed, just loop here so the loop counter stops incrementing\r
118         ; causing the check task to indicate the error.\r
119         BRA RegTest1Error\r
120 ;/*-----------------------------------------------------------*/\r
121 \r
122 ;/* This function is explained in the comments at the top of main.c. */\r
123 _vRegTest2Implementation:\r
124 \r
125         ; Put a known value in each register.\r
126         MOV.L   #10, R1\r
127         MOV.L   #20, R2\r
128         MOV.L   #30, R3\r
129         MOV.L   #40, R4\r
130         MOV.L   #50, R5\r
131         MOV.L   #60, R6\r
132         MOV.L   #70, R7\r
133         MOV.L   #80, R8\r
134         MOV.L   #90, R9\r
135         MOV.L   #100, R10\r
136         MOV.L   #110, R11\r
137         MOV.L   #120, R12\r
138         MOV.L   #130, R13\r
139         MOV.L   #140, R14\r
140         MOV.L   #150, R15\r
141 \r
142         ; Loop, checking on each iteration that each register still contains the\r
143         ; expected value.\r
144 TestLoop2:\r
145 \r
146         ; Push the registers that are going to get clobbered.\r
147         PUSHM   R14-R15\r
148 \r
149         ; Increment the loop counter to show this task is still getting CPU time.\r
150         MOV.L   #_ulRegTest2LoopCounter, R14\r
151         MOV.L   [ R14 ], R15\r
152         ADD             #1, R15\r
153         MOV.L   R15, [ R14 ]\r
154 \r
155         ; Restore the clobbered registers.\r
156         POPM    R14-R15\r
157 \r
158         CMP             #10, R1\r
159         BNE             RegTest2Error\r
160         CMP             #20, R2\r
161         BNE             RegTest2Error\r
162         CMP             #30, R3\r
163         BNE             RegTest2Error\r
164         CMP             #40, R4\r
165         BNE             RegTest2Error\r
166         CMP             #50, R5\r
167         BNE             RegTest2Error\r
168         CMP             #60, R6\r
169         BNE             RegTest2Error\r
170         CMP             #70, R7\r
171         BNE             RegTest2Error\r
172         CMP             #80, R8\r
173         BNE             RegTest2Error\r
174         CMP             #90, R9\r
175         BNE             RegTest2Error\r
176         CMP             #100, R10\r
177         BNE             RegTest2Error\r
178         CMP             #110, R11\r
179         BNE             RegTest2Error\r
180         CMP             #120, R12\r
181         BNE             RegTest2Error\r
182         CMP             #130, R13\r
183         BNE             RegTest2Error\r
184         CMP             #140, R14\r
185         BNE             RegTest2Error\r
186         CMP             #150, R15\r
187         BNE             RegTest2Error\r
188 \r
189         ; All comparisons passed, start a new itteratio of this loop.\r
190         BRA             TestLoop2\r
191 \r
192 RegTest2Error:\r
193         ; A compare failed, just loop here so the loop counter stops incrementing\r
194         ; - causing the check task to indicate the error.\r
195         BRA RegTest2Error\r
196 \r
197         .END\r