]> begriffs open source - cmsis-freertos/blob - Demo/RL78_multiple_IAR/RegTest.s87
Update cmsis_os2.c
[cmsis-freertos] / Demo / RL78_multiple_IAR / RegTest.s87
1 ;/*
2 ;    FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
3 ;
4 ;
5 ;    ***************************************************************************
6 ;     *                                                                       *
7 ;     *    FreeRTOS tutorial books are available in pdf and paperback.        *
8 ;     *    Complete, revised, and edited pdf reference manuals are also       *
9 ;     *    available.                                                         *
10 ;     *                                                                       *
11 ;     *    Purchasing FreeRTOS documentation will not only help you, by       *
12 ;     *    ensuring you get running as quickly as possible and with an        *
13 ;     *    in-depth knowledge of how to use FreeRTOS, it will also help       *
14 ;     *    the FreeRTOS project to continue with its mission of providing     *
15 ;     *    professional grade, cross platform, de facto standard solutions    *
16 ;     *    for microcontrollers - completely free of charge!                  *
17 ;     *                                                                       *
18 ;     *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *
19 ;     *                                                                       *
20 ;     *    Thank you for using FreeRTOS, and thank you for your support!      *
21 ;     *                                                                       *
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 modification to the GPL is included to allow you to
31 ;    distribute a combined work that includes FreeRTOS without being obliged to
32 ;    provide the source code for proprietary components outside of the FreeRTOS
33 ;    kernel.  FreeRTOS is distributed in the hope that it will be useful, but
34 ;    WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
35 ;    or 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
62 ; Functions implemented in this file
63 ;------------------------------------------------------------------------------
64
65         PUBLIC    vRegTest1Task
66         PUBLIC    vRegTest2Task
67
68 ; Functions and variables used by this file
69 ;------------------------------------------------------------------------------
70         EXTERN    vRegTestError
71         EXTERN    usRegTest1LoopCounter
72         EXTERN    usRegTest2LoopCounter
73
74 ;------------------------------------------------------------------------------
75 ;   Fill all the registers with known values, then check that the registers
76 ;   contain the expected value.  An incorrect value being indicative of an
77 ;   error in the context switch mechanism.
78 ;
79 ;   Input:  NONE
80 ;
81 ;   Call:   Created as a task.
82 ;
83 ;   Output: NONE
84 ;
85 ;------------------------------------------------------------------------------
86     RSEG CODE:CODE
87 vRegTest1Task:
88
89         ; First fill the registers.
90         MOVW    AX, #0x1122
91         MOVW    BC, #0x3344
92         MOVW    DE, #0x5566
93         MOVW    HL, #0x7788
94         MOV             CS, #0x01
95
96 #if __DATA_MODEL__ == __DATA_MODEL_FAR__
97
98         ; ES is not saved or restored when using the near memory model so only
99         ; test it when using the far model.
100         MOV             ES, #0x02
101
102 #endif
103
104 loop1:
105
106         ; Continuously check that the register values remain at their expected
107         ; values.  The BRK is to test the yield.  This task runs at low priority
108         ; so will also regularly get preempted.
109         BRK
110
111         ; Compare with the expected value.
112         CMPW    AX, #0x1122
113         SKZ
114
115         ; Jump over the branch to vRegTestError() if the register contained the
116         ; expected value - otherwise flag an error by executing vRegTestError().
117         BR              vRegTestError
118
119         ; Repeat for all the registers.
120         MOVW    AX, BC
121         CMPW    AX, #0x3344
122         SKZ
123         BR              vRegTestError
124         MOVW    AX, DE
125         CMPW    AX, #0x5566
126         SKZ
127         BR              vRegTestError
128         MOVW    AX, HL
129         CMPW    AX, #0x7788
130         SKZ
131         BR              vRegTestError
132         MOV             A, CS
133         CMP             A, #0x01
134         SKZ
135         BR              vRegTestError
136
137 #if __DATA_MODEL__ == __DATA_MODEL_FAR__
138
139         ; ES is not saved or restored when using the near memory model so only
140         ; test it when using the far model.
141         MOV             A, ES
142         CMP             A, #0x02
143         SKZ
144         BR              vRegTestError
145
146 #endif
147
148         ; Indicate that this task is still cycling.
149         INCW    usRegTest1LoopCounter
150
151         MOVW    AX, #0x1122
152         BR              loop1
153
154
155 ;------------------------------------------------------------------------------
156 ;   Fill all the registers with known values, then check that the registers
157 ;   contain the expected value.  An incorrect value being indicative of an
158 ;   error in the context switch mechanism.
159 ;
160 ;   Input:  NONE
161 ;
162 ;   Call:   Created as a task.
163 ;
164 ;   Output: NONE
165 ;
166 ;------------------------------------------------------------------------------
167     RSEG CODE:CODE
168 vRegTest2Task:
169
170         MOVW    AX, #0x99aa
171         MOVW    BC, #0xbbcc
172         MOVW    DE, #0xddee
173         MOVW    HL, #0xff12
174         MOV             CS, #0x03
175
176 #if __DATA_MODEL__ == __DATA_MODEL_FAR__
177
178         MOV             ES, #0x04
179
180 #endif
181
182 loop2:
183         CMPW    AX, #0x99aa
184         SKZ
185         BR              vRegTestError
186         MOVW    AX, BC
187         CMPW    AX, #0xbbcc
188         SKZ
189         BR              vRegTestError
190         MOVW    AX, DE
191         CMPW    AX, #0xddee
192         SKZ
193         BR              vRegTestError
194         MOVW    AX, HL
195         CMPW    AX, #0xff12
196         SKZ
197         BR              vRegTestError
198         MOV             A, CS
199         CMP             A, #0x03
200         SKZ
201         BR              vRegTestError
202
203 #if __DATA_MODEL__ == __DATA_MODEL_FAR__
204
205         MOV             A, ES
206         CMP             A, #0x04
207         SKZ
208         BR              vRegTestError
209
210 #endif
211
212         ; Indicate that this task is still cycling.
213         INCW    usRegTest2LoopCounter
214
215         MOVW    AX, #0x99aa
216         BR              loop2
217
218
219         END