]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/Tensilica_Simulator_Xplorer_XCC/regtest_xtensa.S
Update version number in readiness for V10.3.0 release. Sync SVN with reviewed releas...
[freertos] / FreeRTOS / Demo / Tensilica_Simulator_Xplorer_XCC / regtest_xtensa.S
1 /*\r
2  * FreeRTOS Kernel V10.3.0\r
3  * Copyright (C) 2020 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.\r
14  *\r
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
21  *\r
22  * http://www.FreeRTOS.org\r
23  * http://aws.amazon.com/freertos\r
24  *\r
25  * 1 tab == 4 spaces!\r
26  */\r
27 \r
28 #include "FreeRTOSConfig.h"\r
29 //#include "ISR_Support.h"\r
30 \r
31         .extern ulRegTest1Counter\r
32         .extern ulRegTest2Counter\r
33         .extern vPortYield\r
34         \r
35         .global vRegTest1\r
36         .global vRegTest2\r
37 \r
38         .text\r
39         .align 4\r
40 \r
41 \r
42 /*-----------------------------------------------------------*/\r
43 \r
44 vRegTest1:\r
45 \r
46         /* Set initial values into the general purpose registers.\r
47          * a0 = return address, a1 = stack pointer. */\r
48 #ifdef __XTENSA_WINDOWED_ABI__\r
49         entry   a1, 64\r
50         s32i    a0, a1, 0               /* Save return address. */\r
51 #else\r
52         addi    a1, a1, -64\r
53         s32i    a0, a1, 0               /* Save return address. */\r
54         s32i    a12, a1, 4              /* Save callee-saved regs if call0 ABI. */\r
55         s32i    a13, a1, 8\r
56         s32i    a14, a1, 12\r
57         s32i    a15, a1, 16\r
58 #endif\r
59         movi    a2, 0x11111111\r
60         movi    a3, 0x22222222\r
61         movi    a4, 0x33333333\r
62         movi    a5, 0x44444444\r
63         movi    a6, 0x55555555\r
64         movi    a7, 0x66666666\r
65         movi    a8, 0x77777777\r
66         movi    a9, 0x88888888\r
67         movi    a10, 0x99999999\r
68         movi    a11, 0xaaaaaaaa\r
69         movi    a12, 0xbbbbbbbb\r
70         movi    a13, 0xcccccccc\r
71         movi    a14, 0xdddddddd\r
72         movi    a15, 0xeeeeeeee\r
73 \r
74 _RegTest1Loop:\r
75 \r
76         /* Loop checking the values originally loaded into the general purpose\r
77          * registers remain through the life of the task. */\r
78         movi    a0, 0x11111111\r
79         bne             a0, a2, _RegTest1Error\r
80         movi    a0, 0x22222222\r
81         bne             a0, a3, _RegTest1Error\r
82         movi    a0, 0x33333333\r
83         bne             a0, a4, _RegTest1Error\r
84         movi    a0, 0x44444444\r
85         bne             a0, a5, _RegTest1Error\r
86         movi    a0, 0x55555555\r
87         bne             a0, a6, _RegTest1Error\r
88         movi    a0, 0x66666666\r
89         bne             a0, a7, _RegTest1Error\r
90         movi    a0, 0x77777777\r
91         bne             a0, a8, _RegTest1Error\r
92         movi    a0, 0x88888888\r
93         bne             a0, a9, _RegTest1Error\r
94         movi    a0, 0x99999999\r
95         bne             a0, a10, _RegTest1Error\r
96         movi    a0, 0xaaaaaaaa\r
97         bne             a0, a11, _RegTest1Error\r
98         movi    a0, 0xbbbbbbbb\r
99         bne             a0, a12, _RegTest1Error\r
100         movi    a0, 0xcccccccc\r
101         bne             a0, a13, _RegTest1Error\r
102         movi    a0, 0xdddddddd\r
103         bne             a0, a14, _RegTest1Error\r
104         movi    a0, 0xeeeeeeee\r
105         bne             a0, a15, _RegTest1Error\r
106 \r
107         /* Incrememnt the loop counter to prove this task has not gone into the\r
108          * error null loop. */\r
109         s32i    a2, a1, 20\r
110         movi    a2, ulRegTest1Counter\r
111         l32i    a0, a2, 0\r
112         addi    a0, a0, 1\r
113         s32i    a0, a2, 0\r
114         l32i    a2, a1, 20\r
115 \r
116         /* Loop again. */\r
117         j               _RegTest1Loop\r
118 \r
119 _RegTest1Error:\r
120 .L1:\r
121         j               .L1\r
122 \r
123 \r
124         .align 4\r
125 \r
126 /*-----------------------------------------------------------*/\r
127 \r
128 vRegTest2:\r
129 \r
130         /* Set initial values into the general purpose registers.\r
131          * a0 = return address, a1 = stack pointer. */\r
132 #ifdef __XTENSA_WINDOWED_ABI__\r
133         entry   a1, 64\r
134         s32i    a0, a1, 0               /* Save return address. */\r
135 #else\r
136         addi    a1, a1, -64\r
137         s32i    a0, a1, 0               /* Save return address. */\r
138         s32i    a12, a1, 4              /* Save callee-saved regs if call0 ABI. */\r
139         s32i    a13, a1, 8\r
140         s32i    a14, a1, 12\r
141         s32i    a15, a1, 16\r
142 #endif\r
143 \r
144 _ReInit:\r
145 \r
146         movi    a2, 0x01010101\r
147         movi    a3, 0x02020202\r
148         movi    a4, 0x03030303\r
149         movi    a5, 0x04040404\r
150         movi    a6, 0x05050505\r
151         movi    a7, 0x06060606\r
152         movi    a8, 0x07070707\r
153         movi    a9, 0x08080808\r
154         movi    a10, 0x09090909\r
155         movi    a11, 0x0a0a0a0a\r
156         movi    a12, 0x0b0b0b0b\r
157         movi    a13, 0x0c0c0c0c\r
158         movi    a14, 0x0d0d0d0d\r
159         movi    a15, 0x0e0e0e0e\r
160 \r
161 _RegTest2Loop:\r
162 \r
163         /* Loop checking the values originally loaded into the general purpose\r
164          * registers remain through the life of the task. */\r
165         movi    a0, 0x01010101\r
166         bne             a0, a2, _RegTest1Error\r
167         movi    a0, 0x02020202\r
168         bne             a0, a3, _RegTest1Error\r
169         movi    a0, 0x03030303\r
170         bne             a0, a4, _RegTest1Error\r
171         movi    a0, 0x04040404\r
172         bne             a0, a5, _RegTest1Error\r
173         movi    a0, 0x05050505\r
174         bne             a0, a6, _RegTest1Error\r
175         movi    a0, 0x06060606\r
176         bne             a0, a7, _RegTest1Error\r
177         movi    a0, 0x07070707\r
178         bne             a0, a8, _RegTest1Error\r
179         movi    a0, 0x08080808\r
180         bne             a0, a9, _RegTest1Error\r
181         movi    a0, 0x09090909\r
182         bne             a0, a10, _RegTest1Error\r
183         movi    a0, 0x0a0a0a0a\r
184         bne             a0, a11, _RegTest1Error\r
185         movi    a0, 0x0b0b0b0b\r
186         bne             a0, a12, _RegTest1Error\r
187         movi    a0, 0x0c0c0c0c\r
188         bne             a0, a13, _RegTest1Error\r
189         movi    a0, 0x0d0d0d0d\r
190         bne             a0, a14, _RegTest1Error\r
191         movi    a0, 0x0e0e0e0e\r
192         bne             a0, a15, _RegTest1Error\r
193 \r
194         /* Force a yield from one of the reg test tasks to increase coverage.\r
195          * IMPORTANT: this call will trash some number of registers. Branch\r
196          * to _ReInit to set things up again. */\r
197 #ifdef __XTENSA_WINDOWED_ABI__\r
198         call8   vPortYield\r
199 #else\r
200         call0   vPortYield\r
201 #endif\r
202 \r
203         /* Increment the loop counter to prove this task has not gone into the\r
204          * error null loop. */\r
205         s32i    a2, a1, 20\r
206         movi    a2, ulRegTest2Counter\r
207         l32i    a0, a2, 0\r
208         addi    a0, a0, 1\r
209         s32i    a0, a2, 0\r
210         l32i    a2, a1, 20\r
211 \r
212         /* Loop again. */\r
213         j               _ReInit                 /* See comments above about not using  j _RegTest2Loop.  */\r
214 \r
215 _RegTest2Error:\r
216 .L2:\r
217         j               .L2\r