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