]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RX100_RX113-RSK_GCC_e2studio_IAR/src/Full_Demo/RegTest_IAR.s
382cfe5da7103e7437a406011599228c76f9562b
[freertos] / FreeRTOS / Demo / RX100_RX113-RSK_GCC_e2studio_IAR / src / Full_Demo / RegTest_IAR.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         PUBLIC _vRegTest1Implementation\r
29         PUBLIC _vRegTest2Implementation\r
30 \r
31         EXTERN _ulRegTest1LoopCounter\r
32         EXTERN _ulRegTest2LoopCounter\r
33 \r
34         RSEG CODE:CODE(4)\r
35 \r
36 _vRegTest1Implementation:\r
37 \r
38                 /* Set each register to a known value. */\r
39                 MOV.L   #0x33333333, R15\r
40                 MVTACHI R15\r
41                 MOV.L   #0x44444444, R15\r
42                 MVTACLO R15\r
43                 MOV.L   #1, R1\r
44                 MOV.L   #2, R2\r
45                 MOV.L   #3, R3\r
46                 MOV.L   #4, R4\r
47                 MOV.L   #5, R5\r
48                 MOV.L   #6, R6\r
49                 MOV.L   #7, R7\r
50                 MOV.L   #8, R8\r
51                 MOV.L   #9, R9\r
52                 MOV.L   #10, R10\r
53                 MOV.L   #11, R11\r
54                 MOV.L   #12, R12\r
55                 MOV.L   #13, R13\r
56                 MOV.L   #14, R14\r
57                 MOV.L   #15, R15\r
58 \r
59         /* Loop, checking each iteration that each register still contains the\r
60         expected value. */\r
61         TestLoop1:\r
62 \r
63                 /* Push the registers that are going to get clobbered. */\r
64                 PUSHM   R14-R15\r
65 \r
66                 /* Increment the loop counter to show this task is still getting CPU\r
67                 time. */\r
68                 MOV.L   #_ulRegTest1LoopCounter, R14\r
69                 MOV.L   [ R14 ], R15\r
70                 ADD             #1, R15\r
71                 MOV.L   R15, [ R14 ]\r
72 \r
73                 /* Yield to extend the text coverage.  Set the bit in the ITU SWINTR\r
74                 register. */\r
75                 MOV.L   #1, R14\r
76                 MOV.L   #0872E0H, R15\r
77                 MOV.B   R14, [R15]\r
78                 NOP\r
79                 NOP\r
80 \r
81                 /* Check the accumulator value. */\r
82                 MVFACHI R15\r
83                 CMP             #0x33333333, R15\r
84                 BNE             RegTest2Error\r
85                 MVFACMI R15\r
86                 CMP             #0x33334444, R15\r
87                 BNE             RegTest2Error\r
88 \r
89                 /* Restore the clobbered registers. */\r
90                 POPM    R14-R15\r
91 \r
92                 /* Now compare each register to ensure it still contains the value that\r
93                 was set before this loop was entered. */\r
94                 CMP             #1, R1\r
95                 BNE             RegTest1Error\r
96                 CMP             #2, R2\r
97                 BNE             RegTest1Error\r
98                 CMP             #3, R3\r
99                 BNE             RegTest1Error\r
100                 CMP             #4, R4\r
101                 BNE             RegTest1Error\r
102                 CMP             #5, R5\r
103                 BNE             RegTest1Error\r
104                 CMP             #6, R6\r
105                 BNE             RegTest1Error\r
106                 CMP             #7, R7\r
107                 BNE             RegTest1Error\r
108                 CMP             #8, R8\r
109                 BNE             RegTest1Error\r
110                 CMP             #9, R9\r
111                 BNE             RegTest1Error\r
112                 CMP             #10, R10\r
113                 BNE             RegTest1Error\r
114                 CMP             #11, R11\r
115                 BNE             RegTest1Error\r
116                 CMP             #12, R12\r
117                 BNE             RegTest1Error\r
118                 CMP             #13, R13\r
119                 BNE             RegTest1Error\r
120                 CMP             #14, R14\r
121                 BNE             RegTest1Error\r
122                 CMP             #15, R15\r
123                 BNE             RegTest1Error\r
124 \r
125                 /* All comparisons passed, start a new iteration of this loop. */\r
126                 BRA             TestLoop1\r
127 \r
128         /* A compare failed, just loop here so the loop counter stops\r
129         incrementing causing the check timer to indicate the error. */\r
130         RegTest1Error:\r
131                 BRA RegTest1Error\r
132 \r
133 /*-----------------------------------------------------------*/\r
134 \r
135 _vRegTest2Implementation:\r
136 \r
137                 /* Set each register to a known value. */\r
138                 MOV.L   #0x11111111, R15\r
139                 MVTACHI R15\r
140                 MOV.L   #0x22222222, R15\r
141                 MVTACLO R15\r
142                 MOV.L   #100, R1\r
143                 MOV.L   #200, R2\r
144                 MOV.L   #300, R3\r
145                 MOV.L   #400, R4\r
146                 MOV.L   #500, R5\r
147                 MOV.L   #600, R6\r
148                 MOV.L   #700, R7\r
149                 MOV.L   #800, R8\r
150                 MOV.L   #900, R9\r
151                 MOV.L   #1000, R10\r
152                 MOV.L   #1001, R11\r
153                 MOV.L   #1002, R12\r
154                 MOV.L   #1003, R13\r
155                 MOV.L   #1004, R14\r
156                 MOV.L   #1005, R15\r
157 \r
158         /* Loop, checking each iteration that each register still contains the\r
159         expected value. */\r
160         TestLoop2:\r
161 \r
162                 /* Push the registers that are going to get clobbered. */\r
163                 PUSHM   R14-R15\r
164 \r
165                 /* Increment the loop counter to show this task is still getting CPU\r
166                 time. */\r
167                 MOV.L   #_ulRegTest2LoopCounter, R14\r
168                 MOV.L   [ R14 ], R15\r
169                 ADD             #1, R15\r
170                 MOV.L   R15, [ R14 ]\r
171 \r
172                 /* Check the accumulator value. */\r
173                 MVFACHI R15\r
174                 CMP             #0x11111111, R15\r
175                 BNE             RegTest2Error\r
176                 MVFACMI R15\r
177                 CMP             #0x11112222, R15\r
178                 BNE             RegTest2Error\r
179 \r
180                 /* Restore the clobbered registers. */\r
181                 POPM    R14-R15\r
182 \r
183                 /* Now compare each register to ensure it still contains the value that\r
184                 was set before this loop was entered. */\r
185                 CMP             #100, R1\r
186                 BNE             RegTest2Error\r
187                 CMP             #200, R2\r
188                 BNE             RegTest2Error\r
189                 CMP             #300, R3\r
190                 BNE             RegTest2Error\r
191                 CMP             #400, R4\r
192                 BNE             RegTest2Error\r
193                 CMP             #500, R5\r
194                 BNE             RegTest2Error\r
195                 CMP             #600, R6\r
196                 BNE             RegTest2Error\r
197                 CMP             #700, R7\r
198                 BNE             RegTest2Error\r
199                 CMP             #800, R8\r
200                 BNE             RegTest2Error\r
201                 CMP             #900, R9\r
202                 BNE             RegTest2Error\r
203                 CMP             #1000, R10\r
204                 BNE             RegTest2Error\r
205                 CMP             #1001, R11\r
206                 BNE             RegTest2Error\r
207                 CMP             #1002, R12\r
208                 BNE             RegTest2Error\r
209                 CMP             #1003, R13\r
210                 BNE             RegTest2Error\r
211                 CMP             #1004, R14\r
212                 BNE             RegTest2Error\r
213                 CMP             #1005, R15\r
214                 BNE             RegTest2Error\r
215 \r
216                 /* All comparisons passed, start a new iteration of this loop. */\r
217                 BRA             TestLoop2\r
218 \r
219         /* A compare failed, just loop here so the loop counter stops\r
220         incrementing causing the check timer to indicate the error. */\r
221         RegTest2Error:\r
222                 BRA RegTest2Error\r
223 \r
224 /*-----------------------------------------------------------*/\r
225 \r
226                 END\r
227 \r