]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RX600_RX62N-RDK_IAR/RegTest.s
Update to MIT licensed FreeRTOS V10.0.0 - see https://www.freertos.org/History.txt
[freertos] / FreeRTOS / Demo / RX600_RX62N-RDK_IAR / RegTest.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         PUBLIC _prvRegTest1Implementation\r
30         PUBLIC _prvRegTest2Implementation\r
31         \r
32         EXTERN _ulRegTest1CycleCount\r
33         EXTERN _ulRegTest2CycleCount\r
34 \r
35         RSEG CODE:CODE(4)\r
36 \r
37 /* This function is explained in the comments at the top of main.c. */\r
38 _prvRegTest1Implementation:\r
39 \r
40         /* Put a known value in each register. */\r
41         MOV     #1, R1                                          \r
42         MOV     #2, R2                                          \r
43         MOV     #3, R3                                          \r
44         MOV     #4, R4                                          \r
45         MOV     #5, R5                                          \r
46         MOV     #6, R6                                          \r
47         MOV     #7, R7                                          \r
48         MOV     #8, R8                                          \r
49         MOV     #9, R9                                          \r
50         MOV     #10, R10                                        \r
51         MOV     #11, R11                                        \r
52         MOV     #12, R12                                        \r
53         MOV     #13, R13                                        \r
54         MOV     #14, R14                                        \r
55         MOV     #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     #_ulRegTest1CycleCount, R14     \r
66         MOV     [ R14 ], R15                            \r
67         ADD     #1, R15                                         \r
68         MOV     R15, [ R14 ]                            \r
69         \r
70         /* Yield to extend the text coverage.  Set the bit in the ITU SWINTR register. */\r
71         MOV     #1, R14                                         \r
72         MOV     #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 _prvRegTest2Implementation:\r
124 \r
125         /* Put a known value in each register. */\r
126         MOV     #10H, R1                                        \r
127         MOV     #20H, R2                                        \r
128         MOV     #30H, R3                                        \r
129         MOV     #40H, R4                                        \r
130         MOV     #50H, R5                                        \r
131         MOV     #60H, R6                                        \r
132         MOV     #70H, R7                                        \r
133         MOV     #80H, R8                                        \r
134         MOV     #90H, R9                                        \r
135         MOV     #100H, R10                                      \r
136         MOV     #110H, R11                                      \r
137         MOV     #120H, R12                                      \r
138         MOV     #130H, R13                                      \r
139         MOV     #140H, R14                                      \r
140         MOV     #150H, R15                                      \r
141         \r
142         /* Loop, checking 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     #_ulRegTest2CycleCount, R14     \r
151         MOV     [ R14 ], R15                            \r
152         ADD     #1, R15                                         \r
153         MOV     R15, [ R14 ]                            \r
154         \r
155         /* Restore the clobbered registers. */\r
156         POPM    R14-R15                                         \r
157         \r
158         /* Now compare each register to ensure it still contains the value that was\r
159         set before this loop was entered. */\r
160         CMP     #10H, R1                                        \r
161         BNE     RegTest2Error                           \r
162         CMP     #20H, R2                                        \r
163         BNE     RegTest2Error                           \r
164         CMP     #30H, R3                                        \r
165         BNE     RegTest2Error                           \r
166         CMP     #40H, R4                                        \r
167         BNE     RegTest2Error                           \r
168         CMP     #50H, R5                                        \r
169         BNE     RegTest2Error                           \r
170         CMP     #60H, R6                                        \r
171         BNE     RegTest2Error                           \r
172         CMP     #70H, R7                                        \r
173         BNE     RegTest2Error                           \r
174         CMP     #80H, R8                                        \r
175         BNE     RegTest2Error                           \r
176         CMP     #90H, R9                                        \r
177         BNE     RegTest2Error                           \r
178         CMP     #100H, R10                                      \r
179         BNE     RegTest2Error                           \r
180         CMP     #110H, R11                                      \r
181         BNE     RegTest2Error                           \r
182         CMP     #120H, R12                                      \r
183         BNE     RegTest2Error                           \r
184         CMP     #130H, R13                                      \r
185         BNE     RegTest2Error                           \r
186         CMP     #140H, R14                                      \r
187         BNE     RegTest2Error                           \r
188         CMP     #150H, R15                                      \r
189         BNE     RegTest2Error                           \r
190 \r
191         /* All comparisons passed, start a new itteratio of this loop. */\r
192         BRA     TestLoop2                                       \r
193         \r
194 RegTest2Error:                                                  \r
195         /* A compare failed, just loop here so the loop counter stops incrementing\r
196         - causing the check task to indicate the error. */\r
197         BRA RegTest2Error                                       \r
198 \r
199         \r
200         END\r