2 * FreeRTOS Kernel V10.1.1
3 * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
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:
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
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.
22 * http://www.FreeRTOS.org
23 * http://aws.amazon.com/freertos
31 #include "FreeRTOSConfig.h"
40 /************************************************************************/
41 /* Reg test macro helper. Test a register for a known value branching to
42 error_loop if not correct otherwise continuing on */
43 .macro portREG_TEST work_reg, test_reg, test_value
45 /* Check each register maintains the value assigned to it for the lifetime
47 addiu \work_reg, $0, 0x00
48 addiu \work_reg, \test_reg, -\test_value
51 /* The register value was not that expected. Jump to the error loop so the
52 cycle counter stops incrementing. */
58 /************************************************************************/
59 /* FPU reg test macro helper, Test an FPU register for a known value branching to
60 error_loop if not correct otherwise continuing on */
61 #if ( __mips_hard_float == 1) && ( configUSE_TASK_FPU_SUPPORT == 1 )
62 .macro portFPU_REG_TEST work_reg, test_reg, test_value
63 /* get the lower 32 bit value from the FPU and compare to the test value */
64 mfc1 \work_reg, \test_reg
65 addiu \work_reg, \work_reg, -\test_value
69 /* The register values was not that expected. Jump to the error loop */
77 /************************************************************************/
82 /* Reg test tasks call the error loop when they find an error. Sitting in the
83 tight error loop prevents them incrementing their ulRegTestnCycles counter, and
84 so allows the check softwate timer to know an error has been found. */
97 /* Fill the registers with known values. */
101 /* $4 contains the address of the loop counter - don't mess with $4. */
136 /* Test the FPU registers if they are present on the part. */
137 #if ( __mips_hard_float == 1 ) && ( configUSE_TASK_FPU_SUPPORT == 1 )
205 portREG_TEST $22, $1, 0x11
206 portREG_TEST $22, $2, 0x12
207 portREG_TEST $22, $3, 0x13
208 /* Do not test r4 as we are using it as a loop counter */
209 portREG_TEST $22, $5, 0x15
210 portREG_TEST $22, $6, 0x16
211 portREG_TEST $22, $7, 0x17
212 portREG_TEST $22, $8, 0x18
213 portREG_TEST $22, $9, 0x19
214 portREG_TEST $22, $10, 0x110
215 portREG_TEST $22, $11, 0x111
216 portREG_TEST $22, $12, 0x112
217 portREG_TEST $22, $13, 0x113
218 portREG_TEST $22, $14, 0x114
219 portREG_TEST $22, $15, 0x115
220 portREG_TEST $22, $16, 0x116
221 portREG_TEST $22, $17, 0x117
222 portREG_TEST $22, $18, 0x118
223 portREG_TEST $22, $19, 0x119
224 portREG_TEST $22, $20, 0x120
225 portREG_TEST $22, $21, 0x121
226 /* Do not test r22, used as a helper */
227 portREG_TEST $22, $23, 0x123
228 portREG_TEST $22, $24, 0x124
229 portREG_TEST $22, $25, 0x125
230 portREG_TEST $22, $30, 0x130
233 addiu $22, $22, -0x131
240 addiu $22, $22, -0x132
247 addiu $22, $22, -0x133
254 addiu $22, $22, -0x134
261 addiu $22, $22, -0x135
268 addiu $22, $22, -0x136
274 /* Test the FPU registers if they are present on the part. */
275 #if ( __mips_hard_float == 1 ) && ( configUSE_TASK_FPU_SUPPORT == 1 )
276 portFPU_REG_TEST $22, $f0, 0x180
277 portFPU_REG_TEST $22, $f1, 0x181
278 portFPU_REG_TEST $22, $f2, 0x182
279 portFPU_REG_TEST $22, $f3, 0x183
280 portFPU_REG_TEST $22, $f4, 0x184
281 portFPU_REG_TEST $22, $f5, 0x185
282 portFPU_REG_TEST $22, $f6, 0x186
283 portFPU_REG_TEST $22, $f7, 0x187
284 portFPU_REG_TEST $22, $f8, 0x188
285 portFPU_REG_TEST $22, $f9, 0x189
286 portFPU_REG_TEST $22, $f10, 0x18A
287 portFPU_REG_TEST $22, $f11, 0x18B
288 portFPU_REG_TEST $22, $f12, 0x18C
289 portFPU_REG_TEST $22, $f13, 0x18D
290 portFPU_REG_TEST $22, $f14, 0x18E
291 portFPU_REG_TEST $22, $f15, 0x18F
292 portFPU_REG_TEST $22, $f16, 0x190
293 portFPU_REG_TEST $22, $f17, 0x191
294 portFPU_REG_TEST $22, $f18, 0x192
295 portFPU_REG_TEST $22, $f19, 0x193
296 portFPU_REG_TEST $22, $f20, 0x194
297 portFPU_REG_TEST $22, $f21, 0x195
298 portFPU_REG_TEST $22, $f22, 0x196
299 portFPU_REG_TEST $22, $f23, 0x197
300 portFPU_REG_TEST $22, $f24, 0x198
301 portFPU_REG_TEST $22, $f25, 0x199
302 portFPU_REG_TEST $22, $f26, 0x19A
303 portFPU_REG_TEST $22, $f27, 0x19B
304 portFPU_REG_TEST $22, $f28, 0x19C
305 portFPU_REG_TEST $22, $f29, 0x19D
306 portFPU_REG_TEST $22, $f30, 0x19E
307 portFPU_REG_TEST $22, $f31, 0x19F
310 /* No errors detected. Increment the loop count so the check timer knows
311 this task is still running without error, then loop back to do it all
312 again. The address of the loop counter is in $4. */
321 /************************************************************************/
330 /* $4 contains the address of the loop counter - don't mess with $4. */
365 /* Test the FPU registers if they are present on the part. */
366 #if ( __mips_hard_float == 1 ) && ( configUSE_TASK_FPU_SUPPORT == 1 )
434 portREG_TEST $22, $1, 0x21
435 portREG_TEST $22, $2, 0x22
436 portREG_TEST $22, $3, 0x23
437 /* Do not test r4 as we are using it as a loop counter */
438 portREG_TEST $22, $5, 0x25
439 portREG_TEST $22, $6, 0x26
440 portREG_TEST $22, $7, 0x27
441 portREG_TEST $22, $8, 0x28
442 portREG_TEST $22, $9, 0x29
443 portREG_TEST $22, $10, 0x210
444 portREG_TEST $22, $11, 0x211
445 portREG_TEST $22, $12, 0x212
446 portREG_TEST $22, $13, 0x213
447 portREG_TEST $22, $14, 0x214
448 portREG_TEST $22, $15, 0x215
449 portREG_TEST $22, $16, 0x216
450 portREG_TEST $22, $17, 0x217
451 portREG_TEST $22, $18, 0x218
452 portREG_TEST $22, $19, 0x219
453 portREG_TEST $22, $20, 0x220
454 portREG_TEST $22, $21, 0x221
455 /* Do not test r22, used as a helper */
456 portREG_TEST $22, $23, 0x223
457 portREG_TEST $22, $24, 0x224
458 portREG_TEST $22, $25, 0x225
459 portREG_TEST $22, $30, 0x230
462 addiu $22, $22, -0x231
469 addiu $22, $22, -0x232
476 addiu $22, $22, -0x233
483 addiu $22, $22, -0x234
490 addiu $22, $22, -0x235
497 addiu $22, $22, -0x236
503 /* Test the FPU registers if they are present on the part. */
504 #if ( __mips_hard_float == 1 ) && ( configUSE_TASK_FPU_SUPPORT == 1 )
505 portFPU_REG_TEST $22, $f0, 0x280
506 portFPU_REG_TEST $22, $f1, 0x281
507 portFPU_REG_TEST $22, $f2, 0x282
508 portFPU_REG_TEST $22, $f3, 0x283
509 portFPU_REG_TEST $22, $f4, 0x284
510 portFPU_REG_TEST $22, $f5, 0x285
511 portFPU_REG_TEST $22, $f6, 0x286
512 portFPU_REG_TEST $22, $f7, 0x287
513 portFPU_REG_TEST $22, $f8, 0x288
514 portFPU_REG_TEST $22, $f9, 0x289
515 portFPU_REG_TEST $22, $f10, 0x28A
516 portFPU_REG_TEST $22, $f11, 0x28B
517 portFPU_REG_TEST $22, $f12, 0x28C
518 portFPU_REG_TEST $22, $f13, 0x28D
519 portFPU_REG_TEST $22, $f14, 0x28E
520 portFPU_REG_TEST $22, $f15, 0x28F
521 portFPU_REG_TEST $22, $f16, 0x290
522 portFPU_REG_TEST $22, $f17, 0x291
523 portFPU_REG_TEST $22, $f18, 0x292
524 portFPU_REG_TEST $22, $f19, 0x293
525 portFPU_REG_TEST $22, $f20, 0x294
526 portFPU_REG_TEST $22, $f21, 0x295
527 portFPU_REG_TEST $22, $f22, 0x296
528 portFPU_REG_TEST $22, $f23, 0x297
529 portFPU_REG_TEST $22, $f24, 0x298
530 portFPU_REG_TEST $22, $f25, 0x299
531 portFPU_REG_TEST $22, $f26, 0x29A
532 portFPU_REG_TEST $22, $f27, 0x29B
533 portFPU_REG_TEST $22, $f28, 0x29C
534 portFPU_REG_TEST $22, $f29, 0x29D
535 portFPU_REG_TEST $22, $f30, 0x29E
536 portFPU_REG_TEST $22, $f31, 0x29F
539 /* No errors detected. Increment the loop count so the check timer knows
540 this task is still running without error, then loop back to do it all
541 again. The address of the loop counter is in $4. */