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