]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/PIC32MEC14xx_MPLAB/src/Full_Demo/RegisterTestTasks.S
Update to MIT licensed FreeRTOS V10.0.0 - see https://www.freertos.org/History.txt
[freertos] / FreeRTOS / Demo / PIC32MEC14xx_MPLAB / src / Full_Demo / RegisterTestTasks.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 \r
30 #include <xc.h>\r
31 #include <sys/asm.h>\r
32 \r
33 \r
34         .global vRegTest1\r
35         .global vRegTest2\r
36 \r
37 /* Reg test macro helper. Test a register for a known value branching to\r
38 error_loop if not correct otherwise continuing on */\r
39 .macro  portREG_TEST work_reg, test_reg, test_value\r
40         .set    micromips\r
41         .set    noreorder\r
42         .set    noat\r
43 \r
44         /* Check each register maintains the value assigned to it for the lifetime\r
45         of the task. */\r
46         addiu   \work_reg, $0, 0x00\r
47         addiu   \work_reg, \test_reg, -\test_value\r
48         beq             \work_reg, $0, 1f\r
49         nop\r
50         /* The register value was not that expected.  Jump to the error loop so the\r
51         cycle counter stops incrementing. */\r
52         b       error_loop\r
53         nop\r
54 1:\r
55         .endm\r
56 \r
57 \r
58         .set    micromips\r
59         .set    noreorder\r
60         .set    noat\r
61         .ent    error_loop\r
62 \r
63 /* Reg test tasks call the error loop when they find an error.  Sitting in the\r
64 tight error loop prevents them incrementing their ulRegTestnCycles counter, and\r
65 so allows the check softwate timer to know an error has been found. */\r
66 error_loop:\r
67         b       error_loop\r
68         nop\r
69 \r
70         .end error_loop\r
71 \r
72 \r
73         .set    micromips\r
74         .set    noreorder\r
75         .set    noat\r
76         .ent    vRegTest1\r
77 \r
78 vRegTest1:\r
79         /* Fill the registers with known values. */\r
80         addiu   $1, $0, 0x11\r
81         addiu   $2, $0, 0x12\r
82         addiu   $3, $0, 0x13\r
83         /* $4 contains the address of the loop counter - don't mess with $4. */\r
84         addiu   $5, $0, 0x15\r
85         addiu   $6, $0, 0x16\r
86         addiu   $7, $0, 0x17\r
87         addiu   $8, $0, 0x18\r
88         addiu   $9, $0, 0x19\r
89         addiu   $10, $0, 0x110\r
90         addiu   $11, $0, 0x111\r
91         addiu   $12, $0, 0x112\r
92         addiu   $13, $0, 0x113\r
93         addiu   $14, $0, 0x114\r
94         addiu   $15, $0, 0x115\r
95         addiu   $16, $0, 0x116\r
96         addiu   $17, $0, 0x117\r
97         addiu   $18, $0, 0x118\r
98         addiu   $19, $0, 0x119\r
99         addiu   $20, $0, 0x120\r
100         addiu   $21, $0, 0x121\r
101         addiu   $23, $0, 0x123\r
102         addiu   $24, $0, 0x124\r
103         addiu   $25, $0, 0x125\r
104         addiu   $30, $0, 0x130\r
105         addiu   $22, $0, 0x131\r
106 \r
107 vRegTest1Loop:\r
108         portREG_TEST    $22, $1, 0x11\r
109         portREG_TEST    $22, $2, 0x12\r
110         portREG_TEST    $22, $3, 0x13\r
111         portREG_TEST    $22, $5, 0x15\r
112         portREG_TEST    $22, $6, 0x16\r
113         portREG_TEST    $22, $7, 0x17\r
114         portREG_TEST    $22, $8, 0x18\r
115         portREG_TEST    $22, $9, 0x19\r
116         portREG_TEST    $22, $10, 0x110\r
117         portREG_TEST    $22, $11, 0x111\r
118         portREG_TEST    $22, $12, 0x112\r
119         portREG_TEST    $22, $13, 0x113\r
120         portREG_TEST    $22, $14, 0x114\r
121         portREG_TEST    $22, $15, 0x115\r
122         portREG_TEST    $22, $16, 0x116\r
123         portREG_TEST    $22, $17, 0x117\r
124         portREG_TEST    $22, $18, 0x118\r
125         portREG_TEST    $22, $19, 0x119\r
126         portREG_TEST    $22, $20, 0x120\r
127         portREG_TEST    $22, $21, 0x121\r
128         portREG_TEST    $22, $23, 0x123\r
129         portREG_TEST    $22, $24, 0x124\r
130         portREG_TEST    $22, $25, 0x125\r
131         portREG_TEST    $22, $30, 0x130\r
132 \r
133         /* No errors detected.  Increment the loop count so the check timer knows\r
134         this task is still running without error, then loop back to do it all\r
135         again.  The address of the loop counter is in $4. */\r
136         lw              $22, 0( $4 )\r
137         addiu   $22, $22, 0x01\r
138         sw              $22, 0( $4 )\r
139         b               vRegTest1Loop\r
140         nop\r
141 \r
142         .end    vRegTest1\r
143 \r
144 \r
145         .set    micromips\r
146         .set    noreorder\r
147         .set    noat\r
148         .ent    vRegTest2\r
149 \r
150 vRegTest2:\r
151         addiu   $1, $0, 0x21\r
152         addiu   $2, $0, 0x22\r
153         addiu   $3, $0, 0x23\r
154         /* $4 contains the address of the loop counter - don't mess with $4. */\r
155         addiu   $5, $0, 0x25\r
156         addiu   $6, $0, 0x26\r
157         addiu   $7, $0, 0x27\r
158         addiu   $8, $0, 0x28\r
159         addiu   $9, $0, 0x29\r
160         addiu   $10, $0, 0x210\r
161         addiu   $11, $0, 0x211\r
162         addiu   $12, $0, 0x212\r
163         addiu   $13, $0, 0x213\r
164         addiu   $14, $0, 0x214\r
165         addiu   $15, $0, 0x215\r
166         addiu   $16, $0, 0x216\r
167         addiu   $17, $0, 0x217\r
168         addiu   $18, $0, 0x218\r
169         addiu   $19, $0, 0x219\r
170         addiu   $20, $0, 0x220\r
171         addiu   $21, $0, 0x221\r
172         addiu   $23, $0, 0x223\r
173         addiu   $24, $0, 0x224\r
174         addiu   $25, $0, 0x225\r
175         addiu   $30, $0, 0x230\r
176         addiu   $22, $0, 0x231\r
177 \r
178 vRegTest2Loop:\r
179         portREG_TEST    $22, $1, 0x21\r
180         portREG_TEST    $22, $2, 0x22\r
181         portREG_TEST    $22, $3, 0x23\r
182         portREG_TEST    $22, $5, 0x25\r
183         portREG_TEST    $22, $6, 0x26\r
184         portREG_TEST    $22, $7, 0x27\r
185         portREG_TEST    $22, $8, 0x28\r
186         portREG_TEST    $22, $9, 0x29\r
187         portREG_TEST    $22, $10, 0x210\r
188         portREG_TEST    $22, $11, 0x211\r
189         portREG_TEST    $22, $12, 0x212\r
190         portREG_TEST    $22, $13, 0x213\r
191         portREG_TEST    $22, $14, 0x214\r
192         portREG_TEST    $22, $15, 0x215\r
193         portREG_TEST    $22, $16, 0x216\r
194         portREG_TEST    $22, $17, 0x217\r
195         portREG_TEST    $22, $18, 0x218\r
196         portREG_TEST    $22, $19, 0x219\r
197         portREG_TEST    $22, $20, 0x220\r
198         portREG_TEST    $22, $21, 0x221\r
199         portREG_TEST    $22, $23, 0x223\r
200         portREG_TEST    $22, $24, 0x224\r
201         portREG_TEST    $22, $25, 0x225\r
202         portREG_TEST    $22, $30, 0x230\r
203 \r
204         /* No errors detected.  Increment the loop count so the check timer knows\r
205         this task is still running without error, then loop back to do it all\r
206         again.  The address of the loop counter is in $4. */\r
207         lw              $22, 0( $4 )\r
208         addiu   $22, $22, 0x01\r
209         sw              $22, 0( $4 )\r
210         b               vRegTest2Loop\r
211         nop\r
212 \r
213         .end    vRegTest2\r
214 \r
215 \r
216 \r