]> git.sur5r.net Git - freertos/blob - Demo/NEC_78K0R_IAR/RegTest.s26
Continue 78K0R development.
[freertos] / Demo / NEC_78K0R_IAR / RegTest.s26
1 ;       FreeRTOS.org V5.1.1 - Copyright (C) 2003-2008 Richard Barry.\r
2 ;\r
3 ;       This file is part of the FreeRTOS.org distribution.\r
4 ;\r
5 ;       FreeRTOS.org is free software; you can redistribute it and/or modify\r
6 ;       it under the terms of the GNU General Public License as published by\r
7 ;       the Free Software Foundation; either version 2 of the License, or\r
8 ;       (at your option) any later version.\r
9 ;\r
10 ;       FreeRTOS.org is distributed in the hope that it will be useful,\r
11 ;       but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12 ;       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13 ;       GNU General Public License for more details.\r
14 ;\r
15 ;       You should have received a copy of the GNU General Public License\r
16 ;       along with FreeRTOS.org; if not, write to the Free Software\r
17 ;       Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
18 ;\r
19 ;       A special exception to the GPL can be applied should you wish to distribute\r
20 ;       a combined work that includes FreeRTOS.org, without being obliged to provide\r
21 ;       the source code for any proprietary components.  See the licensing section\r
22 ;       of http://www.FreeRTOS.org for full details of how and when the exception\r
23 ;       can be applied.\r
24 ;\r
25 ;       ***************************************************************************\r
26 ;       See http://www.FreeRTOS.org for documentation, latest information, license\r
27 ;       and contact details.  Please ensure to read the configuration and relevant\r
28 ;       port sections of the online documentation.\r
29 ;       ***************************************************************************\r
30 ;\r
31 ;------------------------------------------------------------------------------\r
32 \r
33 \r
34 ;\r
35 ; This file defines the RegTest tasks as described at the top of main.c\r
36 ;\r
37 \r
38 ;------------------------------------------------------------------------------\r
39 \r
40 #if __CORE__ != __78K0R__\r
41         #error "This file is only for 78K0R Devices"\r
42 #endif\r
43 \r
44 ; Functions implemented in this file\r
45 ;------------------------------------------------------------------------------\r
46 \r
47         PUBLIC    vRegTest1\r
48         PUBLIC    vRegTest2\r
49 \r
50 ; Functions used by this file\r
51 ;------------------------------------------------------------------------------\r
52         EXTERN    vRegTestError\r
53 \r
54 ;------------------------------------------------------------------------------\r
55 ;   Fill all the registers with known values, then check that the registers\r
56 ;   contain the expected value.  An incorrect value being indicative of an\r
57 ;   error in the context switch mechanism.\r
58 ;\r
59 ;   Input:  NONE\r
60 ;\r
61 ;   Call:   Created as a task.\r
62 ;\r
63 ;   Output: NONE\r
64 ;\r
65 ;------------------------------------------------------------------------------\r
66     RSEG CODE:CODE\r
67 vRegTest1:\r
68 \r
69         ; First fill the registers.\r
70         MOVW    AX, #0x1122\r
71         MOVW    BC, #0x3344\r
72         MOVW    DE, #0x5566\r
73         MOVW    HL, #0x7788\r
74         MOV             CS, #0x01\r
75         MOV             ES, #0x02\r
76 \r
77 loop1:\r
78         ; Continuously check that the register values remain at their expected\r
79         ; values.  The BRK is to test the yield.  This task runs at low priority\r
80         ; so will also regularly get preempted.\r
81         BRK\r
82 \r
83         ; Compare with the expected value.\r
84         CMPW    AX, #0x1122\r
85         BZ              +5\r
86         ; Jump over the branch to vRegTestError() if the register contained the\r
87         ; expected value - otherwise flag an error by executing vRegTestError().\r
88         BR              vRegTestError   \r
89 \r
90         ; Repeat for all the registers.\r
91         MOVW    AX, BC\r
92         CMPW    AX, #0x3344\r
93         BZ              +5\r
94         BR              vRegTestError   \r
95         MOVW    AX, DE\r
96         CMPW    AX, #0x5566\r
97         BZ              +5\r
98         BR              vRegTestError   \r
99         MOVW    AX, HL  \r
100         CMPW    AX, #0x7788\r
101         BZ              +5\r
102         BR              vRegTestError\r
103         MOV             A, CS\r
104         CMP             A, #0x01\r
105         BZ              +5\r
106         BR              vRegTestError\r
107         MOV             A, ES\r
108         CMP             A, #0x02\r
109         BZ              +5\r
110         BR              vRegTestError\r
111         MOVW    AX, #0x1122\r
112         BR              loop1\r
113 \r
114 \r
115 ;------------------------------------------------------------------------------\r
116 ;   Fill all the registers with known values, then check that the registers\r
117 ;   contain the expected value.  An incorrect value being indicative of an\r
118 ;   error in the context switch mechanism.\r
119 ;\r
120 ;   Input:  NONE\r
121 ;\r
122 ;   Call:   Created as a task.\r
123 ;\r
124 ;   Output: NONE\r
125 ;\r
126 ;------------------------------------------------------------------------------\r
127     RSEG CODE:CODE\r
128 vRegTest2:\r
129 \r
130         MOVW    AX, #0x99aa\r
131         MOVW    BC, #0xbbcc\r
132         MOVW    DE, #0xddee\r
133         MOVW    HL, #0xff12\r
134         MOV             CS, #0x03\r
135         MOV             ES, #0x04       \r
136 \r
137 loop2:\r
138         CMPW    AX, #0x99aa\r
139         BZ              +5\r
140         BR              vRegTestError   \r
141         MOVW    AX, BC\r
142         CMPW    AX, #0xbbcc\r
143         BZ              +5\r
144         BR              vRegTestError   \r
145         MOVW    AX, DE\r
146         CMPW    AX, #0xddee\r
147         BZ              +5\r
148         BR              vRegTestError   \r
149         MOVW    AX, HL  \r
150         CMPW    AX, #0xff12\r
151         BZ              +5\r
152         BR              vRegTestError\r
153         MOV             A, CS\r
154         CMP             A, #0x03\r
155         BZ              +5\r
156         BR              vRegTestError\r
157         MOV             A, ES\r
158         CMP             A, #0x04\r
159         BZ              +5\r
160         BR              vRegTestError\r
161         MOVW    AX, #0x99aa\r
162         BR              loop2\r
163 \r
164 \r
165         END\r