@@ -1,69 +1,69 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> |
|
2 | 2 | <CodeBlocks_project_file> |
|
3 | 3 | <FileVersion major="1" minor="6" /> |
|
4 | 4 | <Project> |
|
5 | 5 | <Option title="FSW-rtems" /> |
|
6 | 6 | <Option pch_mode="2" /> |
|
7 | 7 | <Option compiler="sparcrtemsgcc446" /> |
|
8 | 8 | <Build> |
|
9 | 9 | <Target title="Debug"> |
|
10 | 10 | <Option output="bin/Debug/fsw" prefix_auto="1" extension_auto="1" /> |
|
11 | 11 | <Option object_output="obj/Debug/" /> |
|
12 | 12 | <Option type="1" /> |
|
13 |
<Option compiler="sparcrtems |
|
|
13 | <Option compiler="sparcrtems446" /> | |
|
14 | 14 | <Compiler> |
|
15 | 15 | <Add option="-fexpensive-optimizations" /> |
|
16 | 16 | <Add option="-O3" /> |
|
17 | 17 | <Add option="-g" /> |
|
18 | 18 | <Add directory="../header" /> |
|
19 | 19 | <Add directory="../src" /> |
|
20 | 20 | </Compiler> |
|
21 | 21 | </Target> |
|
22 | 22 | <Target title="Release"> |
|
23 | 23 | <Option output="bin/Release/FSW-rtems" prefix_auto="1" extension_auto="1" /> |
|
24 | 24 | <Option object_output="obj/Release/" /> |
|
25 | 25 | <Option type="1" /> |
|
26 | 26 | <Option compiler="sparcrtemsgcc446" /> |
|
27 | 27 | <Compiler> |
|
28 | 28 | <Add option="-O2" /> |
|
29 | 29 | </Compiler> |
|
30 | 30 | <Linker> |
|
31 | 31 | <Add option="-s" /> |
|
32 | 32 | </Linker> |
|
33 | 33 | </Target> |
|
34 | 34 | </Build> |
|
35 | 35 | <Compiler> |
|
36 | 36 | <Add option="-Wall" /> |
|
37 | 37 | </Compiler> |
|
38 | 38 | <Unit filename="../header/ccsds_types.h" /> |
|
39 | 39 | <Unit filename="../header/fsw_init.h" /> |
|
40 | 40 | <Unit filename="../header/fsw_misc.h" /> |
|
41 | 41 | <Unit filename="../header/fsw_params.h" /> |
|
42 | 42 | <Unit filename="../header/fsw_processing.h" /> |
|
43 | 43 | <Unit filename="../header/grlib_regs.h" /> |
|
44 | 44 | <Unit filename="../header/tc_handler.h" /> |
|
45 | 45 | <Unit filename="../header/wf_handler.h" /> |
|
46 | 46 | <Unit filename="../src/fsw_globals.c"> |
|
47 | 47 | <Option compilerVar="CC" /> |
|
48 | 48 | </Unit> |
|
49 | 49 | <Unit filename="../src/fsw_init.c"> |
|
50 | 50 | <Option compilerVar="CC" /> |
|
51 | 51 | </Unit> |
|
52 | 52 | <Unit filename="../src/fsw_misc.c"> |
|
53 | 53 | <Option compilerVar="CC" /> |
|
54 | 54 | </Unit> |
|
55 | 55 | <Unit filename="../src/fsw_processing.c"> |
|
56 | 56 | <Option compilerVar="CC" /> |
|
57 | 57 | </Unit> |
|
58 | 58 | <Unit filename="../src/tc_handler.c"> |
|
59 | 59 | <Option compilerVar="CC" /> |
|
60 | 60 | </Unit> |
|
61 | 61 | <Unit filename="../src/wf_handler.c"> |
|
62 | 62 | <Option compilerVar="CC" /> |
|
63 | 63 | </Unit> |
|
64 | 64 | <Extensions> |
|
65 | 65 | <code_completion /> |
|
66 | 66 | <debugger /> |
|
67 | 67 | </Extensions> |
|
68 | 68 | </Project> |
|
69 | 69 | </CodeBlocks_project_file> |
@@ -1,226 +1,310 | |||
|
1 | 1 | # depslib dependency file v1.0 |
|
2 | 2 | 1355231335 source:e:\missions\solo\dev_ple\src\fsw-rtems.c |
|
3 | 3 | <rtems.h> |
|
4 | 4 | <bsp.h> |
|
5 | 5 | <rtems/confdefs.h> |
|
6 | 6 | <drvmgr/drvmgr_confdefs.h> |
|
7 | 7 | <rtems.h> |
|
8 | 8 | <errno.h> |
|
9 | 9 | <fcntl.h> |
|
10 | 10 | <stdio.h> |
|
11 | 11 | <stdlib.h> |
|
12 | 12 | <FSW-config.c> |
|
13 | 13 | <grspw.h> |
|
14 | 14 | <apbuart.h> |
|
15 | 15 | <FSW-rtems-processing.h> |
|
16 | 16 | |
|
17 | 17 | 1355231335 -processing.h> |
|
18 | 18 | |
|
19 | 19 | 1350983928 source:e:\missions\solo\dev_ple\src\grspw.c |
|
20 | 20 | <..\header\grspw.h> |
|
21 | 21 | <stdio.h> |
|
22 | 22 | |
|
23 | 23 | 1354190601 |
|
24 | 24 | |
|
25 | 25 | 1350983928 e:\missions\solo\dev_ple\header\grspw.h |
|
26 | 26 | |
|
27 | 27 | 1351173364 source:e:\missions\solo\dev_ple\src\fsw-config.c |
|
28 | 28 | <drvmgr/ambapp_bus.h> |
|
29 | 29 | |
|
30 | 30 | 1354190602 bapp_bus.h> |
|
31 | 31 | |
|
32 | 32 | 1354190602 e:\missions\solo\dev_ple\src\fsw-config.c |
|
33 | 33 | <drvmgr/ambapp_bus.h> |
|
34 | 34 | |
|
35 | 35 | 1354190602 source:e:\missions\solo\dev_ple\src\fsw-rtems-processing.c |
|
36 | 36 | <FSW-rtems-processing.h> |
|
37 | 37 | <math.h> |
|
38 | 38 | <stdio.h> |
|
39 | 39 | <leon.h> |
|
40 | 40 | |
|
41 | 41 | 1354190601 e:\missions\solo\dev_ple\header\fsw-rtems-processing.h |
|
42 | 42 | <rtems.h> |
|
43 | 43 | |
|
44 | 44 | 1359451040 source:/opt/DEV_PLE/src/FSW-rtems-processing.c |
|
45 | 45 | <FSW-rtems-processing.h> |
|
46 | 46 | <math.h> |
|
47 | 47 | <stdio.h> |
|
48 | 48 | <leon.h> |
|
49 | 49 | |
|
50 | 50 | 1359458568 /opt/DEV_PLE/header/FSW-rtems-processing.h |
|
51 | 51 | <rtems.h> |
|
52 | 52 | <grlibregs.h> |
|
53 | 53 | <FSW-params.h> |
|
54 | 54 | |
|
55 | 55 | 1359458854 source:/opt/DEV_PLE/src/FSW-rtems.c |
|
56 | 56 | <rtems.h> |
|
57 | 57 | <bsp.h> |
|
58 | 58 | <rtems/confdefs.h> |
|
59 | 59 | <drvmgr/drvmgr_confdefs.h> |
|
60 | 60 | <FSW-rtems.h> |
|
61 | 61 | <FSW-config.c> |
|
62 | 62 | |
|
63 | 63 | 1359365823 /opt/DEV_PLE/src/FSW-config.c |
|
64 | 64 | <drvmgr/ambapp_bus.h> |
|
65 | 65 | |
|
66 | 66 | 1359458568 source:/opt/DEV_PLE/src/TC_handler.c |
|
67 | 67 | <TC_handler.h> |
|
68 | 68 | <FSW-params.h> |
|
69 | 69 | |
|
70 | 70 | 1359377846 /opt/DEV_PLE/header/TC_handler.h |
|
71 | 71 | <stdio.h> |
|
72 | 72 | <ccsds_types.h> |
|
73 | 73 | |
|
74 | 74 | 1359640245 /opt/DEV_PLE/header/ccsds_types.h |
|
75 | 75 | |
|
76 | 76 | 1359365823 source:/opt/DEV_PLE/src/FSW-config.c |
|
77 | 77 | <drvmgr/ambapp_bus.h> |
|
78 | 78 | |
|
79 | 79 | 1359452642 /opt/DEV_PLE/header/FSW-config.h |
|
80 | 80 | |
|
81 | 81 | 1359440704 /opt/DEV_PLE/header/grlibregs.h |
|
82 | 82 | |
|
83 | 83 | 1359382989 source:/opt/DEV_PLE/src/WF_handler.c |
|
84 | 84 | |
|
85 | 85 | 1359459475 source:/opt/DEV_PLE/src/FSW-misc.c |
|
86 | 86 | <FSW-misc.h> |
|
87 | 87 | <FSW-params.h> |
|
88 | 88 | |
|
89 | 89 | 1359459330 /opt/DEV_PLE/header/FSW-misc.h |
|
90 | 90 | <rtems.h> |
|
91 | 91 | <stdio.h> |
|
92 | 92 | <FSW-rtems.h> |
|
93 | 93 | <FSW-params.h> |
|
94 | 94 | <grlibregs.h> |
|
95 | 95 | <grspw.h> |
|
96 | 96 | <ccsds_types.h> |
|
97 | 97 | |
|
98 | 98 | 1359459364 /opt/DEV_PLE/header/FSW-rtems.h |
|
99 | 99 | <errno.h> |
|
100 | 100 | <fcntl.h> |
|
101 | 101 | <stdio.h> |
|
102 | 102 | <stdlib.h> |
|
103 | 103 | <grspw.h> |
|
104 | 104 | <apbuart.h> |
|
105 | 105 | <FSW-params.h> |
|
106 | 106 | <FSW-misc.h> |
|
107 | 107 | <FSW-rtems-processing.h> |
|
108 | 108 | <TC_handler.h> |
|
109 | 109 | <WF_handler.h> |
|
110 | 110 | <grlibregs.h> |
|
111 | 111 | |
|
112 | 112 | 1359458453 /opt/DEV_PLE/header/FSW-params.h |
|
113 | 113 | |
|
114 | 114 | 1359459642 /opt/DEV_PLE/header/WF_handler.h |
|
115 | 115 | <rtems.h> |
|
116 | 116 | <FSW-params.h> |
|
117 | 117 | <grspw.h> |
|
118 | 118 | <grlibregs.h> |
|
119 | 119 | <ccsds_types.h> |
|
120 | 120 | <stdio.h> |
|
121 | 121 | <FSW-rtems.h> |
|
122 | 122 | |
|
123 | 123 | 1359464354 source:/opt/DEV_PLE/src/fsw_main.c |
|
124 | 124 | <rtems.h> |
|
125 | 125 | <bsp.h> |
|
126 | 126 | <rtems/confdefs.h> |
|
127 | 127 | <drvmgr/drvmgr_confdefs.h> |
|
128 | 128 | <fsw_main.h> |
|
129 | 129 | <fsw_config.c> |
|
130 | 130 | |
|
131 | 131 | 1359464346 /opt/DEV_PLE/header/fsw_main.h |
|
132 | 132 | <errno.h> |
|
133 | 133 | <fcntl.h> |
|
134 | 134 | <stdio.h> |
|
135 | 135 | <stdlib.h> |
|
136 | 136 | <grspw.h> |
|
137 | 137 | <apbuart.h> |
|
138 | 138 | <fsw_params.h> |
|
139 | 139 | <fsw_misc.h> |
|
140 | 140 | <fsw_processing.h> |
|
141 | 141 | <tc_handler.h> |
|
142 | 142 | <wf_handler.h> |
|
143 | 143 | <grlib_regs.h> |
|
144 | 144 | |
|
145 | 145 | 1359616894 /opt/DEV_PLE/header/fsw_params.h |
|
146 | 146 | |
|
147 | 147 | 1359614518 /opt/DEV_PLE/header/fsw_misc.h |
|
148 | 148 | <rtems.h> |
|
149 | 149 | <stdio.h> |
|
150 | 150 | <fsw_init.h> |
|
151 | 151 | <fsw_params.h> |
|
152 | 152 | <grlib_regs.h> |
|
153 | 153 | <grspw.h> |
|
154 | 154 | <ccsds_types.h> |
|
155 | 155 | |
|
156 | 156 | 1359440704 /opt/DEV_PLE/header/grlib_regs.h |
|
157 | 157 | |
|
158 | 158 | 1359614517 /opt/DEV_PLE/header/fsw_processing.h |
|
159 | 159 | <rtems.h> |
|
160 | 160 | <grlib_regs.h> |
|
161 | 161 | <fsw_params.h> |
|
162 | 162 | |
|
163 | 163 | 1359643450 /opt/DEV_PLE/header/tc_handler.h |
|
164 | 164 | <rtems.h> |
|
165 | 165 | <stdio.h> |
|
166 | 166 | <unistd.h> |
|
167 | 167 | <sys/ioctl.h> |
|
168 | 168 | <ccsds_types.h> |
|
169 | 169 | <grspw.h> |
|
170 | 170 | <fsw_init.h> |
|
171 | 171 | |
|
172 | 172 | 1359614518 /opt/DEV_PLE/header/wf_handler.h |
|
173 | 173 | <rtems.h> |
|
174 | 174 | <fsw_params.h> |
|
175 | 175 | <grspw.h> |
|
176 | 176 | <grlib_regs.h> |
|
177 | 177 | <ccsds_types.h> |
|
178 | 178 | <stdio.h> |
|
179 | 179 | <fsw_init.h> |
|
180 | 180 | |
|
181 | 181 | 1359365823 /opt/DEV_PLE/src/fsw_config.c |
|
182 | 182 | <drvmgr/ambapp_bus.h> |
|
183 | 183 | |
|
184 | 184 | 1359614518 source:/opt/DEV_PLE/src/fsw_misc.c |
|
185 | 185 | <fsw_misc.h> |
|
186 | 186 | <fsw_params.h> |
|
187 | 187 | |
|
188 | 188 | 1359643720 source:/opt/DEV_PLE/src/tc_handler.c |
|
189 | 189 | <tc_handler.h> |
|
190 | 190 | <fsw_params.h> |
|
191 | 191 | |
|
192 | 192 | 1359614518 source:/opt/DEV_PLE/src/wf_handler.c |
|
193 | 193 | <wf_handler.h> |
|
194 | 194 | |
|
195 | 195 | 1359615705 source:/opt/DEV_PLE/src/fsw_globals.c |
|
196 | 196 | <fsw_processing.h> |
|
197 | 197 | <rtems.h> |
|
198 | 198 | |
|
199 | 199 | 1359622160 source:/opt/DEV_PLE/src/fsw_init.c |
|
200 | 200 | <rtems.h> |
|
201 | 201 | <bsp.h> |
|
202 | 202 | <rtems/confdefs.h> |
|
203 | 203 | <drvmgr/drvmgr_confdefs.h> |
|
204 | 204 | <fsw_init.h> |
|
205 | 205 | <fsw_config.c> |
|
206 | 206 | |
|
207 | 207 | 1359615705 /opt/DEV_PLE/header/fsw_init.h |
|
208 | 208 | <errno.h> |
|
209 | 209 | <fcntl.h> |
|
210 | 210 | <stdio.h> |
|
211 | 211 | <stdlib.h> |
|
212 | 212 | <grspw.h> |
|
213 | 213 | <apbuart.h> |
|
214 | 214 | <fsw_params.h> |
|
215 | 215 | <fsw_misc.h> |
|
216 | 216 | <fsw_processing.h> |
|
217 | 217 | <tc_handler.h> |
|
218 | 218 | <wf_handler.h> |
|
219 | 219 | <grlib_regs.h> |
|
220 | 220 | |
|
221 | 221 | 1359614518 source:/opt/DEV_PLE/src/fsw_processing.c |
|
222 | 222 | <fsw_processing.h> |
|
223 | 223 | <math.h> |
|
224 | 224 | <stdio.h> |
|
225 | 225 | <leon.h> |
|
226 | 226 | |
|
227 | 1359665502 source:/home/admin/opt/DEV_PLE/src/fsw_globals.c | |
|
228 | <fsw_processing.h> | |
|
229 | <rtems.h> | |
|
230 | ||
|
231 | 1359663364 /home/admin/opt/DEV_PLE/header/fsw_processing.h | |
|
232 | <rtems.h> | |
|
233 | <grlib_regs.h> | |
|
234 | <fsw_params.h> | |
|
235 | ||
|
236 | 1359470426 /home/admin/opt/DEV_PLE/header/grlib_regs.h | |
|
237 | ||
|
238 | 1359665475 /home/admin/opt/DEV_PLE/header/fsw_params.h | |
|
239 | ||
|
240 | 1359666330 source:/home/admin/opt/DEV_PLE/src/fsw_init.c | |
|
241 | <rtems.h> | |
|
242 | <bsp.h> | |
|
243 | <rtems/confdefs.h> | |
|
244 | <drvmgr/drvmgr_confdefs.h> | |
|
245 | <fsw_init.h> | |
|
246 | <fsw_config.c> | |
|
247 | ||
|
248 | 1359666373 /home/admin/opt/DEV_PLE/header/fsw_init.h | |
|
249 | <errno.h> | |
|
250 | <fcntl.h> | |
|
251 | <stdio.h> | |
|
252 | <stdlib.h> | |
|
253 | <grspw.h> | |
|
254 | <apbuart.h> | |
|
255 | <fsw_params.h> | |
|
256 | <fsw_misc.h> | |
|
257 | <fsw_processing.h> | |
|
258 | <tc_handler.h> | |
|
259 | <wf_handler.h> | |
|
260 | <grlib_regs.h> | |
|
261 | ||
|
262 | 1359663364 /home/admin/opt/DEV_PLE/header/fsw_misc.h | |
|
263 | <rtems.h> | |
|
264 | <stdio.h> | |
|
265 | <fsw_init.h> | |
|
266 | <fsw_params.h> | |
|
267 | <grlib_regs.h> | |
|
268 | <grspw.h> | |
|
269 | <ccsds_types.h> | |
|
270 | ||
|
271 | 1359663364 /home/admin/opt/DEV_PLE/header/ccsds_types.h | |
|
272 | ||
|
273 | 1359665643 /home/admin/opt/DEV_PLE/header/tc_handler.h | |
|
274 | <rtems.h> | |
|
275 | <stdio.h> | |
|
276 | <unistd.h> | |
|
277 | <sys/ioctl.h> | |
|
278 | <ccsds_types.h> | |
|
279 | <grspw.h> | |
|
280 | <fsw_init.h> | |
|
281 | ||
|
282 | 1359663364 /home/admin/opt/DEV_PLE/header/wf_handler.h | |
|
283 | <rtems.h> | |
|
284 | <fsw_params.h> | |
|
285 | <grspw.h> | |
|
286 | <grlib_regs.h> | |
|
287 | <ccsds_types.h> | |
|
288 | <stdio.h> | |
|
289 | <fsw_init.h> | |
|
290 | ||
|
291 | 1359470426 /home/admin/opt/DEV_PLE/src/fsw_config.c | |
|
292 | <drvmgr/ambapp_bus.h> | |
|
293 | ||
|
294 | 1359663364 source:/home/admin/opt/DEV_PLE/src/fsw_misc.c | |
|
295 | <fsw_misc.h> | |
|
296 | <fsw_params.h> | |
|
297 | ||
|
298 | 1359663364 source:/home/admin/opt/DEV_PLE/src/fsw_processing.c | |
|
299 | <fsw_processing.h> | |
|
300 | <math.h> | |
|
301 | <stdio.h> | |
|
302 | <leon.h> | |
|
303 | ||
|
304 | 1359663364 source:/home/admin/opt/DEV_PLE/src/wf_handler.c | |
|
305 | <wf_handler.h> | |
|
306 | ||
|
307 | 1359665083 source:/home/admin/opt/DEV_PLE/src/tc_handler.c | |
|
308 | <tc_handler.h> | |
|
309 | <fsw_params.h> | |
|
310 |
@@ -1,53 +1,43 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> |
|
2 | 2 | <CodeBlocks_layout_file> |
|
3 | 3 | <ActiveTarget name="Debug" /> |
|
4 | 4 | <File name="../header/ccsds_types.h" open="0" top="0" tabpos="5"> |
|
5 |
<Cursor position=" |
|
|
5 | <Cursor position="4079" topLine="120" /> | |
|
6 | 6 | </File> |
|
7 |
<File name="../header/fsw_init.h" open=" |
|
|
8 |
<Cursor position=" |
|
|
7 | <File name="../header/fsw_init.h" open="0" top="0" tabpos="3"> | |
|
8 | <Cursor position="1128" topLine="26" /> | |
|
9 | 9 | </File> |
|
10 | 10 | <File name="../header/fsw_misc.h" open="0" top="0" tabpos="0"> |
|
11 | 11 | <Cursor position="114" topLine="0" /> |
|
12 | 12 | </File> |
|
13 | 13 | <File name="../header/fsw_params.h" open="0" top="0" tabpos="0"> |
|
14 |
<Cursor position="13 |
|
|
14 | <Cursor position="1374" topLine="49" /> | |
|
15 | 15 | </File> |
|
16 | 16 | <File name="../header/fsw_processing.h" open="0" top="0" tabpos="0"> |
|
17 |
<Cursor position="5 |
|
|
17 | <Cursor position="576" topLine="0" /> | |
|
18 | 18 | </File> |
|
19 | 19 | <File name="../header/tc_handler.h" open="0" top="0" tabpos="4"> |
|
20 |
<Cursor position=" |
|
|
20 | <Cursor position="437" topLine="35" /> | |
|
21 | 21 | </File> |
|
22 | 22 | <File name="../header/wf_handler.h" open="0" top="0" tabpos="0"> |
|
23 | 23 | <Cursor position="212" topLine="0" /> |
|
24 | 24 | </File> |
|
25 |
<File name="../src/fsw_globals.c" open=" |
|
|
26 |
<Cursor position=" |
|
|
25 | <File name="../src/fsw_globals.c" open="0" top="0" tabpos="4"> | |
|
26 | <Cursor position="1271" topLine="18" /> | |
|
27 | 27 | </File> |
|
28 | <<<<<<< local | |
|
29 | <File name="../src/fsw_init.c" open="1" top="1" tabpos="0"> | |
|
30 | <Cursor position="1703" topLine="36" /> | |
|
31 | ======= | |
|
32 | <File name="../src/fsw_init.c" open="1" top="1" tabpos="2"> | |
|
33 | <Cursor position="3361" topLine="60" /> | |
|
34 | >>>>>>> other | |
|
28 | <File name="../src/fsw_init.c" open="1" top="0" tabpos="1"> | |
|
29 | <Cursor position="1814" topLine="48" /> | |
|
35 | 30 | </File> |
|
36 | 31 | <File name="../src/fsw_misc.c" open="0" top="0" tabpos="0"> |
|
37 | 32 | <Cursor position="20" topLine="0" /> |
|
38 | 33 | </File> |
|
39 | 34 | <File name="../src/fsw_processing.c" open="0" top="0" tabpos="2"> |
|
40 | 35 | <Cursor position="1175" topLine="46" /> |
|
41 | 36 | </File> |
|
42 | <<<<<<< local | |
|
43 | <File name="../src/tc_handler.c" open="0" top="0" tabpos="3"> | |
|
44 | <Cursor position="2672" topLine="26" /> | |
|
45 | ======= | |
|
46 | <File name="../src/tc_handler.c" open="1" top="0" tabpos="1"> | |
|
47 | <Cursor position="11070" topLine="270" /> | |
|
48 | >>>>>>> other | |
|
37 | <File name="../src/tc_handler.c" open="1" top="1" tabpos="2"> | |
|
38 | <Cursor position="13133" topLine="89" /> | |
|
49 | 39 | </File> |
|
50 | 40 | <File name="../src/wf_handler.c" open="0" top="0" tabpos="0"> |
|
51 | 41 | <Cursor position="3936" topLine="62" /> |
|
52 | 42 | </File> |
|
53 | 43 | </CodeBlocks_layout_file> |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -1,45 +1,47 | |||
|
1 | 1 | #ifndef FSW_RTEMS_H_INCLUDED |
|
2 | 2 | #define FSW_RTEMS_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include <errno.h> |
|
5 | 5 | #include <fcntl.h> |
|
6 | 6 | #include <stdio.h> |
|
7 | 7 | #include <stdlib.h> |
|
8 | 8 | |
|
9 | 9 | #include <grspw.h> |
|
10 | 10 | #include <apbuart.h> |
|
11 | 11 | |
|
12 | 12 | #include <fsw_params.h> |
|
13 | 13 | #include <fsw_misc.h> |
|
14 | 14 | #include <fsw_processing.h> |
|
15 | 15 | #include <tc_handler.h> |
|
16 | 16 | #include <wf_handler.h> |
|
17 | 17 | #include <grlib_regs.h> |
|
18 | 18 | |
|
19 | 19 | extern int sched_yield(); |
|
20 | 20 | extern int errno; |
|
21 | 21 | extern rtems_id Task_id[ ]; /* array of task ids */ |
|
22 | 22 | extern rtems_name Task_name[ ]; /* array of task names */ |
|
23 | 23 | extern rtems_name misc_name[ ]; /* arry of miscellaneous names for rtems objects */ |
|
24 | 24 | extern int fdSPW; // grspw file descriptor |
|
25 | 25 | extern int fdUART; // uart file descriptor |
|
26 | extern struct param_norm_str param_norm; | |
|
26 | 27 | |
|
27 | 28 | // RTEMS TASKS |
|
28 | 29 | rtems_task Init( rtems_task_argument argument); /* forward declaration needed */ |
|
29 | 30 | rtems_task recv_task(rtems_task_argument argument); |
|
30 | 31 | rtems_task spiq_task(rtems_task_argument argument); |
|
31 | 32 | rtems_task stat_task(rtems_task_argument argument); |
|
32 | 33 | rtems_task wfrm_task(rtems_task_argument argument); |
|
33 | 34 | int create_all_tasks(); |
|
34 | 35 | int start_all_tasks(); |
|
35 | 36 | int create_message_queue(); |
|
36 | 37 | |
|
37 | 38 | // OTHER functions |
|
39 | void init_default_mode_parameters(); | |
|
38 | 40 | int configure_spw_link(); |
|
39 | 41 | int send_console_outputs_on_serial_port(); |
|
40 | 42 | extern int rtems_cpu_usage_report(); |
|
41 | 43 | extern int rtems_cpu_usage_reset(); |
|
42 | 44 | void print_statistics(spw_stats *); |
|
43 | 45 | rtems_status_code write_spw(spw_ioctl_pkt_send* spw_ioctl_send); |
|
44 | 46 | |
|
45 | 47 | #endif // FSW_RTEMS_CONFIG_H_INCLUDED |
@@ -1,60 +1,68 | |||
|
1 | 1 | #ifndef FSW_RTEMS_CONFIG_H_INCLUDED |
|
2 | 2 | #define FSW_RTEMS_CONFIG_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #define GRSPW_DEVICE_NAME "/dev/grspw0" |
|
5 | 5 | #define UART_DEVICE_NAME "/dev/console" |
|
6 | 6 | |
|
7 | 7 | //***************************** |
|
8 | 8 | // APB REGISTERS BASE ADDRESSES |
|
9 | 9 | #define REGS_ADDR_APBUART 0x80000100 |
|
10 | 10 | #define REGS_ADDR_GPTIMER 0x80000300 |
|
11 | 11 | #define REGS_ADDR_GRSPW 0x80000500 |
|
12 | 12 | #define REGS_ADDR_SPECTRAL_MATRICES 0x80000700 |
|
13 | 13 | |
|
14 | 14 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
15 | 15 | |
|
16 | 16 | #define IRQ_SM 9 |
|
17 | 17 | #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels |
|
18 | 18 | #define IRQ_WF 10 |
|
19 | 19 | #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels |
|
20 | 20 | |
|
21 | 21 | #define CLKDIV_SM_SIMULATOR 9999 |
|
22 | 22 | #define CLKDIV_WF_SIMULATOR 9999999 |
|
23 | 23 | #define TIMER_SM_SIMULATOR 1 |
|
24 | 24 | #define TIMER_WF_SIMULATOR 2 |
|
25 | 25 | |
|
26 | 26 | //****** |
|
27 | 27 | // RTEMS |
|
28 | 28 | #define TASKID_RECV 1 |
|
29 | 29 | #define TASKID_ACTN 1 |
|
30 | 30 | #define TASKID_SPIQ 3 |
|
31 | 31 | #define TASKID_SMIQ 4 |
|
32 | 32 | #define TASKID_STAT 5 |
|
33 | 33 | #define TASKID_AVF0 6 |
|
34 | 34 | #define TASKID_BPF0 7 |
|
35 | 35 | #define TASKID_WFRM 8 |
|
36 | 36 | |
|
37 | 37 | #define ACTION_MSG_QUEUE_COUNT 10 |
|
38 | 38 | |
|
39 | 39 | //******* |
|
40 | 40 | // MACROS |
|
41 | 41 | #define PRINT_MESSAGES_ON_CONSOLE // enable or disable the printf instructions |
|
42 | 42 | #ifdef PRINT_MESSAGES_ON_CONSOLE |
|
43 | 43 | #define PRINTF(x) printf(x); |
|
44 | 44 | #define PRINTF1(x,y) printf(x,y); |
|
45 | 45 | #define PRINTF2(x,y,z) printf(x,y,z); |
|
46 | 46 | #else |
|
47 | 47 | #define PRINTF(x) ; |
|
48 | 48 | #define PRINTF1(x,y) ; |
|
49 | 49 | #define PRINTF2(x,y,z) ; |
|
50 | 50 | #endif |
|
51 | 51 | |
|
52 | 52 | #define NB_SAMPLES_PER_SNAPSHOT 2048 |
|
53 | 53 | #define NB_BYTES_SWF_BLK 2 * 6 |
|
54 | 54 | |
|
55 | struct param_norm_str{ | |
|
56 | unsigned int sy_lfr_n_swf_l; // length of the snapshots | |
|
57 | unsigned int sy_lfr_n_swf_p; // time between two snapshots | |
|
58 | unsigned int sy_lfr_n_asm_p; // time between two asm | |
|
59 | unsigned char sy_lfr_n_bp_p0; // timebetween two products BP1 set | |
|
60 | unsigned char sy_lfr_n_bp_p1; // time between two products BP2 set | |
|
61 | }; | |
|
62 | ||
|
55 | 63 | extern volatile int wf_snap_f0[ ]; // 24576 bytes |
|
56 | 64 | extern volatile int wf_snap_f1[ ]; // 24576 bytes |
|
57 | 65 | extern volatile int wf_snap_f2[ ]; // 24576 bytes |
|
58 | 66 | extern volatile int wf_cont_f3[ ]; // 24576 bytes |
|
59 | 67 | |
|
60 | 68 | #endif // FSW_RTEMS_CONFIG_H_INCLUDED |
@@ -1,48 +1,54 | |||
|
1 | 1 | #ifndef TC_HANDLER_H_INCLUDED |
|
2 | 2 | #define TC_HANDLER_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include <rtems.h> |
|
5 | 5 | #include <stdio.h> |
|
6 | 6 | #include <unistd.h> // for the read call |
|
7 | 7 | #include <sys/ioctl.h> // for the ioctl call |
|
8 | 8 | #include <ccsds_types.h> |
|
9 | 9 | #include <grspw.h> |
|
10 | 10 | #include <fsw_init.h> |
|
11 | 11 | |
|
12 | 12 | extern int fdSPW; |
|
13 | 13 | extern rtems_name misc_name[ ]; |
|
14 | 14 | extern rtems_name misc_id[ ]; |
|
15 |
extern rtems_id Task_id[ ]; / |
|
|
15 | extern rtems_id Task_id[ ]; // array of task ids | |
|
16 | extern struct param_norm_str param_norm; | |
|
16 | 17 | |
|
17 | 18 | unsigned char currentTC_LEN_RCV[2]; // SHALL be equal to the current TC packet estimated packet length field |
|
18 | 19 | unsigned char currentTC_COMPUTED_CRC[2]; |
|
19 | 20 | unsigned int currentTC_LEN_RCV_AsUnsignedInt; |
|
20 | 21 | unsigned int currentTM_length; |
|
21 | 22 | unsigned char currentTC_processedFlag; |
|
22 | 23 | |
|
23 | 24 | //********************** |
|
24 | 25 | // GENERAL USE FUNCTIONS |
|
25 | 26 | unsigned int lookUpTableForCRC[256]; |
|
26 | 27 | void InitLookUpTableForCRC(); |
|
27 | 28 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData); |
|
28 | 29 | |
|
29 | 30 | //********************* |
|
30 | 31 | // ACCEPTANCE FUNCTIONS |
|
31 | 32 | unsigned char acceptTM(ccsdsTelecommandPacket_t * TMPacket, unsigned int tc_len_recv); |
|
32 | 33 | |
|
33 |
unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int |
|
|
34 | unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int packetLength, | |
|
34 | 35 | unsigned int coarseTime, unsigned int fineTime, TMHeader_t *TMHeader); |
|
35 | 36 | unsigned char TM_build_data(ccsdsTelecommandPacket_t *TC, char* data, unsigned int SID, unsigned char *computed_CRC); |
|
36 | 37 | int TC_checker(ccsdsTelecommandPacket_t *TC, unsigned int TC_LEN_RCV); |
|
37 | 38 | |
|
38 | 39 | //*********** |
|
39 | 40 | // RTEMS TASK |
|
40 | 41 | rtems_task recv_task( rtems_task_argument unused ); |
|
41 | 42 | rtems_task actn_task( rtems_task_argument unused ); |
|
42 | 43 | int create_message_queue(); |
|
43 | 44 | |
|
44 | 45 | //*********** |
|
45 | 46 | // TC ACTIONS |
|
46 |
int default |
|
|
47 | int action_default(ccsdsTelecommandPacket_t *TC); | |
|
48 | int action_load_norm(ccsdsTelecommandPacket_t *TC); | |
|
49 | int action_enter(ccsdsTelecommandPacket_t *TC); | |
|
47 | 50 | |
|
48 | 51 | #endif // TC_HANDLER_H_INCLUDED |
|
52 | ||
|
53 | ||
|
54 |
@@ -1,34 +1,37 | |||
|
1 | 1 | #include <fsw_processing.h> |
|
2 | 2 | #include <rtems.h> |
|
3 | 3 | |
|
4 | 4 | // RTEMS GLOBAL VARIABLES |
|
5 | 5 | rtems_name misc_name[5]; |
|
6 | 6 | rtems_name misc_id[5]; |
|
7 | 7 | rtems_id Task_id[10]; /* array of task ids */ |
|
8 | 8 | rtems_name Task_name[10]; /* array of task names */ |
|
9 | 9 | int fdSPW; |
|
10 | 10 | int fdUART; |
|
11 | 11 | |
|
12 | 12 | // WAVEFORMS GLOBAL VARIABLES |
|
13 | 13 | volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_SWF_BLK ]; // 24576 bytes |
|
14 | 14 | volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_SWF_BLK ]; // 24576 bytes |
|
15 | 15 | volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_SWF_BLK ]; // 24576 bytes |
|
16 | 16 | volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_SWF_BLK ]; // 24576 bytes |
|
17 | 17 | |
|
18 | 18 | // SPECTRAL MATRICES GLOBAL VARIABLES |
|
19 | 19 | volatile int spec_mat_f0_a[ TOTAL_SIZE_SPEC_MAT ]; |
|
20 | 20 | volatile int spec_mat_f0_b[ TOTAL_SIZE_SPEC_MAT ]; |
|
21 | 21 | volatile int spec_mat_f0_c[ TOTAL_SIZE_SPEC_MAT ]; |
|
22 | 22 | volatile int spec_mat_f0_d[ TOTAL_SIZE_SPEC_MAT ]; |
|
23 | 23 | volatile int spec_mat_f0_e[ TOTAL_SIZE_SPEC_MAT ]; |
|
24 | 24 | volatile int spec_mat_f0_f[ TOTAL_SIZE_SPEC_MAT ]; |
|
25 | 25 | volatile int spec_mat_f0_g[ TOTAL_SIZE_SPEC_MAT ]; |
|
26 | 26 | volatile int spec_mat_f0_h[ TOTAL_SIZE_SPEC_MAT ]; |
|
27 | 27 | // |
|
28 | 28 | float averaged_spec_mat_f0[ TOTAL_SIZE_SPEC_MAT ]; |
|
29 | 29 | float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ]; |
|
30 | 30 | |
|
31 | // BASIC PARAMETERS GLOBAL VAIRABLES | |
|
31 | // NORMAL MODE PARAMETERS | |
|
32 | struct param_norm_str param_norm; | |
|
33 | ||
|
34 | // BASIC PARAMETERS GLOBAL VARIABLES | |
|
32 | 35 | unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_MATRIX_f0 * 9 ]; |
|
33 | 36 | |
|
34 | 37 | BP1_t data_BP1[ NB_BINS_COMPRESSED_MATRIX_f0 ]; |
@@ -1,255 +1,264 | |||
|
1 | 1 | //************************* |
|
2 | 2 | // GPL reminder to be added |
|
3 | 3 | //************************* |
|
4 | 4 | |
|
5 | 5 | #include <rtems.h> |
|
6 | 6 | |
|
7 | 7 | /* configuration information */ |
|
8 | 8 | |
|
9 | 9 | #define CONFIGURE_INIT |
|
10 | 10 | |
|
11 | 11 | #include <bsp.h> /* for device driver prototypes */ |
|
12 | 12 | |
|
13 | 13 | /* configuration information */ |
|
14 | 14 | |
|
15 | 15 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
16 | 16 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
17 | 17 | |
|
18 | 18 | #define CONFIGURE_MAXIMUM_TASKS 10 |
|
19 | 19 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
|
20 | 20 | #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) |
|
21 | 21 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 |
|
22 | 22 | #define CONFIGURE_INIT_TASK_PRIORITY 100 |
|
23 | 23 | #define CONFIGURE_MAXIMUM_DRIVERS 16 |
|
24 | 24 | #define CONFIGURE_MAXIMUM_PERIODS 1 |
|
25 | 25 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 |
|
26 | 26 | |
|
27 | 27 | #include <rtems/confdefs.h> |
|
28 | 28 | |
|
29 | 29 | /* If --drvmgr was enabled during the configuration of the RTEMS kernel */ |
|
30 | 30 | #ifdef RTEMS_DRVMGR_STARTUP |
|
31 | 31 | #ifdef LEON3 |
|
32 | 32 | /* Add Timer and UART Driver */ |
|
33 | 33 | #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
34 | 34 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER |
|
35 | 35 | #endif |
|
36 | 36 | #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
37 | 37 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART |
|
38 | 38 | #endif |
|
39 | 39 | #endif |
|
40 | 40 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */ |
|
41 | 41 | #include <drvmgr/drvmgr_confdefs.h> |
|
42 | 42 | #endif |
|
43 | 43 | |
|
44 | 44 | #include <fsw_init.h> |
|
45 | 45 | #include <fsw_config.c> |
|
46 | 46 | |
|
47 | 47 | char *link_status(int status); |
|
48 | 48 | |
|
49 | 49 | char *lstates[6] = {"Error-reset", |
|
50 | 50 | "Error-wait", |
|
51 | 51 | "Ready", |
|
52 | 52 | "Started", |
|
53 | 53 | "Connecting", |
|
54 | 54 | "Run" |
|
55 | 55 | }; |
|
56 | 56 | |
|
57 | 57 | rtems_task Init( rtems_task_argument ignored ) |
|
58 | 58 | { |
|
59 | 59 | rtems_status_code status; |
|
60 | 60 | |
|
61 | 61 | //send_console_outputs_on_serial_port(); |
|
62 | 62 | |
|
63 | 63 | InitLookUpTableForCRC(); // in tc_handler.h |
|
64 | ||
|
64 | init_default_mode_parameters(); | |
|
65 | 65 | create_message_queue(); |
|
66 | 66 | create_all_tasks(); |
|
67 | 67 | start_all_tasks(); |
|
68 | 68 | |
|
69 | 69 | configure_spw_link(); |
|
70 | 70 | // configure timer for spectral matrices simulation |
|
71 | 71 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, |
|
72 | 72 | IRQ_SPARC_SM, spectral_matrices_isr ); |
|
73 | 73 | // configure timer for waveforms simulation |
|
74 | 74 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR, |
|
75 | 75 | IRQ_SPARC_WF, waveforms_isr ); |
|
76 | 76 | |
|
77 | 77 | LEON_Unmask_interrupt( IRQ_SM ); |
|
78 | 78 | LEON_Unmask_interrupt( IRQ_WF ); |
|
79 | 79 | |
|
80 | 80 | status = rtems_task_delete(RTEMS_SELF); |
|
81 | 81 | } |
|
82 | 82 | |
|
83 | 83 | rtems_task spiq_task(rtems_task_argument unused) |
|
84 | 84 | { |
|
85 | 85 | rtems_event_set event_out; |
|
86 | 86 | struct grspw_regs_str *grspw_regs; |
|
87 | 87 | grspw_regs = (struct grspw_regs_str *) REGS_ADDR_GRSPW; |
|
88 | 88 | |
|
89 | 89 | while(1){ |
|
90 | 90 | PRINTF("In SPIQ *** Waiting for SPW_LINKERR_EVENT\n") |
|
91 | 91 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT |
|
92 | 92 | |
|
93 | 93 | if (rtems_task_suspend(Task_id[1])!=RTEMS_SUCCESSFUL) // suspend RECV task |
|
94 | 94 | PRINTF("In SPIQ *** Error suspending RECV Task\n") |
|
95 | 95 | |
|
96 | 96 | configure_spw_link(); |
|
97 | 97 | |
|
98 | 98 | if (rtems_task_restart(Task_id[1], 1)!=RTEMS_SUCCESSFUL) // restart RECV task |
|
99 | 99 | PRINTF("In SPIQ *** Error resume RECV Task\n") |
|
100 | 100 | } |
|
101 | 101 | } |
|
102 | 102 | |
|
103 | void init_default_mode_parameters() | |
|
104 | { | |
|
105 | param_norm.sy_lfr_n_swf_l = 2048; // nb sample | |
|
106 | param_norm.sy_lfr_n_swf_p = 300; // sec | |
|
107 | param_norm.sy_lfr_n_asm_p = 3600; // sec | |
|
108 | param_norm.sy_lfr_n_bp_p0 = 4; // sec | |
|
109 | param_norm.sy_lfr_n_bp_p1 = 20; // sec | |
|
110 | } | |
|
111 | ||
|
103 | 112 | int create_all_tasks() |
|
104 | 113 | { |
|
105 | 114 | rtems_status_code status; |
|
106 | 115 | |
|
107 | 116 | Task_name[1] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
108 | 117 | Task_name[2] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
109 | 118 | Task_name[3] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
110 | 119 | Task_name[4] = rtems_build_name( 'S', 'M', 'I', 'Q' ); |
|
111 | 120 | Task_name[5] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
|
112 | 121 | Task_name[6] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
113 | 122 | Task_name[7] = rtems_build_name( 'B', 'P', 'F', '0' ); |
|
114 | 123 | Task_name[8] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
115 | 124 | |
|
116 | 125 | // RECV |
|
117 | 126 | status = rtems_task_create( |
|
118 | 127 | Task_name[1], 200, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
119 | 128 | RTEMS_DEFAULT_MODES, |
|
120 | 129 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[1] |
|
121 | 130 | ); |
|
122 | 131 | // ACTN |
|
123 | 132 | status = rtems_task_create( |
|
124 | 133 | Task_name[2], 50, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
125 | 134 | RTEMS_DEFAULT_MODES, |
|
126 | 135 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[2] |
|
127 | 136 | ); |
|
128 | 137 | // SPIQ |
|
129 | 138 | status = rtems_task_create( |
|
130 | 139 | Task_name[3], 50, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
131 | 140 | RTEMS_DEFAULT_MODES, |
|
132 | 141 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[3] |
|
133 | 142 | ); |
|
134 | 143 | // SMIQ |
|
135 | 144 | status = rtems_task_create( |
|
136 | 145 | Task_name[4], 10, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
137 | 146 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
138 | 147 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[4] |
|
139 | 148 | ); |
|
140 | 149 | // STAT |
|
141 | 150 | status = rtems_task_create( |
|
142 | 151 | Task_name[5], 200, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
143 | 152 | RTEMS_DEFAULT_MODES, |
|
144 | 153 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[5] |
|
145 | 154 | ); |
|
146 | 155 | // AVF0 |
|
147 | 156 | status = rtems_task_create( |
|
148 | 157 | Task_name[6], 50, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
149 | 158 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
150 | 159 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[6] |
|
151 | 160 | ); |
|
152 | 161 | // BPF0 |
|
153 | 162 | status = rtems_task_create( |
|
154 | 163 | Task_name[7], 50, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
155 | 164 | RTEMS_DEFAULT_MODES, |
|
156 | 165 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[7] |
|
157 | 166 | ); |
|
158 | 167 | // WFRM |
|
159 | 168 | status = rtems_task_create( |
|
160 | 169 | Task_name[8], 100, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
161 | 170 | RTEMS_DEFAULT_MODES, |
|
162 | 171 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[8] |
|
163 | 172 | ); |
|
164 | 173 | |
|
165 | 174 | return 0; |
|
166 | 175 | } |
|
167 | 176 | |
|
168 | 177 | int start_all_tasks() |
|
169 | 178 | { |
|
170 | 179 | rtems_status_code status; |
|
171 | 180 | |
|
172 | 181 | status = rtems_task_start( Task_id[3], spiq_task, 1 ); |
|
173 | 182 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_SPIQ\n") |
|
174 | 183 | |
|
175 | 184 | status = rtems_task_start( Task_id[1], recv_task, 1 ); |
|
176 | 185 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_RECV\n") |
|
177 | 186 | |
|
178 | 187 | status = rtems_task_start( Task_id[2], actn_task, 1 ); |
|
179 | 188 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_ACTN\n") |
|
180 | 189 | |
|
181 | 190 | status = rtems_task_start( Task_id[4], smiq_task, 1 ); |
|
182 | 191 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_BPPR\n") |
|
183 | 192 | |
|
184 | 193 | status = rtems_task_start( Task_id[5], stat_task, 1 ); |
|
185 | 194 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_STAT\n") |
|
186 | 195 | |
|
187 | 196 | status = rtems_task_start( Task_id[6], avf0_task, 1 ); |
|
188 | 197 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_AVF0\n") |
|
189 | 198 | |
|
190 | 199 | status = rtems_task_start( Task_id[7], bpf0_task, 1 ); |
|
191 | 200 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_BPF0\n") |
|
192 | 201 | |
|
193 | 202 | status = rtems_task_start( Task_id[8], wfrm_task, 1 ); |
|
194 | 203 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_WFRM\n") |
|
195 | 204 | |
|
196 | 205 | return 0; |
|
197 | 206 | } |
|
198 | 207 | |
|
199 | 208 | int configure_spw_link() |
|
200 | 209 | { |
|
201 | 210 | rtems_status_code status; |
|
202 | 211 | |
|
203 | 212 | close(fdSPW); // close the device if it is already open |
|
204 | 213 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call reset the hardware |
|
205 | 214 | if (fdSPW<0) PRINTF("In configure_spw_link *** Error opening"GRSPW_DEVICE_NAME"\n") |
|
206 | 215 | while(ioctl(fdSPW, SPACEWIRE_IOCTRL_START, 0) != RTEMS_SUCCESSFUL){ |
|
207 | 216 | PRINTF("In configure_spw_link *** "GRSPW_DEVICE_NAME" not started, retry\n") |
|
208 | 217 | close(fdSPW); // close the device |
|
209 | 218 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call reset the hardware |
|
210 | 219 | if (fdSPW<0) PRINTF("In configure_spw_link *** Error opening"GRSPW_DEVICE_NAME"\n") |
|
211 | 220 | rtems_task_wake_after(100); |
|
212 | 221 | } |
|
213 | 222 | |
|
214 | 223 | PRINTF("In configure_spw_link *** "GRSPW_DEVICE_NAME" opened and started successfully\n") |
|
215 | 224 | |
|
216 | 225 | // sets a few parameters of the link |
|
217 | 226 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_RMAPEN, 1); // sets the RMAP enable bit |
|
218 | 227 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_RMAPEN\n") |
|
219 | 228 | // |
|
220 | 229 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception |
|
221 | 230 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n") |
|
222 | 231 | // |
|
223 | 232 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[3]); // sets the task ID to which an event is sent when a |
|
224 | 233 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs |
|
225 | 234 | // |
|
226 | 235 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 1); // automatic link-disabling due to link-error interrupts |
|
227 | 236 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n") |
|
228 | 237 | // |
|
229 | 238 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit |
|
230 | 239 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n") |
|
231 | 240 | |
|
232 | 241 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // sets the link-error interrupt bit |
|
233 | 242 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n") |
|
234 | 243 | // |
|
235 | 244 | //status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_DESTKEY, CCSDS_DESTINATION_ID); // sets the destination key |
|
236 | 245 | //if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n") |
|
237 | 246 | // |
|
238 | 247 | PRINTF("In configure_spw_link *** "GRSPW_DEVICE_NAME" configured successfully\n") |
|
239 | 248 | |
|
240 | 249 | return RTEMS_SUCCESSFUL; |
|
241 | 250 | } |
|
242 | 251 | |
|
243 | 252 | char *link_status(int status){ |
|
244 | 253 | return lstates[status]; |
|
245 | 254 | } |
|
246 | 255 | |
|
247 | 256 | rtems_status_code write_spw(spw_ioctl_pkt_send* spw_ioctl_send) |
|
248 | 257 | { |
|
249 | 258 | rtems_status_code status; |
|
250 | 259 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send ); |
|
251 | 260 | if (status!=RTEMS_SUCCESSFUL) printf("In write_spw *** Error SPACEWIRE_IOCTRL_SEND\n"); |
|
252 | 261 | return status; |
|
253 | 262 | } |
|
254 | 263 | |
|
255 | 264 |
@@ -1,396 +1,414 | |||
|
1 | 1 | #include <tc_handler.h> |
|
2 | 2 | #include <fsw_params.h> |
|
3 | 3 | |
|
4 | 4 | char *errorCCSDSMsg[8] = { "ILLEGAL_APID 0", |
|
5 | 5 | "WRONG_LEN_PACKET 1", |
|
6 | 6 | "INCOR_CHECKSUM 2", |
|
7 | 7 | "ILL_TYPE 3", |
|
8 | 8 | "ILL_SUBTYPE 4", |
|
9 | 9 | "WRONG_APP_DATA 5", |
|
10 | 10 | "WRONG_CMD_CODE 6", |
|
11 | 11 | "CCSDS_TM_VALID 7" |
|
12 | 12 | }; |
|
13 | 13 | |
|
14 | 14 | //********************** |
|
15 | 15 | // GENERAL USE FUNCTIONS |
|
16 | 16 | unsigned int Crc_opt( unsigned char D, unsigned int Chk) |
|
17 | 17 | { |
|
18 | 18 | return(((Chk << 8) & 0xff00)^lookUpTableForCRC [(((Chk >> 8)^D) & 0x00ff)]); |
|
19 | 19 | } |
|
20 | 20 | |
|
21 | 21 | void InitLookUpTableForCRC() |
|
22 | 22 | { |
|
23 | 23 | unsigned int i, tmp; |
|
24 | 24 | for (i=0; i<256; i++) |
|
25 | 25 | { |
|
26 | 26 | tmp = 0; |
|
27 | 27 | if((i & 1) != 0) tmp = tmp ^ 0x1021; |
|
28 | 28 | if((i & 2) != 0) tmp = tmp ^ 0x2042; |
|
29 | 29 | if((i & 4) != 0) tmp = tmp ^ 0x4084; |
|
30 | 30 | if((i & 8) != 0) tmp = tmp ^ 0x8108; |
|
31 | 31 | if((i & 16) != 0) tmp = tmp ^ 0x1231; |
|
32 | 32 | if((i & 32) != 0) tmp = tmp ^ 0x2462; |
|
33 | 33 | if((i & 64) != 0) tmp = tmp ^ 0x48c4; |
|
34 | 34 | if((i & 128) != 0) tmp = tmp ^ 0x9188; |
|
35 | 35 | lookUpTableForCRC[i] = tmp; |
|
36 | 36 | } |
|
37 | 37 | } |
|
38 | 38 | |
|
39 | 39 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData) |
|
40 | 40 | { |
|
41 | 41 | unsigned int Chk; |
|
42 | 42 | int j; |
|
43 | 43 | Chk = 0xffff; // reset the syndrom to all ones |
|
44 | 44 | for (j=0; j<sizeOfData; j++) { |
|
45 | 45 | Chk = Crc_opt(data[j], Chk); |
|
46 | 46 | } |
|
47 | 47 | crcAsTwoBytes[0] = (unsigned char) (Chk >> 8); |
|
48 | 48 | crcAsTwoBytes[1] = (unsigned char) (Chk & 0x00ff); |
|
49 | 49 | } |
|
50 | 50 | |
|
51 | 51 | |
|
52 | 52 | //********************* |
|
53 | 53 | // ACCEPTANCE FUNCTIONS |
|
54 | 54 | int TC_checker(ccsdsTelecommandPacket_t *TC, unsigned int tc_len_recv) |
|
55 | 55 | { |
|
56 | 56 | rtems_status_code status; |
|
57 | 57 | spw_ioctl_pkt_send spw_ioctl_send; |
|
58 | 58 | TMHeader_t TM_header; |
|
59 | 59 | unsigned int code = 0; |
|
60 | 60 | unsigned char computed_CRC[2]; |
|
61 | 61 | char data[ TM_LEN_EXE_CORR + CCSDS_TC_TM_PACKET_OFFSET - TM_HEADER_LEN ]; |
|
62 | 62 | |
|
63 | 63 | GetCRCAsTwoBytes( (unsigned char*) TC->packetID, computed_CRC, tc_len_recv + 5 ); |
|
64 | 64 | code = acceptTM( TC, tc_len_recv ) ; |
|
65 | 65 | if ( (code == 0) | (code == 1) | (code == 2) |
|
66 | 66 | | (code == 3) | (code == 4) | (code == 5) ) |
|
67 | 67 | { // generate TM_LFR_TC_EXE_CORRUPTED |
|
68 | 68 | // BUILD HEADER |
|
69 |
TM_build_header( TM_LFR_TC_EXE_ERR |
|
|
69 | TM_build_header( TM_LFR_TC_EXE_ERR, TM_LEN_EXE_CORR, 0, 0, &TM_header); | |
|
70 | 70 | // BUILD DATA |
|
71 | 71 | TM_build_data( TC, data, SID_EXE_CORR, computed_CRC); |
|
72 | 72 | // PREPARE TM SENDING |
|
73 | 73 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header |
|
74 | 74 | spw_ioctl_send.hdr = (char*) &TM_header; |
|
75 | 75 | spw_ioctl_send.dlen = TM_LEN_EXE_CORR + CCSDS_TC_TM_PACKET_OFFSET - TM_HEADER_LEN; |
|
76 | 76 | spw_ioctl_send.data = data; |
|
77 | 77 | // SEND PACKET |
|
78 | 78 | write_spw(&spw_ioctl_send); |
|
79 | 79 | } |
|
80 | else { // TM_LFR_TC_EXE_NOT_IMPLEMENTED | |
|
80 | else { // send valid TC to the action launcher | |
|
81 | 81 | status = rtems_message_queue_send( misc_id[0], TC, tc_len_recv + CCSDS_TC_TM_PACKET_OFFSET); |
|
82 | 82 | return -1; |
|
83 | 83 | } |
|
84 | 84 | return -1; |
|
85 | 85 | } |
|
86 | 86 | |
|
87 | 87 | unsigned char acceptTM(ccsdsTelecommandPacket_t * TMPacket, unsigned int TC_LEN_RCV) |
|
88 | 88 | { |
|
89 | 89 | unsigned char pid = 0; |
|
90 | 90 | unsigned char category = 0; |
|
91 | 91 | unsigned int length = 0; |
|
92 | 92 | unsigned char packetType = 0; |
|
93 | 93 | unsigned char packetSubtype = 0; |
|
94 | 94 | unsigned char * CCSDSContent; |
|
95 | 95 | |
|
96 | 96 | // APID check *** APID on 2 bytes |
|
97 | 97 | pid = ((TMPacket->packetID[0] & 0x07)<<4) + ( (TMPacket->packetID[1]>>4) & 0x0f ); // PID = 11 *** 7 bits xxxxx210 7654xxxx |
|
98 | 98 | category = (TMPacket->packetID[1] & 0x0f); // PACKET_CATEGORY = 12 *** 4 bits xxxxxxxx xxxx3210 |
|
99 | 99 | if (pid!=CCSDS_PROCESS_ID) return ILLEGAL_APID; |
|
100 | 100 | if (category!=CCSDS_PACKET_CATEGORY) return ILLEGAL_APID; |
|
101 | 101 | |
|
102 | 102 | // packet length check |
|
103 | 103 | length = TMPacket->packetLength[0] * 256 + TMPacket->packetLength[1]; |
|
104 | 104 | if (length != TC_LEN_RCV ) return WRONG_LEN_PACKET; // LEN RCV != SIZE FIELD |
|
105 | 105 | if (length >= CCSDS_TC_PKT_MAX_SIZE) return WRONG_LEN_PACKET; // check that the packet does not exceed the MAX size |
|
106 | 106 | |
|
107 | 107 | packetType = TMPacket->dataFieldHeader[1]; |
|
108 | 108 | packetSubtype = TMPacket->dataFieldHeader[2]; |
|
109 | 109 | // service type, subtype and packet length check |
|
110 | 110 | if (packetType == 181){ |
|
111 | 111 | switch(packetSubtype){ //subtype, autorized values are 3, 20, 21, 24, 27, 28, 30, 40, 50, 60, 61 |
|
112 | 112 | case 3: |
|
113 | 113 | if (length!=(12-CCSDS_TC_TM_PACKET_OFFSET)) return WRONG_LEN_PACKET; |
|
114 | 114 | break; |
|
115 | 115 | case 20: |
|
116 | 116 | if (length!=(14-CCSDS_TC_TM_PACKET_OFFSET)) return WRONG_LEN_PACKET; |
|
117 | 117 | break; |
|
118 | 118 | case 21: |
|
119 | 119 | if (length!=(20-CCSDS_TC_TM_PACKET_OFFSET)) return WRONG_LEN_PACKET; |
|
120 | 120 | break; |
|
121 | 121 | case 24: |
|
122 | 122 | if (length!=(14-CCSDS_TC_TM_PACKET_OFFSET)) return WRONG_LEN_PACKET; |
|
123 | 123 | break; |
|
124 | 124 | case 27: |
|
125 | 125 | if (length!=(14-CCSDS_TC_TM_PACKET_OFFSET)) return WRONG_LEN_PACKET; |
|
126 | 126 | break; |
|
127 | 127 | case 28: |
|
128 | 128 | if (length!=(14-CCSDS_TC_TM_PACKET_OFFSET)) return WRONG_LEN_PACKET; |
|
129 | 129 | break; |
|
130 | 130 | case 30: |
|
131 | 131 | if (length!=(12-CCSDS_TC_TM_PACKET_OFFSET)) return WRONG_LEN_PACKET; |
|
132 | 132 | break; |
|
133 | 133 | case 40: |
|
134 | 134 | if (length!=(20-CCSDS_TC_TM_PACKET_OFFSET)) return WRONG_LEN_PACKET; |
|
135 | 135 | break; |
|
136 | 136 | case 50: |
|
137 | 137 | if (length!=(50-CCSDS_TC_TM_PACKET_OFFSET)) return WRONG_LEN_PACKET; |
|
138 | 138 | break; |
|
139 | 139 | case 60: |
|
140 | 140 | if (length!=(12-CCSDS_TC_TM_PACKET_OFFSET)) return WRONG_LEN_PACKET; |
|
141 | 141 | break; |
|
142 | 142 | case 61: |
|
143 | 143 | if (length!=(12-CCSDS_TC_TM_PACKET_OFFSET)) return WRONG_LEN_PACKET; |
|
144 | 144 | break; |
|
145 | 145 | default: |
|
146 | 146 | return ILL_SUBTYPE; |
|
147 | 147 | break; |
|
148 | 148 | } |
|
149 | 149 | } |
|
150 | 150 | else if (packetType == 9){ |
|
151 | 151 | if (packetSubtype!=129) return ILL_SUBTYPE; |
|
152 | 152 | if (length!=(18-CCSDS_TC_TM_PACKET_OFFSET)) return WRONG_LEN_PACKET; |
|
153 | 153 | } |
|
154 | 154 | else return ILL_TYPE; |
|
155 | 155 | |
|
156 | 156 | // source ID check // Source ID not documented in the ICD |
|
157 | 157 | |
|
158 | 158 | // packet error control, CRC check |
|
159 | 159 | CCSDSContent = (unsigned char*) TMPacket->packetID; |
|
160 | 160 | GetCRCAsTwoBytes(CCSDSContent, currentTC_COMPUTED_CRC, length + CCSDS_TC_TM_PACKET_OFFSET - 2); // 2 CRC bytes removed from the calculation of the CRC |
|
161 | 161 | if (currentTC_COMPUTED_CRC[0] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -2]) return INCOR_CHECKSUM; |
|
162 | 162 | if (currentTC_COMPUTED_CRC[1] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -1]) return INCOR_CHECKSUM; |
|
163 | 163 | |
|
164 | 164 | return CCSDS_TM_VALID; |
|
165 | 165 | } |
|
166 | 166 | |
|
167 |
unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int |
|
|
167 | unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int packetLength, | |
|
168 | 168 | unsigned int coarseTime, unsigned int fineTime, TMHeader_t *TMHeader) |
|
169 | 169 | { |
|
170 | 170 | TMHeader->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
171 | 171 | TMHeader->protocolIdentifier = 0x02; |
|
172 | 172 | TMHeader->reserved = 0x00; |
|
173 | 173 | TMHeader->userApplication = 0x00; |
|
174 | 174 | TMHeader->packetID[0] = 0x0c; |
|
175 | 175 | TMHeader->packetSequenceControl[0] = 0xc0; |
|
176 | 176 | TMHeader->packetSequenceControl[1] = 0x00; |
|
177 | 177 | TMHeader->packetLength[0] = (unsigned char) (packetLength>>8); |
|
178 | 178 | TMHeader->packetLength[1] = (unsigned char) packetLength; |
|
179 | 179 | TMHeader->dataFieldHeader[0] = 0x10; |
|
180 | 180 | TMHeader->dataFieldHeader[3] = CCSDS_DESTINATION_ID; |
|
181 | 181 | switch (tm_type){ |
|
182 | 182 | case(TM_LFR_TC_EXE_OK): |
|
183 | 183 | TMHeader->packetID[1] = 0xc1; |
|
184 | 184 | TMHeader->dataFieldHeader[1] = 1; // type |
|
185 | 185 | TMHeader->dataFieldHeader[2] = 7; // subtype |
|
186 | 186 | break; |
|
187 | 187 | case(TM_LFR_TC_EXE_ERR): |
|
188 | 188 | TMHeader->packetID[1] = 0xc1; |
|
189 | 189 | TMHeader->dataFieldHeader[1] = 1; // type |
|
190 | 190 | TMHeader->dataFieldHeader[2] = 8; // subtype |
|
191 | 191 | break; |
|
192 | 192 | case(TM_LFR_HK): |
|
193 | 193 | TMHeader->packetID[1] = 0xc4; |
|
194 | 194 | TMHeader->dataFieldHeader[1] = 3; // type |
|
195 | 195 | TMHeader->dataFieldHeader[2] = 25; // subtype |
|
196 | 196 | break; |
|
197 | 197 | case(TM_LFR_SCI): |
|
198 | 198 | TMHeader->packetID[1] = 0xcc; |
|
199 | 199 | TMHeader->dataFieldHeader[1] = 21; // type |
|
200 | 200 | TMHeader->dataFieldHeader[2] = 3; // subtype |
|
201 | 201 | break; |
|
202 | 202 | case(TM_LFR_SCI_SBM): |
|
203 | 203 | TMHeader->packetID[1] = 0xfc; |
|
204 | 204 | TMHeader->dataFieldHeader[1] = 21; // type |
|
205 | 205 | TMHeader->dataFieldHeader[2] = 3; // subtype |
|
206 | 206 | break; |
|
207 | 207 | case(TM_LFR_PAR_DUMP): |
|
208 | 208 | TMHeader->packetID[1] = 0xc9; |
|
209 | 209 | TMHeader->dataFieldHeader[1] = 181; // type |
|
210 | 210 | TMHeader->dataFieldHeader[2] = 31; // subtype |
|
211 | 211 | break; |
|
212 | 212 | default: |
|
213 | 213 | return 0; |
|
214 | 214 | } |
|
215 | 215 | /*TMHeader->dataFieldHeader[4] = (unsigned char) (coarseTime>>24); |
|
216 | 216 | TMHeader->dataFieldHeader[5] = (unsigned char) (coarseTime>>16); |
|
217 | 217 | TMHeader->dataFieldHeader[6] = (unsigned char) (coarseTime>>8); |
|
218 | 218 | TMHeader->dataFieldHeader[7] = (unsigned char) (coarseTime); |
|
219 | 219 | TMHeader->dataFieldHeader[8] = (unsigned char) (fineTime>>8); |
|
220 | 220 | TMHeader->dataFieldHeader[9] = (unsigned char) (fineTime);*/ |
|
221 | 221 | TMHeader->dataFieldHeader[4] = 0xaa; |
|
222 | 222 | TMHeader->dataFieldHeader[5] = 0xbb; |
|
223 | 223 | TMHeader->dataFieldHeader[6] = 0xcc; |
|
224 | 224 | TMHeader->dataFieldHeader[7] = 0xdd; |
|
225 | 225 | TMHeader->dataFieldHeader[8] = 0xee; |
|
226 | 226 | TMHeader->dataFieldHeader[9] = 0xff; |
|
227 | 227 | return 1; |
|
228 | 228 | } |
|
229 | 229 | |
|
230 | 230 | unsigned char TM_build_data(ccsdsTelecommandPacket_t *TC, char* data, unsigned int SID, unsigned char *computed_CRC) |
|
231 | 231 | { |
|
232 | 232 | unsigned int packetLength; |
|
233 | 233 | packetLength = TC->packetLength[0] * 256 + TC->packetLength[1]; |
|
234 | 234 | switch (SID){ |
|
235 | 235 | case (SID_NOT_EXE): |
|
236 | 236 | break; |
|
237 | 237 | case (SID_NOT_IMP): |
|
238 | 238 | data[0] = 0x9c; |
|
239 | 239 | data[1] = 0x42; |
|
240 | 240 | data[2] = TC->packetID[0]; |
|
241 | 241 | data[3] = TC->packetID[1]; |
|
242 | 242 | data[4] = TC->packetSequenceControl[0]; |
|
243 | 243 | data[5] = TC->packetSequenceControl[1]; |
|
244 | 244 | data[6] = TC->dataFieldHeader[1]; // type |
|
245 | 245 | data[7] = TC->dataFieldHeader[2]; // subtype |
|
246 | 246 | break; |
|
247 | 247 | case (SID_EXE_ERR): |
|
248 | 248 | break; |
|
249 | 249 | case (SID_EXE_CORR): |
|
250 | 250 | data[0] = 0x9c; |
|
251 | 251 | data[1] = 0x45; |
|
252 | 252 | data[2] = TC->packetID[0]; |
|
253 | 253 | data[3] = TC->packetID[1]; |
|
254 | 254 | data[4] = TC->packetSequenceControl[0]; |
|
255 | 255 | data[5] = TC->packetSequenceControl[1]; |
|
256 | 256 | data[6] = TC->dataFieldHeader[1]; // type |
|
257 | 257 | data[7] = TC->dataFieldHeader[2]; // subtype |
|
258 | 258 | data[8] = currentTC_LEN_RCV[0]; |
|
259 | 259 | data[9] = currentTC_LEN_RCV[1]; |
|
260 | 260 | data[10] = TC->packetLength[0]; |
|
261 | 261 | data[11] = TC->packetLength[1]; |
|
262 | 262 | data[12] = TC->dataAndCRC[packetLength]; |
|
263 | 263 | data[13] = TC->dataAndCRC[packetLength+1]; |
|
264 | 264 | data[14] = computed_CRC[0]; |
|
265 | 265 | data[15] = computed_CRC[1]; |
|
266 | 266 | break; |
|
267 | 267 | default: |
|
268 | 268 | return 0; |
|
269 | 269 | } |
|
270 | 270 | return 1; |
|
271 | 271 | } |
|
272 | 272 | |
|
273 | 273 | //*********** |
|
274 | 274 | // RTEMS TASK |
|
275 | 275 | rtems_task recv_task( rtems_task_argument unused ) |
|
276 | 276 | { |
|
277 | 277 | int len = 0; |
|
278 | 278 | unsigned int i = 0; |
|
279 | 279 | unsigned int data_length = 0; |
|
280 | 280 | ccsdsTelecommandPacket_t currentTC; |
|
281 | 281 | char data[100]; |
|
282 | 282 | |
|
283 | 283 | for(i=0; i<100; i++) data[i] = 0; |
|
284 | 284 | |
|
285 | 285 | PRINTF("In RECV *** \n") |
|
286 | 286 | |
|
287 | 287 | while(1) |
|
288 | 288 | { |
|
289 | 289 | len = read(fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE); // the call to read is blocking |
|
290 | 290 | if (len == -1){ // error during the read call |
|
291 | 291 | PRINTF("In RECV *** last read call returned -1\n") |
|
292 | 292 | if (rtems_event_send( Task_id[3], SPW_LINKERR_EVENT ) != RTEMS_SUCCESSFUL) |
|
293 | 293 | PRINTF("IN RECV *** Error: rtems_event_send SPW_LINKERR_EVENT\n") |
|
294 | 294 | if (rtems_task_suspend(RTEMS_SELF) != RTEMS_SUCCESSFUL) |
|
295 | 295 | PRINTF("In RECV *** Error: rtems_task_suspend(RTEMS_SELF)\n") |
|
296 | 296 | } |
|
297 | 297 | else { |
|
298 | 298 | //PRINTF1("In RECV *** Got Message of length %d\n", len) |
|
299 | 299 | currentTC_LEN_RCV[0] = 0x00; |
|
300 | 300 | currentTC_LEN_RCV[1] = (unsigned char) len - CCSDS_TC_TM_PACKET_OFFSET - 3; // build the corresponding packet size field |
|
301 | 301 | currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) len - CCSDS_TC_TM_PACKET_OFFSET - 3; // => -3 is for Prot ID, Reserved and User App bytes |
|
302 | 302 | // CHECK THE TC AND BUILD THE APPROPRIATE TM |
|
303 | 303 | data_length = TC_checker(¤tTC, currentTC_LEN_RCV_AsUnsignedInt); |
|
304 | 304 | if (data_length!=-1) |
|
305 | 305 | { |
|
306 | 306 | } |
|
307 | 307 | } |
|
308 | 308 | } |
|
309 | 309 | } |
|
310 | 310 | |
|
311 | 311 | rtems_task actn_task( rtems_task_argument unused ) |
|
312 | 312 | { |
|
313 | 313 | rtems_status_code status; // RTEMS status code |
|
314 | 314 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task |
|
315 | 315 | size_t size; // size of the incoming TC packet |
|
316 | 316 | unsigned char subtype = 0; // subtype of the current TC packet |
|
317 | 317 | |
|
318 | 318 | while(1) |
|
319 | 319 | { |
|
320 | 320 | status = rtems_message_queue_receive(misc_id[0], (char*) &TC, &size, |
|
321 | 321 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); |
|
322 | 322 | if (status!=RTEMS_SUCCESSFUL) PRINTF1("in task ACTN *** error receiving a message, code %d \n", status) |
|
323 | 323 | else |
|
324 | 324 | { |
|
325 | 325 | subtype = TC.dataFieldHeader[2]; |
|
326 | 326 | switch(subtype) |
|
327 | 327 | { |
|
328 | 328 | case TC_SUBTYPE_RESET: |
|
329 | 329 | break; |
|
330 | 330 | case TC_SUBTYPE_LOAD_COMM: |
|
331 | 331 | break; |
|
332 | 332 | case TC_SUBTYPE_LOAD_NORM: |
|
333 | action_load_norm( &TC ); | |
|
333 | 334 | break; |
|
334 | 335 | case TC_SUBTYPE_LOAD_BURST: |
|
335 | 336 | break; |
|
336 | 337 | case TC_SUBTYPE_LOAD_SBM1: |
|
337 | 338 | break; |
|
338 | 339 | case TC_SUBTYPE_LOAD_SBM2: |
|
339 | 340 | break; |
|
340 | 341 | case TC_SUBTYPE_DUMP: |
|
341 |
default |
|
|
342 | action_default( &TC ); | |
|
342 | 343 | break; |
|
343 | 344 | case TC_SUBTYPE_ENTER: |
|
345 | action_enter( &TC ); | |
|
344 | 346 | break; |
|
345 | 347 | case TC_SUBTYPE_UPDT_INFO: |
|
346 | 348 | break; |
|
347 | 349 | case TC_SUBTYPE_EN_CAL: |
|
348 | 350 | break; |
|
349 | 351 | case TC_SUBTYPE_DIS_CAL: |
|
350 | 352 | break; |
|
351 | 353 | case TC_SUBTYPE_UPDT_TIME: |
|
352 | 354 | break; |
|
353 | 355 | default: |
|
354 | 356 | break; |
|
355 | 357 | } |
|
356 | 358 | } |
|
357 | 359 | } |
|
358 | 360 | } |
|
359 | 361 | |
|
360 | 362 | int create_message_queue() |
|
361 | 363 | { |
|
362 | 364 | rtems_status_code status; |
|
363 | 365 | misc_name[0] = rtems_build_name( 'Q', 'U', 'E', 'U' ); |
|
364 | 366 | status = rtems_message_queue_create( misc_name[0], ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE, |
|
365 | 367 | RTEMS_FIFO | RTEMS_LOCAL, &misc_id[0] ); |
|
366 | 368 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in create_message_queue *** error creating message queue\n") |
|
367 | 369 | |
|
368 | 370 | return 0; |
|
369 | 371 | } |
|
370 | 372 | |
|
371 | 373 | //*********** |
|
372 | 374 | // TC ACTIONS |
|
373 |
int default |
|
|
375 | int action_default(ccsdsTelecommandPacket_t *TC) | |
|
374 | 376 | { |
|
375 | 377 | char data[100]; // buffer for the generic TM packet |
|
376 | 378 | TMHeader_t TM_header; // TM header |
|
377 | 379 | spw_ioctl_pkt_send spw_ioctl_send; // structure to send the TM packet if any |
|
378 | 380 | // BUILD HEADER |
|
379 |
TM_build_header( TM_LFR_TC_EXE_ERR |
|
|
381 | TM_build_header( TM_LFR_TC_EXE_ERR, TM_LEN_NOT_IMP, 0, 0, &TM_header); | |
|
380 | 382 | // BUILD DATA |
|
381 | 383 | TM_build_data( TC, data, SID_NOT_IMP, NULL); |
|
382 | 384 | // filling the strture for the spcawire transmission |
|
383 | 385 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header |
|
384 | 386 | spw_ioctl_send.hdr = (char*) &TM_header; |
|
385 | 387 | spw_ioctl_send.dlen = TM_LEN_NOT_IMP + CCSDS_TC_TM_PACKET_OFFSET - TM_HEADER_LEN; |
|
386 | 388 | spw_ioctl_send.data = data; |
|
387 | 389 | // SEND DATA |
|
388 | 390 | write_spw(&spw_ioctl_send); |
|
389 | 391 | |
|
390 | 392 | return 0; |
|
391 | 393 | } |
|
392 | 394 | |
|
395 | int action_enter(ccsdsTelecommandPacket_t *TC) | |
|
396 | { | |
|
397 | return 0; | |
|
398 | } | |
|
399 | ||
|
400 | int action_load_norm(ccsdsTelecommandPacket_t *TC) | |
|
401 | { | |
|
402 | param_norm.sy_lfr_n_swf_l = TC->dataAndCRC[0] * 256 + TC->dataAndCRC[1]; | |
|
403 | param_norm.sy_lfr_n_swf_p = TC->dataAndCRC[2] * 256 + TC->dataAndCRC[3]; | |
|
404 | param_norm.sy_lfr_n_asm_p = TC->dataAndCRC[4] * 256 + TC->dataAndCRC[5]; | |
|
405 | param_norm.sy_lfr_n_bp_p0 = TC->dataAndCRC[6]; | |
|
406 | param_norm.sy_lfr_n_bp_p1 = TC->dataAndCRC[7]; | |
|
407 | printf("sy_lfr_n_ => swf_l %d, swf_p %d, asm_p %d, bsp_p0 %d, bsp_p1 %d\n", | |
|
408 | param_norm.sy_lfr_n_swf_l, param_norm.sy_lfr_n_swf_p, | |
|
409 | param_norm.sy_lfr_n_asm_p, param_norm.sy_lfr_n_bp_p0, param_norm.sy_lfr_n_bp_p1); | |
|
410 | return 0; | |
|
411 | } | |
|
393 | 412 | |
|
394 | 413 | |
|
395 | 414 | |
|
396 |
General Comments 0
You need to be logged in to leave comments.
Login now