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