]> git.sur5r.net Git - freertos/blob - Demo/NEC_78K0R_IAR/RegTest.s26
Update to V6.0.2.
[freertos] / Demo / NEC_78K0R_IAR / RegTest.s26
1 ;/*\r
2 ;    FreeRTOS V6.0.2 - Copyright (C) 2010 Real Time Engineers Ltd.\r
3 ;\r
4 ;    ***************************************************************************\r
5 ;    *                                                                         *\r
6 ;    * If you are:                                                             *\r
7 ;    *                                                                         *\r
8 ;    *    + New to FreeRTOS,                                                   *\r
9 ;    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *\r
10 ;    *    + Looking for basic training,                                        *\r
11 ;    *    + Wanting to improve your FreeRTOS skills and productivity           *\r
12 ;    *                                                                         *\r
13 ;    * then take a look at the FreeRTOS eBook                                  *\r
14 ;    *                                                                         *\r
15 ;    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *\r
16 ;    *                  http://www.FreeRTOS.org/Documentation                  *\r
17 ;    *                                                                         *\r
18 ;    * A pdf reference manual is also available.  Both are usually delivered   *\r
19 ;    * to your inbox within 20 minutes to two hours when purchased between 8am *\r
20 ;    * and 8pm GMT (although please allow up to 24 hours in case of            *\r
21 ;    * exceptional circumstances).  Thank you for your support!                *\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 exception to the GPL is included to allow you to distribute\r
31 ;    a combined work that includes FreeRTOS without being obliged to provide the\r
32 ;    source code for proprietary components outside of the FreeRTOS kernel.\r
33 ;    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
34 ;    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
35 ;    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 #if __CORE__ != __78K0R__\r
62         #error "This file is only for 78K0R Devices"\r
63 #endif\r
64 \r
65 ; Functions implemented in this file\r
66 ;------------------------------------------------------------------------------\r
67 \r
68         PUBLIC    vRegTest1\r
69         PUBLIC    vRegTest2\r
70 \r
71 ; Functions used by this file\r
72 ;------------------------------------------------------------------------------\r
73         EXTERN    vRegTestError\r
74 \r
75 ;------------------------------------------------------------------------------\r
76 ;   Fill all the registers with known values, then check that the registers\r
77 ;   contain the expected value.  An incorrect value being indicative of an\r
78 ;   error in the context switch mechanism.\r
79 ;\r
80 ;   Input:  NONE\r
81 ;\r
82 ;   Call:   Created as a task.\r
83 ;\r
84 ;   Output: NONE\r
85 ;\r
86 ;------------------------------------------------------------------------------\r
87     RSEG CODE:CODE\r
88 vRegTest1:\r
89 \r
90         ; First fill the registers.\r
91         MOVW    AX, #0x1122\r
92         MOVW    BC, #0x3344\r
93         MOVW    DE, #0x5566\r
94         MOVW    HL, #0x7788\r
95         MOV             CS, #0x01\r
96 #if configMEMORY_MODE == 1      \r
97         ; ES is not saved or restored when using the near memory model so only\r
98         ; test it when using the far model.\r
99         MOV             ES, #0x02\r
100 #endif\r
101 \r
102 loop1:\r
103         ; Continuously check that the register values remain at their expected\r
104         ; values.  The BRK is to test the yield.  This task runs at low priority\r
105         ; so will also regularly get preempted.\r
106         BRK\r
107 \r
108         ; Compare with the expected value.\r
109         CMPW    AX, #0x1122\r
110         BZ              +5\r
111         ; Jump over the branch to vRegTestError() if the register contained the\r
112         ; expected value - otherwise flag an error by executing vRegTestError().\r
113         BR              vRegTestError   \r
114 \r
115         ; Repeat for all the registers.\r
116         MOVW    AX, BC\r
117         CMPW    AX, #0x3344\r
118         BZ              +5\r
119         BR              vRegTestError   \r
120         MOVW    AX, DE\r
121         CMPW    AX, #0x5566\r
122         BZ              +5\r
123         BR              vRegTestError   \r
124         MOVW    AX, HL  \r
125         CMPW    AX, #0x7788\r
126         BZ              +5\r
127         BR              vRegTestError\r
128         MOV             A, CS\r
129         CMP             A, #0x01\r
130         BZ              +5\r
131         BR              vRegTestError\r
132 #if configMEMORY_MODE == 1      \r
133         ; ES is not saved or restored when using the near memory model so only\r
134         ; test it when using the far model.\r
135         MOV             A, ES\r
136         CMP             A, #0x02\r
137         BZ              +5\r
138         BR              vRegTestError\r
139 #endif\r
140         MOVW    AX, #0x1122\r
141         BR              loop1\r
142 \r
143 \r
144 ;------------------------------------------------------------------------------\r
145 ;   Fill all the registers with known values, then check that the registers\r
146 ;   contain the expected value.  An incorrect value being indicative of an\r
147 ;   error in the context switch mechanism.\r
148 ;\r
149 ;   Input:  NONE\r
150 ;\r
151 ;   Call:   Created as a task.\r
152 ;\r
153 ;   Output: NONE\r
154 ;\r
155 ;------------------------------------------------------------------------------\r
156     RSEG CODE:CODE\r
157 vRegTest2:\r
158 \r
159         MOVW    AX, #0x99aa\r
160         MOVW    BC, #0xbbcc\r
161         MOVW    DE, #0xddee\r
162         MOVW    HL, #0xff12\r
163         MOV             CS, #0x03\r
164 #if configMEMORY_MODE == 1      \r
165         MOV             ES, #0x04       \r
166 #endif\r
167 \r
168 loop2:\r
169         CMPW    AX, #0x99aa\r
170         BZ              +5\r
171         BR              vRegTestError   \r
172         MOVW    AX, BC\r
173         CMPW    AX, #0xbbcc\r
174         BZ              +5\r
175         BR              vRegTestError   \r
176         MOVW    AX, DE\r
177         CMPW    AX, #0xddee\r
178         BZ              +5\r
179         BR              vRegTestError   \r
180         MOVW    AX, HL  \r
181         CMPW    AX, #0xff12\r
182         BZ              +5\r
183         BR              vRegTestError\r
184         MOV             A, CS\r
185         CMP             A, #0x03\r
186         BZ              +5\r
187         BR              vRegTestError\r
188 #if configMEMORY_MODE == 1              \r
189         MOV             A, ES\r
190         CMP             A, #0x04\r
191         BZ              +5\r
192         BR              vRegTestError\r
193 #endif\r
194         MOVW    AX, #0x99aa\r
195         BR              loop2\r
196 \r
197 \r
198         END\r