]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Full_Demo/RegTest_GCC.S
Update license information text files for the CLI, TCP and UDP products to be correct...
[freertos] / FreeRTOS / Demo / RX100_RX113-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 each register.\r
42         MOV.L   #1, R1\r
43         MOV.L   #2, R2\r
44         MOV.L   #3, R3\r
45         MOV.L   #4, R4\r
46         MOV.L   #5, R5\r
47         MOV.L   #6, R6\r
48         MOV.L   #7, R7\r
49         MOV.L   #8, R8\r
50         MOV.L   #9, R9\r
51         MOV.L   #10, R10\r
52         MOV.L   #11, R11\r
53         MOV.L   #12, R12\r
54         MOV.L   #13, R13\r
55         MOV.L   #14, R14\r
56         MOV.L   #15, R15\r
57 \r
58         ; Loop, checking each iteration that each register still contains the\r
59         ; expected value.\r
60 TestLoop1:\r
61 \r
62         ; Push the registers that are going to get clobbered.\r
63         PUSHM   R14-R15\r
64 \r
65         ; Increment the loop counter to show this task is still getting CPU time.\r
66         MOV.L   #_ulRegTest1LoopCounter, R14\r
67         MOV.L   [ R14 ], R15\r
68         ADD             #1, R15\r
69         MOV.L   R15, [ R14 ]\r
70 \r
71         ; Yield to extend the text coverage.  Set the bit in the ITU SWINTR register.\r
72         MOV.L   #1, R14\r
73         MOV.L   #0872E0H, R15\r
74         MOV.B   R14, [R15]\r
75         NOP\r
76         NOP\r
77 \r
78         ; Restore the clobbered registers.\r
79         POPM    R14-R15\r
80 \r
81         ; Now compare each register to ensure it still contains the value that was\r
82         ; set before this loop was entered.\r
83         CMP             #1, R1\r
84         BNE             RegTest1Error\r
85         CMP             #2, R2\r
86         BNE             RegTest1Error\r
87         CMP             #3, R3\r
88         BNE             RegTest1Error\r
89         CMP             #4, R4\r
90         BNE             RegTest1Error\r
91         CMP             #5, R5\r
92         BNE             RegTest1Error\r
93         CMP             #6, R6\r
94         BNE             RegTest1Error\r
95         CMP             #7, R7\r
96         BNE             RegTest1Error\r
97         CMP             #8, R8\r
98         BNE             RegTest1Error\r
99         CMP             #9, R9\r
100         BNE             RegTest1Error\r
101         CMP             #10, R10\r
102         BNE             RegTest1Error\r
103         CMP             #11, R11\r
104         BNE             RegTest1Error\r
105         CMP             #12, R12\r
106         BNE             RegTest1Error\r
107         CMP             #13, R13\r
108         BNE             RegTest1Error\r
109         CMP             #14, R14\r
110         BNE             RegTest1Error\r
111         CMP             #15, R15\r
112         BNE             RegTest1Error\r
113 \r
114         ; All comparisons passed, start a new itteratio of this loop.\r
115         BRA             TestLoop1\r
116 \r
117 RegTest1Error:\r
118         ; A compare failed, just loop here so the loop counter stops incrementing\r
119         ; causing the check task to indicate the error.\r
120         BRA RegTest1Error\r
121 ;/*-----------------------------------------------------------*/\r
122 \r
123 ;/* This function is explained in the comments at the top of main.c. */\r
124 _vRegTest2Implementation:\r
125 \r
126         ; Put a known value in each register.\r
127         MOV.L   #10, R1\r
128         MOV.L   #20, R2\r
129         MOV.L   #30, R3\r
130         MOV.L   #40, R4\r
131         MOV.L   #50, R5\r
132         MOV.L   #60, R6\r
133         MOV.L   #70, R7\r
134         MOV.L   #80, R8\r
135         MOV.L   #90, R9\r
136         MOV.L   #100, R10\r
137         MOV.L   #110, R11\r
138         MOV.L   #120, R12\r
139         MOV.L   #130, R13\r
140         MOV.L   #140, R14\r
141         MOV.L   #150, R15\r
142 \r
143         ; Loop, checking on each iteration that each register still contains the\r
144         ; expected value.\r
145 TestLoop2:\r
146 \r
147         ; Push the registers that are going to get clobbered.\r
148         PUSHM   R14-R15\r
149 \r
150         ; Increment the loop counter to show this task is still getting CPU time.\r
151         MOV.L   #_ulRegTest2LoopCounter, R14\r
152         MOV.L   [ R14 ], R15\r
153         ADD             #1, R15\r
154         MOV.L   R15, [ R14 ]\r
155 \r
156         ; Restore the clobbered registers.\r
157         POPM    R14-R15\r
158 \r
159         CMP             #10, R1\r
160         BNE             RegTest2Error\r
161         CMP             #20, R2\r
162         BNE             RegTest2Error\r
163         CMP             #30, R3\r
164         BNE             RegTest2Error\r
165         CMP             #40, R4\r
166         BNE             RegTest2Error\r
167         CMP             #50, R5\r
168         BNE             RegTest2Error\r
169         CMP             #60, R6\r
170         BNE             RegTest2Error\r
171         CMP             #70, R7\r
172         BNE             RegTest2Error\r
173         CMP             #80, R8\r
174         BNE             RegTest2Error\r
175         CMP             #90, R9\r
176         BNE             RegTest2Error\r
177         CMP             #100, R10\r
178         BNE             RegTest2Error\r
179         CMP             #110, R11\r
180         BNE             RegTest2Error\r
181         CMP             #120, R12\r
182         BNE             RegTest2Error\r
183         CMP             #130, R13\r
184         BNE             RegTest2Error\r
185         CMP             #140, R14\r
186         BNE             RegTest2Error\r
187         CMP             #150, R15\r
188         BNE             RegTest2Error\r
189 \r
190         ; All comparisons passed, start a new itteratio of this loop.\r
191         BRA             TestLoop2\r
192 \r
193 RegTest2Error:\r
194         ; A compare failed, just loop here so the loop counter stops incrementing\r
195         ; - causing the check task to indicate the error.\r
196         BRA RegTest2Error\r
197 \r
198         .END\r