]> begriffs open source - cmsis-freertos/blob - Demo/RL78_RL78G13_Promo_Board_IAR/RegTest.s87
Update cmsis_os2.c
[cmsis-freertos] / Demo / RL78_RL78G13_Promo_Board_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 #if __CORE__ != __RL78_1__
62         #error "This file is only for RL78 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         
97 #if __DATA_MODEL__ == __DATA_MODEL_FAR__
98
99         ; ES is not saved or restored when using the near memory model so only
100         ; test it when using the far model.
101         MOV             ES, #0x02
102         
103 #endif
104
105 loop1:
106
107         ; Continuously check that the register values remain at their expected
108         ; values.  The BRK is to test the yield.  This task runs at low priority
109         ; so will also regularly get preempted.
110         BRK
111
112         ; Compare with the expected value.
113         CMPW    AX, #0x1122
114         BZ              +5
115
116         ; Jump over the branch to vRegTestError() if the register contained the
117         ; expected value - otherwise flag an error by executing vRegTestError().
118         BR              vRegTestError   
119
120         ; Repeat for all the registers.
121         MOVW    AX, BC
122         CMPW    AX, #0x3344
123         BZ              +5
124         BR              vRegTestError   
125         MOVW    AX, DE
126         CMPW    AX, #0x5566
127         BZ              +5
128         BR              vRegTestError   
129         MOVW    AX, HL  
130         CMPW    AX, #0x7788
131         BZ              +5
132         BR              vRegTestError
133         MOV             A, CS
134         CMP             A, #0x01
135         BZ              +5
136         BR              vRegTestError
137
138 #if __DATA_MODEL__ == __DATA_MODEL_FAR__
139
140         ; ES is not saved or restored when using the near memory model so only
141         ; test it when using the far model.
142         MOV             A, ES
143         CMP             A, #0x02
144         BZ              +5
145         BR              vRegTestError
146
147 #endif
148
149         MOVW    AX, #0x1122
150         BR              loop1
151
152
153 ;------------------------------------------------------------------------------
154 ;   Fill all the registers with known values, then check that the registers
155 ;   contain the expected value.  An incorrect value being indicative of an
156 ;   error in the context switch mechanism.
157 ;
158 ;   Input:  NONE
159 ;
160 ;   Call:   Created as a task.
161 ;
162 ;   Output: NONE
163 ;
164 ;------------------------------------------------------------------------------
165     RSEG CODE:CODE
166 vRegTest2:
167
168         MOVW    AX, #0x99aa
169         MOVW    BC, #0xbbcc
170         MOVW    DE, #0xddee
171         MOVW    HL, #0xff12
172         MOV             CS, #0x03
173
174 #if __DATA_MODEL__ == __DATA_MODEL_FAR__
175
176         MOV             ES, #0x04       
177
178 #endif
179
180 loop2:
181         CMPW    AX, #0x99aa
182         BZ              +5
183         BR              vRegTestError   
184         MOVW    AX, BC
185         CMPW    AX, #0xbbcc
186         BZ              +5
187         BR              vRegTestError   
188         MOVW    AX, DE
189         CMPW    AX, #0xddee
190         BZ              +5
191         BR              vRegTestError   
192         MOVW    AX, HL  
193         CMPW    AX, #0xff12
194         BZ              +5
195         BR              vRegTestError
196         MOV             A, CS
197         CMP             A, #0x03
198         BZ              +5
199         BR              vRegTestError
200
201 #if __DATA_MODEL__ == __DATA_MODEL_FAR__
202
203         MOV             A, ES
204         CMP             A, #0x04
205         BZ              +5
206         BR              vRegTestError
207
208 #endif
209
210         MOVW    AX, #0x99aa
211         BR              loop2
212
213
214         END