]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/MSP430X_MSP430F5438_IAR/RegTest.s43
76ff4d59d7fb9fb9294743f3a574916348f6e32e
[freertos] / FreeRTOS / Demo / MSP430X_MSP430F5438_IAR / RegTest.s43
1 /*\r
2  * FreeRTOS Kernel V10.2.1\r
3  * Copyright (C) 2019 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 #include "msp430.h"\r
28 #include "FreeRTOSConfig.h"\r
29 #include "data_model.h"\r
30 \r
31 /*\r
32  * The definition of the "register test" tasks, as described at the top of\r
33  * main.c\r
34  */\r
35 \r
36 \r
37 \r
38         IMPORT usRegTest1Counter\r
39         IMPORT usRegTest2Counter\r
40         IMPORT vPortYield\r
41         \r
42         EXPORT vRegTest1Task\r
43         EXPORT vRegTest2Task\r
44 \r
45         RSEG CODE\r
46         \r
47         EVEN\r
48 \r
49 vRegTest1Task:\r
50 \r
51         /* Fill each general purpose register with a known value. */\r
52         mov_x   #0x4444, r4\r
53         mov_x   #0x5555, r5\r
54         mov_x   #0x6666, r6\r
55         mov_x   #0x7777, r7\r
56         mov_x   #0x8888, r8\r
57         mov_x   #0x9999, r9\r
58         mov_x   #0xaaaa, r10\r
59         mov_x   #0xbbbb, r11\r
60         mov_x   #0xcccc, r12\r
61         mov_x   #0xdddd, r13\r
62         mov_x   #0xeeee, r14\r
63         mov_x   #0xffff, r15\r
64         \r
65 prvRegTest1Loop:\r
66 \r
67         /* Test each general purpose register to check that it still contains the\r
68         expected known value, jumping to vRegTest1Error if any register contains\r
69         an unexpected value. */\r
70         cmp_x   #0x4444, r4\r
71         jne             vRegTest1Error\r
72         cmp_x   #0x5555, r5\r
73         jne             vRegTest1Error\r
74         cmp_x   #0x6666, r6\r
75         jne             vRegTest1Error\r
76         cmp_x   #0x7777, r7\r
77         jne             vRegTest1Error\r
78         cmp_x   #0x8888, r8\r
79         jne             vRegTest1Error\r
80         cmp_x   #0x9999, r9\r
81         jne             vRegTest1Error\r
82         cmp_x   #0xaaaa, r10\r
83         jne             vRegTest1Error\r
84         cmp_x   #0xbbbb, r11\r
85         jne             vRegTest1Error\r
86         cmp_x   #0xcccc, r12\r
87         jne             vRegTest1Error\r
88         cmp_x   #0xdddd, r13\r
89         jne             vRegTest1Error\r
90         cmp_x   #0xeeee, r14\r
91         jne             vRegTest1Error\r
92         cmp_x   #0xffff, r15\r
93         jne             vRegTest1Error\r
94         \r
95         /* This task is still running without jumping to vRegTest1Error, so increment\r
96         the loop counter so the check task knows the task is running error free. */\r
97         incx.w  &usRegTest1Counter\r
98         \r
99         /* Loop again, performing the same tests. */\r
100         jmp             prvRegTest1Loop\r
101         nop\r
102 \r
103         \r
104         EVEN\r
105         \r
106 vRegTest1Error:\r
107         jmp vRegTest1Error\r
108         nop\r
109         \r
110 /*-----------------------------------------------------------*/\r
111 \r
112 /* See the comments in vRegTest1Task.  This task is the same, it just uses\r
113 different values in its registers. */\r
114 vRegTest2Task:\r
115 \r
116         mov_x   #0x4441, r4\r
117         mov_x   #0x5551, r5\r
118         mov_x   #0x6661, r6\r
119         mov_x   #0x7771, r7\r
120         mov_x   #0x8881, r8\r
121         mov_x   #0x9991, r9\r
122         mov_x   #0xaaa1, r10\r
123         mov_x   #0xbbb1, r11\r
124         mov_x   #0xccc1, r12\r
125         mov_x   #0xddd1, r13\r
126         mov_x   #0xeee1, r14\r
127         mov_x   #0xfff1, r15\r
128         \r
129 prvRegTest2Loop:\r
130 \r
131         cmp_x   #0x4441, r4\r
132         jne             vRegTest2Error\r
133         cmp_x   #0x5551, r5\r
134         jne             vRegTest2Error\r
135         cmp_x   #0x6661, r6\r
136         jne             vRegTest2Error\r
137         cmp_x   #0x7771, r7\r
138         jne             vRegTest2Error\r
139         cmp_x   #0x8881, r8\r
140         jne             vRegTest2Error\r
141         cmp_x   #0x9991, r9\r
142         jne             vRegTest2Error\r
143         cmp_x   #0xaaa1, r10\r
144         jne             vRegTest2Error\r
145         cmp_x   #0xbbb1, r11\r
146         jne             vRegTest2Error\r
147         cmp_x   #0xccc1, r12\r
148         jne             vRegTest2Error\r
149         cmp_x   #0xddd1, r13\r
150         jne             vRegTest2Error\r
151         cmp_x   #0xeee1, r14\r
152         jne             vRegTest2Error\r
153         cmp_x   #0xfff1, r15\r
154         jne             vRegTest2Error\r
155         \r
156         /* Also perform a manual yield, just to increase the scope of the test. */\r
157         calla   #vPortYield\r
158         \r
159         incx.w  &usRegTest2Counter\r
160         jmp             prvRegTest2Loop\r
161         nop\r
162 \r
163         \r
164 vRegTest2Error:\r
165         jmp vRegTest2Error\r
166         nop\r
167 /*-----------------------------------------------------------*/\r
168 \r
169                 \r
170         END\r
171                 \r