]> begriffs open source - cmsis-freertos/blob - Demo/RX600_RX62N-RSK_IAR/RegTest.s
Initial commit
[cmsis-freertos] / Demo / RX600_RX62N-RSK_IAR / RegTest.s
1 /*
2     FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
3     All rights reserved
4
5     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
6
7     This file is part of the FreeRTOS distribution.
8
9     FreeRTOS is free software; you can redistribute it and/or modify it under
10     the terms of the GNU General Public License (version 2) as published by the
11     Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
12
13     ***************************************************************************
14     >>!   NOTE: The modification to the GPL is included to allow you to     !<<
15     >>!   distribute a combined work that includes FreeRTOS without being   !<<
16     >>!   obliged to provide the source code for proprietary components     !<<
17     >>!   outside of the FreeRTOS kernel.                                   !<<
18     ***************************************************************************
19
20     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
21     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
22     FOR A PARTICULAR PURPOSE.  Full license text is available on the following
23     link: http://www.freertos.org/a00114.html
24
25     ***************************************************************************
26      *                                                                       *
27      *    FreeRTOS provides completely free yet professionally developed,    *
28      *    robust, strictly quality controlled, supported, and cross          *
29      *    platform software that is more than just the market leader, it     *
30      *    is the industry's de facto standard.                               *
31      *                                                                       *
32      *    Help yourself get started quickly while simultaneously helping     *
33      *    to support the FreeRTOS project by purchasing a FreeRTOS           *
34      *    tutorial book, reference manual, or both:                          *
35      *    http://www.FreeRTOS.org/Documentation                              *
36      *                                                                       *
37     ***************************************************************************
38
39     http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading
40     the FAQ page "My application does not run, what could be wrong?".  Have you
41     defined configASSERT()?
42
43     http://www.FreeRTOS.org/support - In return for receiving this top quality
44     embedded software for free we request you assist our global community by
45     participating in the support forum.
46
47     http://www.FreeRTOS.org/training - Investing in training allows your team to
48     be as productive as possible as early as possible.  Now you can receive
49     FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
50     Ltd, and the world's leading authority on the world's leading RTOS.
51
52     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
53     including FreeRTOS+Trace - an indispensable productivity tool, a DOS
54     compatible FAT file system, and our tiny thread aware UDP/IP stack.
55
56     http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
57     Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
58
59     http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
60     Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS
61     licenses offer ticketed support, indemnification and commercial middleware.
62
63     http://www.SafeRTOS.com - High Integrity Systems also provide a safety
64     engineered and independently SIL3 certified version for use in safety and
65     mission critical applications that require provable dependability.
66
67     1 tab == 4 spaces!
68 */
69
70         PUBLIC _prvRegTest1Implementation
71         PUBLIC _prvRegTest2Implementation
72         
73         EXTERN _ulRegTest1CycleCount
74         EXTERN _ulRegTest2CycleCount
75
76         RSEG CODE:CODE(4)
77
78 /* This function is explained in the comments at the top of main.c. */
79 _prvRegTest1Implementation:
80
81         /* Put a known value in each register. */
82         MOV     #1, R1                                          
83         MOV     #2, R2                                          
84         MOV     #3, R3                                          
85         MOV     #4, R4                                          
86         MOV     #5, R5                                          
87         MOV     #6, R6                                          
88         MOV     #7, R7                                          
89         MOV     #8, R8                                          
90         MOV     #9, R9                                          
91         MOV     #10, R10                                        
92         MOV     #11, R11                                        
93         MOV     #12, R12                                        
94         MOV     #13, R13                                        
95         MOV     #14, R14                                        
96         MOV     #15, R15                                        
97         
98         /* Loop, checking each iteration that each register still contains the
99         expected value. */
100 TestLoop1:                                                              
101
102         /* Push the registers that are going to get clobbered. */
103         PUSHM   R14-R15                                         
104         
105         /* Increment the loop counter to show this task is still getting CPU time. */
106         MOV     #_ulRegTest1CycleCount, R14     
107         MOV     [ R14 ], R15                            
108         ADD     #1, R15                                         
109         MOV     R15, [ R14 ]                            
110         
111         /* Yield to extend the text coverage.  Set the bit in the ITU SWINTR register. */
112         MOV     #1, R14                                         
113         MOV     #0872E0H, R15                           
114         MOV.B   R14, [R15]                                      
115         NOP                                                             
116         NOP                                                             
117         
118         /* Restore the clobbered registers. */
119         POPM    R14-R15                                         
120         
121         /* Now compare each register to ensure it still contains the value that was
122         set before this loop was entered. */
123         CMP     #1, R1                                          
124         BNE     RegTest1Error                           
125         CMP     #2, R2                                          
126         BNE     RegTest1Error                           
127         CMP     #3, R3                                          
128         BNE     RegTest1Error                           
129         CMP     #4, R4                                          
130         BNE     RegTest1Error                           
131         CMP     #5, R5                                          
132         BNE     RegTest1Error                           
133         CMP     #6, R6                                          
134         BNE     RegTest1Error                           
135         CMP     #7, R7                                          
136         BNE     RegTest1Error                           
137         CMP     #8, R8                                          
138         BNE     RegTest1Error                           
139         CMP     #9, R9                                          
140         BNE     RegTest1Error                           
141         CMP     #10, R10                                        
142         BNE     RegTest1Error                           
143         CMP     #11, R11                                        
144         BNE     RegTest1Error                           
145         CMP     #12, R12                                        
146         BNE     RegTest1Error                           
147         CMP     #13, R13                                        
148         BNE     RegTest1Error                           
149         CMP     #14, R14                                        
150         BNE     RegTest1Error                           
151         CMP     #15, R15                                        
152         BNE     RegTest1Error                           
153
154         /* All comparisons passed, start a new itteratio of this loop. */
155         BRA             TestLoop1                               
156         
157 RegTest1Error:                                                  
158         /* A compare failed, just loop here so the loop counter stops incrementing
159         - causing the check task to indicate the error. */
160         BRA RegTest1Error                                       
161 /*-----------------------------------------------------------*/
162
163 /* This function is explained in the comments at the top of main.c. */
164 _prvRegTest2Implementation:
165
166         /* Put a known value in each register. */
167         MOV     #10H, R1                                        
168         MOV     #20H, R2                                        
169         MOV     #30H, R3                                        
170         MOV     #40H, R4                                        
171         MOV     #50H, R5                                        
172         MOV     #60H, R6                                        
173         MOV     #70H, R7                                        
174         MOV     #80H, R8                                        
175         MOV     #90H, R9                                        
176         MOV     #100H, R10                                      
177         MOV     #110H, R11                                      
178         MOV     #120H, R12                                      
179         MOV     #130H, R13                                      
180         MOV     #140H, R14                                      
181         MOV     #150H, R15                                      
182         
183         /* Loop, checking each iteration that each register still contains the
184         expected value. */
185 TestLoop2:                                                              
186
187         /* Push the registers that are going to get clobbered. */
188         PUSHM   R14-R15                                         
189         
190         /* Increment the loop counter to show this task is still getting CPU time. */
191         MOV     #_ulRegTest2CycleCount, R14     
192         MOV     [ R14 ], R15                            
193         ADD     #1, R15                                         
194         MOV     R15, [ R14 ]                            
195         
196         /* Restore the clobbered registers. */
197         POPM    R14-R15                                         
198         
199         /* Now compare each register to ensure it still contains the value that was
200         set before this loop was entered. */
201         CMP     #10H, R1                                        
202         BNE     RegTest2Error                           
203         CMP     #20H, R2                                        
204         BNE     RegTest2Error                           
205         CMP     #30H, R3                                        
206         BNE     RegTest2Error                           
207         CMP     #40H, R4                                        
208         BNE     RegTest2Error                           
209         CMP     #50H, R5                                        
210         BNE     RegTest2Error                           
211         CMP     #60H, R6                                        
212         BNE     RegTest2Error                           
213         CMP     #70H, R7                                        
214         BNE     RegTest2Error                           
215         CMP     #80H, R8                                        
216         BNE     RegTest2Error                           
217         CMP     #90H, R9                                        
218         BNE     RegTest2Error                           
219         CMP     #100H, R10                                      
220         BNE     RegTest2Error                           
221         CMP     #110H, R11                                      
222         BNE     RegTest2Error                           
223         CMP     #120H, R12                                      
224         BNE     RegTest2Error                           
225         CMP     #130H, R13                                      
226         BNE     RegTest2Error                           
227         CMP     #140H, R14                                      
228         BNE     RegTest2Error                           
229         CMP     #150H, R15                                      
230         BNE     RegTest2Error                           
231
232         /* All comparisons passed, start a new itteratio of this loop. */
233         BRA     TestLoop2                                       
234         
235 RegTest2Error:                                                  
236         /* A compare failed, just loop here so the loop counter stops incrementing
237         - causing the check task to indicate the error. */
238         BRA RegTest2Error                                       
239
240         
241         END