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