1 |
584 |
jeremybenn |
;/*
|
2 |
|
|
; FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd.
|
3 |
|
|
;
|
4 |
|
|
; ***************************************************************************
|
5 |
|
|
; * *
|
6 |
|
|
; * If you are: *
|
7 |
|
|
; * *
|
8 |
|
|
; * + New to FreeRTOS, *
|
9 |
|
|
; * + Wanting to learn FreeRTOS or multitasking in general quickly *
|
10 |
|
|
; * + Looking for basic training, *
|
11 |
|
|
; * + Wanting to improve your FreeRTOS skills and productivity *
|
12 |
|
|
; * *
|
13 |
|
|
; * then take a look at the FreeRTOS books - available as PDF or paperback *
|
14 |
|
|
; * *
|
15 |
|
|
; * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
|
16 |
|
|
; * http://www.FreeRTOS.org/Documentation *
|
17 |
|
|
; * *
|
18 |
|
|
; * A pdf reference manual is also available. Both are usually delivered *
|
19 |
|
|
; * to your inbox within 20 minutes to two hours when purchased between 8am *
|
20 |
|
|
; * and 8pm GMT (although please allow up to 24 hours in case of *
|
21 |
|
|
; * exceptional circumstances). Thank you for your support! *
|
22 |
|
|
; * *
|
23 |
|
|
; ***************************************************************************
|
24 |
|
|
;
|
25 |
|
|
; This file is part of the FreeRTOS distribution.
|
26 |
|
|
;
|
27 |
|
|
; FreeRTOS is free software; you can redistribute it and/or modify it under
|
28 |
|
|
; the terms of the GNU General Public License (version 2) as published by the
|
29 |
|
|
; Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
30 |
|
|
; ***NOTE*** The exception to the GPL is included to allow you to distribute
|
31 |
|
|
; a combined work that includes FreeRTOS without being obliged to provide the
|
32 |
|
|
; source code for proprietary components outside of the FreeRTOS kernel.
|
33 |
|
|
; FreeRTOS is distributed in the hope that it will be useful, but WITHOUT
|
34 |
|
|
; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
35 |
|
|
; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
36 |
|
|
; more details. You should have received a copy of the GNU General Public
|
37 |
|
|
; License and the FreeRTOS license exception along with FreeRTOS; if not it
|
38 |
|
|
; can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
39 |
|
|
; by writing to Richard Barry, contact details for whom are available on the
|
40 |
|
|
; FreeRTOS WEB site.
|
41 |
|
|
;
|
42 |
|
|
; 1 tab == 4 spaces!
|
43 |
|
|
;
|
44 |
|
|
; http://www.FreeRTOS.org - Documentation, latest information, license and
|
45 |
|
|
; contact details.
|
46 |
|
|
;
|
47 |
|
|
; http://www.SafeRTOS.com - A version that is certified for use in safety
|
48 |
|
|
; critical systems.
|
49 |
|
|
;
|
50 |
|
|
; http://www.OpenRTOS.com - Commercial support, development, porting,
|
51 |
|
|
; licensing and training services.
|
52 |
|
|
;*/
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
;
|
56 |
|
|
; This file defines the RegTest tasks as described at the top of main.c
|
57 |
|
|
;
|
58 |
|
|
|
59 |
|
|
;------------------------------------------------------------------------------
|
60 |
|
|
|
61 |
|
|
#if __CORE__ != __78K0R__
|
62 |
|
|
#error "This file is only for 78K0R Devices"
|
63 |
|
|
#endif
|
64 |
|
|
|
65 |
|
|
; Functions implemented in this file
|
66 |
|
|
;------------------------------------------------------------------------------
|
67 |
|
|
|
68 |
|
|
PUBLIC vRegTest1
|
69 |
|
|
PUBLIC vRegTest2
|
70 |
|
|
|
71 |
|
|
; Functions used by this file
|
72 |
|
|
;------------------------------------------------------------------------------
|
73 |
|
|
EXTERN vRegTestError
|
74 |
|
|
|
75 |
|
|
;------------------------------------------------------------------------------
|
76 |
|
|
; Fill all the registers with known values, then check that the registers
|
77 |
|
|
; contain the expected value. An incorrect value being indicative of an
|
78 |
|
|
; error in the context switch mechanism.
|
79 |
|
|
;
|
80 |
|
|
; Input: NONE
|
81 |
|
|
;
|
82 |
|
|
; Call: Created as a task.
|
83 |
|
|
;
|
84 |
|
|
; Output: NONE
|
85 |
|
|
;
|
86 |
|
|
;------------------------------------------------------------------------------
|
87 |
|
|
RSEG CODE:CODE
|
88 |
|
|
vRegTest1:
|
89 |
|
|
|
90 |
|
|
; First fill the registers.
|
91 |
|
|
MOVW AX, #0x1122
|
92 |
|
|
MOVW BC, #0x3344
|
93 |
|
|
MOVW DE, #0x5566
|
94 |
|
|
MOVW HL, #0x7788
|
95 |
|
|
MOV CS, #0x01
|
96 |
|
|
#if configMEMORY_MODE == 1
|
97 |
|
|
; ES is not saved or restored when using the near memory model so only
|
98 |
|
|
; test it when using the far model.
|
99 |
|
|
MOV ES, #0x02
|
100 |
|
|
#endif
|
101 |
|
|
|
102 |
|
|
loop1:
|
103 |
|
|
; Continuously check that the register values remain at their expected
|
104 |
|
|
; values. The BRK is to test the yield. This task runs at low priority
|
105 |
|
|
; so will also regularly get preempted.
|
106 |
|
|
BRK
|
107 |
|
|
|
108 |
|
|
; Compare with the expected value.
|
109 |
|
|
CMPW AX, #0x1122
|
110 |
|
|
BZ +5
|
111 |
|
|
; Jump over the branch to vRegTestError() if the register contained the
|
112 |
|
|
; expected value - otherwise flag an error by executing vRegTestError().
|
113 |
|
|
BR vRegTestError
|
114 |
|
|
|
115 |
|
|
; Repeat for all the registers.
|
116 |
|
|
MOVW AX, BC
|
117 |
|
|
CMPW AX, #0x3344
|
118 |
|
|
BZ +5
|
119 |
|
|
BR vRegTestError
|
120 |
|
|
MOVW AX, DE
|
121 |
|
|
CMPW AX, #0x5566
|
122 |
|
|
BZ +5
|
123 |
|
|
BR vRegTestError
|
124 |
|
|
MOVW AX, HL
|
125 |
|
|
CMPW AX, #0x7788
|
126 |
|
|
BZ +5
|
127 |
|
|
BR vRegTestError
|
128 |
|
|
MOV A, CS
|
129 |
|
|
CMP A, #0x01
|
130 |
|
|
BZ +5
|
131 |
|
|
BR vRegTestError
|
132 |
|
|
#if configMEMORY_MODE == 1
|
133 |
|
|
; ES is not saved or restored when using the near memory model so only
|
134 |
|
|
; test it when using the far model.
|
135 |
|
|
MOV A, ES
|
136 |
|
|
CMP A, #0x02
|
137 |
|
|
BZ +5
|
138 |
|
|
BR vRegTestError
|
139 |
|
|
#endif
|
140 |
|
|
MOVW AX, #0x1122
|
141 |
|
|
BR loop1
|
142 |
|
|
|
143 |
|
|
|
144 |
|
|
;------------------------------------------------------------------------------
|
145 |
|
|
; Fill all the registers with known values, then check that the registers
|
146 |
|
|
; contain the expected value. An incorrect value being indicative of an
|
147 |
|
|
; error in the context switch mechanism.
|
148 |
|
|
;
|
149 |
|
|
; Input: NONE
|
150 |
|
|
;
|
151 |
|
|
; Call: Created as a task.
|
152 |
|
|
;
|
153 |
|
|
; Output: NONE
|
154 |
|
|
;
|
155 |
|
|
;------------------------------------------------------------------------------
|
156 |
|
|
RSEG CODE:CODE
|
157 |
|
|
vRegTest2:
|
158 |
|
|
|
159 |
|
|
MOVW AX, #0x99aa
|
160 |
|
|
MOVW BC, #0xbbcc
|
161 |
|
|
MOVW DE, #0xddee
|
162 |
|
|
MOVW HL, #0xff12
|
163 |
|
|
MOV CS, #0x03
|
164 |
|
|
#if configMEMORY_MODE == 1
|
165 |
|
|
MOV ES, #0x04
|
166 |
|
|
#endif
|
167 |
|
|
|
168 |
|
|
loop2:
|
169 |
|
|
CMPW AX, #0x99aa
|
170 |
|
|
BZ +5
|
171 |
|
|
BR vRegTestError
|
172 |
|
|
MOVW AX, BC
|
173 |
|
|
CMPW AX, #0xbbcc
|
174 |
|
|
BZ +5
|
175 |
|
|
BR vRegTestError
|
176 |
|
|
MOVW AX, DE
|
177 |
|
|
CMPW AX, #0xddee
|
178 |
|
|
BZ +5
|
179 |
|
|
BR vRegTestError
|
180 |
|
|
MOVW AX, HL
|
181 |
|
|
CMPW AX, #0xff12
|
182 |
|
|
BZ +5
|
183 |
|
|
BR vRegTestError
|
184 |
|
|
MOV A, CS
|
185 |
|
|
CMP A, #0x03
|
186 |
|
|
BZ +5
|
187 |
|
|
BR vRegTestError
|
188 |
|
|
#if configMEMORY_MODE == 1
|
189 |
|
|
MOV A, ES
|
190 |
|
|
CMP A, #0x04
|
191 |
|
|
BZ +5
|
192 |
|
|
BR vRegTestError
|
193 |
|
|
#endif
|
194 |
|
|
MOVW AX, #0x99aa
|
195 |
|
|
BR loop2
|
196 |
|
|
|
197 |
|
|
|
198 |
|
|
END
|