]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/NEC_78K0R_IAR/RegTest.s26
Update version number in readiness for V10.3.0 release. Sync SVN with reviewed releas...
[freertos] / FreeRTOS / Demo / NEC_78K0R_IAR / RegTest.s26
1 ;/*\r
2 ; * FreeRTOS Kernel V10.3.0\r
3 ; * Copyright (C) 2020 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
4 ; *\r
5 ; * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
6 ; * this software and associated documentation files (the "Software"), to deal in\r
7 ; * the Software without restriction, including without limitation the rights to\r
8 ; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
9 ; * the Software, and to permit persons to whom the Software is furnished to do so,\r
10 ; * subject to the following conditions:\r
11 ; *\r
12 ; * The above copyright notice and this permission notice shall be included in all\r
13 ; * copies or substantial portions of the Software.\r
14 ; *\r
15 ; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
16 ; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
17 ; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
18 ; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
19 ; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
20 ; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
21 ; *\r
22 ; * http://www.FreeRTOS.org\r
23 ; * http://aws.amazon.com/freertos\r
24 ; *\r
25 ; * 1 tab == 4 spaces!\r
26 ; */\r
27 \r
28 \r
29 ;\r
30 ; This file defines the RegTest tasks as described at the top of main.c\r
31 ;\r
32 \r
33 ;------------------------------------------------------------------------------\r
34 \r
35 #if __CORE__ != __78K0R__\r
36         #error "This file is only for 78K0R Devices"\r
37 #endif\r
38 \r
39 ; Functions implemented in this file\r
40 ;------------------------------------------------------------------------------\r
41 \r
42         PUBLIC    vRegTest1\r
43         PUBLIC    vRegTest2\r
44 \r
45 ; Functions used by this file\r
46 ;------------------------------------------------------------------------------\r
47         EXTERN    vRegTestError\r
48 \r
49 ;------------------------------------------------------------------------------\r
50 ;   Fill all the registers with known values, then check that the registers\r
51 ;   contain the expected value.  An incorrect value being indicative of an\r
52 ;   error in the context switch mechanism.\r
53 ;\r
54 ;   Input:  NONE\r
55 ;\r
56 ;   Call:   Created as a task.\r
57 ;\r
58 ;   Output: NONE\r
59 ;\r
60 ;------------------------------------------------------------------------------\r
61     RSEG CODE:CODE\r
62 vRegTest1:\r
63 \r
64         ; First fill the registers.\r
65         MOVW    AX, #0x1122\r
66         MOVW    BC, #0x3344\r
67         MOVW    DE, #0x5566\r
68         MOVW    HL, #0x7788\r
69         MOV             CS, #0x01\r
70 #if configMEMORY_MODE == 1      \r
71         ; ES is not saved or restored when using the near memory model so only\r
72         ; test it when using the far model.\r
73         MOV             ES, #0x02\r
74 #endif\r
75 \r
76 loop1:\r
77         ; Continuously check that the register values remain at their expected\r
78         ; values.  The BRK is to test the yield.  This task runs at low priority\r
79         ; so will also regularly get preempted.\r
80         BRK\r
81 \r
82         ; Compare with the expected value.\r
83         CMPW    AX, #0x1122\r
84         BZ              +5\r
85         ; Jump over the branch to vRegTestError() if the register contained the\r
86         ; expected value - otherwise flag an error by executing vRegTestError().\r
87         BR              vRegTestError   \r
88 \r
89         ; Repeat for all the registers.\r
90         MOVW    AX, BC\r
91         CMPW    AX, #0x3344\r
92         BZ              +5\r
93         BR              vRegTestError   \r
94         MOVW    AX, DE\r
95         CMPW    AX, #0x5566\r
96         BZ              +5\r
97         BR              vRegTestError   \r
98         MOVW    AX, HL  \r
99         CMPW    AX, #0x7788\r
100         BZ              +5\r
101         BR              vRegTestError\r
102         MOV             A, CS\r
103         CMP             A, #0x01\r
104         BZ              +5\r
105         BR              vRegTestError\r
106 #if configMEMORY_MODE == 1      \r
107         ; ES is not saved or restored when using the near memory model so only\r
108         ; test it when using the far model.\r
109         MOV             A, ES\r
110         CMP             A, #0x02\r
111         BZ              +5\r
112         BR              vRegTestError\r
113 #endif\r
114         MOVW    AX, #0x1122\r
115         BR              loop1\r
116 \r
117 \r
118 ;------------------------------------------------------------------------------\r
119 ;   Fill all the registers with known values, then check that the registers\r
120 ;   contain the expected value.  An incorrect value being indicative of an\r
121 ;   error in the context switch mechanism.\r
122 ;\r
123 ;   Input:  NONE\r
124 ;\r
125 ;   Call:   Created as a task.\r
126 ;\r
127 ;   Output: NONE\r
128 ;\r
129 ;------------------------------------------------------------------------------\r
130     RSEG CODE:CODE\r
131 vRegTest2:\r
132 \r
133         MOVW    AX, #0x99aa\r
134         MOVW    BC, #0xbbcc\r
135         MOVW    DE, #0xddee\r
136         MOVW    HL, #0xff12\r
137         MOV             CS, #0x03\r
138 #if configMEMORY_MODE == 1      \r
139         MOV             ES, #0x04       \r
140 #endif\r
141 \r
142 loop2:\r
143         CMPW    AX, #0x99aa\r
144         BZ              +5\r
145         BR              vRegTestError   \r
146         MOVW    AX, BC\r
147         CMPW    AX, #0xbbcc\r
148         BZ              +5\r
149         BR              vRegTestError   \r
150         MOVW    AX, DE\r
151         CMPW    AX, #0xddee\r
152         BZ              +5\r
153         BR              vRegTestError   \r
154         MOVW    AX, HL  \r
155         CMPW    AX, #0xff12\r
156         BZ              +5\r
157         BR              vRegTestError\r
158         MOV             A, CS\r
159         CMP             A, #0x03\r
160         BZ              +5\r
161         BR              vRegTestError\r
162 #if configMEMORY_MODE == 1              \r
163         MOV             A, ES\r
164         CMP             A, #0x04\r
165         BZ              +5\r
166         BR              vRegTestError\r
167 #endif\r
168         MOVW    AX, #0x99aa\r
169         BR              loop2\r
170 \r
171 \r
172         END\r