]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RL78_multiple_IAR/RegTest.s87
Update version number ready for V8.2.1 release.
[freertos] / FreeRTOS / Demo / RL78_multiple_IAR / RegTest.s87
1 ;/*\r
2 ;    FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
3 ;\r
4 ;\r
5 ;    ***************************************************************************\r
6 ;     *                                                                       *\r
7 ;     *    FreeRTOS tutorial books are available in pdf and paperback.        *\r
8 ;     *    Complete, revised, and edited pdf reference manuals are also       *\r
9 ;     *    available.                                                         *\r
10 ;     *                                                                       *\r
11 ;     *    Purchasing FreeRTOS documentation will not only help you, by       *\r
12 ;     *    ensuring you get running as quickly as possible and with an        *\r
13 ;     *    in-depth knowledge of how to use FreeRTOS, it will also help       *\r
14 ;     *    the FreeRTOS project to continue with its mission of providing     *\r
15 ;     *    professional grade, cross platform, de facto standard solutions    *\r
16 ;     *    for microcontrollers - completely free of charge!                  *\r
17 ;     *                                                                       *\r
18 ;     *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *\r
19 ;     *                                                                       *\r
20 ;     *    Thank you for using FreeRTOS, and thank you for your support!      *\r
21 ;     *                                                                       *\r
22 ;    ***************************************************************************\r
23 ;\r
24 ;\r
25 ;    This file is part of the FreeRTOS distribution.\r
26 ;\r
27 ;    FreeRTOS is free software; you can redistribute it and/or modify it under\r
28 ;    the terms of the GNU General Public License (version 2) as published by the\r
29 ;    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
30 ;    >>>NOTE<<< The modification to the GPL is included to allow you to\r
31 ;    distribute a combined work that includes FreeRTOS without being obliged to\r
32 ;    provide the source code for proprietary components outside of the FreeRTOS\r
33 ;    kernel.  FreeRTOS is distributed in the hope that it will be useful, but\r
34 ;    WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
35 ;    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
36 ;    more details. You should have received a copy of the GNU General Public\r
37 ;    License and the FreeRTOS license exception along with FreeRTOS; if not it\r
38 ;    can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
39 ;    by writing to Richard Barry, contact details for whom are available on the\r
40 ;    FreeRTOS WEB site.\r
41 ;\r
42 ;    1 tab == 4 spaces!\r
43 ;\r
44 ;    http://www.FreeRTOS.org - Documentation, latest information, license and\r
45 ;    contact details.\r
46 ;\r
47 ;    http://www.SafeRTOS.com - A version that is certified for use in safety\r
48 ;    critical systems.\r
49 ;\r
50 ;    http://www.OpenRTOS.com - Commercial support, development, porting,\r
51 ;    licensing and training services.\r
52 ;*/\r
53 \r
54 \r
55 ;\r
56 ; This file defines the RegTest tasks as described at the top of main.c\r
57 ;\r
58 \r
59 ;------------------------------------------------------------------------------\r
60 \r
61 \r
62 ; Functions implemented in this file\r
63 ;------------------------------------------------------------------------------\r
64 \r
65         PUBLIC    vRegTest1Task\r
66         PUBLIC    vRegTest2Task\r
67 \r
68 ; Functions and variables used by this file\r
69 ;------------------------------------------------------------------------------\r
70         EXTERN    vRegTestError\r
71         EXTERN    usRegTest1LoopCounter\r
72         EXTERN    usRegTest2LoopCounter\r
73 \r
74 ;------------------------------------------------------------------------------\r
75 ;   Fill all the registers with known values, then check that the registers\r
76 ;   contain the expected value.  An incorrect value being indicative of an\r
77 ;   error in the context switch mechanism.\r
78 ;\r
79 ;   Input:  NONE\r
80 ;\r
81 ;   Call:   Created as a task.\r
82 ;\r
83 ;   Output: NONE\r
84 ;\r
85 ;------------------------------------------------------------------------------\r
86     RSEG CODE:CODE\r
87 vRegTest1Task:\r
88 \r
89         ; First fill the registers.\r
90         MOVW    AX, #0x1122\r
91         MOVW    BC, #0x3344\r
92         MOVW    DE, #0x5566\r
93         MOVW    HL, #0x7788\r
94         MOV             CS, #0x01\r
95 \r
96 #if __DATA_MODEL__ == __DATA_MODEL_FAR__\r
97 \r
98         ; ES is not saved or restored when using the near memory model so only\r
99         ; test it when using the far model.\r
100         MOV             ES, #0x02\r
101 \r
102 #endif\r
103 \r
104 loop1:\r
105 \r
106         ; Continuously check that the register values remain at their expected\r
107         ; values.  The BRK is to test the yield.  This task runs at low priority\r
108         ; so will also regularly get preempted.\r
109         BRK\r
110 \r
111         ; Compare with the expected value.\r
112         CMPW    AX, #0x1122\r
113         SKZ\r
114 \r
115         ; Jump over the branch to vRegTestError() if the register contained the\r
116         ; expected value - otherwise flag an error by executing vRegTestError().\r
117         BR              vRegTestError\r
118 \r
119         ; Repeat for all the registers.\r
120         MOVW    AX, BC\r
121         CMPW    AX, #0x3344\r
122         SKZ\r
123         BR              vRegTestError\r
124         MOVW    AX, DE\r
125         CMPW    AX, #0x5566\r
126         SKZ\r
127         BR              vRegTestError\r
128         MOVW    AX, HL\r
129         CMPW    AX, #0x7788\r
130         SKZ\r
131         BR              vRegTestError\r
132         MOV             A, CS\r
133         CMP             A, #0x01\r
134         SKZ\r
135         BR              vRegTestError\r
136 \r
137 #if __DATA_MODEL__ == __DATA_MODEL_FAR__\r
138 \r
139         ; ES is not saved or restored when using the near memory model so only\r
140         ; test it when using the far model.\r
141         MOV             A, ES\r
142         CMP             A, #0x02\r
143         SKZ\r
144         BR              vRegTestError\r
145 \r
146 #endif\r
147 \r
148         ; Indicate that this task is still cycling.\r
149         INCW    usRegTest1LoopCounter\r
150 \r
151         MOVW    AX, #0x1122\r
152         BR              loop1\r
153 \r
154 \r
155 ;------------------------------------------------------------------------------\r
156 ;   Fill all the registers with known values, then check that the registers\r
157 ;   contain the expected value.  An incorrect value being indicative of an\r
158 ;   error in the context switch mechanism.\r
159 ;\r
160 ;   Input:  NONE\r
161 ;\r
162 ;   Call:   Created as a task.\r
163 ;\r
164 ;   Output: NONE\r
165 ;\r
166 ;------------------------------------------------------------------------------\r
167     RSEG CODE:CODE\r
168 vRegTest2Task:\r
169 \r
170         MOVW    AX, #0x99aa\r
171         MOVW    BC, #0xbbcc\r
172         MOVW    DE, #0xddee\r
173         MOVW    HL, #0xff12\r
174         MOV             CS, #0x03\r
175 \r
176 #if __DATA_MODEL__ == __DATA_MODEL_FAR__\r
177 \r
178         MOV             ES, #0x04\r
179 \r
180 #endif\r
181 \r
182 loop2:\r
183         CMPW    AX, #0x99aa\r
184         SKZ\r
185         BR              vRegTestError\r
186         MOVW    AX, BC\r
187         CMPW    AX, #0xbbcc\r
188         SKZ\r
189         BR              vRegTestError\r
190         MOVW    AX, DE\r
191         CMPW    AX, #0xddee\r
192         SKZ\r
193         BR              vRegTestError\r
194         MOVW    AX, HL\r
195         CMPW    AX, #0xff12\r
196         SKZ\r
197         BR              vRegTestError\r
198         MOV             A, CS\r
199         CMP             A, #0x03\r
200         SKZ\r
201         BR              vRegTestError\r
202 \r
203 #if __DATA_MODEL__ == __DATA_MODEL_FAR__\r
204 \r
205         MOV             A, ES\r
206         CMP             A, #0x04\r
207         SKZ\r
208         BR              vRegTestError\r
209 \r
210 #endif\r
211 \r
212         ; Indicate that this task is still cycling.\r
213         INCW    usRegTest2LoopCounter\r
214 \r
215         MOVW    AX, #0x99aa\r
216         BR              loop2\r
217 \r
218 \r
219         END\r