]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/NEC_78K0R_IAR/RegTest.s26
Update version number to 8.1.2 after moving the defaulting of configUSE_PORT_OPTIMISE...
[freertos] / FreeRTOS / Demo / NEC_78K0R_IAR / RegTest.s26
1 ;/*\r
2 ;    FreeRTOS V8.1.2 - Copyright (C) 2014 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 #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