]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RL78_multiple_IAR/RegTest.s87
Update version number in readiness for V10.3.0 release. Sync SVN with reviewed releas...
[freertos] / FreeRTOS / Demo / RL78_multiple_IAR / RegTest.s87
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 \r
29 ;\r
30 ; This file defines the RegTest tasks as described at the top of main.c\r
31 ;\r
32 \r
33 ;------------------------------------------------------------------------------\r
34 \r
35 \r
36 ; Functions implemented in this file\r
37 ;------------------------------------------------------------------------------\r
38 \r
39         PUBLIC    vRegTest1Task\r
40         PUBLIC    vRegTest2Task\r
41 \r
42 ; Functions and variables used by this file\r
43 ;------------------------------------------------------------------------------\r
44         EXTERN    vRegTestError\r
45         EXTERN    usRegTest1LoopCounter\r
46         EXTERN    usRegTest2LoopCounter\r
47 \r
48 ;------------------------------------------------------------------------------\r
49 ;   Fill all the registers with known values, then check that the registers\r
50 ;   contain the expected value.  An incorrect value being indicative of an\r
51 ;   error in the context switch mechanism.\r
52 ;\r
53 ;   Input:  NONE\r
54 ;\r
55 ;   Call:   Created as a task.\r
56 ;\r
57 ;   Output: NONE\r
58 ;\r
59 ;------------------------------------------------------------------------------\r
60     RSEG CODE:CODE\r
61 vRegTest1Task:\r
62 \r
63         ; First fill the registers.\r
64         MOVW    AX, #0x1122\r
65         MOVW    BC, #0x3344\r
66         MOVW    DE, #0x5566\r
67         MOVW    HL, #0x7788\r
68         MOV             CS, #0x01\r
69 \r
70 #if __DATA_MODEL__ == __DATA_MODEL_FAR__\r
71 \r
72         ; ES is not saved or restored when using the near memory model so only\r
73         ; test it when using the far model.\r
74         MOV             ES, #0x02\r
75 \r
76 #endif\r
77 \r
78 loop1:\r
79 \r
80         ; Continuously check that the register values remain at their expected\r
81         ; values.  The BRK is to test the yield.  This task runs at low priority\r
82         ; so will also regularly get preempted.\r
83         BRK\r
84 \r
85         ; Compare with the expected value.\r
86         CMPW    AX, #0x1122\r
87         SKZ\r
88 \r
89         ; Jump over the branch to vRegTestError() if the register contained the\r
90         ; expected value - otherwise flag an error by executing vRegTestError().\r
91         BR              vRegTestError\r
92 \r
93         ; Repeat for all the registers.\r
94         MOVW    AX, BC\r
95         CMPW    AX, #0x3344\r
96         SKZ\r
97         BR              vRegTestError\r
98         MOVW    AX, DE\r
99         CMPW    AX, #0x5566\r
100         SKZ\r
101         BR              vRegTestError\r
102         MOVW    AX, HL\r
103         CMPW    AX, #0x7788\r
104         SKZ\r
105         BR              vRegTestError\r
106         MOV             A, CS\r
107         CMP             A, #0x01\r
108         SKZ\r
109         BR              vRegTestError\r
110 \r
111 #if __DATA_MODEL__ == __DATA_MODEL_FAR__\r
112 \r
113         ; ES is not saved or restored when using the near memory model so only\r
114         ; test it when using the far model.\r
115         MOV             A, ES\r
116         CMP             A, #0x02\r
117         SKZ\r
118         BR              vRegTestError\r
119 \r
120 #endif\r
121 \r
122         ; Indicate that this task is still cycling.\r
123         INCW    usRegTest1LoopCounter\r
124 \r
125         MOVW    AX, #0x1122\r
126         BR              loop1\r
127 \r
128 \r
129 ;------------------------------------------------------------------------------\r
130 ;   Fill all the registers with known values, then check that the registers\r
131 ;   contain the expected value.  An incorrect value being indicative of an\r
132 ;   error in the context switch mechanism.\r
133 ;\r
134 ;   Input:  NONE\r
135 ;\r
136 ;   Call:   Created as a task.\r
137 ;\r
138 ;   Output: NONE\r
139 ;\r
140 ;------------------------------------------------------------------------------\r
141     RSEG CODE:CODE\r
142 vRegTest2Task:\r
143 \r
144         MOVW    AX, #0x99aa\r
145         MOVW    BC, #0xbbcc\r
146         MOVW    DE, #0xddee\r
147         MOVW    HL, #0xff12\r
148         MOV             CS, #0x03\r
149 \r
150 #if __DATA_MODEL__ == __DATA_MODEL_FAR__\r
151 \r
152         MOV             ES, #0x04\r
153 \r
154 #endif\r
155 \r
156 loop2:\r
157         CMPW    AX, #0x99aa\r
158         SKZ\r
159         BR              vRegTestError\r
160         MOVW    AX, BC\r
161         CMPW    AX, #0xbbcc\r
162         SKZ\r
163         BR              vRegTestError\r
164         MOVW    AX, DE\r
165         CMPW    AX, #0xddee\r
166         SKZ\r
167         BR              vRegTestError\r
168         MOVW    AX, HL\r
169         CMPW    AX, #0xff12\r
170         SKZ\r
171         BR              vRegTestError\r
172         MOV             A, CS\r
173         CMP             A, #0x03\r
174         SKZ\r
175         BR              vRegTestError\r
176 \r
177 #if __DATA_MODEL__ == __DATA_MODEL_FAR__\r
178 \r
179         MOV             A, ES\r
180         CMP             A, #0x04\r
181         SKZ\r
182         BR              vRegTestError\r
183 \r
184 #endif\r
185 \r
186         ; Indicate that this task is still cycling.\r
187         INCW    usRegTest2LoopCounter\r
188 \r
189         MOVW    AX, #0x99aa\r
190         BR              loop2\r
191 \r
192 \r
193         END\r