@@ -0,0 +1,19 | |||||
|
1 | #ifndef TC_LOAD_DUMP_PARAMETERS_H | |||
|
2 | #define TC_LOAD_DUMP_PARAMETERS_H | |||
|
3 | ||||
|
4 | #include "tc_handler.h" | |||
|
5 | ||||
|
6 | int action_load_common_par( ccsdsTelecommandPacket_t *TC ); | |||
|
7 | int action_load_normal_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |||
|
8 | int action_load_burst_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |||
|
9 | int action_load_sbm1_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |||
|
10 | int action_load_sbm2_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |||
|
11 | int action_dump_par(rtems_id queue_id ); | |||
|
12 | ||||
|
13 | int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |||
|
14 | int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |||
|
15 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |||
|
16 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |||
|
17 | int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |||
|
18 | ||||
|
19 | #endif // TC_LOAD_DUMP_PARAMETERS_H |
@@ -0,0 +1,377 | |||||
|
1 | /** Functions to load and dump parameters in the LFR registers. | |||
|
2 | * | |||
|
3 | * @file | |||
|
4 | * @author P. LEROY | |||
|
5 | * | |||
|
6 | * A group of functions to handle TC related to parameter loading and dumping.\n | |||
|
7 | * TC_LFR_LOAD_COMMON_PAR\n | |||
|
8 | * TC_LFR_LOAD_NORMAL_PAR\n | |||
|
9 | * TC_LFR_LOAD_BURST_PAR\n | |||
|
10 | * TC_LFR_LOAD_SBM1_PAR\n | |||
|
11 | * TC_LFR_LOAD_SBM2_PAR\n | |||
|
12 | * | |||
|
13 | */ | |||
|
14 | ||||
|
15 | #include "tc_load_dump_parameters.h" | |||
|
16 | ||||
|
17 | int action_load_common_par(ccsdsTelecommandPacket_t *TC) | |||
|
18 | { | |||
|
19 | /** This function updates the LFR registers with the incoming common parameters. | |||
|
20 | * | |||
|
21 | * @param TC points to the TeleCommand packet that is being processed | |||
|
22 | * | |||
|
23 | * | |||
|
24 | */ | |||
|
25 | parameter_dump_packet.unused0 = TC->dataAndCRC[0]; | |||
|
26 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1]; | |||
|
27 | set_wfp_data_shaping(parameter_dump_packet.bw_sp0_sp1_r0_r1); | |||
|
28 | return LFR_SUCCESSFUL; | |||
|
29 | } | |||
|
30 | ||||
|
31 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |||
|
32 | { | |||
|
33 | /** This function updates the LFR registers with the incoming normal parameters. | |||
|
34 | * | |||
|
35 | * @param TC points to the TeleCommand packet that is being processed | |||
|
36 | * @param queue_id is the id of the queue which handles TM related to this execution step | |||
|
37 | * | |||
|
38 | */ | |||
|
39 | int result; | |||
|
40 | int flag; | |||
|
41 | ||||
|
42 | flag = LFR_SUCCESSFUL; | |||
|
43 | result = LFR_SUCCESSFUL; | |||
|
44 | ||||
|
45 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { | |||
|
46 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |||
|
47 | flag = LFR_DEFAULT; | |||
|
48 | } | |||
|
49 | ||||
|
50 | //*************** | |||
|
51 | // sy_lfr_n_swf_l | |||
|
52 | if (flag == LFR_SUCCESSFUL) | |||
|
53 | { | |||
|
54 | result = set_sy_lfr_n_swf_l( TC, queue_id ); | |||
|
55 | if (result != LFR_SUCCESSFUL) | |||
|
56 | { | |||
|
57 | flag = LFR_DEFAULT; | |||
|
58 | } | |||
|
59 | } | |||
|
60 | ||||
|
61 | //*************** | |||
|
62 | // sy_lfr_n_swf_p | |||
|
63 | if (flag == LFR_SUCCESSFUL) | |||
|
64 | { | |||
|
65 | result = set_sy_lfr_n_swf_p( TC, queue_id ); | |||
|
66 | if (result != LFR_SUCCESSFUL) | |||
|
67 | { | |||
|
68 | flag = LFR_DEFAULT; | |||
|
69 | } | |||
|
70 | } | |||
|
71 | ||||
|
72 | //*************** | |||
|
73 | // sy_lfr_n_asm_p | |||
|
74 | if (flag == LFR_SUCCESSFUL) | |||
|
75 | { | |||
|
76 | result = set_sy_lfr_n_asm_p( TC, queue_id ); | |||
|
77 | if (result != LFR_SUCCESSFUL) | |||
|
78 | { | |||
|
79 | flag = LFR_DEFAULT; | |||
|
80 | } | |||
|
81 | } | |||
|
82 | ||||
|
83 | //*************** | |||
|
84 | // sy_lfr_n_bp_p0 | |||
|
85 | if (flag == LFR_SUCCESSFUL) | |||
|
86 | { | |||
|
87 | result = set_sy_lfr_n_bp_p0( TC, queue_id ); | |||
|
88 | if (result != LFR_SUCCESSFUL) | |||
|
89 | { | |||
|
90 | flag = LFR_DEFAULT; | |||
|
91 | } | |||
|
92 | } | |||
|
93 | ||||
|
94 | //*************** | |||
|
95 | // sy_lfr_n_bp_p1 | |||
|
96 | if (flag == LFR_SUCCESSFUL) | |||
|
97 | { | |||
|
98 | result = set_sy_lfr_n_bp_p1( TC, queue_id ); | |||
|
99 | if (result != LFR_SUCCESSFUL) | |||
|
100 | { | |||
|
101 | flag = LFR_DEFAULT; | |||
|
102 | } | |||
|
103 | } | |||
|
104 | ||||
|
105 | return result; | |||
|
106 | } | |||
|
107 | ||||
|
108 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |||
|
109 | { | |||
|
110 | /** This function updates the LFR registers with the incoming burst parameters. | |||
|
111 | * | |||
|
112 | * @param TC points to the TeleCommand packet that is being processed | |||
|
113 | * @param queue_id is the id of the queue which handles TM related to this execution step | |||
|
114 | * | |||
|
115 | */ | |||
|
116 | int result; | |||
|
117 | unsigned char lfrMode; | |||
|
118 | ||||
|
119 | result = LFR_DEFAULT; | |||
|
120 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |||
|
121 | ||||
|
122 | if ( lfrMode == LFR_MODE_BURST ) { | |||
|
123 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |||
|
124 | result = LFR_DEFAULT; | |||
|
125 | } | |||
|
126 | else { | |||
|
127 | parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0]; | |||
|
128 | parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1]; | |||
|
129 | ||||
|
130 | result = LFR_SUCCESSFUL; | |||
|
131 | } | |||
|
132 | ||||
|
133 | return result; | |||
|
134 | } | |||
|
135 | ||||
|
136 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |||
|
137 | { | |||
|
138 | /** This function updates the LFR registers with the incoming sbm1 parameters. | |||
|
139 | * | |||
|
140 | * @param TC points to the TeleCommand packet that is being processed | |||
|
141 | * @param queue_id is the id of the queue which handles TM related to this execution step | |||
|
142 | * | |||
|
143 | */ | |||
|
144 | int result; | |||
|
145 | unsigned char lfrMode; | |||
|
146 | ||||
|
147 | result = LFR_DEFAULT; | |||
|
148 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |||
|
149 | ||||
|
150 | if ( lfrMode == LFR_MODE_SBM1 ) { | |||
|
151 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |||
|
152 | result = LFR_DEFAULT; | |||
|
153 | } | |||
|
154 | else { | |||
|
155 | parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0]; | |||
|
156 | parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1]; | |||
|
157 | ||||
|
158 | result = LFR_SUCCESSFUL; | |||
|
159 | } | |||
|
160 | ||||
|
161 | return result; | |||
|
162 | } | |||
|
163 | ||||
|
164 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |||
|
165 | { | |||
|
166 | /** This function updates the LFR registers with the incoming sbm2 parameters. | |||
|
167 | * | |||
|
168 | * @param TC points to the TeleCommand packet that is being processed | |||
|
169 | * @param queue_id is the id of the queue which handles TM related to this execution step | |||
|
170 | * | |||
|
171 | */ | |||
|
172 | ||||
|
173 | int result; | |||
|
174 | unsigned char lfrMode; | |||
|
175 | ||||
|
176 | result = LFR_DEFAULT; | |||
|
177 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |||
|
178 | ||||
|
179 | if ( lfrMode == LFR_MODE_SBM2 ) { | |||
|
180 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |||
|
181 | result = LFR_DEFAULT; | |||
|
182 | } | |||
|
183 | else { | |||
|
184 | parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0]; | |||
|
185 | parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1]; | |||
|
186 | ||||
|
187 | result = LFR_SUCCESSFUL; | |||
|
188 | } | |||
|
189 | ||||
|
190 | return result; | |||
|
191 | } | |||
|
192 | ||||
|
193 | int action_dump_par( rtems_id queue_id ) | |||
|
194 | { | |||
|
195 | /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue. | |||
|
196 | * | |||
|
197 | * @param queue_id is the id of the queue which handles TM related to this execution step. | |||
|
198 | * | |||
|
199 | * @return RTEMS directive status codes: | |||
|
200 | * - RTEMS_SUCCESSFUL - message sent successfully | |||
|
201 | * - RTEMS_INVALID_ID - invalid queue id | |||
|
202 | * - RTEMS_INVALID_SIZE - invalid message size | |||
|
203 | * - RTEMS_INVALID_ADDRESS - buffer is NULL | |||
|
204 | * - RTEMS_UNSATISFIED - out of message buffers | |||
|
205 | * - RTEMS_TOO_MANY - queue s limit has been reached | |||
|
206 | * | |||
|
207 | */ | |||
|
208 | ||||
|
209 | int status; | |||
|
210 | ||||
|
211 | // SEND DATA | |||
|
212 | status = rtems_message_queue_send( queue_id, ¶meter_dump_packet, | |||
|
213 | PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); | |||
|
214 | if (status != RTEMS_SUCCESSFUL) { | |||
|
215 | PRINTF1("in action_dump *** ERR sending packet, code %d", status) | |||
|
216 | } | |||
|
217 | ||||
|
218 | return status; | |||
|
219 | } | |||
|
220 | ||||
|
221 | //*********************** | |||
|
222 | // NORMAL MODE PARAMETERS | |||
|
223 | ||||
|
224 | int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |||
|
225 | { | |||
|
226 | /** This function sets the number of points of a snapshot (sy_lfr_n_swf_l). | |||
|
227 | * | |||
|
228 | * @param TC points to the TeleCommand packet that is being processed | |||
|
229 | * @param queue_id is the id of the queue which handles TM related to this execution step | |||
|
230 | * | |||
|
231 | */ | |||
|
232 | ||||
|
233 | unsigned int tmp; | |||
|
234 | int result; | |||
|
235 | unsigned char msb; | |||
|
236 | unsigned char lsb; | |||
|
237 | ||||
|
238 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L ]; | |||
|
239 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L+1 ]; | |||
|
240 | ||||
|
241 | tmp = ( unsigned int ) floor( | |||
|
242 | ( ( msb*256 ) + lsb ) / 16 | |||
|
243 | ) * 16; | |||
|
244 | ||||
|
245 | if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16 | |||
|
246 | { // 2048 is the maximum limit due to thesize of the buffers | |||
|
247 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_L+10, lsb ); | |||
|
248 | result = WRONG_APP_DATA; | |||
|
249 | } | |||
|
250 | else if (tmp != 2048) | |||
|
251 | { | |||
|
252 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); | |||
|
253 | result = FUNCT_NOT_IMPL; | |||
|
254 | } | |||
|
255 | else | |||
|
256 | { | |||
|
257 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (tmp >> 8); | |||
|
258 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (tmp ); | |||
|
259 | result = LFR_SUCCESSFUL; | |||
|
260 | } | |||
|
261 | ||||
|
262 | return result; | |||
|
263 | } | |||
|
264 | ||||
|
265 | int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |||
|
266 | { | |||
|
267 | /** This function sets the time between two snapshots, in s (sy_lfr_n_swf_p). | |||
|
268 | * | |||
|
269 | * @param TC points to the TeleCommand packet that is being processed | |||
|
270 | * @param queue_id is the id of the queue which handles TM related to this execution step | |||
|
271 | * | |||
|
272 | */ | |||
|
273 | ||||
|
274 | unsigned int tmp; | |||
|
275 | int result; | |||
|
276 | unsigned char msb; | |||
|
277 | unsigned char lsb; | |||
|
278 | ||||
|
279 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P ]; | |||
|
280 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P+1 ]; | |||
|
281 | ||||
|
282 | tmp = ( unsigned int ) floor( | |||
|
283 | ( ( msb*256 ) + lsb ) / 8 | |||
|
284 | ) * 8; | |||
|
285 | ||||
|
286 | if ( (tmp < 16) || (tmp > 65528) ) | |||
|
287 | { | |||
|
288 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_P+10, lsb ); | |||
|
289 | result = WRONG_APP_DATA; | |||
|
290 | } | |||
|
291 | else | |||
|
292 | { | |||
|
293 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8); | |||
|
294 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp ); | |||
|
295 | result = LFR_SUCCESSFUL; | |||
|
296 | } | |||
|
297 | ||||
|
298 | return result; | |||
|
299 | } | |||
|
300 | ||||
|
301 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |||
|
302 | { | |||
|
303 | /** This function sets the time between two full spectral matrices transmission, in s (sy_lfr_n_asm_p). | |||
|
304 | * | |||
|
305 | * @param TC points to the TeleCommand packet that is being processed | |||
|
306 | * @param queue_id is the id of the queue which handles TM related to this execution step | |||
|
307 | * | |||
|
308 | */ | |||
|
309 | ||||
|
310 | int result; | |||
|
311 | unsigned char msb; | |||
|
312 | unsigned char lsb; | |||
|
313 | ||||
|
314 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P ]; | |||
|
315 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P+1 ]; | |||
|
316 | ||||
|
317 | parameter_dump_packet.sy_lfr_n_asm_p[0] = msb; | |||
|
318 | parameter_dump_packet.sy_lfr_n_asm_p[1] = lsb; | |||
|
319 | result = LFR_SUCCESSFUL; | |||
|
320 | ||||
|
321 | return result; | |||
|
322 | } | |||
|
323 | ||||
|
324 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |||
|
325 | { | |||
|
326 | /** This function sets the time between two basic parameter sets, in s (sy_lfr_n_bp_p0). | |||
|
327 | * | |||
|
328 | * @param TC points to the TeleCommand packet that is being processed | |||
|
329 | * @param queue_id is the id of the queue which handles TM related to this execution step | |||
|
330 | * | |||
|
331 | */ | |||
|
332 | ||||
|
333 | int status; | |||
|
334 | ||||
|
335 | status = LFR_SUCCESSFUL; | |||
|
336 | ||||
|
337 | parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P0 ]; | |||
|
338 | ||||
|
339 | return status; | |||
|
340 | } | |||
|
341 | ||||
|
342 | int set_sy_lfr_n_bp_p1(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |||
|
343 | { | |||
|
344 | /** This function sets the time between two basic parameter sets (autocorrelation + crosscorrelation), in s (sy_lfr_n_bp_p1). | |||
|
345 | * | |||
|
346 | * @param TC points to the TeleCommand packet that is being processed | |||
|
347 | * @param queue_id is the id of the queue which handles TM related to this execution step | |||
|
348 | * | |||
|
349 | */ | |||
|
350 | ||||
|
351 | int status; | |||
|
352 | ||||
|
353 | status = LFR_SUCCESSFUL; | |||
|
354 | ||||
|
355 | parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P1 ]; | |||
|
356 | ||||
|
357 | return status; | |||
|
358 | } | |||
|
359 | ||||
|
360 | //********************** | |||
|
361 | // BURST MODE PARAMETERS | |||
|
362 | ||||
|
363 | //********************* | |||
|
364 | // SBM1 MODE PARAMETERS | |||
|
365 | ||||
|
366 | //********************* | |||
|
367 | // SBM2 MODE PARAMETERS | |||
|
368 | ||||
|
369 | ||||
|
370 | ||||
|
371 | ||||
|
372 | ||||
|
373 | ||||
|
374 | ||||
|
375 | ||||
|
376 | ||||
|
377 |
@@ -1,233 +1,243 | |||||
1 | ############################################################################# |
|
1 | ############################################################################# | |
2 | # Makefile for building: bin/fsw |
|
2 | # Makefile for building: bin/fsw | |
3 |
# Generated by qmake (2.01a) (Qt 4.8.5) on: |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Oct 17 10:12:11 2013 | |
4 | # Project: fsw-qt.pro |
|
4 | # Project: fsw-qt.pro | |
5 | # Template: app |
|
5 | # Template: app | |
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
7 | ############################################################################# |
|
7 | ############################################################################# | |
8 |
|
8 | |||
9 | ####### Compiler, tools and options |
|
9 | ####### Compiler, tools and options | |
10 |
|
10 | |||
11 | CC = sparc-rtems-gcc |
|
11 | CC = sparc-rtems-gcc | |
12 | CXX = sparc-rtems-g++ |
|
12 | CXX = sparc-rtems-g++ | |
13 | DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=15 -DPRINT_MESSAGES_ON_CONSOLE |
|
13 | DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=15 -DPRINT_MESSAGES_ON_CONSOLE | |
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) | |
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) | |
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header |
|
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header | |
17 | LINK = sparc-rtems-g++ |
|
17 | LINK = sparc-rtems-g++ | |
18 | LFLAGS = |
|
18 | LFLAGS = | |
19 | LIBS = $(SUBLIBS) |
|
19 | LIBS = $(SUBLIBS) | |
20 | AR = sparc-rtems-ar rcs |
|
20 | AR = sparc-rtems-ar rcs | |
21 | RANLIB = |
|
21 | RANLIB = | |
22 | QMAKE = /usr/bin/qmake-qt4 |
|
22 | QMAKE = /usr/bin/qmake-qt4 | |
23 | TAR = tar -cf |
|
23 | TAR = tar -cf | |
24 | COMPRESS = gzip -9f |
|
24 | COMPRESS = gzip -9f | |
25 | COPY = cp -f |
|
25 | COPY = cp -f | |
26 | SED = sed |
|
26 | SED = sed | |
27 | COPY_FILE = $(COPY) |
|
27 | COPY_FILE = $(COPY) | |
28 | COPY_DIR = $(COPY) -r |
|
28 | COPY_DIR = $(COPY) -r | |
29 | STRIP = sparc-rtems-strip |
|
29 | STRIP = sparc-rtems-strip | |
30 | INSTALL_FILE = install -m 644 -p |
|
30 | INSTALL_FILE = install -m 644 -p | |
31 | INSTALL_DIR = $(COPY_DIR) |
|
31 | INSTALL_DIR = $(COPY_DIR) | |
32 | INSTALL_PROGRAM = install -m 755 -p |
|
32 | INSTALL_PROGRAM = install -m 755 -p | |
33 | DEL_FILE = rm -f |
|
33 | DEL_FILE = rm -f | |
34 | SYMLINK = ln -f -s |
|
34 | SYMLINK = ln -f -s | |
35 | DEL_DIR = rmdir |
|
35 | DEL_DIR = rmdir | |
36 | MOVE = mv -f |
|
36 | MOVE = mv -f | |
37 | CHK_DIR_EXISTS= test -d |
|
37 | CHK_DIR_EXISTS= test -d | |
38 | MKDIR = mkdir -p |
|
38 | MKDIR = mkdir -p | |
39 |
|
39 | |||
40 | ####### Output directory |
|
40 | ####### Output directory | |
41 |
|
41 | |||
42 | OBJECTS_DIR = obj/ |
|
42 | OBJECTS_DIR = obj/ | |
43 |
|
43 | |||
44 | ####### Files |
|
44 | ####### Files | |
45 |
|
45 | |||
46 | SOURCES = ../src/wf_handler.c \ |
|
46 | SOURCES = ../src/wf_handler.c \ | |
47 | ../src/tc_handler.c \ |
|
47 | ../src/tc_handler.c \ | |
48 | ../src/fsw_processing.c \ |
|
48 | ../src/fsw_processing.c \ | |
49 | ../src/fsw_misc.c \ |
|
49 | ../src/fsw_misc.c \ | |
50 | ../src/fsw_init.c \ |
|
50 | ../src/fsw_init.c \ | |
51 | ../src/fsw_globals.c \ |
|
51 | ../src/fsw_globals.c \ | |
52 | ../src/fsw_spacewire.c |
|
52 | ../src/fsw_spacewire.c \ | |
|
53 | ../src/tc_load_dump_parameters.c \ | |||
|
54 | ../src/tm_lfr_tc_exe.c | |||
53 | OBJECTS = obj/wf_handler.o \ |
|
55 | OBJECTS = obj/wf_handler.o \ | |
54 | obj/tc_handler.o \ |
|
56 | obj/tc_handler.o \ | |
55 | obj/fsw_processing.o \ |
|
57 | obj/fsw_processing.o \ | |
56 | obj/fsw_misc.o \ |
|
58 | obj/fsw_misc.o \ | |
57 | obj/fsw_init.o \ |
|
59 | obj/fsw_init.o \ | |
58 | obj/fsw_globals.o \ |
|
60 | obj/fsw_globals.o \ | |
59 | obj/fsw_spacewire.o |
|
61 | obj/fsw_spacewire.o \ | |
|
62 | obj/tc_load_dump_parameters.o \ | |||
|
63 | obj/tm_lfr_tc_exe.o | |||
60 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
64 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
61 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
65 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
62 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
66 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
63 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
67 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
64 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
68 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
65 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
69 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
66 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
70 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
67 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
71 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
68 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
72 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
69 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
73 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
70 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
74 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
71 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
75 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
72 | sparc.pri \ |
|
76 | sparc.pri \ | |
73 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
77 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
74 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
78 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
75 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
79 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
76 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
80 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
77 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
81 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
78 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
82 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
79 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
83 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
80 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
84 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
81 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
85 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
82 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ |
|
86 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ | |
83 | fsw-qt.pro |
|
87 | fsw-qt.pro | |
84 | QMAKE_TARGET = fsw |
|
88 | QMAKE_TARGET = fsw | |
85 | DESTDIR = bin/ |
|
89 | DESTDIR = bin/ | |
86 | TARGET = bin/fsw |
|
90 | TARGET = bin/fsw | |
87 |
|
91 | |||
88 | first: all |
|
92 | first: all | |
89 | ####### Implicit rules |
|
93 | ####### Implicit rules | |
90 |
|
94 | |||
91 | .SUFFIXES: .o .c .cpp .cc .cxx .C |
|
95 | .SUFFIXES: .o .c .cpp .cc .cxx .C | |
92 |
|
96 | |||
93 | .cpp.o: |
|
97 | .cpp.o: | |
94 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
98 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
95 |
|
99 | |||
96 | .cc.o: |
|
100 | .cc.o: | |
97 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
101 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
98 |
|
102 | |||
99 | .cxx.o: |
|
103 | .cxx.o: | |
100 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
104 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
101 |
|
105 | |||
102 | .C.o: |
|
106 | .C.o: | |
103 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
107 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" | |
104 |
|
108 | |||
105 | .c.o: |
|
109 | .c.o: | |
106 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" |
|
110 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" | |
107 |
|
111 | |||
108 | ####### Build rules |
|
112 | ####### Build rules | |
109 |
|
113 | |||
110 | all: Makefile $(TARGET) |
|
114 | all: Makefile $(TARGET) | |
111 |
|
115 | |||
112 | $(TARGET): $(OBJECTS) |
|
116 | $(TARGET): $(OBJECTS) | |
113 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ |
|
117 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ | |
114 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) |
|
118 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) | |
115 |
|
119 | |||
116 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
120 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ | |
117 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
121 | /usr/lib64/qt4/mkspecs/common/linux.conf \ | |
118 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
122 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ | |
119 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
123 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ | |
120 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
124 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ | |
121 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
125 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ | |
122 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
126 | /usr/lib64/qt4/mkspecs/qconfig.pri \ | |
123 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
127 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ | |
124 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
128 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ | |
125 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
129 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ | |
126 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
130 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ | |
127 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
131 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ | |
128 | sparc.pri \ |
|
132 | sparc.pri \ | |
129 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
133 | /usr/lib64/qt4/mkspecs/features/release.prf \ | |
130 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
134 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ | |
131 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
135 | /usr/lib64/qt4/mkspecs/features/shared.prf \ | |
132 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
136 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ | |
133 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
137 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ | |
134 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
138 | /usr/lib64/qt4/mkspecs/features/resources.prf \ | |
135 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
139 | /usr/lib64/qt4/mkspecs/features/uic.prf \ | |
136 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
140 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ | |
137 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
141 | /usr/lib64/qt4/mkspecs/features/lex.prf \ | |
138 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf |
|
142 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf | |
139 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
143 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
140 | /usr/lib64/qt4/mkspecs/common/unix.conf: |
|
144 | /usr/lib64/qt4/mkspecs/common/unix.conf: | |
141 | /usr/lib64/qt4/mkspecs/common/linux.conf: |
|
145 | /usr/lib64/qt4/mkspecs/common/linux.conf: | |
142 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: |
|
146 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: | |
143 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: |
|
147 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: | |
144 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: |
|
148 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: | |
145 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: |
|
149 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: | |
146 | /usr/lib64/qt4/mkspecs/qconfig.pri: |
|
150 | /usr/lib64/qt4/mkspecs/qconfig.pri: | |
147 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: |
|
151 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: | |
148 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: |
|
152 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: | |
149 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: |
|
153 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: | |
150 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: |
|
154 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: | |
151 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: |
|
155 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: | |
152 | sparc.pri: |
|
156 | sparc.pri: | |
153 | /usr/lib64/qt4/mkspecs/features/release.prf: |
|
157 | /usr/lib64/qt4/mkspecs/features/release.prf: | |
154 | /usr/lib64/qt4/mkspecs/features/default_post.prf: |
|
158 | /usr/lib64/qt4/mkspecs/features/default_post.prf: | |
155 | /usr/lib64/qt4/mkspecs/features/shared.prf: |
|
159 | /usr/lib64/qt4/mkspecs/features/shared.prf: | |
156 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: |
|
160 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: | |
157 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: |
|
161 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: | |
158 | /usr/lib64/qt4/mkspecs/features/resources.prf: |
|
162 | /usr/lib64/qt4/mkspecs/features/resources.prf: | |
159 | /usr/lib64/qt4/mkspecs/features/uic.prf: |
|
163 | /usr/lib64/qt4/mkspecs/features/uic.prf: | |
160 | /usr/lib64/qt4/mkspecs/features/yacc.prf: |
|
164 | /usr/lib64/qt4/mkspecs/features/yacc.prf: | |
161 | /usr/lib64/qt4/mkspecs/features/lex.prf: |
|
165 | /usr/lib64/qt4/mkspecs/features/lex.prf: | |
162 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: |
|
166 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: | |
163 | qmake: FORCE |
|
167 | qmake: FORCE | |
164 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
168 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
165 |
|
169 | |||
166 | dist: |
|
170 | dist: | |
167 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 |
|
171 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 | |
168 | $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0 |
|
172 | $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0 | |
169 |
|
173 | |||
170 |
|
174 | |||
171 | clean:compiler_clean |
|
175 | clean:compiler_clean | |
172 | -$(DEL_FILE) $(OBJECTS) |
|
176 | -$(DEL_FILE) $(OBJECTS) | |
173 | -$(DEL_FILE) *~ core *.core |
|
177 | -$(DEL_FILE) *~ core *.core | |
174 |
|
178 | |||
175 |
|
179 | |||
176 | ####### Sub-libraries |
|
180 | ####### Sub-libraries | |
177 |
|
181 | |||
178 | distclean: clean |
|
182 | distclean: clean | |
179 | -$(DEL_FILE) $(TARGET) |
|
183 | -$(DEL_FILE) $(TARGET) | |
180 | -$(DEL_FILE) Makefile |
|
184 | -$(DEL_FILE) Makefile | |
181 |
|
185 | |||
182 |
|
186 | |||
183 | grmon: |
|
187 | grmon: | |
184 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u |
|
188 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u | |
185 |
|
189 | |||
186 | check: first |
|
190 | check: first | |
187 |
|
191 | |||
188 | compiler_rcc_make_all: |
|
192 | compiler_rcc_make_all: | |
189 | compiler_rcc_clean: |
|
193 | compiler_rcc_clean: | |
190 | compiler_uic_make_all: |
|
194 | compiler_uic_make_all: | |
191 | compiler_uic_clean: |
|
195 | compiler_uic_clean: | |
192 | compiler_image_collection_make_all: qmake_image_collection.cpp |
|
196 | compiler_image_collection_make_all: qmake_image_collection.cpp | |
193 | compiler_image_collection_clean: |
|
197 | compiler_image_collection_clean: | |
194 | -$(DEL_FILE) qmake_image_collection.cpp |
|
198 | -$(DEL_FILE) qmake_image_collection.cpp | |
195 | compiler_yacc_decl_make_all: |
|
199 | compiler_yacc_decl_make_all: | |
196 | compiler_yacc_decl_clean: |
|
200 | compiler_yacc_decl_clean: | |
197 | compiler_yacc_impl_make_all: |
|
201 | compiler_yacc_impl_make_all: | |
198 | compiler_yacc_impl_clean: |
|
202 | compiler_yacc_impl_clean: | |
199 | compiler_lex_make_all: |
|
203 | compiler_lex_make_all: | |
200 | compiler_lex_clean: |
|
204 | compiler_lex_clean: | |
201 | compiler_clean: |
|
205 | compiler_clean: | |
202 |
|
206 | |||
203 | ####### Compile |
|
207 | ####### Compile | |
204 |
|
208 | |||
205 | obj/wf_handler.o: ../src/wf_handler.c |
|
209 | obj/wf_handler.o: ../src/wf_handler.c | |
206 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c |
|
210 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c | |
207 |
|
211 | |||
208 | obj/tc_handler.o: ../src/tc_handler.c |
|
212 | obj/tc_handler.o: ../src/tc_handler.c | |
209 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c |
|
213 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c | |
210 |
|
214 | |||
211 | obj/fsw_processing.o: ../src/fsw_processing.c |
|
215 | obj/fsw_processing.o: ../src/fsw_processing.c | |
212 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c |
|
216 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c | |
213 |
|
217 | |||
214 | obj/fsw_misc.o: ../src/fsw_misc.c |
|
218 | obj/fsw_misc.o: ../src/fsw_misc.c | |
215 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c |
|
219 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c | |
216 |
|
220 | |||
217 | obj/fsw_init.o: ../src/fsw_init.c |
|
221 | obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c | |
218 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c |
|
222 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c | |
219 |
|
223 | |||
220 | obj/fsw_globals.o: ../src/fsw_globals.c |
|
224 | obj/fsw_globals.o: ../src/fsw_globals.c | |
221 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c |
|
225 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c | |
222 |
|
226 | |||
223 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c |
|
227 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c | |
224 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c |
|
228 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c | |
225 |
|
229 | |||
|
230 | obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c | |||
|
231 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c | |||
|
232 | ||||
|
233 | obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c | |||
|
234 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c | |||
|
235 | ||||
226 | ####### Install |
|
236 | ####### Install | |
227 |
|
237 | |||
228 | install: FORCE |
|
238 | install: FORCE | |
229 |
|
239 | |||
230 | uninstall: FORCE |
|
240 | uninstall: FORCE | |
231 |
|
241 | |||
232 | FORCE: |
|
242 | FORCE: | |
233 |
|
243 |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -1,63 +1,71 | |||||
1 | TEMPLATE = app |
|
1 | TEMPLATE = app | |
2 | # CONFIG += console v8 sim |
|
2 | # CONFIG += console v8 sim | |
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** gsa |
|
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** gsa | |
4 | CONFIG += console verbose |
|
4 | CONFIG += console verbose | |
5 | CONFIG -= qt |
|
5 | CONFIG -= qt | |
6 |
|
6 | |||
7 | include(./sparc.pri) |
|
7 | include(./sparc.pri) | |
8 |
|
8 | |||
9 | # flight software version |
|
9 | # flight software version | |
10 | SWVERSION=-0-15 |
|
10 | SWVERSION=-0-15 | |
11 | DEFINES += SW_VERSION_N1=0 |
|
11 | DEFINES += SW_VERSION_N1=0 | |
12 | DEFINES += SW_VERSION_N2=0 |
|
12 | DEFINES += SW_VERSION_N2=0 | |
13 | DEFINES += SW_VERSION_N3=0 |
|
13 | DEFINES += SW_VERSION_N3=0 | |
14 | DEFINES += SW_VERSION_N4=15 |
|
14 | DEFINES += SW_VERSION_N4=15 | |
15 |
|
15 | |||
16 | contains( CONFIG, verbose ) { |
|
16 | contains( CONFIG, verbose ) { | |
17 | DEFINES += PRINT_MESSAGES_ON_CONSOLE |
|
17 | DEFINES += PRINT_MESSAGES_ON_CONSOLE | |
18 | } |
|
18 | } | |
19 |
|
19 | |||
20 | contains( CONFIG, cpu_usage_report ) { |
|
20 | contains( CONFIG, cpu_usage_report ) { | |
21 | DEFINES += PRINT_TASK_STATISTICS |
|
21 | DEFINES += PRINT_TASK_STATISTICS | |
22 | } |
|
22 | } | |
23 |
|
23 | |||
24 | contains( CONFIG, stack_report ) { |
|
24 | contains( CONFIG, stack_report ) { | |
25 | DEFINES += PRINT_STACK_REPORT |
|
25 | DEFINES += PRINT_STACK_REPORT | |
26 | } |
|
26 | } | |
27 |
|
27 | |||
28 | contains( CONFIG, boot_messages ) { |
|
28 | contains( CONFIG, boot_messages ) { | |
29 | DEFINES += BOOT_MESSAGES |
|
29 | DEFINES += BOOT_MESSAGES | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
|
32 | #doxygen.target = doxygen | |||
|
33 | #doxygen.commands = doxygen ../doc/Doxyfile | |||
|
34 | #QMAKE_EXTRA_TARGETS += doxygen | |||
|
35 | ||||
32 | TARGET = fsw |
|
36 | TARGET = fsw | |
33 | contains( CONFIG, gsa ) { |
|
37 | contains( CONFIG, gsa ) { | |
34 | DEFINES += GSA |
|
38 | DEFINES += GSA | |
35 | TARGET = fsw-gsa |
|
39 | TARGET = fsw-gsa | |
36 | } |
|
40 | } | |
37 |
|
41 | |||
38 | INCLUDEPATH += \ |
|
42 | INCLUDEPATH += \ | |
39 | ../src \ |
|
43 | ../src \ | |
40 | ../header |
|
44 | ../header | |
41 |
|
45 | |||
42 | SOURCES += \ |
|
46 | SOURCES += \ | |
43 | ../src/wf_handler.c \ |
|
47 | ../src/wf_handler.c \ | |
44 | ../src/tc_handler.c \ |
|
48 | ../src/tc_handler.c \ | |
45 | ../src/fsw_processing.c \ |
|
49 | ../src/fsw_processing.c \ | |
46 | ../src/fsw_misc.c \ |
|
50 | ../src/fsw_misc.c \ | |
47 | ../src/fsw_init.c \ |
|
51 | ../src/fsw_init.c \ | |
48 | ../src/fsw_globals.c \ |
|
52 | ../src/fsw_globals.c \ | |
49 | ../src/fsw_spacewire.c |
|
53 | ../src/fsw_spacewire.c \ | |
|
54 | ../src/tc_load_dump_parameters.c \ | |||
|
55 | ../src/tm_lfr_tc_exe.c | |||
50 |
|
56 | |||
51 | HEADERS += \ |
|
57 | HEADERS += \ | |
52 | ../header/wf_handler.h \ |
|
58 | ../header/wf_handler.h \ | |
53 | ../header/tc_handler.h \ |
|
59 | ../header/tc_handler.h \ | |
54 | ../header/grlib_regs.h \ |
|
60 | ../header/grlib_regs.h \ | |
55 | ../header/fsw_processing.h \ |
|
61 | ../header/fsw_processing.h \ | |
56 | ../header/fsw_params.h \ |
|
62 | ../header/fsw_params.h \ | |
57 | ../header/fsw_misc.h \ |
|
63 | ../header/fsw_misc.h \ | |
58 | ../header/fsw_init.h \ |
|
64 | ../header/fsw_init.h \ | |
59 | ../header/ccsds_types.h \ |
|
65 | ../header/ccsds_types.h \ | |
60 | ../header/fsw_params_processing.h \ |
|
66 | ../header/fsw_params_processing.h \ | |
61 | ../header/fsw_spacewire.h \ |
|
67 | ../header/fsw_spacewire.h \ | |
62 | ../header/tm_byte_positions.h |
|
68 | ../header/tm_byte_positions.h \ | |
|
69 | ../header/tc_load_dump_parameters.h \ | |||
|
70 | ../header/tm_lfr_tc_exe | |||
63 |
|
71 |
@@ -1,257 +1,305 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <!DOCTYPE QtCreatorProject> |
|
2 | <!DOCTYPE QtCreatorProject> | |
3 |
<!-- Written by QtCreator 2.8.0, 2013-10-1 |
|
3 | <!-- Written by QtCreator 2.8.0, 2013-10-17T08:46:24. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> | |
7 | <value type="int">0</value> |
|
7 | <value type="int">0</value> | |
8 | </data> |
|
8 | </data> | |
9 | <data> |
|
9 | <data> | |
10 | <variable>ProjectExplorer.Project.EditorSettings</variable> |
|
10 | <variable>ProjectExplorer.Project.EditorSettings</variable> | |
11 | <valuemap type="QVariantMap"> |
|
11 | <valuemap type="QVariantMap"> | |
12 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> |
|
12 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> | |
13 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> |
|
13 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> | |
14 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> |
|
14 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> | |
15 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> |
|
15 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> | |
16 | <value type="QString" key="language">Cpp</value> |
|
16 | <value type="QString" key="language">Cpp</value> | |
17 | <valuemap type="QVariantMap" key="value"> |
|
17 | <valuemap type="QVariantMap" key="value"> | |
18 | <value type="QString" key="CurrentPreferences">CppGlobal</value> |
|
18 | <value type="QString" key="CurrentPreferences">CppGlobal</value> | |
19 | </valuemap> |
|
19 | </valuemap> | |
20 | </valuemap> |
|
20 | </valuemap> | |
21 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> |
|
21 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> | |
22 | <value type="QString" key="language">QmlJS</value> |
|
22 | <value type="QString" key="language">QmlJS</value> | |
23 | <valuemap type="QVariantMap" key="value"> |
|
23 | <valuemap type="QVariantMap" key="value"> | |
24 | <value type="QString" key="CurrentPreferences">QmlJSGlobal</value> |
|
24 | <value type="QString" key="CurrentPreferences">QmlJSGlobal</value> | |
25 | </valuemap> |
|
25 | </valuemap> | |
26 | </valuemap> |
|
26 | </valuemap> | |
27 | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> |
|
27 | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> | |
28 | <value type="QByteArray" key="EditorConfiguration.Codec">System</value> |
|
28 | <value type="QByteArray" key="EditorConfiguration.Codec">System</value> | |
29 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> |
|
29 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> | |
30 | <value type="int" key="EditorConfiguration.IndentSize">4</value> |
|
30 | <value type="int" key="EditorConfiguration.IndentSize">4</value> | |
31 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> |
|
31 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> | |
32 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> |
|
32 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> | |
33 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> |
|
33 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> | |
34 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> |
|
34 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> | |
35 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> |
|
35 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> | |
36 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> |
|
36 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> | |
37 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> |
|
37 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> | |
38 | <value type="int" key="EditorConfiguration.TabSize">8</value> |
|
38 | <value type="int" key="EditorConfiguration.TabSize">8</value> | |
39 | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> |
|
39 | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> | |
40 | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> |
|
40 | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> | |
41 | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> |
|
41 | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> | |
42 | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> |
|
42 | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> | |
43 | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> |
|
43 | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> | |
44 | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> |
|
44 | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> | |
45 | </valuemap> |
|
45 | </valuemap> | |
46 | </data> |
|
46 | </data> | |
47 | <data> |
|
47 | <data> | |
48 | <variable>ProjectExplorer.Project.PluginSettings</variable> |
|
48 | <variable>ProjectExplorer.Project.PluginSettings</variable> | |
49 | <valuemap type="QVariantMap"/> |
|
49 | <valuemap type="QVariantMap"/> | |
50 | </data> |
|
50 | </data> | |
51 | <data> |
|
51 | <data> | |
52 | <variable>ProjectExplorer.Project.Target.0</variable> |
|
52 | <variable>ProjectExplorer.Project.Target.0</variable> | |
53 | <valuemap type="QVariantMap"> |
|
53 | <valuemap type="QVariantMap"> | |
54 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
54 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> | |
55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> | |
56 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value> |
|
56 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value> | |
57 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
|
57 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> | |
58 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
|
58 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> | |
59 |
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration"> |
|
59 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">1</value> | |
60 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
|
60 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> | |
61 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
61 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
63 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
63 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
64 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
64 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> | |
65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> | |
67 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
67 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> | |
68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> |
|
68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> | |
69 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
69 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> | |
70 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
70 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> | |
71 | </valuemap> |
|
71 | </valuemap> | |
72 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
72 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> | |
73 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
73 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
74 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
74 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
77 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
77 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
78 | <value type="QString">-w</value> |
|
78 | <value type="QString">-w</value> | |
79 | <value type="QString">-r</value> |
|
79 | <value type="QString">-r</value> | |
80 | </valuelist> |
|
80 | </valuelist> | |
81 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
81 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> | |
82 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </value> |
|
82 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w -j 4</value> | |
83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
84 | </valuemap> |
|
84 | </valuemap> | |
85 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
85 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> | |
86 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
86 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> | |
87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> | |
89 | </valuemap> |
|
89 | </valuemap> | |
90 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
90 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> | |
91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
92 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
92 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
93 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
93 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
96 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
96 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
97 | <value type="QString">-w</value> |
|
97 | <value type="QString">-w</value> | |
98 | <value type="QString">-r</value> |
|
98 | <value type="QString">-r</value> | |
99 | </valuelist> |
|
99 | </valuelist> | |
100 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
100 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> | |
101 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value> |
|
101 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value> | |
102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
103 | </valuemap> |
|
103 | </valuemap> | |
104 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
104 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> | |
105 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
105 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> | |
106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> | |
108 | </valuemap> |
|
108 | </valuemap> | |
109 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
109 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> | |
110 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
110 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> | |
111 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
111 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> | |
112 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value> |
|
112 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value> | |
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> | |
115 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
115 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> | |
116 | <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value> |
|
116 | <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value> | |
117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value> |
|
117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value> | |
118 | </valuemap> |
|
118 | </valuemap> | |
119 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> |
|
119 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> | |
120 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
120 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
122 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
122 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> | |
124 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
124 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> | |
126 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
126 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> | |
127 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> |
|
127 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> | |
128 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
128 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> | |
129 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
129 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> | |
130 | </valuemap> |
|
130 | </valuemap> | |
131 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
131 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> | |
132 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
132 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
133 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
133 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
134 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
134 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
135 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
135 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
136 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
136 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
137 | <value type="QString">-w</value> |
|
137 | <value type="QString">-w</value> | |
138 | <value type="QString">-r</value> |
|
138 | <value type="QString">-r</value> | |
139 | </valuelist> |
|
139 | </valuelist> | |
140 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
140 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> | |
141 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </value> |
|
141 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </value> | |
142 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
142 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
143 | </valuemap> |
|
143 | </valuemap> | |
144 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
144 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> | |
145 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
145 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> | |
146 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
146 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
147 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
147 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> | |
148 | </valuemap> |
|
148 | </valuemap> | |
149 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
149 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> | |
150 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
150 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
151 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
151 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
152 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
152 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
153 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
153 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
154 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
154 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
155 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
155 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
156 | <value type="QString">-w</value> |
|
156 | <value type="QString">-w</value> | |
157 | <value type="QString">-r</value> |
|
157 | <value type="QString">-r</value> | |
158 | </valuelist> |
|
158 | </valuelist> | |
159 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
159 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> | |
160 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value> |
|
160 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value> | |
161 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
161 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
162 | </valuemap> |
|
162 | </valuemap> | |
163 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
163 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> | |
164 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
164 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> | |
165 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
165 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
166 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
166 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> | |
167 | </valuemap> |
|
167 | </valuemap> | |
168 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
168 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> | |
169 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
169 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> | |
170 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
170 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> | |
171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value> |
|
171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value> | |
172 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
172 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> | |
174 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> |
|
174 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> | |
175 | <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value> |
|
175 | <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value> | |
176 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value> |
|
176 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value> | |
177 | </valuemap> |
|
177 | </valuemap> | |
178 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value> |
|
178 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value> | |
179 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
179 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> | |
180 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
180 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
181 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
181 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> | |
182 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
182 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> | |
183 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
183 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
184 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
184 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> | |
185 | </valuemap> |
|
185 | </valuemap> | |
186 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
186 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> | |
187 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value> |
|
187 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value> | |
188 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
188 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
189 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
189 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> | |
190 | </valuemap> |
|
190 | </valuemap> | |
191 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
191 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> | |
192 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
192 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> | |
193 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
193 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> | |
194 | <value type="bool" key="Analyzer.Project.UseGlobal">true</value> |
|
194 | <value type="bool" key="Analyzer.Project.UseGlobal">true</value> | |
195 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
195 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> | |
196 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
196 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> | |
197 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
197 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> | |
198 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
198 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> | |
199 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
199 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> | |
200 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
200 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> | |
201 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
201 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> | |
202 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
202 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> | |
203 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
203 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> | |
204 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
204 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> | |
205 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
205 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> | |
206 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
206 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> | |
207 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
207 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> | |
208 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
208 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> | |
209 | <value type="int">0</value> |
|
209 | <value type="int">0</value> | |
210 | <value type="int">1</value> |
|
210 | <value type="int">1</value> | |
211 | <value type="int">2</value> |
|
211 | <value type="int">2</value> | |
212 | <value type="int">3</value> |
|
212 | <value type="int">3</value> | |
213 | <value type="int">4</value> |
|
213 | <value type="int">4</value> | |
214 | <value type="int">5</value> |
|
214 | <value type="int">5</value> | |
215 | <value type="int">6</value> |
|
215 | <value type="int">6</value> | |
216 | <value type="int">7</value> |
|
216 | <value type="int">7</value> | |
217 | <value type="int">8</value> |
|
217 | <value type="int">8</value> | |
218 | <value type="int">9</value> |
|
218 | <value type="int">9</value> | |
219 | <value type="int">10</value> |
|
219 | <value type="int">10</value> | |
220 | <value type="int">11</value> |
|
220 | <value type="int">11</value> | |
221 | <value type="int">12</value> |
|
221 | <value type="int">12</value> | |
222 | <value type="int">13</value> |
|
222 | <value type="int">13</value> | |
223 | <value type="int">14</value> |
|
223 | <value type="int">14</value> | |
224 | </valuelist> |
|
224 | </valuelist> | |
225 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
225 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> | |
226 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
226 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> | |
227 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> |
|
227 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> | |
228 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
228 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
229 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> |
|
229 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> | |
230 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
230 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> | |
231 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> |
|
231 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> | |
232 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
232 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> | |
233 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
233 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> | |
234 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
234 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> | |
235 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
235 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> | |
236 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> |
|
236 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> | |
237 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> |
|
237 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> | |
238 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
238 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> | |
239 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
239 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> | |
240 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value> |
|
240 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value> | |
241 | </valuemap> |
|
241 | </valuemap> | |
242 |
<value type="int" key="ProjectExplorer.Target.RunConfiguration |
|
242 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1"> | |
|
243 | <value type="bool" key="Analyzer.Project.UseGlobal">true</value> | |||
|
244 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> | |||
|
245 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> | |||
|
246 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> | |||
|
247 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> | |||
|
248 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> | |||
|
249 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> | |||
|
250 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> | |||
|
251 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> | |||
|
252 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> | |||
|
253 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> | |||
|
254 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> | |||
|
255 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> | |||
|
256 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> | |||
|
257 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> | |||
|
258 | <value type="int">0</value> | |||
|
259 | <value type="int">1</value> | |||
|
260 | <value type="int">2</value> | |||
|
261 | <value type="int">3</value> | |||
|
262 | <value type="int">4</value> | |||
|
263 | <value type="int">5</value> | |||
|
264 | <value type="int">6</value> | |||
|
265 | <value type="int">7</value> | |||
|
266 | <value type="int">8</value> | |||
|
267 | <value type="int">9</value> | |||
|
268 | <value type="int">10</value> | |||
|
269 | <value type="int">11</value> | |||
|
270 | <value type="int">12</value> | |||
|
271 | <value type="int">13</value> | |||
|
272 | <value type="int">14</value> | |||
|
273 | </valuelist> | |||
|
274 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> | |||
|
275 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> | |||
|
276 | <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value> | |||
|
277 | <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">doxygen</value> | |||
|
278 | <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">true</value> | |||
|
279 | <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">/opt/DEV_PLE/doc</value> | |||
|
280 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run doxygen</value> | |||
|
281 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |||
|
282 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value> | |||
|
283 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> | |||
|
284 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> | |||
|
285 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> | |||
|
286 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> | |||
|
287 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> | |||
|
288 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> | |||
|
289 | </valuemap> | |||
|
290 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">2</value> | |||
243 | </valuemap> |
|
291 | </valuemap> | |
244 | </data> |
|
292 | </data> | |
245 | <data> |
|
293 | <data> | |
246 | <variable>ProjectExplorer.Project.TargetCount</variable> |
|
294 | <variable>ProjectExplorer.Project.TargetCount</variable> | |
247 | <value type="int">1</value> |
|
295 | <value type="int">1</value> | |
248 | </data> |
|
296 | </data> | |
249 | <data> |
|
297 | <data> | |
250 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> |
|
298 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> | |
251 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> |
|
299 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> | |
252 | </data> |
|
300 | </data> | |
253 | <data> |
|
301 | <data> | |
254 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
|
302 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> | |
255 | <value type="int">14</value> |
|
303 | <value type="int">14</value> | |
256 | </data> |
|
304 | </data> | |
257 | </qtcreator> |
|
305 | </qtcreator> |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -1,635 +1,627 | |||||
1 | #ifndef CCSDS_H_INCLUDED |
|
1 | #ifndef CCSDS_H_INCLUDED | |
2 | #define CCSDS_H_INCLUDED |
|
2 | #define CCSDS_H_INCLUDED | |
3 |
|
3 | |||
4 | #define CCSDS_PROTOCOLE_EXTRA_BYTES 4 |
|
4 | #define CCSDS_PROTOCOLE_EXTRA_BYTES 4 | |
5 | #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4 |
|
5 | #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4 | |
6 | #define CCSDS_TM_PKT_MAX_SIZE 4412 |
|
6 | #define CCSDS_TM_PKT_MAX_SIZE 4412 | |
7 | #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4 |
|
7 | #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4 | |
8 | #define CCSDS_TC_PKT_MAX_SIZE 256 |
|
8 | #define CCSDS_TC_PKT_MAX_SIZE 256 | |
9 | #define CCSDS_TC_PKT_MIN_SIZE 16 |
|
9 | #define CCSDS_TC_PKT_MIN_SIZE 16 | |
10 | #define CCSDS_TC_TM_PACKET_OFFSET 7 |
|
10 | #define CCSDS_TC_TM_PACKET_OFFSET 7 | |
11 | #define CCSDS_PROCESS_ID 76 |
|
11 | #define CCSDS_PROCESS_ID 76 | |
12 | #define CCSDS_PACKET_CATEGORY 12 |
|
12 | #define CCSDS_PACKET_CATEGORY 12 | |
13 | #define CCSDS_NODE_ADDRESS 0xfe |
|
13 | #define CCSDS_NODE_ADDRESS 0xfe | |
14 | #define CCSDS_USER_APP 0x00 |
|
14 | #define CCSDS_USER_APP 0x00 | |
15 |
|
15 | |||
16 | #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10 |
|
16 | #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10 | |
17 | #define DEFAULT_RESERVED 0x00 |
|
17 | #define DEFAULT_RESERVED 0x00 | |
18 | #define DEFAULT_HKBIA 0x1e // 0001 1110 |
|
18 | #define DEFAULT_HKBIA 0x1e // 0001 1110 | |
19 |
|
19 | |||
20 | // PACKET ID |
|
20 | // PACKET ID | |
21 | #define TM_PACKET_ID_TC_EXE 0x0cc1 // PID 76 CAT 1 |
|
21 | #define TM_PACKET_ID_TC_EXE 0x0cc1 // PID 76 CAT 1 | |
22 | #define TM_PACKET_ID_HK 0x0cc4 // PID 76 CAT 4 |
|
22 | #define TM_PACKET_ID_HK 0x0cc4 // PID 76 CAT 4 | |
23 | #define TM_PACKET_ID_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9 |
|
23 | #define TM_PACKET_ID_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9 | |
24 | #define TM_PACKET_ID_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12 |
|
24 | #define TM_PACKET_ID_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12 | |
25 | #define TM_PACKET_ID_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12 |
|
25 | #define TM_PACKET_ID_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12 | |
26 | #define TM_PACKET_PID_DEFAULT 76 |
|
26 | #define TM_PACKET_PID_DEFAULT 76 | |
27 | #define TM_PACKET_PID_BURST_SBM1_SBM2 79 |
|
27 | #define TM_PACKET_PID_BURST_SBM1_SBM2 79 | |
28 | #define TM_PACKET_CAT_TC_EXE 1 |
|
28 | #define TM_PACKET_CAT_TC_EXE 1 | |
29 | #define TM_PACKET_CAT_HK 4 |
|
29 | #define TM_PACKET_CAT_HK 4 | |
30 | #define TM_PACKET_CAT_PARAMETER_DUMP 9 |
|
30 | #define TM_PACKET_CAT_PARAMETER_DUMP 9 | |
31 | #define TM_PACKET_CAT_SCIENCE 12 |
|
31 | #define TM_PACKET_CAT_SCIENCE 12 | |
32 |
|
32 | |||
33 | // PACKET SEQUENCE CONTROL |
|
33 | // PACKET SEQUENCE CONTROL | |
34 | #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000] |
|
34 | #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000] | |
35 | #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000] |
|
35 | #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000] | |
36 | #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000] |
|
36 | #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000] | |
37 | #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000] |
|
37 | #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000] | |
38 | #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000] |
|
38 | #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000] | |
39 |
|
39 | |||
40 | // DESTINATION ID |
|
40 | // DESTINATION ID | |
41 | #define TM_DESTINATION_ID_GROUND 0 |
|
41 | #define TM_DESTINATION_ID_GROUND 0 | |
42 | #define TM_DESTINATION_ID_MISSION_TIMELINE 110 |
|
42 | #define TM_DESTINATION_ID_MISSION_TIMELINE 110 | |
43 | #define TM_DESTINATION_ID_TC_SEQUENCES 111 |
|
43 | #define TM_DESTINATION_ID_TC_SEQUENCES 111 | |
44 | #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112 |
|
44 | #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112 | |
45 | #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113 |
|
45 | #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113 | |
46 | #define TM_DESTINATION_ID_DIRECT_CMD 120 |
|
46 | #define TM_DESTINATION_ID_DIRECT_CMD 120 | |
47 | #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121 |
|
47 | #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121 | |
48 | #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122 |
|
48 | #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122 | |
49 | #define TM_DESTINATION_ID_OBCP 15 |
|
49 | #define TM_DESTINATION_ID_OBCP 15 | |
50 | #define TM_DESTINATION_ID_SYSTEM_CONTROL 14 |
|
50 | #define TM_DESTINATION_ID_SYSTEM_CONTROL 14 | |
51 | #define TM_DESTINATION_ID_AOCS 11 |
|
51 | #define TM_DESTINATION_ID_AOCS 11 | |
52 |
|
52 | |||
53 | #define CCSDS_DESTINATION_ID 0x01 |
|
53 | #define CCSDS_DESTINATION_ID 0x01 | |
54 | #define CCSDS_PROTOCOLE_ID 0x02 |
|
54 | #define CCSDS_PROTOCOLE_ID 0x02 | |
55 | #define CCSDS_RESERVED 0x00 |
|
55 | #define CCSDS_RESERVED 0x00 | |
56 | #define CCSDS_USER_APP 0x00 |
|
56 | #define CCSDS_USER_APP 0x00 | |
57 |
|
57 | |||
58 | #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24 |
|
58 | #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24 | |
59 | #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32 |
|
59 | #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32 | |
60 | #define SIZE_HK_PARAMETERS 112 |
|
60 | #define SIZE_HK_PARAMETERS 112 | |
61 |
|
61 | |||
62 | // TC TYPES |
|
62 | // TC TYPES | |
63 | #define TC_TYPE_GEN 181 |
|
63 | #define TC_TYPE_GEN 181 | |
64 | #define TC_TYPE_TIME 9 |
|
64 | #define TC_TYPE_TIME 9 | |
65 |
|
65 | |||
66 | // TC SUBTYPES |
|
66 | // TC SUBTYPES | |
67 | #define TC_SUBTYPE_RESET 1 |
|
67 | #define TC_SUBTYPE_RESET 1 | |
68 | #define TC_SUBTYPE_LOAD_COMM 11 |
|
68 | #define TC_SUBTYPE_LOAD_COMM 11 | |
69 | #define TC_SUBTYPE_LOAD_NORM 13 |
|
69 | #define TC_SUBTYPE_LOAD_NORM 13 | |
70 | #define TC_SUBTYPE_LOAD_BURST 19 |
|
70 | #define TC_SUBTYPE_LOAD_BURST 19 | |
71 | #define TC_SUBTYPE_LOAD_SBM1 25 |
|
71 | #define TC_SUBTYPE_LOAD_SBM1 25 | |
72 | #define TC_SUBTYPE_LOAD_SBM2 27 |
|
72 | #define TC_SUBTYPE_LOAD_SBM2 27 | |
73 | #define TC_SUBTYPE_DUMP 31 |
|
73 | #define TC_SUBTYPE_DUMP 31 | |
74 | #define TC_SUBTYPE_ENTER 41 |
|
74 | #define TC_SUBTYPE_ENTER 41 | |
75 | #define TC_SUBTYPE_UPDT_INFO 51 |
|
75 | #define TC_SUBTYPE_UPDT_INFO 51 | |
76 | #define TC_SUBTYPE_EN_CAL 61 |
|
76 | #define TC_SUBTYPE_EN_CAL 61 | |
77 | #define TC_SUBTYPE_DIS_CAL 63 |
|
77 | #define TC_SUBTYPE_DIS_CAL 63 | |
78 | #define TC_SUBTYPE_UPDT_TIME 129 |
|
78 | #define TC_SUBTYPE_UPDT_TIME 129 | |
79 |
|
79 | |||
80 | // TC LEN |
|
80 | // TC LEN | |
81 | #define TC_LEN_RESET 12 |
|
81 | #define TC_LEN_RESET 12 | |
82 | #define TC_LEN_LOAD_COMM 14 |
|
82 | #define TC_LEN_LOAD_COMM 14 | |
83 | #define TC_LEN_LOAD_NORM 20 |
|
83 | #define TC_LEN_LOAD_NORM 20 | |
84 | #define TC_LEN_LOAD_BURST 14 |
|
84 | #define TC_LEN_LOAD_BURST 14 | |
85 | #define TC_LEN_LOAD_SBM1 14 |
|
85 | #define TC_LEN_LOAD_SBM1 14 | |
86 | #define TC_LEN_LOAD_SBM2 14 |
|
86 | #define TC_LEN_LOAD_SBM2 14 | |
87 | #define TC_LEN_DUMP 12 |
|
87 | #define TC_LEN_DUMP 12 | |
88 | #define TC_LEN_ENTER 20 |
|
88 | #define TC_LEN_ENTER 20 | |
89 | #define TC_LEN_UPDT_INFO 48 |
|
89 | #define TC_LEN_UPDT_INFO 48 | |
90 | #define TC_LEN_EN_CAL 12 |
|
90 | #define TC_LEN_EN_CAL 12 | |
91 | #define TC_LEN_DIS_CAL 12 |
|
91 | #define TC_LEN_DIS_CAL 12 | |
92 | #define TC_LEN_UPDT_TIME 18 |
|
92 | #define TC_LEN_UPDT_TIME 18 | |
93 |
|
93 | |||
94 | // TM TYPES |
|
94 | // TM TYPES | |
95 | #define TM_TYPE_TC_EXE 1 |
|
95 | #define TM_TYPE_TC_EXE 1 | |
96 | #define TM_TYPE_HK 3 |
|
96 | #define TM_TYPE_HK 3 | |
97 | #define TM_TYPE_PARAMETER_DUMP 3 |
|
97 | #define TM_TYPE_PARAMETER_DUMP 3 | |
98 | #define TM_TYPE_LFR_SCIENCE 21 |
|
98 | #define TM_TYPE_LFR_SCIENCE 21 | |
99 |
|
99 | |||
100 | // TM SUBTYPES |
|
100 | // TM SUBTYPES | |
101 | #define TM_SUBTYPE_EXE_OK 7 |
|
101 | #define TM_SUBTYPE_EXE_OK 7 | |
102 | #define TM_SUBTYPE_EXE_NOK 8 |
|
102 | #define TM_SUBTYPE_EXE_NOK 8 | |
103 | #define TM_SUBTYPE_HK 25 |
|
103 | #define TM_SUBTYPE_HK 25 | |
104 | #define TM_SUBTYPE_PARAMETER_DUMP 25 |
|
104 | #define TM_SUBTYPE_PARAMETER_DUMP 25 | |
105 | #define TM_SUBTYPE_SCIENCE 3 |
|
105 | #define TM_SUBTYPE_SCIENCE 3 | |
106 | #define TM_SUBTYPE_LFR_SCIENCE 3 |
|
106 | #define TM_SUBTYPE_LFR_SCIENCE 3 | |
107 |
|
107 | |||
108 | // FAILURE CODES |
|
108 | // FAILURE CODES | |
109 | #define ILLEGAL_APID 0 |
|
109 | #define ILLEGAL_APID 0 | |
110 | #define WRONG_LEN_PACKET 1 |
|
110 | #define WRONG_LEN_PACKET 1 | |
111 | #define INCOR_CHECKSUM 2 |
|
111 | #define INCOR_CHECKSUM 2 | |
112 | #define ILL_TYPE 3 |
|
112 | #define ILL_TYPE 3 | |
113 | #define ILL_SUBTYPE 4 |
|
113 | #define ILL_SUBTYPE 4 | |
114 | #define WRONG_APP_DATA 5 |
|
114 | #define WRONG_APP_DATA 5 // 0x00 0x05 | |
115 | // |
|
115 | // | |
116 | #define WRONG_CMD_CODE 6 |
|
|||
117 | #define CCSDS_TM_VALID 7 |
|
116 | #define CCSDS_TM_VALID 7 | |
118 | #define FAILURE_CODE_INCONSISTENT 5 // 0x00 0x05 |
|
117 | #define TC_NOT_EXE 42000 // 0xa4 0x10 | |
119 |
#define F |
|
118 | #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12 | |
120 |
#define FAIL |
|
119 | #define FAIL_DETECTED 42003 // 0xa4 0x13 | |
121 |
#define |
|
120 | #define CORRUPTED 42005 // 0xa4 0x15 | |
122 | #define FAILURE_CODE_CORRUPTED 42005 // 0xa4 0x15 |
|
|||
123 |
|
121 | |||
124 | // TM SID |
|
122 | // TM SID | |
125 | #define SID_DEFAULT 0 |
|
|||
126 | #define SID_EXE_INC 5 |
|
|||
127 | #define SID_NOT_EXE 42000 // 0xa4 0x10 |
|
|||
128 | #define SID_NOT_IMP 42002 // 0xa4 0x12 |
|
|||
129 | #define SID_EXE_ERR 42003 // 0xa4 0x13 |
|
|||
130 | #define SID_EXE_CORR 42005 // 0xa4 0x15 |
|
|||
131 | #define SID_HK 1 |
|
123 | #define SID_HK 1 | |
132 | #define SID_PARAMETER_DUMP 10 |
|
124 | #define SID_PARAMETER_DUMP 10 | |
133 |
|
125 | |||
134 | #define SID_NORM_SWF_F0 3 |
|
126 | #define SID_NORM_SWF_F0 3 | |
135 | #define SID_NORM_SWF_F1 4 |
|
127 | #define SID_NORM_SWF_F1 4 | |
136 | #define SID_NORM_SWF_F2 5 |
|
128 | #define SID_NORM_SWF_F2 5 | |
137 | #define SID_NORM_CWF_F3 1 |
|
129 | #define SID_NORM_CWF_F3 1 | |
138 | #define SID_BURST_CWF_F2 2 |
|
130 | #define SID_BURST_CWF_F2 2 | |
139 | #define SID_SBM1_CWF_F1 24 |
|
131 | #define SID_SBM1_CWF_F1 24 | |
140 | #define SID_SBM2_CWF_F2 25 |
|
132 | #define SID_SBM2_CWF_F2 25 | |
141 | #define SID_NORM_ASM_F0 11 |
|
133 | #define SID_NORM_ASM_F0 11 | |
142 | #define SID_NORM_ASM_F1 12 |
|
134 | #define SID_NORM_ASM_F1 12 | |
143 | #define SID_NORM_ASM_F2 13 |
|
135 | #define SID_NORM_ASM_F2 13 | |
144 | #define SID_NORM_BP1_F0 14 |
|
136 | #define SID_NORM_BP1_F0 14 | |
145 | #define SID_NORM_BP1_F1 15 |
|
137 | #define SID_NORM_BP1_F1 15 | |
146 | #define SID_NORM_BP1_F2 16 |
|
138 | #define SID_NORM_BP1_F2 16 | |
147 | #define SID_NORM_BP2_F0 19 |
|
139 | #define SID_NORM_BP2_F0 19 | |
148 | #define SID_NORM_BP2_F1 20 |
|
140 | #define SID_NORM_BP2_F1 20 | |
149 | #define SID_NORM_BP2_F2 21 |
|
141 | #define SID_NORM_BP2_F2 21 | |
150 | #define SID_BURST_BP1_F0 17 |
|
142 | #define SID_BURST_BP1_F0 17 | |
151 | #define SID_BURST_BP2_F0 22 |
|
143 | #define SID_BURST_BP2_F0 22 | |
152 | #define SID_BURST_BP1_F1 18 |
|
144 | #define SID_BURST_BP1_F1 18 | |
153 | #define SID_BURST_BP2_F1 23 |
|
145 | #define SID_BURST_BP2_F1 23 | |
154 | #define SID_SBM1_BP1_F0 28 |
|
146 | #define SID_SBM1_BP1_F0 28 | |
155 | #define SID_SBM1_BP2_F0 31 |
|
147 | #define SID_SBM1_BP2_F0 31 | |
156 | #define SID_SBM2_BP1_F0 29 |
|
148 | #define SID_SBM2_BP1_F0 29 | |
157 | #define SID_SBM2_BP2_F0 32 |
|
149 | #define SID_SBM2_BP2_F0 32 | |
158 | #define SID_SBM2_BP1_F1 30 |
|
150 | #define SID_SBM2_BP1_F1 30 | |
159 | #define SID_SBM2_BP2_F1 33 |
|
151 | #define SID_SBM2_BP2_F1 33 | |
160 |
|
152 | |||
161 | // LENGTH (BYTES) |
|
153 | // LENGTH (BYTES) | |
162 | #define LENGTH_TM_LFR_TC_EXE_MAX 32 |
|
154 | #define LENGTH_TM_LFR_TC_EXE_MAX 32 | |
163 | #define LENGTH_TM_LFR_HK 126 |
|
155 | #define LENGTH_TM_LFR_HK 126 | |
164 |
|
156 | |||
165 | // HEADER_LENGTH |
|
157 | // HEADER_LENGTH | |
166 | #define TM_HEADER_LEN 16 |
|
158 | #define TM_HEADER_LEN 16 | |
167 | #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28 |
|
159 | #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28 | |
168 | // PACKET_LENGTH |
|
160 | // PACKET_LENGTH | |
169 | #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET) |
|
161 | #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET) | |
170 | #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET) |
|
162 | #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET) | |
171 | #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET) |
|
163 | #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET) | |
172 | #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET) |
|
164 | #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET) | |
173 | #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET) |
|
165 | #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET) | |
174 | #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET) |
|
166 | #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET) | |
175 | #define PACKET_LENGTH_HK (126 - CCSDS_TC_TM_PACKET_OFFSET) |
|
167 | #define PACKET_LENGTH_HK (126 - CCSDS_TC_TM_PACKET_OFFSET) | |
176 | #define PACKET_LENGTH_PARAMETER_DUMP (34 - CCSDS_TC_TM_PACKET_OFFSET) |
|
168 | #define PACKET_LENGTH_PARAMETER_DUMP (34 - CCSDS_TC_TM_PACKET_OFFSET) | |
177 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM (TOTAL_SIZE_SM + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET) |
|
169 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM (TOTAL_SIZE_SM + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET) | |
178 |
|
170 | |||
179 | #define SPARE1_PUSVERSION_SPARE2 0x10 |
|
171 | #define SPARE1_PUSVERSION_SPARE2 0x10 | |
180 |
|
172 | |||
181 | #define LEN_TM_LFR_HK 130 // 126 + 4 |
|
173 | #define LEN_TM_LFR_HK 130 // 126 + 4 | |
182 | #define LEN_TM_LFR_TC_EXE_NOT_IMP 28 // 24 + 4 |
|
174 | #define LEN_TM_LFR_TC_EXE_NOT_IMP 28 // 24 + 4 | |
183 |
|
175 | |||
184 | #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1 |
|
176 | #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1 | |
185 | #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1 |
|
177 | #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1 | |
186 | #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1 |
|
178 | #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1 | |
187 | #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1 |
|
179 | #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1 | |
188 | #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1 |
|
180 | #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1 | |
189 | #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1 |
|
181 | #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1 | |
190 | #define DEFAULT_PKTCNT 0x07 |
|
182 | #define DEFAULT_PKTCNT 0x07 | |
191 | #define BLK_NR_340 0x0154 |
|
183 | #define BLK_NR_340 0x0154 | |
192 | #define BLK_NR_8 0x0008 |
|
184 | #define BLK_NR_8 0x0008 | |
193 |
|
185 | |||
194 | enum TM_TYPE{ |
|
186 | enum TM_TYPE{ | |
195 | TM_LFR_TC_EXE_OK, |
|
187 | TM_LFR_TC_EXE_OK, | |
196 | TM_LFR_TC_EXE_ERR, |
|
188 | TM_LFR_TC_EXE_ERR, | |
197 | TM_LFR_HK, |
|
189 | TM_LFR_HK, | |
198 | TM_LFR_SCI, |
|
190 | TM_LFR_SCI, | |
199 | TM_LFR_SCI_SBM, |
|
191 | TM_LFR_SCI_SBM, | |
200 | TM_LFR_PAR_DUMP |
|
192 | TM_LFR_PAR_DUMP | |
201 | }; |
|
193 | }; | |
202 |
|
194 | |||
203 | struct TMHeader_str |
|
195 | struct TMHeader_str | |
204 | { |
|
196 | { | |
205 | volatile unsigned char targetLogicalAddress; |
|
197 | volatile unsigned char targetLogicalAddress; | |
206 | volatile unsigned char protocolIdentifier; |
|
198 | volatile unsigned char protocolIdentifier; | |
207 | volatile unsigned char reserved; |
|
199 | volatile unsigned char reserved; | |
208 | volatile unsigned char userApplication; |
|
200 | volatile unsigned char userApplication; | |
209 | volatile unsigned char packetID[2]; |
|
201 | volatile unsigned char packetID[2]; | |
210 | volatile unsigned char packetSequenceControl[2]; |
|
202 | volatile unsigned char packetSequenceControl[2]; | |
211 | volatile unsigned char packetLength[2]; |
|
203 | volatile unsigned char packetLength[2]; | |
212 | // DATA FIELD HEADER |
|
204 | // DATA FIELD HEADER | |
213 | volatile unsigned char spare1_pusVersion_spare2; |
|
205 | volatile unsigned char spare1_pusVersion_spare2; | |
214 | volatile unsigned char serviceType; |
|
206 | volatile unsigned char serviceType; | |
215 | volatile unsigned char serviceSubType; |
|
207 | volatile unsigned char serviceSubType; | |
216 | volatile unsigned char destinationID; |
|
208 | volatile unsigned char destinationID; | |
217 | volatile unsigned char time[6]; |
|
209 | volatile unsigned char time[6]; | |
218 | }; |
|
210 | }; | |
219 | typedef struct TMHeader_str TMHeader_t; |
|
211 | typedef struct TMHeader_str TMHeader_t; | |
220 |
|
212 | |||
221 | struct Packet_TM_LFR_TC_EXE_str |
|
213 | struct Packet_TM_LFR_TC_EXE_str | |
222 | { |
|
214 | { | |
223 | volatile unsigned char targetLogicalAddress; |
|
215 | volatile unsigned char targetLogicalAddress; | |
224 | volatile unsigned char protocolIdentifier; |
|
216 | volatile unsigned char protocolIdentifier; | |
225 | volatile unsigned char reserved; |
|
217 | volatile unsigned char reserved; | |
226 | volatile unsigned char userApplication; |
|
218 | volatile unsigned char userApplication; | |
227 | volatile unsigned char packetID[2]; |
|
219 | volatile unsigned char packetID[2]; | |
228 | volatile unsigned char packetSequenceControl[2]; |
|
220 | volatile unsigned char packetSequenceControl[2]; | |
229 | volatile unsigned char packetLength[2]; |
|
221 | volatile unsigned char packetLength[2]; | |
230 | // DATA FIELD HEADER |
|
222 | // DATA FIELD HEADER | |
231 | volatile unsigned char spare1_pusVersion_spare2; |
|
223 | volatile unsigned char spare1_pusVersion_spare2; | |
232 | volatile unsigned char serviceType; |
|
224 | volatile unsigned char serviceType; | |
233 | volatile unsigned char serviceSubType; |
|
225 | volatile unsigned char serviceSubType; | |
234 | volatile unsigned char destinationID; |
|
226 | volatile unsigned char destinationID; | |
235 | volatile unsigned char time[6]; |
|
227 | volatile unsigned char time[6]; | |
236 | volatile unsigned char data[LENGTH_TM_LFR_TC_EXE_MAX - 10 + 1]; |
|
228 | volatile unsigned char data[LENGTH_TM_LFR_TC_EXE_MAX - 10 + 1]; | |
237 | }; |
|
229 | }; | |
238 | typedef struct Packet_TM_LFR_TC_EXE_str Packet_TM_LFR_TC_EXE_t; |
|
230 | typedef struct Packet_TM_LFR_TC_EXE_str Packet_TM_LFR_TC_EXE_t; | |
239 |
|
231 | |||
240 | struct Packet_TM_LFR_TC_EXE_SUCCESS_str |
|
232 | struct Packet_TM_LFR_TC_EXE_SUCCESS_str | |
241 | { |
|
233 | { | |
242 | volatile unsigned char targetLogicalAddress; |
|
234 | volatile unsigned char targetLogicalAddress; | |
243 | volatile unsigned char protocolIdentifier; |
|
235 | volatile unsigned char protocolIdentifier; | |
244 | volatile unsigned char reserved; |
|
236 | volatile unsigned char reserved; | |
245 | volatile unsigned char userApplication; |
|
237 | volatile unsigned char userApplication; | |
246 | // PACKET HEADER |
|
238 | // PACKET HEADER | |
247 | volatile unsigned char packetID[2]; |
|
239 | volatile unsigned char packetID[2]; | |
248 | volatile unsigned char packetSequenceControl[2]; |
|
240 | volatile unsigned char packetSequenceControl[2]; | |
249 | volatile unsigned char packetLength[2]; |
|
241 | volatile unsigned char packetLength[2]; | |
250 | // DATA FIELD HEADER |
|
242 | // DATA FIELD HEADER | |
251 | volatile unsigned char spare1_pusVersion_spare2; |
|
243 | volatile unsigned char spare1_pusVersion_spare2; | |
252 | volatile unsigned char serviceType; |
|
244 | volatile unsigned char serviceType; | |
253 | volatile unsigned char serviceSubType; |
|
245 | volatile unsigned char serviceSubType; | |
254 | volatile unsigned char destinationID; |
|
246 | volatile unsigned char destinationID; | |
255 | volatile unsigned char time[6]; |
|
247 | volatile unsigned char time[6]; | |
256 | // |
|
248 | // | |
257 | volatile unsigned char telecommand_pkt_id[2]; |
|
249 | volatile unsigned char telecommand_pkt_id[2]; | |
258 | volatile unsigned char pkt_seq_control[2]; |
|
250 | volatile unsigned char pkt_seq_control[2]; | |
259 | }; |
|
251 | }; | |
260 | typedef struct Packet_TM_LFR_TC_EXE_SUCCESS_str Packet_TM_LFR_TC_EXE_SUCCESS_t; |
|
252 | typedef struct Packet_TM_LFR_TC_EXE_SUCCESS_str Packet_TM_LFR_TC_EXE_SUCCESS_t; | |
261 |
|
253 | |||
262 | struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str |
|
254 | struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str | |
263 | { |
|
255 | { | |
264 | volatile unsigned char targetLogicalAddress; |
|
256 | volatile unsigned char targetLogicalAddress; | |
265 | volatile unsigned char protocolIdentifier; |
|
257 | volatile unsigned char protocolIdentifier; | |
266 | volatile unsigned char reserved; |
|
258 | volatile unsigned char reserved; | |
267 | volatile unsigned char userApplication; |
|
259 | volatile unsigned char userApplication; | |
268 | // PACKET HEADER |
|
260 | // PACKET HEADER | |
269 | volatile unsigned char packetID[2]; |
|
261 | volatile unsigned char packetID[2]; | |
270 | volatile unsigned char packetSequenceControl[2]; |
|
262 | volatile unsigned char packetSequenceControl[2]; | |
271 | volatile unsigned char packetLength[2]; |
|
263 | volatile unsigned char packetLength[2]; | |
272 | // DATA FIELD HEADER |
|
264 | // DATA FIELD HEADER | |
273 | volatile unsigned char spare1_pusVersion_spare2; |
|
265 | volatile unsigned char spare1_pusVersion_spare2; | |
274 | volatile unsigned char serviceType; |
|
266 | volatile unsigned char serviceType; | |
275 | volatile unsigned char serviceSubType; |
|
267 | volatile unsigned char serviceSubType; | |
276 | volatile unsigned char destinationID; |
|
268 | volatile unsigned char destinationID; | |
277 | volatile unsigned char time[6]; |
|
269 | volatile unsigned char time[6]; | |
278 | // |
|
270 | // | |
279 | volatile unsigned char tc_failure_code[2]; |
|
271 | volatile unsigned char tc_failure_code[2]; | |
280 | volatile unsigned char telecommand_pkt_id[2]; |
|
272 | volatile unsigned char telecommand_pkt_id[2]; | |
281 | volatile unsigned char pkt_seq_control[2]; |
|
273 | volatile unsigned char pkt_seq_control[2]; | |
282 | volatile unsigned char tc_service; |
|
274 | volatile unsigned char tc_service; | |
283 | volatile unsigned char tc_subtype; |
|
275 | volatile unsigned char tc_subtype; | |
284 | volatile unsigned char byte_position; |
|
276 | volatile unsigned char byte_position; | |
285 | volatile unsigned char rcv_value; |
|
277 | volatile unsigned char rcv_value; | |
286 | }; |
|
278 | }; | |
287 | typedef struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str Packet_TM_LFR_TC_EXE_INCONSISTENT_t; |
|
279 | typedef struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str Packet_TM_LFR_TC_EXE_INCONSISTENT_t; | |
288 |
|
280 | |||
289 | struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str |
|
281 | struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str | |
290 | { |
|
282 | { | |
291 | volatile unsigned char targetLogicalAddress; |
|
283 | volatile unsigned char targetLogicalAddress; | |
292 | volatile unsigned char protocolIdentifier; |
|
284 | volatile unsigned char protocolIdentifier; | |
293 | volatile unsigned char reserved; |
|
285 | volatile unsigned char reserved; | |
294 | volatile unsigned char userApplication; |
|
286 | volatile unsigned char userApplication; | |
295 | // PACKET HEADER |
|
287 | // PACKET HEADER | |
296 | volatile unsigned char packetID[2]; |
|
288 | volatile unsigned char packetID[2]; | |
297 | volatile unsigned char packetSequenceControl[2]; |
|
289 | volatile unsigned char packetSequenceControl[2]; | |
298 | volatile unsigned char packetLength[2]; |
|
290 | volatile unsigned char packetLength[2]; | |
299 | // DATA FIELD HEADER |
|
291 | // DATA FIELD HEADER | |
300 | volatile unsigned char spare1_pusVersion_spare2; |
|
292 | volatile unsigned char spare1_pusVersion_spare2; | |
301 | volatile unsigned char serviceType; |
|
293 | volatile unsigned char serviceType; | |
302 | volatile unsigned char serviceSubType; |
|
294 | volatile unsigned char serviceSubType; | |
303 | volatile unsigned char destinationID; |
|
295 | volatile unsigned char destinationID; | |
304 | volatile unsigned char time[6]; |
|
296 | volatile unsigned char time[6]; | |
305 | // |
|
297 | // | |
306 | volatile unsigned char tc_failure_code[2]; |
|
298 | volatile unsigned char tc_failure_code[2]; | |
307 | volatile unsigned char telecommand_pkt_id[2]; |
|
299 | volatile unsigned char telecommand_pkt_id[2]; | |
308 | volatile unsigned char pkt_seq_control[2]; |
|
300 | volatile unsigned char pkt_seq_control[2]; | |
309 | volatile unsigned char tc_service; |
|
301 | volatile unsigned char tc_service; | |
310 | volatile unsigned char tc_subtype; |
|
302 | volatile unsigned char tc_subtype; | |
311 | volatile unsigned char lfr_status_word[2]; |
|
303 | volatile unsigned char lfr_status_word[2]; | |
312 | }; |
|
304 | }; | |
313 | typedef struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t; |
|
305 | typedef struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t; | |
314 |
|
306 | |||
315 | struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str |
|
307 | struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str | |
316 | { |
|
308 | { | |
317 | volatile unsigned char targetLogicalAddress; |
|
309 | volatile unsigned char targetLogicalAddress; | |
318 | volatile unsigned char protocolIdentifier; |
|
310 | volatile unsigned char protocolIdentifier; | |
319 | volatile unsigned char reserved; |
|
311 | volatile unsigned char reserved; | |
320 | volatile unsigned char userApplication; |
|
312 | volatile unsigned char userApplication; | |
321 | // PACKET HEADER |
|
313 | // PACKET HEADER | |
322 | volatile unsigned char packetID[2]; |
|
314 | volatile unsigned char packetID[2]; | |
323 | volatile unsigned char packetSequenceControl[2]; |
|
315 | volatile unsigned char packetSequenceControl[2]; | |
324 | volatile unsigned char packetLength[2]; |
|
316 | volatile unsigned char packetLength[2]; | |
325 | // DATA FIELD HEADER |
|
317 | // DATA FIELD HEADER | |
326 | volatile unsigned char spare1_pusVersion_spare2; |
|
318 | volatile unsigned char spare1_pusVersion_spare2; | |
327 | volatile unsigned char serviceType; |
|
319 | volatile unsigned char serviceType; | |
328 | volatile unsigned char serviceSubType; |
|
320 | volatile unsigned char serviceSubType; | |
329 | volatile unsigned char destinationID; |
|
321 | volatile unsigned char destinationID; | |
330 | volatile unsigned char time[6]; |
|
322 | volatile unsigned char time[6]; | |
331 | // |
|
323 | // | |
332 | volatile unsigned char tc_failure_code[2]; |
|
324 | volatile unsigned char tc_failure_code[2]; | |
333 | volatile unsigned char telecommand_pkt_id[2]; |
|
325 | volatile unsigned char telecommand_pkt_id[2]; | |
334 | volatile unsigned char pkt_seq_control[2]; |
|
326 | volatile unsigned char pkt_seq_control[2]; | |
335 | volatile unsigned char tc_service; |
|
327 | volatile unsigned char tc_service; | |
336 | volatile unsigned char tc_subtype; |
|
328 | volatile unsigned char tc_subtype; | |
337 | }; |
|
329 | }; | |
338 | typedef struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t; |
|
330 | typedef struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t; | |
339 |
|
331 | |||
340 | struct Packet_TM_LFR_TC_EXE_ERROR_str |
|
332 | struct Packet_TM_LFR_TC_EXE_ERROR_str | |
341 | { |
|
333 | { | |
342 | volatile unsigned char targetLogicalAddress; |
|
334 | volatile unsigned char targetLogicalAddress; | |
343 | volatile unsigned char protocolIdentifier; |
|
335 | volatile unsigned char protocolIdentifier; | |
344 | volatile unsigned char reserved; |
|
336 | volatile unsigned char reserved; | |
345 | volatile unsigned char userApplication; |
|
337 | volatile unsigned char userApplication; | |
346 | // PACKET HEADER |
|
338 | // PACKET HEADER | |
347 | volatile unsigned char packetID[2]; |
|
339 | volatile unsigned char packetID[2]; | |
348 | volatile unsigned char packetSequenceControl[2]; |
|
340 | volatile unsigned char packetSequenceControl[2]; | |
349 | volatile unsigned char packetLength[2]; |
|
341 | volatile unsigned char packetLength[2]; | |
350 | // DATA FIELD HEADER |
|
342 | // DATA FIELD HEADER | |
351 | volatile unsigned char spare1_pusVersion_spare2; |
|
343 | volatile unsigned char spare1_pusVersion_spare2; | |
352 | volatile unsigned char serviceType; |
|
344 | volatile unsigned char serviceType; | |
353 | volatile unsigned char serviceSubType; |
|
345 | volatile unsigned char serviceSubType; | |
354 | volatile unsigned char destinationID; |
|
346 | volatile unsigned char destinationID; | |
355 | volatile unsigned char time[6]; |
|
347 | volatile unsigned char time[6]; | |
356 | // |
|
348 | // | |
357 | volatile unsigned char tc_failure_code[2]; |
|
349 | volatile unsigned char tc_failure_code[2]; | |
358 | volatile unsigned char telecommand_pkt_id[2]; |
|
350 | volatile unsigned char telecommand_pkt_id[2]; | |
359 | volatile unsigned char pkt_seq_control[2]; |
|
351 | volatile unsigned char pkt_seq_control[2]; | |
360 | volatile unsigned char tc_service; |
|
352 | volatile unsigned char tc_service; | |
361 | volatile unsigned char tc_subtype; |
|
353 | volatile unsigned char tc_subtype; | |
362 | }; |
|
354 | }; | |
363 | typedef struct Packet_TM_LFR_TC_EXE_ERROR_str Packet_TM_LFR_TC_EXE_ERROR_t; |
|
355 | typedef struct Packet_TM_LFR_TC_EXE_ERROR_str Packet_TM_LFR_TC_EXE_ERROR_t; | |
364 |
|
356 | |||
365 | struct Packet_TM_LFR_TC_EXE_CORRUPTED_str |
|
357 | struct Packet_TM_LFR_TC_EXE_CORRUPTED_str | |
366 | { |
|
358 | { | |
367 | volatile unsigned char targetLogicalAddress; |
|
359 | volatile unsigned char targetLogicalAddress; | |
368 | volatile unsigned char protocolIdentifier; |
|
360 | volatile unsigned char protocolIdentifier; | |
369 | volatile unsigned char reserved; |
|
361 | volatile unsigned char reserved; | |
370 | volatile unsigned char userApplication; |
|
362 | volatile unsigned char userApplication; | |
371 | // PACKET HEADER |
|
363 | // PACKET HEADER | |
372 | volatile unsigned char packetID[2]; |
|
364 | volatile unsigned char packetID[2]; | |
373 | volatile unsigned char packetSequenceControl[2]; |
|
365 | volatile unsigned char packetSequenceControl[2]; | |
374 | volatile unsigned char packetLength[2]; |
|
366 | volatile unsigned char packetLength[2]; | |
375 | // DATA FIELD HEADER |
|
367 | // DATA FIELD HEADER | |
376 | volatile unsigned char spare1_pusVersion_spare2; |
|
368 | volatile unsigned char spare1_pusVersion_spare2; | |
377 | volatile unsigned char serviceType; |
|
369 | volatile unsigned char serviceType; | |
378 | volatile unsigned char serviceSubType; |
|
370 | volatile unsigned char serviceSubType; | |
379 | volatile unsigned char destinationID; |
|
371 | volatile unsigned char destinationID; | |
380 | volatile unsigned char time[6]; |
|
372 | volatile unsigned char time[6]; | |
381 | // |
|
373 | // | |
382 | volatile unsigned char tc_failure_code[2]; |
|
374 | volatile unsigned char tc_failure_code[2]; | |
383 | volatile unsigned char telecommand_pkt_id[2]; |
|
375 | volatile unsigned char telecommand_pkt_id[2]; | |
384 | volatile unsigned char pkt_seq_control[2]; |
|
376 | volatile unsigned char pkt_seq_control[2]; | |
385 | volatile unsigned char tc_service; |
|
377 | volatile unsigned char tc_service; | |
386 | volatile unsigned char tc_subtype; |
|
378 | volatile unsigned char tc_subtype; | |
387 | volatile unsigned char pkt_len_rcv_value[2]; |
|
379 | volatile unsigned char pkt_len_rcv_value[2]; | |
388 | volatile unsigned char pkt_datafieldsize_cnt[2]; |
|
380 | volatile unsigned char pkt_datafieldsize_cnt[2]; | |
389 | volatile unsigned char rcv_crc[2]; |
|
381 | volatile unsigned char rcv_crc[2]; | |
390 | volatile unsigned char computed_crc[2]; |
|
382 | volatile unsigned char computed_crc[2]; | |
391 | }; |
|
383 | }; | |
392 | typedef struct Packet_TM_LFR_TC_EXE_CORRUPTED_str Packet_TM_LFR_TC_EXE_CORRUPTED_t; |
|
384 | typedef struct Packet_TM_LFR_TC_EXE_CORRUPTED_str Packet_TM_LFR_TC_EXE_CORRUPTED_t; | |
393 |
|
385 | |||
394 | struct Header_TM_LFR_SCIENCE_SWF_str |
|
386 | struct Header_TM_LFR_SCIENCE_SWF_str | |
395 | { |
|
387 | { | |
396 | volatile unsigned char targetLogicalAddress; |
|
388 | volatile unsigned char targetLogicalAddress; | |
397 | volatile unsigned char protocolIdentifier; |
|
389 | volatile unsigned char protocolIdentifier; | |
398 | volatile unsigned char reserved; |
|
390 | volatile unsigned char reserved; | |
399 | volatile unsigned char userApplication; |
|
391 | volatile unsigned char userApplication; | |
400 | volatile unsigned char packetID[2]; |
|
392 | volatile unsigned char packetID[2]; | |
401 | volatile unsigned char packetSequenceControl[2]; |
|
393 | volatile unsigned char packetSequenceControl[2]; | |
402 | volatile unsigned char packetLength[2]; |
|
394 | volatile unsigned char packetLength[2]; | |
403 | // DATA FIELD HEADER |
|
395 | // DATA FIELD HEADER | |
404 | volatile unsigned char spare1_pusVersion_spare2; |
|
396 | volatile unsigned char spare1_pusVersion_spare2; | |
405 | volatile unsigned char serviceType; |
|
397 | volatile unsigned char serviceType; | |
406 | volatile unsigned char serviceSubType; |
|
398 | volatile unsigned char serviceSubType; | |
407 | volatile unsigned char destinationID; |
|
399 | volatile unsigned char destinationID; | |
408 | volatile unsigned char time[6]; |
|
400 | volatile unsigned char time[6]; | |
409 | // AUXILIARY HEADER |
|
401 | // AUXILIARY HEADER | |
410 | volatile unsigned char sid; |
|
402 | volatile unsigned char sid; | |
411 | volatile unsigned char hkBIA; |
|
403 | volatile unsigned char hkBIA; | |
412 | volatile unsigned char pktCnt; |
|
404 | volatile unsigned char pktCnt; | |
413 | volatile unsigned char pktNr; |
|
405 | volatile unsigned char pktNr; | |
414 | volatile unsigned char acquisitionTime[6]; |
|
406 | volatile unsigned char acquisitionTime[6]; | |
415 | volatile unsigned char blkNr[2]; |
|
407 | volatile unsigned char blkNr[2]; | |
416 | }; |
|
408 | }; | |
417 | typedef struct Header_TM_LFR_SCIENCE_SWF_str Header_TM_LFR_SCIENCE_SWF_t; |
|
409 | typedef struct Header_TM_LFR_SCIENCE_SWF_str Header_TM_LFR_SCIENCE_SWF_t; | |
418 |
|
410 | |||
419 | struct Header_TM_LFR_SCIENCE_CWF_str |
|
411 | struct Header_TM_LFR_SCIENCE_CWF_str | |
420 | { |
|
412 | { | |
421 | volatile unsigned char targetLogicalAddress; |
|
413 | volatile unsigned char targetLogicalAddress; | |
422 | volatile unsigned char protocolIdentifier; |
|
414 | volatile unsigned char protocolIdentifier; | |
423 | volatile unsigned char reserved; |
|
415 | volatile unsigned char reserved; | |
424 | volatile unsigned char userApplication; |
|
416 | volatile unsigned char userApplication; | |
425 | volatile unsigned char packetID[2]; |
|
417 | volatile unsigned char packetID[2]; | |
426 | volatile unsigned char packetSequenceControl[2]; |
|
418 | volatile unsigned char packetSequenceControl[2]; | |
427 | volatile unsigned char packetLength[2]; |
|
419 | volatile unsigned char packetLength[2]; | |
428 | // DATA FIELD HEADER |
|
420 | // DATA FIELD HEADER | |
429 | volatile unsigned char spare1_pusVersion_spare2; |
|
421 | volatile unsigned char spare1_pusVersion_spare2; | |
430 | volatile unsigned char serviceType; |
|
422 | volatile unsigned char serviceType; | |
431 | volatile unsigned char serviceSubType; |
|
423 | volatile unsigned char serviceSubType; | |
432 | volatile unsigned char destinationID; |
|
424 | volatile unsigned char destinationID; | |
433 | volatile unsigned char time[6]; |
|
425 | volatile unsigned char time[6]; | |
434 | // AUXILIARY DATA HEADER |
|
426 | // AUXILIARY DATA HEADER | |
435 | volatile unsigned char sid; |
|
427 | volatile unsigned char sid; | |
436 | volatile unsigned char hkBIA; |
|
428 | volatile unsigned char hkBIA; | |
437 | volatile unsigned char acquisitionTime[6]; |
|
429 | volatile unsigned char acquisitionTime[6]; | |
438 | volatile unsigned char blkNr[2]; |
|
430 | volatile unsigned char blkNr[2]; | |
439 | }; |
|
431 | }; | |
440 | typedef struct Header_TM_LFR_SCIENCE_CWF_str Header_TM_LFR_SCIENCE_CWF_t; |
|
432 | typedef struct Header_TM_LFR_SCIENCE_CWF_str Header_TM_LFR_SCIENCE_CWF_t; | |
441 |
|
433 | |||
442 | struct Header_TM_LFR_SCIENCE_ASM_str |
|
434 | struct Header_TM_LFR_SCIENCE_ASM_str | |
443 | { |
|
435 | { | |
444 | volatile unsigned char targetLogicalAddress; |
|
436 | volatile unsigned char targetLogicalAddress; | |
445 | volatile unsigned char protocolIdentifier; |
|
437 | volatile unsigned char protocolIdentifier; | |
446 | volatile unsigned char reserved; |
|
438 | volatile unsigned char reserved; | |
447 | volatile unsigned char userApplication; |
|
439 | volatile unsigned char userApplication; | |
448 | volatile unsigned char packetID[2]; |
|
440 | volatile unsigned char packetID[2]; | |
449 | volatile unsigned char packetSequenceControl[2]; |
|
441 | volatile unsigned char packetSequenceControl[2]; | |
450 | volatile unsigned char packetLength[2]; |
|
442 | volatile unsigned char packetLength[2]; | |
451 | // DATA FIELD HEADER |
|
443 | // DATA FIELD HEADER | |
452 | volatile unsigned char spare1_pusVersion_spare2; |
|
444 | volatile unsigned char spare1_pusVersion_spare2; | |
453 | volatile unsigned char serviceType; |
|
445 | volatile unsigned char serviceType; | |
454 | volatile unsigned char serviceSubType; |
|
446 | volatile unsigned char serviceSubType; | |
455 | volatile unsigned char destinationID; |
|
447 | volatile unsigned char destinationID; | |
456 | volatile unsigned char time[6]; |
|
448 | volatile unsigned char time[6]; | |
457 | // AUXILIARY HEADER |
|
449 | // AUXILIARY HEADER | |
458 | volatile unsigned char sid; |
|
450 | volatile unsigned char sid; | |
459 | volatile unsigned char biaStatusInfo; |
|
451 | volatile unsigned char biaStatusInfo; | |
460 | volatile unsigned char cntASM; |
|
452 | volatile unsigned char cntASM; | |
461 | volatile unsigned char nrASM; |
|
453 | volatile unsigned char nrASM; | |
462 | volatile unsigned char acquisitionTime[6]; |
|
454 | volatile unsigned char acquisitionTime[6]; | |
463 | volatile unsigned char blkNr[2]; |
|
455 | volatile unsigned char blkNr[2]; | |
464 | }; |
|
456 | }; | |
465 | typedef struct Header_TM_LFR_SCIENCE_ASM_str Header_TM_LFR_SCIENCE_ASM_t; |
|
457 | typedef struct Header_TM_LFR_SCIENCE_ASM_str Header_TM_LFR_SCIENCE_ASM_t; | |
466 |
|
458 | |||
467 | struct ccsdsTelecommandPacket_str |
|
459 | struct ccsdsTelecommandPacket_str | |
468 | { |
|
460 | { | |
469 | //unsigned char targetLogicalAddress; // removed by the grspw module |
|
461 | //unsigned char targetLogicalAddress; // removed by the grspw module | |
470 | volatile unsigned char protocolIdentifier; |
|
462 | volatile unsigned char protocolIdentifier; | |
471 | volatile unsigned char reserved; |
|
463 | volatile unsigned char reserved; | |
472 | volatile unsigned char userApplication; |
|
464 | volatile unsigned char userApplication; | |
473 | volatile unsigned char packetID[2]; |
|
465 | volatile unsigned char packetID[2]; | |
474 | volatile unsigned char packetSequenceControl[2]; |
|
466 | volatile unsigned char packetSequenceControl[2]; | |
475 | volatile unsigned char packetLength[2]; |
|
467 | volatile unsigned char packetLength[2]; | |
476 | // DATA FIELD HEADER |
|
468 | // DATA FIELD HEADER | |
477 | volatile unsigned char headerFlag_pusVersion_Ack; |
|
469 | volatile unsigned char headerFlag_pusVersion_Ack; | |
478 | volatile unsigned char serviceType; |
|
470 | volatile unsigned char serviceType; | |
479 | volatile unsigned char serviceSubType; |
|
471 | volatile unsigned char serviceSubType; | |
480 | volatile unsigned char sourceID; |
|
472 | volatile unsigned char sourceID; | |
481 | volatile unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; |
|
473 | volatile unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; | |
482 | }; |
|
474 | }; | |
483 | typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t; |
|
475 | typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t; | |
484 |
|
476 | |||
485 | struct Packet_TM_LFR_HK_str |
|
477 | struct Packet_TM_LFR_HK_str | |
486 | { |
|
478 | { | |
487 | volatile unsigned char targetLogicalAddress; |
|
479 | volatile unsigned char targetLogicalAddress; | |
488 | volatile unsigned char protocolIdentifier; |
|
480 | volatile unsigned char protocolIdentifier; | |
489 | volatile unsigned char reserved; |
|
481 | volatile unsigned char reserved; | |
490 | volatile unsigned char userApplication; |
|
482 | volatile unsigned char userApplication; | |
491 | volatile unsigned char packetID[2]; |
|
483 | volatile unsigned char packetID[2]; | |
492 | volatile unsigned char packetSequenceControl[2]; |
|
484 | volatile unsigned char packetSequenceControl[2]; | |
493 | volatile unsigned char packetLength[2]; |
|
485 | volatile unsigned char packetLength[2]; | |
494 | volatile unsigned char spare1_pusVersion_spare2; |
|
486 | volatile unsigned char spare1_pusVersion_spare2; | |
495 | volatile unsigned char serviceType; |
|
487 | volatile unsigned char serviceType; | |
496 | volatile unsigned char serviceSubType; |
|
488 | volatile unsigned char serviceSubType; | |
497 | volatile unsigned char destinationID; |
|
489 | volatile unsigned char destinationID; | |
498 | volatile unsigned char time[6]; |
|
490 | volatile unsigned char time[6]; | |
499 | volatile unsigned char sid; |
|
491 | volatile unsigned char sid; | |
500 |
|
492 | |||
501 | //************** |
|
493 | //************** | |
502 | // HK PARAMETERS |
|
494 | // HK PARAMETERS | |
503 | unsigned char lfr_status_word[2]; |
|
495 | unsigned char lfr_status_word[2]; | |
504 | unsigned char lfr_sw_version[4]; |
|
496 | unsigned char lfr_sw_version[4]; | |
505 | // tc statistics |
|
497 | // tc statistics | |
506 | unsigned char hk_lfr_update_info_tc_cnt[2]; |
|
498 | unsigned char hk_lfr_update_info_tc_cnt[2]; | |
507 | unsigned char hk_lfr_update_time_tc_cnt[2]; |
|
499 | unsigned char hk_lfr_update_time_tc_cnt[2]; | |
508 | unsigned char hk_dpu_exe_tc_lfr_cnt[2]; |
|
500 | unsigned char hk_dpu_exe_tc_lfr_cnt[2]; | |
509 | unsigned char hk_dpu_rej_tc_lfr_cnt[2]; |
|
501 | unsigned char hk_dpu_rej_tc_lfr_cnt[2]; | |
510 | unsigned char hk_lfr_last_exe_tc_id[2]; |
|
502 | unsigned char hk_lfr_last_exe_tc_id[2]; | |
511 | unsigned char hk_lfr_last_exe_tc_type[2]; |
|
503 | unsigned char hk_lfr_last_exe_tc_type[2]; | |
512 | unsigned char hk_lfr_last_exe_tc_subtype[2]; |
|
504 | unsigned char hk_lfr_last_exe_tc_subtype[2]; | |
513 | unsigned char hk_lfr_last_exe_tc_time[6]; |
|
505 | unsigned char hk_lfr_last_exe_tc_time[6]; | |
514 | unsigned char hk_lfr_last_rej_tc_id[2]; |
|
506 | unsigned char hk_lfr_last_rej_tc_id[2]; | |
515 | unsigned char hk_lfr_last_rej_tc_type[2]; |
|
507 | unsigned char hk_lfr_last_rej_tc_type[2]; | |
516 | unsigned char hk_lfr_last_rej_tc_subtype[2]; |
|
508 | unsigned char hk_lfr_last_rej_tc_subtype[2]; | |
517 | unsigned char hk_lfr_last_rej_tc_time[6]; |
|
509 | unsigned char hk_lfr_last_rej_tc_time[6]; | |
518 | // anomaly statistics |
|
510 | // anomaly statistics | |
519 | unsigned char hk_lfr_le_cnt[2]; |
|
511 | unsigned char hk_lfr_le_cnt[2]; | |
520 | unsigned char hk_lfr_me_cnt[2]; |
|
512 | unsigned char hk_lfr_me_cnt[2]; | |
521 | unsigned char hk_lfr_he_cnt[2]; |
|
513 | unsigned char hk_lfr_he_cnt[2]; | |
522 | unsigned char hk_lfr_last_er_rid[2]; |
|
514 | unsigned char hk_lfr_last_er_rid[2]; | |
523 | unsigned char hk_lfr_last_er_code; |
|
515 | unsigned char hk_lfr_last_er_code; | |
524 | unsigned char hk_lfr_last_er_time[6]; |
|
516 | unsigned char hk_lfr_last_er_time[6]; | |
525 | // vhdl_blk_status |
|
517 | // vhdl_blk_status | |
526 | unsigned char hk_lfr_vhdl_aa_sm; |
|
518 | unsigned char hk_lfr_vhdl_aa_sm; | |
527 | unsigned char hk_lfr_vhdl_fft_sr; |
|
519 | unsigned char hk_lfr_vhdl_fft_sr; | |
528 | unsigned char hk_lfr_vhdl_cic_hk; |
|
520 | unsigned char hk_lfr_vhdl_cic_hk; | |
529 | unsigned char hk_lfr_vhdl_iir_cal; |
|
521 | unsigned char hk_lfr_vhdl_iir_cal; | |
530 | // spacewire_if_statistics |
|
522 | // spacewire_if_statistics | |
531 | unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2]; |
|
523 | unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2]; | |
532 | unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2]; |
|
524 | unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2]; | |
533 | unsigned char hk_lfr_dpu_spw_tick_out_cnt; |
|
525 | unsigned char hk_lfr_dpu_spw_tick_out_cnt; | |
534 | unsigned char hk_lfr_dpu_spw_last_timc; |
|
526 | unsigned char hk_lfr_dpu_spw_last_timc; | |
535 | // ahb error statistics |
|
527 | // ahb error statistics | |
536 | unsigned int hk_lfr_last_fail_addr; |
|
528 | unsigned int hk_lfr_last_fail_addr; | |
537 | // temperatures |
|
529 | // temperatures | |
538 | unsigned char hk_lfr_temp_scm[2]; |
|
530 | unsigned char hk_lfr_temp_scm[2]; | |
539 | unsigned char hk_lfr_temp_pcb[2]; |
|
531 | unsigned char hk_lfr_temp_pcb[2]; | |
540 | unsigned char hk_lfr_temp_fpga[2]; |
|
532 | unsigned char hk_lfr_temp_fpga[2]; | |
541 | // error counters |
|
533 | // error counters | |
542 | unsigned char hk_lfr_dpu_spw_parity; |
|
534 | unsigned char hk_lfr_dpu_spw_parity; | |
543 | unsigned char hk_lfr_dpu_spw_disconnect; |
|
535 | unsigned char hk_lfr_dpu_spw_disconnect; | |
544 | unsigned char hk_lfr_dpu_spw_escape; |
|
536 | unsigned char hk_lfr_dpu_spw_escape; | |
545 | unsigned char hk_lfr_dpu_spw_credit; |
|
537 | unsigned char hk_lfr_dpu_spw_credit; | |
546 | unsigned char hk_lfr_dpu_spw_write_sync; |
|
538 | unsigned char hk_lfr_dpu_spw_write_sync; | |
547 | unsigned char hk_lfr_dpu_spw_rx_ahb; |
|
539 | unsigned char hk_lfr_dpu_spw_rx_ahb; | |
548 | unsigned char hk_lfr_dpu_spw_tx_ahb; |
|
540 | unsigned char hk_lfr_dpu_spw_tx_ahb; | |
549 | unsigned char hk_lfr_dpu_spw_header_crc; |
|
541 | unsigned char hk_lfr_dpu_spw_header_crc; | |
550 | unsigned char hk_lfr_dpu_spw_data_crc; |
|
542 | unsigned char hk_lfr_dpu_spw_data_crc; | |
551 | unsigned char hk_lfr_dpu_spw_early_eop; |
|
543 | unsigned char hk_lfr_dpu_spw_early_eop; | |
552 | unsigned char hk_lfr_dpu_spw_invalid_addr; |
|
544 | unsigned char hk_lfr_dpu_spw_invalid_addr; | |
553 | unsigned char hk_lfr_dpu_spw_eep; |
|
545 | unsigned char hk_lfr_dpu_spw_eep; | |
554 | unsigned char hk_lfr_dpu_spw_rx_too_big; |
|
546 | unsigned char hk_lfr_dpu_spw_rx_too_big; | |
555 | // timecode |
|
547 | // timecode | |
556 | unsigned char hk_lfr_timecode_erroneous; |
|
548 | unsigned char hk_lfr_timecode_erroneous; | |
557 | unsigned char hk_lfr_timecode_missing; |
|
549 | unsigned char hk_lfr_timecode_missing; | |
558 | unsigned char hk_lfr_timecode_invalid; |
|
550 | unsigned char hk_lfr_timecode_invalid; | |
559 | // time |
|
551 | // time | |
560 | unsigned char hk_lfr_time_timecode_it; |
|
552 | unsigned char hk_lfr_time_timecode_it; | |
561 | unsigned char hk_lfr_time_not_synchro; |
|
553 | unsigned char hk_lfr_time_not_synchro; | |
562 | unsigned char hk_lfr_time_timecode_ctr; |
|
554 | unsigned char hk_lfr_time_timecode_ctr; | |
563 | // hk_lfr_buffer_dpu_ |
|
555 | // hk_lfr_buffer_dpu_ | |
564 | unsigned char hk_lfr_buffer_dpu_tc_fifo; |
|
556 | unsigned char hk_lfr_buffer_dpu_tc_fifo; | |
565 | unsigned char hk_lfr_buffer_dpu_tm_fifo; |
|
557 | unsigned char hk_lfr_buffer_dpu_tm_fifo; | |
566 | // hk_lfr_ahb_ |
|
558 | // hk_lfr_ahb_ | |
567 | unsigned char hk_lfr_ahb_correctable; |
|
559 | unsigned char hk_lfr_ahb_correctable; | |
568 | unsigned char hk_lfr_ahb_uncorrectable; |
|
560 | unsigned char hk_lfr_ahb_uncorrectable; | |
569 | unsigned char hk_lfr_ahb_fails_trans; |
|
561 | unsigned char hk_lfr_ahb_fails_trans; | |
570 | // hk_lfr_adc_ |
|
562 | // hk_lfr_adc_ | |
571 | unsigned char hk_lfr_adc_failure; |
|
563 | unsigned char hk_lfr_adc_failure; | |
572 | unsigned char hk_lfr_adc_timeout; |
|
564 | unsigned char hk_lfr_adc_timeout; | |
573 | unsigned char hk_lfr_toomany_err; |
|
565 | unsigned char hk_lfr_toomany_err; | |
574 | // hk_lfr_cpu_ |
|
566 | // hk_lfr_cpu_ | |
575 | unsigned char hk_lfr_cpu_write_err; |
|
567 | unsigned char hk_lfr_cpu_write_err; | |
576 | unsigned char hk_lfr_cpu_ins_access_err; |
|
568 | unsigned char hk_lfr_cpu_ins_access_err; | |
577 | unsigned char hk_lfr_cpu_illegal_ins; |
|
569 | unsigned char hk_lfr_cpu_illegal_ins; | |
578 | unsigned char hk_lfr_cpu_privilegied_ins; |
|
570 | unsigned char hk_lfr_cpu_privilegied_ins; | |
579 | unsigned char hk_lfr_cpu_register_hw; |
|
571 | unsigned char hk_lfr_cpu_register_hw; | |
580 | unsigned char hk_lfr_cpu_not_aligned; |
|
572 | unsigned char hk_lfr_cpu_not_aligned; | |
581 | unsigned char hk_lfr_cpu_data_exception; |
|
573 | unsigned char hk_lfr_cpu_data_exception; | |
582 | unsigned char hk_lfr_cpu_div_exception; |
|
574 | unsigned char hk_lfr_cpu_div_exception; | |
583 | unsigned char hk_lfr_cpu_arith_overflow; |
|
575 | unsigned char hk_lfr_cpu_arith_overflow; | |
584 | }; |
|
576 | }; | |
585 | typedef struct Packet_TM_LFR_HK_str Packet_TM_LFR_HK_t; |
|
577 | typedef struct Packet_TM_LFR_HK_str Packet_TM_LFR_HK_t; | |
586 |
|
578 | |||
587 | struct Packet_TM_LFR_PARAMETER_DUMP_str |
|
579 | struct Packet_TM_LFR_PARAMETER_DUMP_str | |
588 | { |
|
580 | { | |
589 | volatile unsigned char targetLogicalAddress; |
|
581 | volatile unsigned char targetLogicalAddress; | |
590 | volatile unsigned char protocolIdentifier; |
|
582 | volatile unsigned char protocolIdentifier; | |
591 | volatile unsigned char reserved; |
|
583 | volatile unsigned char reserved; | |
592 | volatile unsigned char userApplication; |
|
584 | volatile unsigned char userApplication; | |
593 | volatile unsigned char packetID[2]; |
|
585 | volatile unsigned char packetID[2]; | |
594 | volatile unsigned char packetSequenceControl[2]; |
|
586 | volatile unsigned char packetSequenceControl[2]; | |
595 | volatile unsigned char packetLength[2]; |
|
587 | volatile unsigned char packetLength[2]; | |
596 | // DATA FIELD HEADER |
|
588 | // DATA FIELD HEADER | |
597 | volatile unsigned char spare1_pusVersion_spare2; |
|
589 | volatile unsigned char spare1_pusVersion_spare2; | |
598 | volatile unsigned char serviceType; |
|
590 | volatile unsigned char serviceType; | |
599 | volatile unsigned char serviceSubType; |
|
591 | volatile unsigned char serviceSubType; | |
600 | volatile unsigned char destinationID; |
|
592 | volatile unsigned char destinationID; | |
601 | volatile unsigned char time[6]; |
|
593 | volatile unsigned char time[6]; | |
602 | volatile unsigned char sid; |
|
594 | volatile unsigned char sid; | |
603 |
|
595 | |||
604 | //****************** |
|
596 | //****************** | |
605 | // COMMON PARAMETERS |
|
597 | // COMMON PARAMETERS | |
606 | volatile unsigned char unused0; |
|
598 | volatile unsigned char unused0; | |
607 | volatile unsigned char bw_sp0_sp1_r0_r1; |
|
599 | volatile unsigned char bw_sp0_sp1_r0_r1; | |
608 |
|
600 | |||
609 | //****************** |
|
601 | //****************** | |
610 | // NORMAL PARAMETERS |
|
602 | // NORMAL PARAMETERS | |
611 | volatile unsigned char sy_lfr_n_swf_l[2]; |
|
603 | volatile unsigned char sy_lfr_n_swf_l[2]; | |
612 | volatile unsigned char sy_lfr_n_swf_p[2]; |
|
604 | volatile unsigned char sy_lfr_n_swf_p[2]; | |
613 | volatile unsigned char sy_lfr_n_asm_p[2]; |
|
605 | volatile unsigned char sy_lfr_n_asm_p[2]; | |
614 | volatile unsigned char sy_lfr_n_bp_p0; |
|
606 | volatile unsigned char sy_lfr_n_bp_p0; | |
615 | volatile unsigned char sy_lfr_n_bp_p1; |
|
607 | volatile unsigned char sy_lfr_n_bp_p1; | |
616 |
|
608 | |||
617 | //***************** |
|
609 | //***************** | |
618 | // BURST PARAMETERS |
|
610 | // BURST PARAMETERS | |
619 | volatile unsigned char sy_lfr_b_bp_p0; |
|
611 | volatile unsigned char sy_lfr_b_bp_p0; | |
620 | volatile unsigned char sy_lfr_b_bp_p1; |
|
612 | volatile unsigned char sy_lfr_b_bp_p1; | |
621 |
|
613 | |||
622 | //**************** |
|
614 | //**************** | |
623 | // SBM1 PARAMETERS |
|
615 | // SBM1 PARAMETERS | |
624 | volatile unsigned char sy_lfr_s1_bp_p0; |
|
616 | volatile unsigned char sy_lfr_s1_bp_p0; | |
625 | volatile unsigned char sy_lfr_s1_bp_p1; |
|
617 | volatile unsigned char sy_lfr_s1_bp_p1; | |
626 |
|
618 | |||
627 | //**************** |
|
619 | //**************** | |
628 | // SBM2 PARAMETERS |
|
620 | // SBM2 PARAMETERS | |
629 | volatile unsigned char sy_lfr_s2_bp_p0; |
|
621 | volatile unsigned char sy_lfr_s2_bp_p0; | |
630 | volatile unsigned char sy_lfr_s2_bp_p1; |
|
622 | volatile unsigned char sy_lfr_s2_bp_p1; | |
631 | }; |
|
623 | }; | |
632 | typedef struct Packet_TM_LFR_PARAMETER_DUMP_str Packet_TM_LFR_PARAMETER_DUMP_t; |
|
624 | typedef struct Packet_TM_LFR_PARAMETER_DUMP_str Packet_TM_LFR_PARAMETER_DUMP_t; | |
633 |
|
625 | |||
634 |
|
626 | |||
635 | #endif // CCSDS_H_INCLUDED |
|
627 | #endif // CCSDS_H_INCLUDED |
@@ -1,60 +1,58 | |||||
1 | #ifndef FSW_RTEMS_H_INCLUDED |
|
1 | #ifndef FSW_RTEMS_H_INCLUDED | |
2 | #define FSW_RTEMS_H_INCLUDED |
|
2 | #define FSW_RTEMS_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <errno.h> |
|
4 | #include <errno.h> | |
5 | #include <fcntl.h> |
|
5 | #include <fcntl.h> | |
6 | #include <stdio.h> |
|
6 | #include <stdio.h> | |
7 | #include <stdlib.h> |
|
7 | #include <stdlib.h> | |
|
8 | #include <unistd.h> // for the read call | |||
|
9 | #include <sys/ioctl.h> // for the ioctl call | |||
8 |
|
10 | |||
|
11 | #include <rtems.h> | |||
9 | #include <grspw.h> |
|
12 | #include <grspw.h> | |
10 | #include <apbuart.h> |
|
13 | #include <apbuart.h> | |
|
14 | #include <leon.h> | |||
11 |
|
15 | |||
12 | #include "fsw_params.h" |
|
16 | #include "fsw_params.h" | |
13 | #include "fsw_misc.h" |
|
17 | #include "fsw_misc.h" | |
14 | #include "tm_byte_positions.h" |
|
|||
15 | #include "fsw_processing.h" |
|
18 | #include "fsw_processing.h" | |
16 | #include "tc_handler.h" |
|
19 | #include "tc_handler.h" | |
17 | #include "wf_handler.h" |
|
20 | #include "wf_handler.h" | |
18 | #include "grlib_regs.h" |
|
|||
19 | #include "ccsds_types.h" |
|
|||
20 |
|
21 | |||
21 | #include "fsw_spacewire.h" |
|
22 | #include "fsw_spacewire.h" | |
22 |
|
23 | |||
23 | extern rtems_name misc_name[5]; |
|
24 | extern rtems_name misc_name[5]; | |
24 | extern rtems_id misc_id[5]; |
|
25 | extern rtems_id misc_id[5]; | |
25 | extern rtems_name Task_name[20]; /* array of task names */ |
|
26 | extern rtems_name Task_name[20]; /* array of task names */ | |
26 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
27 | extern rtems_id Task_id[20]; /* array of task ids */ | |
27 | extern unsigned int maxCount; |
|
28 | extern unsigned int maxCount; | |
28 | extern int fdSPW; // grspw file descriptor |
|
29 | extern int fdSPW; // grspw file descriptor | |
29 | extern int fdUART; // uart file descriptor |
|
30 | extern int fdUART; // uart file descriptor | |
30 | extern unsigned char lfrCurrentMode; |
|
31 | extern unsigned char lfrCurrentMode; | |
31 |
|
32 | |||
32 | // MODE PARAMETERS |
|
33 | // MODE PARAMETERS | |
33 | extern struct param_local_str param_local; |
|
34 | extern struct param_local_str param_local; | |
34 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
35 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; | |
35 | extern unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID]; |
|
36 | extern unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID]; | |
36 |
|
37 | |||
37 | // RTEMS TASKS |
|
38 | // RTEMS TASKS | |
38 |
rtems_task Init( rtems_task_argument argument); |
|
39 | rtems_task Init( rtems_task_argument argument); | |
39 | rtems_task recv_task(rtems_task_argument argument); |
|
|||
40 | rtems_task stat_task(rtems_task_argument argument); |
|
|||
41 | rtems_task wfrm_task(rtems_task_argument argument); |
|
|||
42 |
|
40 | |||
43 | // OTHER functions |
|
41 | // OTHER functions | |
44 | int create_names( void ); |
|
42 | int create_names( void ); | |
45 | int create_all_tasks( void ); |
|
43 | int create_all_tasks( void ); | |
46 | int start_all_tasks( void ); |
|
44 | int start_all_tasks( void ); | |
47 | rtems_status_code create_message_queues( void ); |
|
45 | rtems_status_code create_message_queues( void ); | |
48 | // |
|
46 | // | |
49 | void init_parameter_dump( void ); |
|
47 | void init_parameter_dump( void ); | |
50 | void init_local_mode_parameters( void ); |
|
48 | void init_local_mode_parameters( void ); | |
51 | void init_housekeeping_parameters( void ); |
|
49 | void init_housekeeping_parameters( void ); | |
52 |
|
50 | |||
53 | extern int rtems_cpu_usage_report( void ); |
|
51 | extern int rtems_cpu_usage_report( void ); | |
54 | extern int rtems_cpu_usage_reset( void ); |
|
52 | extern int rtems_cpu_usage_reset( void ); | |
55 | extern void rtems_stack_checker_report_usage( void ); |
|
53 | extern void rtems_stack_checker_report_usage( void ); | |
56 |
|
54 | |||
57 | extern int sched_yield( void ); |
|
55 | extern int sched_yield( void ); | |
58 | extern int errno; |
|
56 | extern int errno; | |
59 |
|
57 | |||
60 | #endif // FSW_RTEMS_CONFIG_H_INCLUDED |
|
58 | #endif // FSW_RTEMS_CONFIG_H_INCLUDED |
@@ -1,36 +1,28 | |||||
1 | #ifndef FSW_MISC_H_INCLUDED |
|
1 | #ifndef FSW_MISC_H_INCLUDED | |
2 | #define FSW_MISC_H_INCLUDED |
|
2 | #define FSW_MISC_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
|||
5 | #include <stdio.h> |
|
|||
6 |
|
||||
7 | #include <grspw.h> |
|
|||
8 |
|
||||
9 | #include "fsw_init.h" |
|
4 | #include "fsw_init.h" | |
10 | #include "fsw_params.h" |
|
|||
11 | #include "grlib_regs.h" |
|
|||
12 | #include "ccsds_types.h" |
|
|||
13 |
|
5 | |||
14 | rtems_name HK_name; // name of the HK rate monotonic |
|
6 | rtems_name HK_name; // name of the HK rate monotonic | |
15 | rtems_id HK_id; // id of the HK rate monotonic period |
|
7 | rtems_id HK_id; // id of the HK rate monotonic period | |
16 | extern Packet_TM_LFR_HK_t housekeeping_packet; |
|
8 | extern Packet_TM_LFR_HK_t housekeeping_packet; | |
17 |
|
9 | |||
18 | int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, |
|
10 | int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, | |
19 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ); |
|
11 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ); | |
20 | int timer_start( gptimer_regs_t *gptimer_regs, unsigned char timer ); |
|
12 | int timer_start( gptimer_regs_t *gptimer_regs, unsigned char timer ); | |
21 | int timer_stop( gptimer_regs_t *gptimer_regs, unsigned char timer ); |
|
13 | int timer_stop( gptimer_regs_t *gptimer_regs, unsigned char timer ); | |
22 | int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider); |
|
14 | int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider); | |
23 | void update_spacewire_statistics(); |
|
15 | void update_spacewire_statistics(); | |
24 |
|
16 | |||
25 | // SERIAL LINK |
|
17 | // SERIAL LINK | |
26 | int send_console_outputs_on_apbuart_port( void ); |
|
18 | int send_console_outputs_on_apbuart_port( void ); | |
27 |
|
|
19 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value); | |
28 |
|
20 | |||
29 | // RTEMS TASKS |
|
21 | // RTEMS TASKS | |
30 | rtems_task stat_task(rtems_task_argument argument); |
|
22 | rtems_task stat_task(rtems_task_argument argument); | |
31 | rtems_task hous_task(rtems_task_argument argument); |
|
23 | rtems_task hous_task(rtems_task_argument argument); | |
32 | rtems_task send_task(rtems_task_argument argument); |
|
24 | rtems_task send_task(rtems_task_argument argument); | |
33 |
|
25 | |||
34 | rtems_id get_pkts_queue_id( void ); |
|
26 | rtems_id get_pkts_queue_id( void ); | |
35 |
|
27 | |||
36 | #endif // FSW_MISC_H_INCLUDED |
|
28 | #endif // FSW_MISC_H_INCLUDED |
@@ -1,223 +1,225 | |||||
1 | #ifndef FSW_RTEMS_CONFIG_H_INCLUDED |
|
1 | #ifndef FSW_RTEMS_CONFIG_H_INCLUDED | |
2 | #define FSW_RTEMS_CONFIG_H_INCLUDED |
|
2 | #define FSW_RTEMS_CONFIG_H_INCLUDED | |
3 |
|
3 | |||
|
4 | #include "grlib_regs.h" | |||
4 | #include "fsw_params_processing.h" |
|
5 | #include "fsw_params_processing.h" | |
|
6 | #include "tm_byte_positions.h" | |||
5 | #include "ccsds_types.h" |
|
7 | #include "ccsds_types.h" | |
6 |
|
8 | |||
7 | #define GRSPW_DEVICE_NAME "/dev/grspw0" |
|
9 | #define GRSPW_DEVICE_NAME "/dev/grspw0" | |
8 | #define UART_DEVICE_NAME "/dev/console" |
|
10 | #define UART_DEVICE_NAME "/dev/console" | |
9 |
|
11 | |||
10 | //************************ |
|
12 | //************************ | |
11 | // flight software version |
|
13 | // flight software version | |
12 | // this parameters is handled by the Qt project options |
|
14 | // this parameters is handled by the Qt project options | |
13 |
|
15 | |||
14 | //********** |
|
16 | //********** | |
15 | // LFR MODES |
|
17 | // LFR MODES | |
16 | #define LFR_MODE_STANDBY 0 |
|
18 | #define LFR_MODE_STANDBY 0 | |
17 | #define LFR_MODE_NORMAL 1 |
|
19 | #define LFR_MODE_NORMAL 1 | |
18 | #define LFR_MODE_BURST 2 |
|
20 | #define LFR_MODE_BURST 2 | |
19 | #define LFR_MODE_SBM1 3 |
|
21 | #define LFR_MODE_SBM1 3 | |
20 | #define LFR_MODE_SBM2 4 |
|
22 | #define LFR_MODE_SBM2 4 | |
21 | #define LFR_MODE_NORMAL_CWF_F3 5 |
|
23 | #define LFR_MODE_NORMAL_CWF_F3 5 | |
22 |
|
24 | |||
23 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 |
|
25 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 | |
24 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 |
|
26 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 | |
25 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 |
|
27 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 | |
26 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 |
|
28 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 | |
27 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 |
|
29 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 | |
28 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 |
|
30 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 | |
29 |
|
31 | |||
30 | //**************************** |
|
32 | //**************************** | |
31 | // LFR DEFAULT MODE PARAMETERS |
|
33 | // LFR DEFAULT MODE PARAMETERS | |
32 | // COMMON |
|
34 | // COMMON | |
33 | #define DEFAULT_SY_LFR_COMMON0 0x00 |
|
35 | #define DEFAULT_SY_LFR_COMMON0 0x00 | |
34 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 |
|
36 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 | |
35 | // NORM |
|
37 | // NORM | |
36 | #define DEFAULT_SY_LFR_N_SWF_L 2048 // nb sample |
|
38 | #define DEFAULT_SY_LFR_N_SWF_L 2048 // nb sample | |
37 | #define DEFAULT_SY_LFR_N_SWF_P 16 // sec |
|
39 | #define DEFAULT_SY_LFR_N_SWF_P 16 // sec | |
38 | #define DEFAULT_SY_LFR_N_ASM_P 16 // sec |
|
40 | #define DEFAULT_SY_LFR_N_ASM_P 16 // sec | |
39 | #define DEFAULT_SY_LFR_N_BP_P0 4 // sec |
|
41 | #define DEFAULT_SY_LFR_N_BP_P0 4 // sec | |
40 | #define DEFAULT_SY_LFR_N_BP_P1 20 // sec |
|
42 | #define DEFAULT_SY_LFR_N_BP_P1 20 // sec | |
41 | #define MIN_DELTA_SNAPSHOT 16 // sec |
|
43 | #define MIN_DELTA_SNAPSHOT 16 // sec | |
42 | // BURST |
|
44 | // BURST | |
43 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec |
|
45 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec | |
44 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec |
|
46 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec | |
45 | // SBM1 |
|
47 | // SBM1 | |
46 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec |
|
48 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec | |
47 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec |
|
49 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec | |
48 | // SBM2 |
|
50 | // SBM2 | |
49 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec |
|
51 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec | |
50 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec |
|
52 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec | |
51 | // ADDITIONAL PARAMETERS |
|
53 | // ADDITIONAL PARAMETERS | |
52 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms |
|
54 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms | |
53 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s |
|
55 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s | |
54 | // |
|
56 | // | |
55 | //**************************** |
|
57 | //**************************** | |
56 |
|
58 | |||
57 | //***************************** |
|
59 | //***************************** | |
58 | // APB REGISTERS BASE ADDRESSES |
|
60 | // APB REGISTERS BASE ADDRESSES | |
59 | #define REGS_ADDR_APBUART 0x80000100 |
|
61 | #define REGS_ADDR_APBUART 0x80000100 | |
60 | #define REGS_ADDR_GPTIMER 0x80000300 |
|
62 | #define REGS_ADDR_GPTIMER 0x80000300 | |
61 | #define REGS_ADDR_GRSPW 0x80000500 |
|
63 | #define REGS_ADDR_GRSPW 0x80000500 | |
62 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 |
|
64 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 | |
63 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 |
|
65 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 | |
64 |
|
66 | |||
65 | #ifdef GSA |
|
67 | #ifdef GSA | |
66 | #else |
|
68 | #else | |
67 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20 |
|
69 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20 | |
68 | #endif |
|
70 | #endif | |
69 |
|
71 | |||
70 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
72 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff | |
71 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) |
|
73 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) | |
72 |
|
74 | |||
73 | //********** |
|
75 | //********** | |
74 | // IRQ LINES |
|
76 | // IRQ LINES | |
75 | #define IRQ_SM 9 |
|
77 | #define IRQ_SM 9 | |
76 | #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels |
|
78 | #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels | |
77 | #define IRQ_WF 10 |
|
79 | #define IRQ_WF 10 | |
78 | #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels |
|
80 | #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels | |
79 | #define IRQ_TIME1 12 |
|
81 | #define IRQ_TIME1 12 | |
80 | #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels |
|
82 | #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels | |
81 | #define IRQ_TIME2 13 |
|
83 | #define IRQ_TIME2 13 | |
82 | #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels |
|
84 | #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels | |
83 | #define IRQ_WAVEFORM_PICKER 14 |
|
85 | #define IRQ_WAVEFORM_PICKER 14 | |
84 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels |
|
86 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels | |
85 | #define IRQ_SPECTRAL_MATRIX 6 |
|
87 | #define IRQ_SPECTRAL_MATRIX 6 | |
86 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels |
|
88 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels | |
87 |
|
89 | |||
88 | //***** |
|
90 | //***** | |
89 | // TIME |
|
91 | // TIME | |
90 | #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms |
|
92 | #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms | |
91 | #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s |
|
93 | #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s | |
92 | #define TIMER_SM_SIMULATOR 1 |
|
94 | #define TIMER_SM_SIMULATOR 1 | |
93 | #define TIMER_WF_SIMULATOR 2 |
|
95 | #define TIMER_WF_SIMULATOR 2 | |
94 | #define HK_PERIOD 100 // 100 * 10ms => 1sec |
|
96 | #define HK_PERIOD 100 // 100 * 10ms => 1sec | |
95 |
|
97 | |||
96 | //********** |
|
98 | //********** | |
97 | // LPP CODES |
|
99 | // LPP CODES | |
98 | #define LFR_SUCCESSFUL 0 |
|
100 | #define LFR_SUCCESSFUL 0 | |
99 | #define LFR_DEFAULT 1 |
|
101 | #define LFR_DEFAULT 1 | |
100 |
|
102 | |||
101 | //****** |
|
103 | //****** | |
102 | // RTEMS |
|
104 | // RTEMS | |
103 | #define TASKID_RECV 1 |
|
105 | #define TASKID_RECV 1 | |
104 | #define TASKID_ACTN 2 |
|
106 | #define TASKID_ACTN 2 | |
105 | #define TASKID_SPIQ 3 |
|
107 | #define TASKID_SPIQ 3 | |
106 | #define TASKID_SMIQ 4 |
|
108 | #define TASKID_SMIQ 4 | |
107 | #define TASKID_STAT 5 |
|
109 | #define TASKID_STAT 5 | |
108 | #define TASKID_AVF0 6 |
|
110 | #define TASKID_AVF0 6 | |
109 | #define TASKID_BPF0 7 |
|
111 | #define TASKID_BPF0 7 | |
110 | #define TASKID_WFRM 8 |
|
112 | #define TASKID_WFRM 8 | |
111 | #define TASKID_DUMB 9 |
|
113 | #define TASKID_DUMB 9 | |
112 | #define TASKID_HOUS 10 |
|
114 | #define TASKID_HOUS 10 | |
113 | #define TASKID_MATR 11 |
|
115 | #define TASKID_MATR 11 | |
114 | #define TASKID_CWF3 12 |
|
116 | #define TASKID_CWF3 12 | |
115 | #define TASKID_CWF2 13 |
|
117 | #define TASKID_CWF2 13 | |
116 | #define TASKID_CWF1 14 |
|
118 | #define TASKID_CWF1 14 | |
117 | #define TASKID_SEND 15 |
|
119 | #define TASKID_SEND 15 | |
118 |
|
120 | |||
119 | #define TASK_PRIORITY_SPIQ 5 |
|
121 | #define TASK_PRIORITY_SPIQ 5 | |
120 | #define TASK_PRIORITY_SMIQ 10 |
|
122 | #define TASK_PRIORITY_SMIQ 10 | |
121 | // |
|
123 | // | |
122 | #define TASK_PRIORITY_RECV 20 |
|
124 | #define TASK_PRIORITY_RECV 20 | |
123 | #define TASK_PRIORITY_ACTN 30 |
|
125 | #define TASK_PRIORITY_ACTN 30 | |
124 | // |
|
126 | // | |
125 | #define TASK_PRIORITY_HOUS 40 |
|
127 | #define TASK_PRIORITY_HOUS 40 | |
126 | #define TASK_PRIORITY_CWF1 40 |
|
128 | #define TASK_PRIORITY_CWF1 40 | |
127 | #define TASK_PRIORITY_CWF2 40 |
|
129 | #define TASK_PRIORITY_CWF2 40 | |
128 | #define TASK_PRIORITY_WFRM 40 |
|
130 | #define TASK_PRIORITY_WFRM 40 | |
129 | #define TASK_PRIORITY_CWF3 40 |
|
131 | #define TASK_PRIORITY_CWF3 40 | |
130 | // |
|
132 | // | |
131 | #define TASK_PRIORITY_SEND 40 |
|
133 | #define TASK_PRIORITY_SEND 40 | |
132 | // |
|
134 | // | |
133 | #define TASK_PRIORITY_AVF0 60 |
|
135 | #define TASK_PRIORITY_AVF0 60 | |
134 | #define TASK_PRIORITY_BPF0 60 |
|
136 | #define TASK_PRIORITY_BPF0 60 | |
135 | #define TASK_PRIORITY_MATR 100 |
|
137 | #define TASK_PRIORITY_MATR 100 | |
136 | #define TASK_PRIORITY_STAT 200 |
|
138 | #define TASK_PRIORITY_STAT 200 | |
137 | #define TASK_PRIORITY_DUMB 200 |
|
139 | #define TASK_PRIORITY_DUMB 200 | |
138 |
|
140 | |||
139 | #define ACTION_MSG_QUEUE_COUNT 10 |
|
141 | #define ACTION_MSG_QUEUE_COUNT 10 | |
140 | #define ACTION_MSG_PKTS_COUNT 50 |
|
142 | #define ACTION_MSG_PKTS_COUNT 50 | |
141 |
#define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_ |
|
143 | #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES) | |
142 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options |
|
144 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options | |
143 |
|
145 | |||
144 | #define QUEUE_QUEU 0 |
|
146 | #define QUEUE_QUEU 0 | |
145 | #define QUEUE_PKTS 1 |
|
147 | #define QUEUE_PKTS 1 | |
146 |
|
148 | |||
147 | //******* |
|
149 | //******* | |
148 | // MACROS |
|
150 | // MACROS | |
149 | #ifdef PRINT_MESSAGES_ON_CONSOLE |
|
151 | #ifdef PRINT_MESSAGES_ON_CONSOLE | |
150 | #define PRINTF(x) printf(x); |
|
152 | #define PRINTF(x) printf(x); | |
151 | #define PRINTF1(x,y) printf(x,y); |
|
153 | #define PRINTF1(x,y) printf(x,y); | |
152 | #define PRINTF2(x,y,z) printf(x,y,z); |
|
154 | #define PRINTF2(x,y,z) printf(x,y,z); | |
153 | #else |
|
155 | #else | |
154 | #define PRINTF(x) ; |
|
156 | #define PRINTF(x) ; | |
155 | #define PRINTF1(x,y) ; |
|
157 | #define PRINTF1(x,y) ; | |
156 | #define PRINTF2(x,y,z) ; |
|
158 | #define PRINTF2(x,y,z) ; | |
157 | #endif |
|
159 | #endif | |
158 |
|
160 | |||
159 | #ifdef BOOT_MESSAGES |
|
161 | #ifdef BOOT_MESSAGES | |
160 | #define BOOT_PRINTF(x) printf(x); |
|
162 | #define BOOT_PRINTF(x) printf(x); | |
161 | #define BOOT_PRINTF1(x,y) printf(x,y); |
|
163 | #define BOOT_PRINTF1(x,y) printf(x,y); | |
162 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); |
|
164 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); | |
163 | #else |
|
165 | #else | |
164 | #define BOOT_PRINTF(x) ; |
|
166 | #define BOOT_PRINTF(x) ; | |
165 | #define BOOT_PRINTF1(x,y) ; |
|
167 | #define BOOT_PRINTF1(x,y) ; | |
166 | #define BOOT_PRINTF2(x,y,z) ; |
|
168 | #define BOOT_PRINTF2(x,y,z) ; | |
167 | #endif |
|
169 | #endif | |
168 |
|
170 | |||
169 | #ifdef DEBUG_MESSAGES |
|
171 | #ifdef DEBUG_MESSAGES | |
170 | #define DEBUG_PRINTF(x) printf(x); |
|
172 | #define DEBUG_PRINTF(x) printf(x); | |
171 | #define DEBUG_PRINTF1(x,y) printf(x,y); |
|
173 | #define DEBUG_PRINTF1(x,y) printf(x,y); | |
172 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); |
|
174 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); | |
173 | #else |
|
175 | #else | |
174 | #define DEBUG_PRINTF(x) ; |
|
176 | #define DEBUG_PRINTF(x) ; | |
175 | #define DEBUG_PRINTF1(x,y) ; |
|
177 | #define DEBUG_PRINTF1(x,y) ; | |
176 | #define DEBUG_PRINTF2(x,y,z) ; |
|
178 | #define DEBUG_PRINTF2(x,y,z) ; | |
177 | #endif |
|
179 | #endif | |
178 |
|
180 | |||
179 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period |
|
181 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period | |
180 |
|
182 | |||
181 | #define NB_SAMPLES_PER_SNAPSHOT 2048 |
|
183 | #define NB_SAMPLES_PER_SNAPSHOT 2048 | |
182 | #define TIME_OFFSET 2 |
|
184 | #define TIME_OFFSET 2 | |
183 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 |
|
185 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 | |
184 | #define NB_BYTES_SWF_BLK (2 * 6) |
|
186 | #define NB_BYTES_SWF_BLK (2 * 6) | |
185 | #define NB_WORDS_SWF_BLK 3 |
|
187 | #define NB_WORDS_SWF_BLK 3 | |
186 | #define NB_BYTES_CWF3_LIGHT_BLK 6 |
|
188 | #define NB_BYTES_CWF3_LIGHT_BLK 6 | |
187 | #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 |
|
189 | #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 | |
188 |
|
190 | |||
189 | //****************** |
|
191 | //****************** | |
190 | // SEQUENCE COUNTERS |
|
192 | // SEQUENCE COUNTERS | |
191 | #define SEQ_CNT_NB_PID 2 |
|
193 | #define SEQ_CNT_NB_PID 2 | |
192 | #define SEQ_CNT_NB_CAT 4 |
|
194 | #define SEQ_CNT_NB_CAT 4 | |
193 | #define SEQ_CNT_NB_DEST_ID 11 |
|
195 | #define SEQ_CNT_NB_DEST_ID 11 | |
194 | // pid |
|
196 | // pid | |
195 | #define SEQ_CNT_PID_76 0 |
|
197 | #define SEQ_CNT_PID_76 0 | |
196 | #define SEQ_CNT_PID_79 1 |
|
198 | #define SEQ_CNT_PID_79 1 | |
197 | //cat |
|
199 | //cat | |
198 | #define SEQ_CNT_CAT_1 0 |
|
200 | #define SEQ_CNT_CAT_1 0 | |
199 | #define SEQ_CNT_CAT_4 1 |
|
201 | #define SEQ_CNT_CAT_4 1 | |
200 | #define SEQ_CNT_CAT_9 2 |
|
202 | #define SEQ_CNT_CAT_9 2 | |
201 | #define SEQ_CNT_CAT_12 3 |
|
203 | #define SEQ_CNT_CAT_12 3 | |
202 | // destination id |
|
204 | // destination id | |
203 | #define SEQ_CNT_DST_ID_GROUND 0 |
|
205 | #define SEQ_CNT_DST_ID_GROUND 0 | |
204 | #define SEQ_CNT_DST_ID_MISSION_TIMELINE 1 |
|
206 | #define SEQ_CNT_DST_ID_MISSION_TIMELINE 1 | |
205 | #define SEQ_CNT_DST_ID_TC_SEQUENCES 2 |
|
207 | #define SEQ_CNT_DST_ID_TC_SEQUENCES 2 | |
206 | #define SEQ_CNT_DST_ID_RECOVERY_ACTION_CMD 3 |
|
208 | #define SEQ_CNT_DST_ID_RECOVERY_ACTION_CMD 3 | |
207 | #define SEQ_CNT_DST_ID_BACKUP_MISSION_TIMELINE 4 |
|
209 | #define SEQ_CNT_DST_ID_BACKUP_MISSION_TIMELINE 4 | |
208 | #define SEQ_CNT_DST_ID_DIRECT_CMD 5 |
|
210 | #define SEQ_CNT_DST_ID_DIRECT_CMD 5 | |
209 | #define SEQ_CNT_DST_ID_SPARE_GRD_SRC1 6 |
|
211 | #define SEQ_CNT_DST_ID_SPARE_GRD_SRC1 6 | |
210 | #define SEQ_CNT_DST_ID_SPARE_GRD_SRC2 7 |
|
212 | #define SEQ_CNT_DST_ID_SPARE_GRD_SRC2 7 | |
211 | #define SEQ_CNT_DST_ID_OBCP 8 |
|
213 | #define SEQ_CNT_DST_ID_OBCP 8 | |
212 | #define SEQ_CNT_DST_ID_SYSTEM_CONTROL 9 |
|
214 | #define SEQ_CNT_DST_ID_SYSTEM_CONTROL 9 | |
213 | #define SEQ_CNT_DST_ID_AOCS 10 |
|
215 | #define SEQ_CNT_DST_ID_AOCS 10 | |
214 |
|
216 | |||
215 | struct param_local_str{ |
|
217 | struct param_local_str{ | |
216 | unsigned int local_sbm1_nb_cwf_sent; |
|
218 | unsigned int local_sbm1_nb_cwf_sent; | |
217 | unsigned int local_sbm1_nb_cwf_max; |
|
219 | unsigned int local_sbm1_nb_cwf_max; | |
218 | unsigned int local_sbm2_nb_cwf_sent; |
|
220 | unsigned int local_sbm2_nb_cwf_sent; | |
219 | unsigned int local_sbm2_nb_cwf_max; |
|
221 | unsigned int local_sbm2_nb_cwf_max; | |
220 | unsigned int local_nb_interrupt_f0_MAX; |
|
222 | unsigned int local_nb_interrupt_f0_MAX; | |
221 | }; |
|
223 | }; | |
222 |
|
224 | |||
223 | #endif // FSW_RTEMS_CONFIG_H_INCLUDED |
|
225 | #endif // FSW_RTEMS_CONFIG_H_INCLUDED |
@@ -1,68 +1,55 | |||||
1 | #ifndef FSW_RTEMS_PROCESSING_H_INCLUDED |
|
1 | #ifndef FSW_RTEMS_PROCESSING_H_INCLUDED | |
2 | #define FSW_RTEMS_PROCESSING_H_INCLUDED |
|
2 | #define FSW_RTEMS_PROCESSING_H_INCLUDED | |
3 |
|
3 | |||
4 |
#include |
|
4 | #include "fsw_init.h" | |
5 | #include <grspw.h> |
|
|||
6 | #include <leon.h> |
|
|||
7 |
|
||||
8 | #include <fsw_init.h> |
|
|||
9 | #include <fsw_params.h> |
|
|||
10 | #include <grlib_regs.h> |
|
|||
11 | #include <ccsds_types.h> |
|
|||
12 |
|
||||
13 | #include <stdio.h> |
|
|||
14 | #include <stdlib.h> |
|
|||
15 |
|
5 | |||
16 | extern volatile int spec_mat_f0_0[ ]; |
|
6 | extern volatile int spec_mat_f0_0[ ]; | |
17 | extern volatile int spec_mat_f0_1[ ]; |
|
7 | extern volatile int spec_mat_f0_1[ ]; | |
18 | extern volatile int spec_mat_f0_a[ ]; |
|
8 | extern volatile int spec_mat_f0_a[ ]; | |
19 | extern volatile int spec_mat_f0_b[ ]; |
|
9 | extern volatile int spec_mat_f0_b[ ]; | |
20 | extern volatile int spec_mat_f0_c[ ]; |
|
10 | extern volatile int spec_mat_f0_c[ ]; | |
21 | extern volatile int spec_mat_f0_d[ ]; |
|
11 | extern volatile int spec_mat_f0_d[ ]; | |
22 | extern volatile int spec_mat_f0_e[ ]; |
|
12 | extern volatile int spec_mat_f0_e[ ]; | |
23 | extern volatile int spec_mat_f0_f[ ]; |
|
13 | extern volatile int spec_mat_f0_f[ ]; | |
24 | extern volatile int spec_mat_f0_g[ ]; |
|
14 | extern volatile int spec_mat_f0_g[ ]; | |
25 | extern volatile int spec_mat_f0_h[ ]; |
|
15 | extern volatile int spec_mat_f0_h[ ]; | |
26 |
|
16 | |||
27 | extern volatile int spec_mat_f1[ ]; |
|
17 | extern volatile int spec_mat_f1[ ]; | |
28 | extern volatile int spec_mat_f2[ ]; |
|
18 | extern volatile int spec_mat_f2[ ]; | |
29 |
|
19 | |||
30 | extern volatile int spec_mat_f1_bis[ ]; |
|
20 | extern volatile int spec_mat_f1_bis[ ]; | |
31 | extern volatile int spec_mat_f2_bis[ ]; |
|
21 | extern volatile int spec_mat_f2_bis[ ]; | |
32 | extern volatile int spec_mat_f0_0_bis[ ]; |
|
22 | extern volatile int spec_mat_f0_0_bis[ ]; | |
33 | extern volatile int spec_mat_f0_1_bis[ ]; |
|
23 | extern volatile int spec_mat_f0_1_bis[ ]; | |
34 |
|
24 | |||
35 | // parameters |
|
25 | // parameters | |
36 | extern struct param_local_str param_local; |
|
26 | extern struct param_local_str param_local; | |
37 |
|
27 | |||
38 | // registers |
|
28 | // registers | |
39 | extern time_management_regs_t *time_management_regs; |
|
29 | extern time_management_regs_t *time_management_regs; | |
40 | extern spectral_matrix_regs_t *spectral_matrix_regs; |
|
30 | extern spectral_matrix_regs_t *spectral_matrix_regs; | |
41 |
|
31 | |||
42 | // ISR |
|
32 | // ISR | |
43 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ); |
|
33 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ); | |
44 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ); |
|
34 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ); | |
45 |
|
35 | |||
46 | // RTEMS TASKS |
|
36 | // RTEMS TASKS | |
47 | rtems_task spw_bppr_task(rtems_task_argument argument); |
|
37 | rtems_task spw_bppr_task(rtems_task_argument argument); | |
48 | rtems_task avf0_task(rtems_task_argument argument); |
|
38 | rtems_task avf0_task(rtems_task_argument argument); | |
49 | rtems_task bpf0_task(rtems_task_argument argument); |
|
39 | rtems_task bpf0_task(rtems_task_argument argument); | |
50 | rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator |
|
40 | rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator | |
51 | rtems_task matr_task(rtems_task_argument argument); |
|
41 | rtems_task matr_task(rtems_task_argument argument); | |
52 |
|
42 | |||
53 | rtems_task spw_bppr_task_rate_monotonic(rtems_task_argument argument); |
|
|||
54 |
|
||||
55 | void matrix_average(volatile int *spec_mat, volatile float *averaged_spec_mat); |
|
|||
56 | void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat); |
|
43 | void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat); | |
57 | void matrix_reset(volatile float *averaged_spec_mat); |
|
44 | void matrix_reset(volatile float *averaged_spec_mat); | |
58 | void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1); |
|
45 | void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1); | |
59 | void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat); |
|
46 | void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat); | |
60 | // |
|
47 | // | |
61 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header); |
|
48 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header); | |
62 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
49 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
63 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id); |
|
50 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id); | |
64 | void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix); |
|
51 | void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix); | |
65 | void fill_averaged_spectral_matrix(); |
|
52 | void fill_averaged_spectral_matrix( void ); | |
66 | void reset_spectral_matrix_regs(); |
|
53 | void reset_spectral_matrix_regs(); | |
67 |
|
54 | |||
68 | #endif // FSW_RTEMS_PROCESSING_H_INCLUDED |
|
55 | #endif // FSW_RTEMS_PROCESSING_H_INCLUDED |
@@ -1,32 +1,22 | |||||
1 | #ifndef FSW_SPACEWIRE_H_INCLUDED |
|
1 | #ifndef FSW_SPACEWIRE_H_INCLUDED | |
2 | #define FSW_SPACEWIRE_H_INCLUDED |
|
2 | #define FSW_SPACEWIRE_H_INCLUDED | |
3 |
|
3 | |||
4 |
#include |
|
4 | #include "fsw_init.h" | |
5 |
|
||||
6 | #include <grspw.h> |
|
|||
7 |
|
||||
8 | #include <stdio.h> |
|
|||
9 | #include <stdlib.h> |
|
|||
10 | #include <fcntl.h> |
|
|||
11 |
|
||||
12 | #include "fsw_params.h" |
|
|||
13 | #include "ccsds_types.h" |
|
|||
14 | #include "fsw_misc.h" |
|
|||
15 |
|
5 | |||
16 | extern spw_stats spacewire_stats; |
|
6 | extern spw_stats spacewire_stats; | |
17 | extern spw_stats spacewire_stats_backup; |
|
7 | extern spw_stats spacewire_stats_backup; | |
18 |
|
8 | |||
19 | // RTEMS TASK |
|
9 | // RTEMS TASK | |
20 | rtems_task spiq_task(rtems_task_argument argument); |
|
10 | rtems_task spiq_task(rtems_task_argument argument); | |
21 |
|
11 | |||
22 | int spacewire_configure_link( void ); |
|
12 | int spacewire_configure_link( void ); | |
23 | int spacewire_wait_for_link(void); |
|
13 | int spacewire_wait_for_link(void); | |
24 | void spacewire_set_NP(unsigned char val, unsigned int regAddr); // No Port force |
|
14 | void spacewire_set_NP(unsigned char val, unsigned int regAddr); // No Port force | |
25 | void spacewire_set_RE(unsigned char val, unsigned int regAddr); // RMAP Enable |
|
15 | void spacewire_set_RE(unsigned char val, unsigned int regAddr); // RMAP Enable | |
26 | void spacewire_compute_stats_offsets(); |
|
16 | void spacewire_compute_stats_offsets(void); | |
27 |
|
17 | |||
28 | void timecode_irq_handler(void *pDev, void *regs, int minor, unsigned int tc); |
|
18 | void timecode_irq_handler(void *pDev, void *regs, int minor, unsigned int tc); | |
29 |
|
19 | |||
30 | void (*grspw_timecode_callback) (void *pDev, void *regs, int minor, unsigned int tc); |
|
20 | void (*grspw_timecode_callback) (void *pDev, void *regs, int minor, unsigned int tc); | |
31 |
|
21 | |||
32 | #endif // FSW_SPACEWIRE_H_INCLUDED |
|
22 | #endif // FSW_SPACEWIRE_H_INCLUDED |
@@ -1,86 +1,71 | |||||
1 | #ifndef TC_HANDLER_H_INCLUDED |
|
1 | #ifndef TC_HANDLER_H_INCLUDED | |
2 | #define TC_HANDLER_H_INCLUDED |
|
2 | #define TC_HANDLER_H_INCLUDED | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
|||
5 | #include <bsp.h> // for the LEON_Unmask_interrupt function |
|
|||
6 | #include <stdio.h> |
|
|||
7 | #include <unistd.h> // for the read call |
|
|||
8 | #include <sys/ioctl.h> // for the ioctl call |
|
|||
9 | #include <ccsds_types.h> |
|
|||
10 | #include <grspw.h> |
|
|||
11 |
|
||||
12 | #include "fsw_init.h" |
|
4 | #include "fsw_init.h" | |
13 | #include "fsw_misc.h" |
|
5 | #include "tc_load_dump_parameters.h" | |
|
6 | #include "tm_lfr_tc_exe.h" | |||
14 |
|
7 | |||
15 | // MODE PARAMETERS |
|
8 | // MODE PARAMETERS | |
16 | extern struct param_sbm1_str param_sbm1; |
|
9 | extern struct param_sbm1_str param_sbm1; | |
17 | extern struct param_sbm2_str param_sbm2; |
|
10 | extern struct param_sbm2_str param_sbm2; | |
18 | extern time_management_regs_t *time_management_regs; |
|
11 | extern time_management_regs_t *time_management_regs; | |
19 | extern waveform_picker_regs_t *waveform_picker_regs; |
|
12 | extern waveform_picker_regs_t *waveform_picker_regs; | |
20 | extern gptimer_regs_t *gptimer_regs; |
|
13 | extern gptimer_regs_t *gptimer_regs; | |
21 |
|
14 | |||
22 | //**** |
|
15 | //**** | |
23 | // ISR |
|
16 | // ISR | |
24 | rtems_isr commutation_isr1( rtems_vector_number vector ); |
|
17 | rtems_isr commutation_isr1( rtems_vector_number vector ); | |
25 | rtems_isr commutation_isr2( rtems_vector_number vector ); |
|
18 | rtems_isr commutation_isr2( rtems_vector_number vector ); | |
26 |
|
19 | |||
27 | //********************** |
|
20 | //********************** | |
28 | // GENERAL USE FUNCTIONS |
|
21 | // GENERAL USE FUNCTIONS | |
29 | unsigned int Crc_opt( unsigned char D, unsigned int Chk); |
|
22 | unsigned int Crc_opt( unsigned char D, unsigned int Chk); | |
30 | void initLookUpTableForCRC( void ); |
|
23 | void initLookUpTableForCRC( void ); | |
31 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData); |
|
24 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData); | |
32 | void updateLFRCurrentMode(); |
|
25 | void updateLFRCurrentMode(); | |
33 |
|
26 | |||
34 | //********************* |
|
27 | //********************* | |
35 | // ACCEPTANCE FUNCTIONS |
|
28 | // ACCEPTANCE FUNCTIONS | |
36 |
int |
|
29 | int tc_acceptance(ccsdsTelecommandPacket_t *TC, unsigned int TC_LEN_RCV, rtems_id queue_queu_id, rtems_id queue_pkts_id); | |
37 |
|
|
30 | int tc_parser(ccsdsTelecommandPacket_t * TCPacket, unsigned int TC_LEN_RCV); | |
|
31 | int tc_check_type( unsigned char packetType ); | |||
|
32 | int tc_check_subtype( unsigned char packetType ); | |||
|
33 | int tc_check_length( unsigned char packetType, unsigned int length ); | |||
|
34 | int tc_check_crc( ccsdsTelecommandPacket_t * TCPacket, unsigned int length ); | |||
38 |
|
35 | |||
39 | //*********** |
|
36 | //*********** | |
40 | // RTEMS TASK |
|
37 | // RTEMS TASK | |
41 | rtems_task recv_task( rtems_task_argument unused ); |
|
38 | rtems_task recv_task( rtems_task_argument unused ); | |
42 | rtems_task actn_task( rtems_task_argument unused ); |
|
39 | rtems_task actn_task( rtems_task_argument unused ); | |
43 | rtems_task dumb_task( rtems_task_argument unused ); |
|
40 | rtems_task dumb_task( rtems_task_argument unused ); | |
44 |
|
41 | |||
45 | //*********** |
|
42 | //*********** | |
46 | // TC ACTIONS |
|
43 | // TC ACTIONS | |
47 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
44 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
48 | int action_load_common_par(ccsdsTelecommandPacket_t *TC); |
|
|||
49 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
|||
50 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
|||
51 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
|||
52 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
|||
53 | int action_dump_par(ccsdsTelecommandPacket_t *TC); |
|
|||
54 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
45 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
55 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
46 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
56 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
47 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
57 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
48 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
58 | int action_update_time(ccsdsTelecommandPacket_t *TC); |
|
49 | int action_update_time(ccsdsTelecommandPacket_t *TC); | |
59 |
|
50 | |||
60 | // mode transition |
|
51 | // mode transition | |
61 | int transition_validation(unsigned char requestedMode); |
|
52 | int transition_validation(unsigned char requestedMode); | |
62 | int stop_current_mode(); |
|
53 | int stop_current_mode(); | |
63 | int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC); |
|
54 | int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC); | |
64 | int enter_standby_mode(); |
|
55 | int enter_standby_mode(); | |
65 | int enter_normal_mode(); |
|
56 | int enter_normal_mode(); | |
66 | int enter_burst_mode(); |
|
57 | int enter_burst_mode(); | |
67 | int enter_sbm1_mode(); |
|
58 | int enter_sbm1_mode(); | |
68 | int enter_sbm2_mode(); |
|
59 | int enter_sbm2_mode(); | |
69 | int restart_science_tasks(); |
|
60 | int restart_science_tasks(); | |
70 | int suspend_science_tasks(); |
|
61 | int suspend_science_tasks(); | |
71 |
|
62 | |||
72 | // other functions |
|
63 | // other functions | |
73 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC); |
|
64 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC); | |
74 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC); |
|
65 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC); | |
75 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id); |
|
66 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id); | |
76 | // |
|
|||
77 | int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
|||
78 | int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char byte_position, unsigned char rcv_value); |
|
|||
79 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
|||
80 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
|||
81 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
|||
82 |
|
67 | |||
83 | #endif // TC_HANDLER_H_INCLUDED |
|
68 | #endif // TC_HANDLER_H_INCLUDED | |
84 |
|
69 | |||
85 |
|
70 | |||
86 |
|
71 |
@@ -1,6 +1,22 | |||||
1 | #ifndef TM_BYTE_POSITIONS_H |
|
1 | #ifndef TM_BYTE_POSITIONS_H | |
2 | #define TM_BYTE_POSITIONS_H |
|
2 | #define TM_BYTE_POSITIONS_H | |
3 |
|
3 | |||
4 | #define BYTE_POS_CP_LFR_MODE 11 |
|
4 | #define BYTE_POS_CP_LFR_MODE 11 | |
5 |
|
5 | |||
|
6 | // TC_LFR_LOAD_COMMON_PAR | |||
|
7 | ||||
|
8 | // TC_LFR_LOAD_NORMAL_PAR | |||
|
9 | #define BYTE_POS_SY_LFR_N_SWF_L 0 | |||
|
10 | #define BYTE_POS_SY_LFR_N_SWF_P 2 | |||
|
11 | #define BYTE_POS_SY_LFR_N_ASM_P 4 | |||
|
12 | #define BYTE_POS_SY_LFR_N_BP_P0 6 | |||
|
13 | #define BYTE_POS_SY_LFR_N_BP_P1 7 | |||
|
14 | ||||
|
15 | // TC_LFR_LOAD_BURST_PAR | |||
|
16 | ||||
|
17 | // TC_LFR_LOAD_SBM1_PAR | |||
|
18 | ||||
|
19 | // TC_LFR_LOAD_SBM2_PAR | |||
|
20 | ||||
|
21 | ||||
6 | #endif // TM_BYTE_POSITIONS_H |
|
22 | #endif // TM_BYTE_POSITIONS_H |
@@ -1,74 +1,65 | |||||
1 | #ifndef WF_HANDLER_H_INCLUDED |
|
1 | #ifndef WF_HANDLER_H_INCLUDED | |
2 | #define WF_HANDLER_H_INCLUDED |
|
2 | #define WF_HANDLER_H_INCLUDED | |
3 |
|
3 | |||
4 |
#include |
|
4 | #include "fsw_init.h" | |
5 | #include <grspw.h> |
|
|||
6 |
|
5 | |||
7 | #include <stdio.h> |
|
|||
8 | #include <math.h> |
|
6 | #include <math.h> | |
9 |
|
7 | |||
10 | #include "fsw_params.h" |
|
|||
11 | #include "grlib_regs.h" |
|
|||
12 | #include "ccsds_types.h" |
|
|||
13 | #include "fsw_init.h" |
|
|||
14 |
|
||||
15 | #define pi 3.1415 |
|
8 | #define pi 3.1415 | |
16 |
|
9 | |||
17 | //#include <sys/ioctl.h> |
|
|||
18 |
|
||||
19 | extern int fdSPW; |
|
10 | extern int fdSPW; | |
20 | extern volatile int wf_snap_f0[ ]; |
|
11 | extern volatile int wf_snap_f0[ ]; | |
21 | // |
|
12 | // | |
22 | extern volatile int wf_snap_f1[ ]; |
|
13 | extern volatile int wf_snap_f1[ ]; | |
23 | extern volatile int wf_snap_f1_bis[ ]; |
|
14 | extern volatile int wf_snap_f1_bis[ ]; | |
24 | extern volatile int wf_snap_f1_norm[ ]; |
|
15 | extern volatile int wf_snap_f1_norm[ ]; | |
25 | // |
|
16 | // | |
26 | extern volatile int wf_snap_f2[ ]; |
|
17 | extern volatile int wf_snap_f2[ ]; | |
27 | extern volatile int wf_snap_f2_bis[ ]; |
|
18 | extern volatile int wf_snap_f2_bis[ ]; | |
28 | extern volatile int wf_snap_f2_norm[ ]; |
|
19 | extern volatile int wf_snap_f2_norm[ ]; | |
29 | // |
|
20 | // | |
30 | extern volatile int wf_cont_f3[ ]; |
|
21 | extern volatile int wf_cont_f3[ ]; | |
31 | extern volatile int wf_cont_f3_bis[ ]; |
|
22 | extern volatile int wf_cont_f3_bis[ ]; | |
32 | extern char wf_cont_f3_light[ ]; |
|
23 | extern char wf_cont_f3_light[ ]; | |
33 | extern waveform_picker_regs_t *waveform_picker_regs; |
|
24 | extern waveform_picker_regs_t *waveform_picker_regs; | |
34 |
|
25 | |||
35 | rtems_isr waveforms_isr( rtems_vector_number vector ); |
|
26 | rtems_isr waveforms_isr( rtems_vector_number vector ); | |
36 | rtems_isr waveforms_simulator_isr( rtems_vector_number vector ); |
|
27 | rtems_isr waveforms_simulator_isr( rtems_vector_number vector ); | |
37 | rtems_task wfrm_task( rtems_task_argument argument ); |
|
28 | rtems_task wfrm_task( rtems_task_argument argument ); | |
38 | rtems_task cwf3_task( rtems_task_argument argument ); |
|
29 | rtems_task cwf3_task( rtems_task_argument argument ); | |
39 | rtems_task cwf2_task( rtems_task_argument argument ); |
|
30 | rtems_task cwf2_task( rtems_task_argument argument ); | |
40 | rtems_task cwf1_task( rtems_task_argument argument ); |
|
31 | rtems_task cwf1_task( rtems_task_argument argument ); | |
41 |
|
32 | |||
42 | //****************** |
|
33 | //****************** | |
43 | // general functions |
|
34 | // general functions | |
44 | void init_waveforms( void ); |
|
35 | void init_waveforms( void ); | |
45 | // |
|
36 | // | |
46 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF ); |
|
37 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF ); | |
47 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); |
|
38 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); | |
48 | int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); |
|
39 | int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); | |
49 | // |
|
40 | // | |
50 | void reset_waveforms( void ); |
|
41 | void reset_waveforms( void ); | |
51 |
|
42 | |||
52 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ); |
|
43 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ); | |
53 | int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
44 | int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); | |
54 | int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
45 | int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); | |
55 | int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
46 | int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); | |
56 |
|
47 | |||
57 | //************** |
|
48 | //************** | |
58 | // wfp registers |
|
49 | // wfp registers | |
59 | void set_wfp_data_shaping(); |
|
50 | void set_wfp_data_shaping(); | |
60 | char set_wfp_delta_snapshot(); |
|
51 | char set_wfp_delta_snapshot(); | |
61 | void set_wfp_burst_enable_register( unsigned char mode); |
|
52 | void set_wfp_burst_enable_register( unsigned char mode); | |
62 | void reset_wfp_burst_enable(); |
|
53 | void reset_wfp_burst_enable(); | |
63 | void reset_wfp_status(); |
|
54 | void reset_wfp_status(); | |
64 | void reset_waveform_picker_regs(); |
|
55 | void reset_waveform_picker_regs(); | |
65 |
|
56 | |||
66 | //***************** |
|
57 | //***************** | |
67 | // local parameters |
|
58 | // local parameters | |
68 | void set_local_sbm1_nb_cwf_max(); |
|
59 | void set_local_sbm1_nb_cwf_max(); | |
69 | void set_local_sbm2_nb_cwf_max(); |
|
60 | void set_local_sbm2_nb_cwf_max(); | |
70 | void set_local_nb_interrupt_f0_MAX(); |
|
61 | void set_local_nb_interrupt_f0_MAX(); | |
71 | void reset_local_sbm1_nb_cwf_sent(); |
|
62 | void reset_local_sbm1_nb_cwf_sent(); | |
72 | void reset_local_sbm2_nb_cwf_sent(); |
|
63 | void reset_local_sbm2_nb_cwf_sent(); | |
73 |
|
64 | |||
74 | #endif // WF_HANDLER_H_INCLUDED |
|
65 | #endif // WF_HANDLER_H_INCLUDED |
@@ -1,73 +1,73 | |||||
1 | //#include <fsw_processing.h> |
|
1 | //#include <fsw_processing.h> | |
2 | #include <rtems.h> |
|
2 | #include <rtems.h> | |
3 | #include <grspw.h> |
|
3 | #include <grspw.h> | |
4 |
#include |
|
4 | #include "ccsds_types.h" | |
5 |
#include |
|
5 | #include "grlib_regs.h" | |
6 |
#include |
|
6 | #include "fsw_params.h" | |
7 |
|
7 | |||
8 | // RTEMS GLOBAL VARIABLES |
|
8 | // RTEMS GLOBAL VARIABLES | |
9 | rtems_name misc_name[5]; |
|
9 | rtems_name misc_name[5]; | |
10 | rtems_id misc_id[5]; |
|
10 | rtems_id misc_id[5]; | |
11 | rtems_name Task_name[20]; /* array of task names */ |
|
11 | rtems_name Task_name[20]; /* array of task names */ | |
12 | rtems_id Task_id[20]; /* array of task ids */ |
|
12 | rtems_id Task_id[20]; /* array of task ids */ | |
13 | unsigned int maxCount; |
|
13 | unsigned int maxCount; | |
14 | int fdSPW = 0; |
|
14 | int fdSPW = 0; | |
15 | int fdUART = 0; |
|
15 | int fdUART = 0; | |
16 | unsigned char lfrCurrentMode; |
|
16 | unsigned char lfrCurrentMode; | |
17 |
|
17 | |||
18 | // APB CONFIGURATION REGISTERS |
|
18 | // APB CONFIGURATION REGISTERS | |
19 | time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT; |
|
19 | time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT; | |
20 | gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER; |
|
20 | gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER; | |
21 | #ifdef GSA |
|
21 | #ifdef GSA | |
22 | #else |
|
22 | #else | |
23 | waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER; |
|
23 | waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER; | |
24 | #endif |
|
24 | #endif | |
25 | spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX; |
|
25 | spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX; | |
26 |
|
26 | |||
27 | // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes |
|
27 | // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes | |
28 | volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
28 | volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; | |
29 | // |
|
29 | // | |
30 | volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
30 | volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; | |
31 | volatile int wf_snap_f1_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
31 | volatile int wf_snap_f1_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; | |
32 | volatile int wf_snap_f1_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
32 | volatile int wf_snap_f1_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; | |
33 | // |
|
33 | // | |
34 | volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
34 | volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; | |
35 | volatile int wf_snap_f2_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
35 | volatile int wf_snap_f2_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; | |
36 | volatile int wf_snap_f2_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
36 | volatile int wf_snap_f2_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; | |
37 | // |
|
37 | // | |
38 | volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
38 | volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; | |
39 | volatile int wf_cont_f3_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
39 | volatile int wf_cont_f3_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; | |
40 | char wf_cont_f3_light[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_CWF3_LIGHT_BLK ]; |
|
40 | char wf_cont_f3_light[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_CWF3_LIGHT_BLK ]; | |
41 |
|
41 | |||
42 | // SPECTRAL MATRICES GLOBAL VARIABLES |
|
42 | // SPECTRAL MATRICES GLOBAL VARIABLES | |
43 | volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
43 | volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ]; | |
44 | volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
44 | volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ]; | |
45 | volatile int spec_mat_f0_a[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
45 | volatile int spec_mat_f0_a[ SM_HEADER + TOTAL_SIZE_SM ]; | |
46 | volatile int spec_mat_f0_b[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
46 | volatile int spec_mat_f0_b[ SM_HEADER + TOTAL_SIZE_SM ]; | |
47 | volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
47 | volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ]; | |
48 | volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
48 | volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ]; | |
49 | volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
49 | volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ]; | |
50 | volatile int spec_mat_f0_f[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
50 | volatile int spec_mat_f0_f[ SM_HEADER + TOTAL_SIZE_SM ]; | |
51 | volatile int spec_mat_f0_g[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
51 | volatile int spec_mat_f0_g[ SM_HEADER + TOTAL_SIZE_SM ]; | |
52 | volatile int spec_mat_f0_h[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
52 | volatile int spec_mat_f0_h[ SM_HEADER + TOTAL_SIZE_SM ]; | |
53 | volatile int spec_mat_f0_0_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
53 | volatile int spec_mat_f0_0_bis[ SM_HEADER + TOTAL_SIZE_SM ]; | |
54 | volatile int spec_mat_f0_1_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
54 | volatile int spec_mat_f0_1_bis[ SM_HEADER + TOTAL_SIZE_SM ]; | |
55 | // |
|
55 | // | |
56 | volatile int spec_mat_f1[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
56 | volatile int spec_mat_f1[ SM_HEADER + TOTAL_SIZE_SM ]; | |
57 | volatile int spec_mat_f1_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
57 | volatile int spec_mat_f1_bis[ SM_HEADER + TOTAL_SIZE_SM ]; | |
58 | // |
|
58 | // | |
59 | volatile int spec_mat_f2[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
59 | volatile int spec_mat_f2[ SM_HEADER + TOTAL_SIZE_SM ]; | |
60 | volatile int spec_mat_f2_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
60 | volatile int spec_mat_f2_bis[ SM_HEADER + TOTAL_SIZE_SM ]; | |
61 |
|
61 | |||
62 | // MODE PARAMETERS |
|
62 | // MODE PARAMETERS | |
63 | Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
63 | Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; | |
64 | struct param_local_str param_local; |
|
64 | struct param_local_str param_local; | |
65 |
|
65 | |||
66 | // HK PACKETS |
|
66 | // HK PACKETS | |
67 | Packet_TM_LFR_HK_t housekeeping_packet; |
|
67 | Packet_TM_LFR_HK_t housekeeping_packet; | |
68 | // sequence counters are incremented by APID (PID + CAT) and destination ID |
|
68 | // sequence counters are incremented by APID (PID + CAT) and destination ID | |
69 | unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID]; |
|
69 | unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID]; | |
70 | spw_stats spacewire_stats; |
|
70 | spw_stats spacewire_stats; | |
71 | spw_stats spacewire_stats_backup; |
|
71 | spw_stats spacewire_stats_backup; | |
72 |
|
72 | |||
73 |
|
73 |
@@ -1,456 +1,573 | |||||
1 | //************************* |
|
1 | //************************* | |
2 | // GPL reminder to be added |
|
2 | // GPL reminder to be added | |
3 | //************************* |
|
3 | //************************* | |
4 |
|
4 | |||
5 | #include <rtems.h> |
|
5 | #include <rtems.h> | |
6 |
|
6 | |||
7 | /* configuration information */ |
|
7 | /* configuration information */ | |
8 |
|
8 | |||
9 | #define CONFIGURE_INIT |
|
9 | #define CONFIGURE_INIT | |
10 |
|
10 | |||
11 | #include <bsp.h> /* for device driver prototypes */ |
|
11 | #include <bsp.h> /* for device driver prototypes */ | |
12 |
|
12 | |||
13 | /* configuration information */ |
|
13 | /* configuration information */ | |
14 |
|
14 | |||
15 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
15 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER | |
16 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
16 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER | |
17 |
|
17 | |||
18 | #define CONFIGURE_MAXIMUM_TASKS 20 |
|
18 | #define CONFIGURE_MAXIMUM_TASKS 20 | |
19 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
|
19 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE | |
20 | #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) |
|
20 | #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) | |
21 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 |
|
21 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 | |
22 | #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100 |
|
22 | #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100 | |
23 | #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT) |
|
23 | #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT) | |
24 | #define CONFIGURE_MAXIMUM_DRIVERS 16 |
|
24 | #define CONFIGURE_MAXIMUM_DRIVERS 16 | |
25 | #define CONFIGURE_MAXIMUM_PERIODS 5 |
|
25 | #define CONFIGURE_MAXIMUM_PERIODS 5 | |
26 | #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s) |
|
26 | #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s) | |
27 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2 |
|
27 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2 | |
28 | #ifdef PRINT_STACK_REPORT |
|
28 | #ifdef PRINT_STACK_REPORT | |
29 | #define CONFIGURE_STACK_CHECKER_ENABLED |
|
29 | #define CONFIGURE_STACK_CHECKER_ENABLED | |
30 | #endif |
|
30 | #endif | |
31 |
|
31 | |||
32 | #include <rtems/confdefs.h> |
|
32 | #include <rtems/confdefs.h> | |
33 |
|
33 | |||
34 | /* If --drvmgr was enabled during the configuration of the RTEMS kernel */ |
|
34 | /* If --drvmgr was enabled during the configuration of the RTEMS kernel */ | |
35 | #ifdef RTEMS_DRVMGR_STARTUP |
|
35 | #ifdef RTEMS_DRVMGR_STARTUP | |
36 | #ifdef LEON3 |
|
36 | #ifdef LEON3 | |
37 | /* Add Timer and UART Driver */ |
|
37 | /* Add Timer and UART Driver */ | |
38 | #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
38 | #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER | |
39 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER |
|
39 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER | |
40 | #endif |
|
40 | #endif | |
41 | #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
41 | #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER | |
42 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART |
|
42 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART | |
43 | #endif |
|
43 | #endif | |
44 | #endif |
|
44 | #endif | |
45 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */ |
|
45 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */ | |
46 | #include <drvmgr/drvmgr_confdefs.h> |
|
46 | #include <drvmgr/drvmgr_confdefs.h> | |
47 | #endif |
|
47 | #endif | |
48 |
|
48 | |||
49 |
#include |
|
49 | #include "fsw_init.h" | |
50 |
#include |
|
50 | #include "fsw_config.c" | |
51 |
|
51 | |||
52 | rtems_task Init( rtems_task_argument ignored ) |
|
52 | rtems_task Init( rtems_task_argument ignored ) | |
53 | { |
|
53 | { | |
54 | rtems_status_code status; |
|
54 | rtems_status_code status; | |
55 | rtems_isr_entry old_isr_handler; |
|
55 | rtems_isr_entry old_isr_handler; | |
56 |
|
56 | |||
57 | BOOT_PRINTF("\n\n\n\n\n") |
|
57 | BOOT_PRINTF("\n\n\n\n\n") | |
58 | BOOT_PRINTF("***************************\n") |
|
58 | BOOT_PRINTF("***************************\n") | |
59 | BOOT_PRINTF("** START Flight Software **\n") |
|
59 | BOOT_PRINTF("** START Flight Software **\n") | |
60 | BOOT_PRINTF("***************************\n") |
|
60 | BOOT_PRINTF("***************************\n") | |
61 | BOOT_PRINTF("\n\n") |
|
61 | BOOT_PRINTF("\n\n") | |
62 |
|
62 | |||
63 | //send_console_outputs_on_apbuart_port(); |
|
63 | //send_console_outputs_on_apbuart_port(); | |
64 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); |
|
64 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); | |
65 |
|
65 | |||
66 | initLookUpTableForCRC(); // in tc_handler.h |
|
|||
67 | init_parameter_dump(); |
|
66 | init_parameter_dump(); | |
68 | init_local_mode_parameters(); |
|
67 | init_local_mode_parameters(); | |
69 | init_housekeeping_parameters(); |
|
68 | init_housekeeping_parameters(); | |
70 |
|
69 | |||
71 | create_names(); // create all names |
|
70 | create_names(); // create all names | |
72 |
|
71 | |||
73 | create_message_queues(); |
|
72 | create_message_queues(); | |
74 |
|
73 | |||
75 |
create_all_tasks(); |
|
74 | status = create_all_tasks(); // create all tasks | |
|
75 | if (status != RTEMS_SUCCESSFUL) | |||
|
76 | { | |||
|
77 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status) | |||
|
78 | } | |||
76 |
|
79 | |||
77 |
start_all_tasks(); |
|
80 | status = start_all_tasks(); // start all tasks | |
|
81 | if (status != RTEMS_SUCCESSFUL) | |||
|
82 | { | |||
|
83 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) | |||
|
84 | } | |||
78 |
|
85 | |||
79 |
stop_current_mode(); |
|
86 | status = stop_current_mode(); // go in STANDBY mode | |
|
87 | if (status != RTEMS_SUCCESSFUL) | |||
|
88 | { | |||
|
89 | PRINTF1("in INIT *** ERR in stop_current_mode, code %d", status) | |||
|
90 | } | |||
80 |
|
91 | |||
81 | grspw_timecode_callback = &timecode_irq_handler; |
|
92 | grspw_timecode_callback = &timecode_irq_handler; | |
82 |
|
93 | |||
83 | spacewire_configure_link(); |
|
94 | spacewire_configure_link(); | |
84 |
|
95 | |||
85 | #ifdef GSA |
|
96 | #ifdef GSA | |
86 | // mask IRQ lines |
|
97 | // mask IRQ lines | |
87 | LEON_Mask_interrupt( IRQ_SM ); |
|
98 | LEON_Mask_interrupt( IRQ_SM ); | |
88 | LEON_Mask_interrupt( IRQ_WF ); |
|
99 | LEON_Mask_interrupt( IRQ_WF ); | |
89 | // Spectral Matrices simulator |
|
100 | // Spectral Matrices simulator | |
90 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, |
|
101 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, | |
91 | IRQ_SPARC_SM, spectral_matrices_isr ); |
|
102 | IRQ_SPARC_SM, spectral_matrices_isr ); | |
92 | // WaveForms |
|
103 | // WaveForms | |
93 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR, |
|
104 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR, | |
94 | IRQ_SPARC_WF, waveforms_simulator_isr ); |
|
105 | IRQ_SPARC_WF, waveforms_simulator_isr ); | |
95 | #else |
|
106 | #else | |
96 | // mask IRQ lines |
|
107 | // mask IRQ lines | |
97 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
108 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); | |
98 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
109 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); | |
99 | // reset configuration registers |
|
110 | // reset configuration registers | |
100 | reset_waveform_picker_regs(); |
|
111 | reset_waveform_picker_regs(); | |
101 | reset_spectral_matrix_regs(); |
|
112 | reset_spectral_matrix_regs(); | |
102 | // configure IRQ handling for the waveform picker unit |
|
113 | // configure IRQ handling for the waveform picker unit | |
103 | status = rtems_interrupt_catch( waveforms_isr, |
|
114 | status = rtems_interrupt_catch( waveforms_isr, | |
104 | IRQ_SPARC_WAVEFORM_PICKER, |
|
115 | IRQ_SPARC_WAVEFORM_PICKER, | |
105 | &old_isr_handler) ; |
|
116 | &old_isr_handler) ; | |
106 | // configure IRQ handling for the spectral matrix unit |
|
117 | // configure IRQ handling for the spectral matrix unit | |
107 | // status = rtems_interrupt_catch( spectral_matrices_isr, |
|
118 | // status = rtems_interrupt_catch( spectral_matrices_isr, | |
108 | // IRQ_SPARC_SPECTRAL_MATRIX, |
|
119 | // IRQ_SPARC_SPECTRAL_MATRIX, | |
109 | // &old_isr_handler) ; |
|
120 | // &old_isr_handler) ; | |
110 | // Spectral Matrices simulator |
|
121 | // Spectral Matrices simulator | |
111 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, |
|
122 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, | |
112 | IRQ_SPARC_SM, spectral_matrices_isr_simu ); |
|
123 | IRQ_SPARC_SM, spectral_matrices_isr_simu ); | |
113 | #endif |
|
124 | #endif | |
114 |
|
125 | |||
115 | BOOT_PRINTF("delete INIT\n") |
|
126 | BOOT_PRINTF("delete INIT\n") | |
116 |
|
127 | |||
117 | status = rtems_task_delete(RTEMS_SELF); |
|
128 | status = rtems_task_delete(RTEMS_SELF); | |
118 |
|
129 | |||
119 | } |
|
130 | } | |
120 |
|
131 | |||
121 | void init_parameter_dump( void ) |
|
132 | void init_parameter_dump( void ) | |
122 | { |
|
133 | { | |
123 | parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
134 | parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
124 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
135 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
125 | parameter_dump_packet.reserved = CCSDS_RESERVED; |
|
136 | parameter_dump_packet.reserved = CCSDS_RESERVED; | |
126 | parameter_dump_packet.userApplication = CCSDS_USER_APP; |
|
137 | parameter_dump_packet.userApplication = CCSDS_USER_APP; | |
127 | parameter_dump_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_PARAMETER_DUMP >> 8); |
|
138 | parameter_dump_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_PARAMETER_DUMP >> 8); | |
128 | parameter_dump_packet.packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP; |
|
139 | parameter_dump_packet.packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP; | |
129 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
140 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
130 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
141 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
131 | parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8); |
|
142 | parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8); | |
132 | parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP; |
|
143 | parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP; | |
133 | // DATA FIELD HEADER |
|
144 | // DATA FIELD HEADER | |
134 | parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2; |
|
145 | parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2; | |
135 | parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP; |
|
146 | parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP; | |
136 | parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP; |
|
147 | parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP; | |
137 | parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
148 | parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
138 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
149 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
139 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
150 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
140 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
151 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
141 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
152 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
142 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
153 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
143 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
154 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
144 | parameter_dump_packet.sid = SID_PARAMETER_DUMP; |
|
155 | parameter_dump_packet.sid = SID_PARAMETER_DUMP; | |
145 |
|
156 | |||
146 | //****************** |
|
157 | //****************** | |
147 | // COMMON PARAMETERS |
|
158 | // COMMON PARAMETERS | |
148 | parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0; |
|
159 | parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0; | |
149 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1; |
|
160 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1; | |
150 |
|
161 | |||
151 | //****************** |
|
162 | //****************** | |
152 | // NORMAL PARAMETERS |
|
163 | // NORMAL PARAMETERS | |
153 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_L >> 8); |
|
164 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_L >> 8); | |
154 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_L ); |
|
165 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_L ); | |
155 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_P >> 8); |
|
166 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_P >> 8); | |
156 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_P ); |
|
167 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_P ); | |
157 | parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (DEFAULT_SY_LFR_N_ASM_P >> 8); |
|
168 | parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (DEFAULT_SY_LFR_N_ASM_P >> 8); | |
158 | parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (DEFAULT_SY_LFR_N_ASM_P ); |
|
169 | parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (DEFAULT_SY_LFR_N_ASM_P ); | |
159 | parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) DEFAULT_SY_LFR_N_BP_P0; |
|
170 | parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) DEFAULT_SY_LFR_N_BP_P0; | |
160 | parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) DEFAULT_SY_LFR_N_BP_P1; |
|
171 | parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) DEFAULT_SY_LFR_N_BP_P1; | |
161 |
|
172 | |||
162 | //***************** |
|
173 | //***************** | |
163 | // BURST PARAMETERS |
|
174 | // BURST PARAMETERS | |
164 | parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0; |
|
175 | parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0; | |
165 | parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1; |
|
176 | parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1; | |
166 |
|
177 | |||
167 | //**************** |
|
178 | //**************** | |
168 | // SBM1 PARAMETERS |
|
179 | // SBM1 PARAMETERS | |
169 | parameter_dump_packet.sy_lfr_s1_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P0; // min value is 0.25 s for the period |
|
180 | parameter_dump_packet.sy_lfr_s1_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P0; // min value is 0.25 s for the period | |
170 | parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1; |
|
181 | parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1; | |
171 |
|
182 | |||
172 | //**************** |
|
183 | //**************** | |
173 | // SBM2 PARAMETERS |
|
184 | // SBM2 PARAMETERS | |
174 | parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0; |
|
185 | parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0; | |
175 | parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1; |
|
186 | parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1; | |
176 | } |
|
187 | } | |
177 |
|
188 | |||
178 | void init_local_mode_parameters( void ) |
|
189 | void init_local_mode_parameters( void ) | |
179 | { |
|
190 | { | |
180 | // LOCAL PARAMETERS |
|
191 | // LOCAL PARAMETERS | |
181 | set_local_sbm1_nb_cwf_max(); |
|
192 | set_local_sbm1_nb_cwf_max(); | |
182 | set_local_sbm2_nb_cwf_max(); |
|
193 | set_local_sbm2_nb_cwf_max(); | |
183 | set_local_nb_interrupt_f0_MAX(); |
|
194 | set_local_nb_interrupt_f0_MAX(); | |
184 |
|
195 | |||
185 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
196 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) | |
186 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
197 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) | |
187 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
198 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) | |
188 |
|
199 | |||
189 | reset_local_sbm1_nb_cwf_sent(); |
|
200 | reset_local_sbm1_nb_cwf_sent(); | |
190 | reset_local_sbm2_nb_cwf_sent(); |
|
201 | reset_local_sbm2_nb_cwf_sent(); | |
191 | } |
|
202 | } | |
192 |
|
203 | |||
193 | void init_housekeeping_parameters( void ) |
|
204 | void init_housekeeping_parameters( void ) | |
194 | { |
|
205 | { | |
195 | unsigned int i = 0; |
|
206 | unsigned int i = 0; | |
196 | unsigned int j = 0; |
|
207 | unsigned int j = 0; | |
197 | unsigned int k = 0; |
|
208 | unsigned int k = 0; | |
198 | char *parameters; |
|
209 | char *parameters; | |
199 |
|
210 | |||
200 | parameters = (char*) &housekeeping_packet.lfr_status_word; |
|
211 | parameters = (char*) &housekeeping_packet.lfr_status_word; | |
201 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) |
|
212 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) | |
202 | { |
|
213 | { | |
203 | parameters[i] = 0x00; |
|
214 | parameters[i] = 0x00; | |
204 | } |
|
215 | } | |
205 | // init status word |
|
216 | // init status word | |
206 | housekeeping_packet.lfr_status_word[0] = 0x00; |
|
217 | housekeeping_packet.lfr_status_word[0] = 0x00; | |
207 | housekeeping_packet.lfr_status_word[1] = 0x00; |
|
218 | housekeeping_packet.lfr_status_word[1] = 0x00; | |
208 | // init software version |
|
219 | // init software version | |
209 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
220 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; | |
210 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
221 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; | |
211 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
222 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; | |
212 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
223 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; | |
213 | // init sequence counters |
|
224 | // init sequence counters | |
214 | for (i = 0; i<SEQ_CNT_NB_PID; i++) |
|
225 | for (i = 0; i<SEQ_CNT_NB_PID; i++) | |
215 | { |
|
226 | { | |
216 | for(j = 0; j<SEQ_CNT_NB_CAT; j++) |
|
227 | for(j = 0; j<SEQ_CNT_NB_CAT; j++) | |
217 | { |
|
228 | { | |
218 | for(k = 0; k<SEQ_CNT_NB_DEST_ID; k++) |
|
229 | for(k = 0; k<SEQ_CNT_NB_DEST_ID; k++) | |
219 | { |
|
230 | { | |
220 | sequenceCounters[i][j][k] = 0x00; |
|
231 | sequenceCounters[i][j][k] = 0x00; | |
221 | } |
|
232 | } | |
222 | } |
|
233 | } | |
223 | } |
|
234 | } | |
224 | updateLFRCurrentMode(); |
|
235 | updateLFRCurrentMode(); | |
225 | } |
|
236 | } | |
226 |
|
237 | |||
227 | int create_names( void ) |
|
238 | int create_names( void ) // create all names for tasks and queues | |
228 | { |
|
239 | { | |
|
240 | /** This function creates all RTEMS names used in the software for tasks and queues. | |||
|
241 | * | |||
|
242 | * @return RTEMS directive status codes: | |||
|
243 | * - RTEMS_SUCCESSFUL - message sent successfully | |||
|
244 | * | |||
|
245 | */ | |||
|
246 | ||||
229 | // task names |
|
247 | // task names | |
230 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
248 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); | |
231 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
249 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); | |
232 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
250 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); | |
233 | Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); |
|
251 | Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); | |
234 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
|
252 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); | |
235 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
253 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); | |
236 | Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' ); |
|
254 | Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' ); | |
237 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
255 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); | |
238 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
256 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); | |
239 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
257 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
240 | Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' ); |
|
258 | Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' ); | |
241 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); |
|
259 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); | |
242 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
260 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); | |
243 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
261 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); | |
244 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
262 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); | |
245 |
|
263 | |||
246 | // rate monotonic period name |
|
264 | // rate monotonic period name | |
247 | HK_name = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
265 | HK_name = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
248 |
|
266 | |||
249 | misc_name[QUEUE_QUEU] = rtems_build_name( 'Q', 'U', 'E', 'U' ); |
|
267 | misc_name[QUEUE_QUEU] = rtems_build_name( 'Q', 'U', 'E', 'U' ); | |
250 | misc_name[QUEUE_PKTS] = rtems_build_name( 'P', 'K', 'T', 'S' ); |
|
268 | misc_name[QUEUE_PKTS] = rtems_build_name( 'P', 'K', 'T', 'S' ); | |
251 |
|
269 | |||
252 | return 0; |
|
270 | return RTEMS_SUCCESSFUL; | |
253 | } |
|
271 | } | |
254 |
|
272 | |||
255 | int create_all_tasks( void ) |
|
273 | int create_all_tasks( void ) // create all tasks which run in the software | |
256 | { |
|
274 | { | |
|
275 | /** This function creates all RTEMS tasks used in the software. | |||
|
276 | * | |||
|
277 | * @return RTEMS directive status codes: | |||
|
278 | * - RTEMS_SUCCESSFUL - task created successfully | |||
|
279 | * - RTEMS_INVALID_ADDRESS - id is NULL | |||
|
280 | * - RTEMS_INVALID_NAME - invalid task name | |||
|
281 | * - RTEMS_INVALID_PRIORITY - invalid task priority | |||
|
282 | * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured | |||
|
283 | * - RTEMS_TOO_MANY - too many tasks created | |||
|
284 | * - RTEMS_UNSATISFIED - not enough memory for stack/FP context | |||
|
285 | * - RTEMS_TOO_MANY - too many global objects | |||
|
286 | * | |||
|
287 | */ | |||
|
288 | ||||
257 | rtems_status_code status; |
|
289 | rtems_status_code status; | |
258 |
|
290 | |||
259 | // RECV |
|
291 | // RECV | |
260 | status = rtems_task_create( |
|
292 | status = rtems_task_create( | |
261 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, |
|
293 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, | |
262 | RTEMS_DEFAULT_MODES, |
|
294 | RTEMS_DEFAULT_MODES, | |
263 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] |
|
295 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] | |
264 | ); |
|
296 | ); | |
265 | // ACTN |
|
297 | ||
|
298 | if (status == RTEMS_SUCCESSFUL) // ACTN | |||
|
299 | { | |||
266 | status = rtems_task_create( |
|
300 | status = rtems_task_create( | |
267 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, |
|
301 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, | |
268 | RTEMS_DEFAULT_MODES, |
|
302 | RTEMS_DEFAULT_MODES, | |
269 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] |
|
303 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] | |
270 | ); |
|
304 | ); | |
271 | // SPIQ |
|
305 | } | |
|
306 | if (status == RTEMS_SUCCESSFUL) // SPIQ | |||
|
307 | { | |||
272 | status = rtems_task_create( |
|
308 | status = rtems_task_create( | |
273 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
309 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, | |
274 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
310 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
275 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] |
|
311 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] | |
276 | ); |
|
312 | ); | |
277 | // SMIQ |
|
313 | } | |
|
314 | if (status == RTEMS_SUCCESSFUL) // SMIQ | |||
|
315 | { | |||
278 | status = rtems_task_create( |
|
316 | status = rtems_task_create( | |
279 | Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
317 | Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE, | |
280 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
318 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
281 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ] |
|
319 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ] | |
282 | ); |
|
320 | ); | |
283 | // STAT |
|
321 | } | |
|
322 | if (status == RTEMS_SUCCESSFUL) // STAT | |||
|
323 | { | |||
284 | status = rtems_task_create( |
|
324 | status = rtems_task_create( | |
285 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, |
|
325 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, | |
286 | RTEMS_DEFAULT_MODES, |
|
326 | RTEMS_DEFAULT_MODES, | |
287 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] |
|
327 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] | |
288 | ); |
|
328 | ); | |
289 | // AVF0 |
|
329 | } | |
|
330 | if (status == RTEMS_SUCCESSFUL) // AVF0 | |||
|
331 | { | |||
290 | status = rtems_task_create( |
|
332 | status = rtems_task_create( | |
291 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, |
|
333 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, | |
292 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
334 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
293 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] |
|
335 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] | |
294 | ); |
|
336 | ); | |
295 | // BPF0 |
|
337 | } | |
|
338 | if (status == RTEMS_SUCCESSFUL) // BPF0 | |||
|
339 | { | |||
296 | status = rtems_task_create( |
|
340 | status = rtems_task_create( | |
297 | Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE, |
|
341 | Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE, | |
298 | RTEMS_DEFAULT_MODES, |
|
342 | RTEMS_DEFAULT_MODES, | |
299 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0] |
|
343 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0] | |
300 | ); |
|
344 | ); | |
301 | // WFRM |
|
345 | } | |
|
346 | if (status == RTEMS_SUCCESSFUL) // WFRM | |||
|
347 | { | |||
302 | status = rtems_task_create( |
|
348 | status = rtems_task_create( | |
303 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, |
|
349 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, | |
304 | RTEMS_DEFAULT_MODES, |
|
350 | RTEMS_DEFAULT_MODES, | |
305 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] |
|
351 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] | |
306 | ); |
|
352 | ); | |
307 | // DUMB |
|
353 | } | |
|
354 | if (status == RTEMS_SUCCESSFUL) // DUMB | |||
|
355 | { | |||
308 | status = rtems_task_create( |
|
356 | status = rtems_task_create( | |
309 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, |
|
357 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, | |
310 | RTEMS_DEFAULT_MODES, |
|
358 | RTEMS_DEFAULT_MODES, | |
311 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] |
|
359 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] | |
312 | ); |
|
360 | ); | |
313 | // HOUS |
|
361 | } | |
|
362 | if (status == RTEMS_SUCCESSFUL) // HOUS | |||
|
363 | { | |||
314 | status = rtems_task_create( |
|
364 | status = rtems_task_create( | |
315 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, |
|
365 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, | |
316 | RTEMS_DEFAULT_MODES, |
|
366 | RTEMS_DEFAULT_MODES, | |
317 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] |
|
367 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] | |
318 | ); |
|
368 | ); | |
319 | // MATR |
|
369 | } | |
|
370 | if (status == RTEMS_SUCCESSFUL) // MATR | |||
|
371 | { | |||
320 | status = rtems_task_create( |
|
372 | status = rtems_task_create( | |
321 | Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE, |
|
373 | Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE, | |
322 | RTEMS_DEFAULT_MODES, |
|
374 | RTEMS_DEFAULT_MODES, | |
323 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR] |
|
375 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR] | |
324 | ); |
|
376 | ); | |
325 | // CWF3 |
|
377 | } | |
|
378 | if (status == RTEMS_SUCCESSFUL) // CWF3 | |||
|
379 | { | |||
326 | status = rtems_task_create( |
|
380 | status = rtems_task_create( | |
327 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, |
|
381 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, | |
328 | RTEMS_DEFAULT_MODES, |
|
382 | RTEMS_DEFAULT_MODES, | |
329 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3] |
|
383 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3] | |
330 | ); |
|
384 | ); | |
331 | // CWF2 |
|
385 | } | |
|
386 | if (status == RTEMS_SUCCESSFUL) // CWF2 | |||
|
387 | { | |||
332 | status = rtems_task_create( |
|
388 | status = rtems_task_create( | |
333 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, |
|
389 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, | |
334 | RTEMS_DEFAULT_MODES, |
|
390 | RTEMS_DEFAULT_MODES, | |
335 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2] |
|
391 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2] | |
336 | ); |
|
392 | ); | |
337 | // CWF1 |
|
393 | } | |
|
394 | if (status == RTEMS_SUCCESSFUL) // CWF1 | |||
|
395 | { | |||
338 | status = rtems_task_create( |
|
396 | status = rtems_task_create( | |
339 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, |
|
397 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, | |
340 | RTEMS_DEFAULT_MODES, |
|
398 | RTEMS_DEFAULT_MODES, | |
341 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1] |
|
399 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1] | |
342 | ); |
|
400 | ); | |
343 | // SEND |
|
401 | } | |
|
402 | if (status == RTEMS_SUCCESSFUL) // SEND | |||
|
403 | { | |||
344 | status = rtems_task_create( |
|
404 | status = rtems_task_create( | |
345 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, |
|
405 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, | |
346 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
406 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
347 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] |
|
407 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] | |
348 | ); |
|
408 | ); | |
|
409 | } | |||
349 |
|
410 | |||
350 |
return |
|
411 | return status; | |
351 | } |
|
412 | } | |
352 |
|
413 | |||
353 | int start_all_tasks( void ) |
|
414 | int start_all_tasks( void ) | |
354 | { |
|
415 | { | |
|
416 | /** This function starts all RTEMS tasks used in the software. | |||
|
417 | * | |||
|
418 | * @return RTEMS directive status codes: | |||
|
419 | * - RTEMS_SUCCESSFUL - ask started successfully | |||
|
420 | * - RTEMS_INVALID_ADDRESS - invalid task entry point | |||
|
421 | * - RTEMS_INVALID_ID - invalid task id | |||
|
422 | * - RTEMS_INCORRECT_STATE - task not in the dormant state | |||
|
423 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task | |||
|
424 | * | |||
|
425 | */ | |||
|
426 | // starts all the tasks fot eh flight software | |||
|
427 | ||||
355 | rtems_status_code status; |
|
428 | rtems_status_code status; | |
356 |
|
429 | |||
357 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); |
|
430 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); | |
358 | if (status!=RTEMS_SUCCESSFUL) { |
|
431 | if (status!=RTEMS_SUCCESSFUL) { | |
359 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") |
|
432 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") | |
360 | } |
|
433 | } | |
361 |
|
434 | |||
|
435 | if (status == RTEMS_SUCCESSFUL) // SMIQ | |||
|
436 | { | |||
362 | status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); |
|
437 | status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); | |
363 | if (status!=RTEMS_SUCCESSFUL) { |
|
438 | if (status!=RTEMS_SUCCESSFUL) { | |
364 | BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n") |
|
439 | BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n") | |
365 | } |
|
440 | } | |
|
441 | } | |||
366 |
|
442 | |||
|
443 | if (status == RTEMS_SUCCESSFUL) // RECV | |||
|
444 | { | |||
367 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); |
|
445 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); | |
368 | if (status!=RTEMS_SUCCESSFUL) { |
|
446 | if (status!=RTEMS_SUCCESSFUL) { | |
369 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") |
|
447 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") | |
370 | } |
|
448 | } | |
|
449 | } | |||
371 |
|
450 | |||
|
451 | if (status == RTEMS_SUCCESSFUL) // SEND | |||
|
452 | { | |||
372 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); |
|
453 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); | |
373 | if (status!=RTEMS_SUCCESSFUL) { |
|
454 | if (status!=RTEMS_SUCCESSFUL) { | |
374 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") |
|
455 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") | |
375 | } |
|
456 | } | |
|
457 | } | |||
376 |
|
458 | |||
|
459 | if (status == RTEMS_SUCCESSFUL) // ACTN | |||
|
460 | { | |||
377 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); |
|
461 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); | |
378 | if (status!=RTEMS_SUCCESSFUL) { |
|
462 | if (status!=RTEMS_SUCCESSFUL) { | |
379 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") |
|
463 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") | |
380 | } |
|
464 | } | |
|
465 | } | |||
381 |
|
466 | |||
|
467 | if (status == RTEMS_SUCCESSFUL) // STAT | |||
|
468 | { | |||
382 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); |
|
469 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); | |
383 | if (status!=RTEMS_SUCCESSFUL) { |
|
470 | if (status!=RTEMS_SUCCESSFUL) { | |
384 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") |
|
471 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") | |
385 | } |
|
472 | } | |
|
473 | } | |||
386 |
|
474 | |||
|
475 | if (status == RTEMS_SUCCESSFUL) // AVF0 | |||
|
476 | { | |||
387 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 ); |
|
477 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 ); | |
388 | if (status!=RTEMS_SUCCESSFUL) { |
|
478 | if (status!=RTEMS_SUCCESSFUL) { | |
389 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") |
|
479 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") | |
390 | } |
|
480 | } | |
|
481 | } | |||
391 |
|
482 | |||
|
483 | if (status == RTEMS_SUCCESSFUL) // BPF0 | |||
|
484 | { | |||
392 | status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 ); |
|
485 | status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 ); | |
393 | if (status!=RTEMS_SUCCESSFUL) { |
|
486 | if (status!=RTEMS_SUCCESSFUL) { | |
394 | BOOT_PRINTF("in INIT *** Error starting TASK_BPF0\n") |
|
487 | BOOT_PRINTF("in INIT *** Error starting TASK_BPF0\n") | |
395 | } |
|
488 | } | |
|
489 | } | |||
396 |
|
490 | |||
|
491 | if (status == RTEMS_SUCCESSFUL) // WFRM | |||
|
492 | { | |||
397 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); |
|
493 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); | |
398 | if (status!=RTEMS_SUCCESSFUL) { |
|
494 | if (status!=RTEMS_SUCCESSFUL) { | |
399 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") |
|
495 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") | |
400 | } |
|
496 | } | |
|
497 | } | |||
401 |
|
498 | |||
|
499 | if (status == RTEMS_SUCCESSFUL) // DUMB | |||
|
500 | { | |||
402 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); |
|
501 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); | |
403 | if (status!=RTEMS_SUCCESSFUL) { |
|
502 | if (status!=RTEMS_SUCCESSFUL) { | |
404 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") |
|
503 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") | |
405 | } |
|
504 | } | |
|
505 | } | |||
406 |
|
506 | |||
|
507 | if (status == RTEMS_SUCCESSFUL) // HOUS | |||
|
508 | { | |||
407 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); |
|
509 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); | |
408 | if (status!=RTEMS_SUCCESSFUL) { |
|
510 | if (status!=RTEMS_SUCCESSFUL) { | |
409 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") |
|
511 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") | |
410 | } |
|
512 | } | |
|
513 | } | |||
411 |
|
514 | |||
|
515 | if (status == RTEMS_SUCCESSFUL) // MATR | |||
|
516 | { | |||
412 | status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 ); |
|
517 | status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 ); | |
413 | if (status!=RTEMS_SUCCESSFUL) { |
|
518 | if (status!=RTEMS_SUCCESSFUL) { | |
414 | BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n") |
|
519 | BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n") | |
415 | } |
|
520 | } | |
|
521 | } | |||
416 |
|
522 | |||
|
523 | if (status == RTEMS_SUCCESSFUL) // CWF3 | |||
|
524 | { | |||
417 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); |
|
525 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); | |
418 | if (status!=RTEMS_SUCCESSFUL) { |
|
526 | if (status!=RTEMS_SUCCESSFUL) { | |
419 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") |
|
527 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") | |
420 | } |
|
528 | } | |
|
529 | } | |||
421 |
|
530 | |||
|
531 | if (status == RTEMS_SUCCESSFUL) // CWF2 | |||
|
532 | { | |||
422 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); |
|
533 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); | |
423 | if (status!=RTEMS_SUCCESSFUL) { |
|
534 | if (status!=RTEMS_SUCCESSFUL) { | |
424 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") |
|
535 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") | |
425 | } |
|
536 | } | |
|
537 | } | |||
426 |
|
538 | |||
|
539 | if (status == RTEMS_SUCCESSFUL) // CWF1 | |||
|
540 | { | |||
427 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); |
|
541 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); | |
428 | if (status!=RTEMS_SUCCESSFUL) { |
|
542 | if (status!=RTEMS_SUCCESSFUL) { | |
429 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") |
|
543 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") | |
430 | } |
|
544 | } | |
431 |
|
||||
432 | return 0; |
|
|||
433 | } |
|
545 | } | |
434 |
|
546 | |||
435 | rtems_status_code create_message_queues( void ) |
|
547 | return status; | |
|
548 | } | |||
|
549 | ||||
|
550 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software | |||
436 | { |
|
551 | { | |
437 | rtems_status_code status; |
|
552 | rtems_status_code status; | |
438 | rtems_status_code ret; |
|
553 | rtems_status_code ret; | |
439 | rtems_id queue_id; |
|
554 | rtems_id queue_id; | |
440 |
|
555 | |||
|
556 | // create the queue for handling TM packet sending | |||
441 | ret = rtems_message_queue_create( misc_name[QUEUE_PKTS], ACTION_MSG_PKTS_COUNT, |
|
557 | ret = rtems_message_queue_create( misc_name[QUEUE_PKTS], ACTION_MSG_PKTS_COUNT, | |
442 | ACTION_MSG_PKTS_MAX_SIZE, |
|
558 | ACTION_MSG_PKTS_MAX_SIZE, | |
443 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
559 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
444 | if (ret != RTEMS_SUCCESSFUL) { |
|
560 | if (ret != RTEMS_SUCCESSFUL) { | |
445 | BOOT_PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", ret) |
|
561 | BOOT_PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", ret) | |
446 | } |
|
562 | } | |
447 |
|
563 | |||
|
564 | // create the queue for handling valid TCs | |||
448 | status = rtems_message_queue_create( misc_name[QUEUE_QUEU], ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE, |
|
565 | status = rtems_message_queue_create( misc_name[QUEUE_QUEU], ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE, | |
449 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
566 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
450 | if (status != RTEMS_SUCCESSFUL) { |
|
567 | if (status != RTEMS_SUCCESSFUL) { | |
451 | ret = status; |
|
568 | ret = status; | |
452 | BOOT_PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", ret) |
|
569 | BOOT_PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", ret) | |
453 | } |
|
570 | } | |
454 |
|
571 | |||
455 | return ret; |
|
572 | return ret; | |
456 | } |
|
573 | } |
@@ -1,325 +1,331 | |||||
1 |
#include |
|
1 | #include "fsw_misc.h" | |
2 | #include <fsw_params.h> |
|
|||
3 |
|
2 | |||
4 | int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, |
|
3 | int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, | |
5 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) |
|
4 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) | |
6 | { // configure the timer for the waveforms simulation |
|
5 | { // configure the timer for the waveforms simulation | |
7 | rtems_status_code status; |
|
6 | rtems_status_code status; | |
8 | rtems_isr_entry old_isr_handler; |
|
7 | rtems_isr_entry old_isr_handler; | |
9 |
|
8 | |||
10 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels |
|
9 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels | |
11 | if (status!=RTEMS_SUCCESSFUL) |
|
10 | if (status!=RTEMS_SUCCESSFUL) | |
12 | { |
|
11 | { | |
13 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n") |
|
12 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n") | |
14 | } |
|
13 | } | |
15 |
|
14 | |||
16 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); |
|
15 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); | |
17 |
|
16 | |||
18 | return 1; |
|
17 | return 1; | |
19 | } |
|
18 | } | |
20 |
|
19 | |||
21 | int timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
20 | int timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) | |
22 | { |
|
21 | { | |
23 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
22 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any | |
24 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register |
|
23 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register | |
25 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer |
|
24 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer | |
26 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart |
|
25 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart | |
27 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable |
|
26 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable | |
28 |
|
27 | |||
29 | return 1; |
|
28 | return 1; | |
30 | } |
|
29 | } | |
31 |
|
30 | |||
32 | int timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
31 | int timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) | |
33 | { |
|
32 | { | |
34 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer |
|
33 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer | |
35 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable |
|
34 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable | |
36 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
35 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any | |
37 |
|
36 | |||
38 | return 1; |
|
37 | return 1; | |
39 | } |
|
38 | } | |
40 |
|
39 | |||
41 | int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) |
|
40 | int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) | |
42 | { |
|
41 | { | |
43 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz |
|
42 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz | |
44 |
|
43 | |||
45 | return 1; |
|
44 | return 1; | |
46 | } |
|
45 | } | |
47 |
|
46 | |||
48 | void update_spacewire_statistics() |
|
47 | void update_spacewire_statistics() | |
49 | { |
|
48 | { | |
50 | rtems_status_code status; |
|
49 | rtems_status_code status; | |
51 | spw_stats spacewire_stats_grspw; |
|
50 | spw_stats spacewire_stats_grspw; | |
52 |
|
51 | |||
53 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); |
|
52 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); | |
54 |
|
53 | |||
55 | spacewire_stats.packets_received = spacewire_stats_backup.packets_received |
|
54 | spacewire_stats.packets_received = spacewire_stats_backup.packets_received | |
56 | + spacewire_stats_grspw.packets_received; |
|
55 | + spacewire_stats_grspw.packets_received; | |
57 | spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent |
|
56 | spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent | |
58 | + spacewire_stats_grspw.packets_sent; |
|
57 | + spacewire_stats_grspw.packets_sent; | |
59 | spacewire_stats.parity_err = spacewire_stats_backup.parity_err |
|
58 | spacewire_stats.parity_err = spacewire_stats_backup.parity_err | |
60 | + spacewire_stats_grspw.parity_err; |
|
59 | + spacewire_stats_grspw.parity_err; | |
61 | spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err |
|
60 | spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err | |
62 | + spacewire_stats_grspw.disconnect_err; |
|
61 | + spacewire_stats_grspw.disconnect_err; | |
63 | spacewire_stats.escape_err = spacewire_stats_backup.escape_err |
|
62 | spacewire_stats.escape_err = spacewire_stats_backup.escape_err | |
64 | + spacewire_stats_grspw.escape_err; |
|
63 | + spacewire_stats_grspw.escape_err; | |
65 | spacewire_stats.credit_err = spacewire_stats_backup.credit_err |
|
64 | spacewire_stats.credit_err = spacewire_stats_backup.credit_err | |
66 | + spacewire_stats_grspw.credit_err; |
|
65 | + spacewire_stats_grspw.credit_err; | |
67 | spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err |
|
66 | spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err | |
68 | + spacewire_stats_grspw.write_sync_err; |
|
67 | + spacewire_stats_grspw.write_sync_err; | |
69 | spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err |
|
68 | spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err | |
70 | + spacewire_stats_grspw.rx_rmap_header_crc_err; |
|
69 | + spacewire_stats_grspw.rx_rmap_header_crc_err; | |
71 | spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err |
|
70 | spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err | |
72 | + spacewire_stats_grspw.rx_rmap_data_crc_err; |
|
71 | + spacewire_stats_grspw.rx_rmap_data_crc_err; | |
73 | spacewire_stats.early_ep = spacewire_stats_backup.early_ep |
|
72 | spacewire_stats.early_ep = spacewire_stats_backup.early_ep | |
74 | + spacewire_stats_grspw.early_ep; |
|
73 | + spacewire_stats_grspw.early_ep; | |
75 | spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address |
|
74 | spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address | |
76 | + spacewire_stats_grspw.invalid_address; |
|
75 | + spacewire_stats_grspw.invalid_address; | |
77 | spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err |
|
76 | spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err | |
78 | + spacewire_stats_grspw.rx_eep_err; |
|
77 | + spacewire_stats_grspw.rx_eep_err; | |
79 | spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated |
|
78 | spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated | |
80 | + spacewire_stats_grspw.rx_truncated; |
|
79 | + spacewire_stats_grspw.rx_truncated; | |
81 | //spacewire_stats.tx_link_err; |
|
80 | //spacewire_stats.tx_link_err; | |
82 |
|
81 | |||
83 | //**************************** |
|
82 | //**************************** | |
84 | // DPU_SPACEWIRE_IF_STATISTICS |
|
83 | // DPU_SPACEWIRE_IF_STATISTICS | |
85 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8); |
|
84 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8); | |
86 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received); |
|
85 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received); | |
87 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8); |
|
86 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8); | |
88 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent); |
|
87 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent); | |
89 | //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt; |
|
88 | //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt; | |
90 | //housekeeping_packet.hk_lfr_dpu_spw_last_timc; |
|
89 | //housekeeping_packet.hk_lfr_dpu_spw_last_timc; | |
91 |
|
90 | |||
92 | //****************************************** |
|
91 | //****************************************** | |
93 | // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY |
|
92 | // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY | |
94 | housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err; |
|
93 | housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err; | |
95 | housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err; |
|
94 | housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err; | |
96 | housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err; |
|
95 | housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err; | |
97 | housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err; |
|
96 | housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err; | |
98 | housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err; |
|
97 | housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err; | |
99 | // housekeeping_packet.hk_lfr_dpu_spw_rx_ahb; |
|
98 | // housekeeping_packet.hk_lfr_dpu_spw_rx_ahb; | |
100 | // housekeeping_packet.hk_lfr_dpu_spw_tx_ahb; |
|
99 | // housekeeping_packet.hk_lfr_dpu_spw_tx_ahb; | |
101 | housekeeping_packet.hk_lfr_dpu_spw_header_crc = (unsigned char) spacewire_stats.rx_rmap_header_crc_err; |
|
100 | housekeeping_packet.hk_lfr_dpu_spw_header_crc = (unsigned char) spacewire_stats.rx_rmap_header_crc_err; | |
102 | housekeeping_packet.hk_lfr_dpu_spw_data_crc = (unsigned char) spacewire_stats.rx_rmap_data_crc_err; |
|
101 | housekeeping_packet.hk_lfr_dpu_spw_data_crc = (unsigned char) spacewire_stats.rx_rmap_data_crc_err; | |
103 |
|
102 | |||
104 | //********************************************* |
|
103 | //********************************************* | |
105 | // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY |
|
104 | // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY | |
106 | housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep; |
|
105 | housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep; | |
107 | housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address; |
|
106 | housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address; | |
108 | housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err; |
|
107 | housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err; | |
109 | housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated; |
|
108 | housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated; | |
110 |
|
109 | |||
111 | } |
|
110 | } | |
112 |
|
111 | |||
113 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port |
|
112 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port | |
114 | { |
|
113 | { | |
115 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
114 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; | |
116 |
|
115 | |||
117 | apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB; |
|
116 | apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB; | |
118 | PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") |
|
117 | PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") | |
119 |
|
118 | |||
120 | return 0; |
|
119 | return 0; | |
121 | } |
|
120 | } | |
122 |
|
121 | |||
123 |
|
|
122 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) | |
124 | { |
|
123 | { | |
|
124 | /** This function sets the scaler reload register of the apbuart module | |||
|
125 | * | |||
|
126 | * @param regs is the address of the apbuart registers in memory | |||
|
127 | * @param value is the value that will be stored in the scaler register | |||
|
128 | * | |||
|
129 | * The value shall be set by the software to get data on the serial interface. | |||
|
130 | * | |||
|
131 | */ | |||
|
132 | ||||
125 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; |
|
133 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; | |
126 |
|
134 | |||
127 | apbuart_regs->scaler = value; |
|
135 | apbuart_regs->scaler = value; | |
128 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) |
|
136 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) | |
129 |
|
||||
130 | return 0; |
|
|||
131 | } |
|
137 | } | |
132 |
|
138 | |||
133 | //************ |
|
139 | //************ | |
134 | // RTEMS TASKS |
|
140 | // RTEMS TASKS | |
135 |
|
141 | |||
136 | rtems_task stat_task(rtems_task_argument argument) |
|
142 | rtems_task stat_task(rtems_task_argument argument) | |
137 | { |
|
143 | { | |
138 | int i; |
|
144 | int i; | |
139 | int j; |
|
145 | int j; | |
140 | i = 0; |
|
146 | i = 0; | |
141 | j = 0; |
|
147 | j = 0; | |
142 | BOOT_PRINTF("in STAT *** \n") |
|
148 | BOOT_PRINTF("in STAT *** \n") | |
143 | while(1){ |
|
149 | while(1){ | |
144 | rtems_task_wake_after(1000); |
|
150 | rtems_task_wake_after(1000); | |
145 | PRINTF1("%d\n", j) |
|
151 | PRINTF1("%d\n", j) | |
146 | if (i == CPU_USAGE_REPORT_PERIOD) { |
|
152 | if (i == CPU_USAGE_REPORT_PERIOD) { | |
147 | // #ifdef PRINT_TASK_STATISTICS |
|
153 | // #ifdef PRINT_TASK_STATISTICS | |
148 | // rtems_cpu_usage_report(); |
|
154 | // rtems_cpu_usage_report(); | |
149 | // rtems_cpu_usage_reset(); |
|
155 | // rtems_cpu_usage_reset(); | |
150 | // #endif |
|
156 | // #endif | |
151 | i = 0; |
|
157 | i = 0; | |
152 | } |
|
158 | } | |
153 | else i++; |
|
159 | else i++; | |
154 | j++; |
|
160 | j++; | |
155 | } |
|
161 | } | |
156 | } |
|
162 | } | |
157 |
|
163 | |||
158 | rtems_task hous_task(rtems_task_argument argument) |
|
164 | rtems_task hous_task(rtems_task_argument argument) | |
159 | { |
|
165 | { | |
160 | rtems_status_code status; |
|
166 | rtems_status_code status; | |
161 | spw_ioctl_pkt_send spw_ioctl_send; |
|
167 | spw_ioctl_pkt_send spw_ioctl_send; | |
162 | rtems_id queue_id; |
|
168 | rtems_id queue_id; | |
163 |
|
169 | |||
164 | spw_ioctl_send.hlen = 0; |
|
170 | spw_ioctl_send.hlen = 0; | |
165 | spw_ioctl_send.hdr = NULL; |
|
171 | spw_ioctl_send.hdr = NULL; | |
166 | spw_ioctl_send.dlen = PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
172 | spw_ioctl_send.dlen = PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
167 | spw_ioctl_send.data = (char*) &housekeeping_packet; |
|
173 | spw_ioctl_send.data = (char*) &housekeeping_packet; | |
168 | spw_ioctl_send.options = 0; |
|
174 | spw_ioctl_send.options = 0; | |
169 |
|
175 | |||
170 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); |
|
176 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); | |
171 | if (status != RTEMS_SUCCESSFUL) |
|
177 | if (status != RTEMS_SUCCESSFUL) | |
172 | { |
|
178 | { | |
173 | PRINTF1("in HOUS *** ERR %d\n", status) |
|
179 | PRINTF1("in HOUS *** ERR %d\n", status) | |
174 | } |
|
180 | } | |
175 |
|
181 | |||
176 | BOOT_PRINTF("in HOUS ***\n") |
|
182 | BOOT_PRINTF("in HOUS ***\n") | |
177 |
|
183 | |||
178 | if (rtems_rate_monotonic_ident( HK_name, &HK_id) != RTEMS_SUCCESSFUL) { |
|
184 | if (rtems_rate_monotonic_ident( HK_name, &HK_id) != RTEMS_SUCCESSFUL) { | |
179 | status = rtems_rate_monotonic_create( HK_name, &HK_id ); |
|
185 | status = rtems_rate_monotonic_create( HK_name, &HK_id ); | |
180 | if( status != RTEMS_SUCCESSFUL ) { |
|
186 | if( status != RTEMS_SUCCESSFUL ) { | |
181 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) |
|
187 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) | |
182 | } |
|
188 | } | |
183 | } |
|
189 | } | |
184 |
|
190 | |||
185 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
191 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
186 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
192 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
187 | housekeeping_packet.reserved = DEFAULT_RESERVED; |
|
193 | housekeeping_packet.reserved = DEFAULT_RESERVED; | |
188 | housekeeping_packet.userApplication = CCSDS_USER_APP; |
|
194 | housekeeping_packet.userApplication = CCSDS_USER_APP; | |
189 | housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8); |
|
195 | housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8); | |
190 | housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK); |
|
196 | housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK); | |
191 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
197 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
192 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
198 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
193 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
199 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); | |
194 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
200 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); | |
195 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
201 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
196 | housekeeping_packet.serviceType = TM_TYPE_HK; |
|
202 | housekeeping_packet.serviceType = TM_TYPE_HK; | |
197 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; |
|
203 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; | |
198 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
204 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
199 |
|
205 | |||
200 | status = rtems_rate_monotonic_cancel(HK_id); |
|
206 | status = rtems_rate_monotonic_cancel(HK_id); | |
201 | if( status != RTEMS_SUCCESSFUL ) { |
|
207 | if( status != RTEMS_SUCCESSFUL ) { | |
202 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) |
|
208 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) | |
203 | } |
|
209 | } | |
204 | else { |
|
210 | else { | |
205 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") |
|
211 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") | |
206 | } |
|
212 | } | |
207 |
|
213 | |||
208 | while(1){ // launch the rate monotonic task |
|
214 | while(1){ // launch the rate monotonic task | |
209 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); |
|
215 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); | |
210 | if ( status != RTEMS_SUCCESSFUL ) { |
|
216 | if ( status != RTEMS_SUCCESSFUL ) { | |
211 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_period *** code %d\n", status); |
|
217 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_period *** code %d\n", status); | |
212 | } |
|
218 | } | |
213 | else { |
|
219 | else { | |
214 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
220 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
215 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
221 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
216 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
222 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
217 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
223 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
218 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
224 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
219 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
225 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
220 | housekeeping_packet.sid = SID_HK; |
|
226 | housekeeping_packet.sid = SID_HK; | |
221 |
|
227 | |||
222 | update_spacewire_statistics(); |
|
228 | update_spacewire_statistics(); | |
223 |
|
229 | |||
224 | // SEND PACKET |
|
230 | // SEND PACKET | |
225 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
231 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
226 | if (status != RTEMS_SUCCESSFUL) { |
|
232 | if (status != RTEMS_SUCCESSFUL) { | |
227 | PRINTF1("in HOUS *** ERR %d\n", status) |
|
233 | PRINTF1("in HOUS *** ERR %d\n", status) | |
228 | } |
|
234 | } | |
229 | } |
|
235 | } | |
230 | } |
|
236 | } | |
231 |
|
237 | |||
232 | PRINTF("in HOUS *** deleting task\n") |
|
238 | PRINTF("in HOUS *** deleting task\n") | |
233 |
|
239 | |||
234 | status = rtems_task_delete( RTEMS_SELF ); // should not return |
|
240 | status = rtems_task_delete( RTEMS_SELF ); // should not return | |
235 | printf( "rtems_task_delete returned with status of %d.\n", status ); |
|
241 | printf( "rtems_task_delete returned with status of %d.\n", status ); | |
236 | exit( 1 ); |
|
242 | exit( 1 ); | |
237 | } |
|
243 | } | |
238 |
|
244 | |||
239 | rtems_task send_task( rtems_task_argument argument) |
|
245 | rtems_task send_task( rtems_task_argument argument) | |
240 | { |
|
246 | { | |
241 | rtems_status_code status; // RTEMS status code |
|
247 | rtems_status_code status; // RTEMS status code | |
242 | char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer |
|
248 | char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer | |
243 | spw_ioctl_pkt_send *spw_ioctl_send; |
|
249 | spw_ioctl_pkt_send *spw_ioctl_send; | |
244 | size_t size; // size of the incoming TC packet |
|
250 | size_t size; // size of the incoming TC packet | |
245 | u_int32_t count; |
|
251 | u_int32_t count; | |
246 | rtems_id queue_id; |
|
252 | rtems_id queue_id; | |
247 |
|
253 | |||
248 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); |
|
254 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); | |
249 | if (status != RTEMS_SUCCESSFUL) |
|
255 | if (status != RTEMS_SUCCESSFUL) | |
250 | { |
|
256 | { | |
251 | PRINTF1("in SEND *** ERR getting queue id, %d\n", status) |
|
257 | PRINTF1("in SEND *** ERR getting queue id, %d\n", status) | |
252 | } |
|
258 | } | |
253 |
|
259 | |||
254 | BOOT_PRINTF("in SEND *** \n") |
|
260 | BOOT_PRINTF("in SEND *** \n") | |
255 |
|
261 | |||
256 | while(1) |
|
262 | while(1) | |
257 | { |
|
263 | { | |
258 | status = rtems_message_queue_receive( queue_id, incomingData, &size, |
|
264 | status = rtems_message_queue_receive( queue_id, incomingData, &size, | |
259 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); |
|
265 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); | |
260 |
|
266 | |||
261 | if (status!=RTEMS_SUCCESSFUL) |
|
267 | if (status!=RTEMS_SUCCESSFUL) | |
262 | { |
|
268 | { | |
263 | PRINTF1("in SEND *** (1) ERR = %d\n", status) |
|
269 | PRINTF1("in SEND *** (1) ERR = %d\n", status) | |
264 | } |
|
270 | } | |
265 | else |
|
271 | else | |
266 | { |
|
272 | { | |
267 | if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet |
|
273 | if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet | |
268 | { |
|
274 | { | |
269 | status = write( fdSPW, incomingData, size ); |
|
275 | status = write( fdSPW, incomingData, size ); | |
270 | if (status == -1){ |
|
276 | if (status == -1){ | |
271 | PRINTF2("in SEND *** (2.a) ERR = %d, size = %d\n", status, size) |
|
277 | PRINTF2("in SEND *** (2.a) ERR = %d, size = %d\n", status, size) | |
272 | } |
|
278 | } | |
273 | } |
|
279 | } | |
274 | else // the incoming message is a spw_ioctl_pkt_send structure |
|
280 | else // the incoming message is a spw_ioctl_pkt_send structure | |
275 | { |
|
281 | { | |
276 | spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData; |
|
282 | spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData; | |
277 | if (spw_ioctl_send->hlen == 0) |
|
283 | if (spw_ioctl_send->hlen == 0) | |
278 | { |
|
284 | { | |
279 | status = write( fdSPW, spw_ioctl_send->data, spw_ioctl_send->dlen ); |
|
285 | status = write( fdSPW, spw_ioctl_send->data, spw_ioctl_send->dlen ); | |
280 | if (status == -1){ |
|
286 | if (status == -1){ | |
281 | PRINTF2("in SEND *** (2.b) ERR = %d, dlen = %d\n", status, spw_ioctl_send->dlen) |
|
287 | PRINTF2("in SEND *** (2.b) ERR = %d, dlen = %d\n", status, spw_ioctl_send->dlen) | |
282 | } |
|
288 | } | |
283 | } |
|
289 | } | |
284 | else |
|
290 | else | |
285 | { |
|
291 | { | |
286 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send ); |
|
292 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send ); | |
287 | if (status == -1){ |
|
293 | if (status == -1){ | |
288 | PRINTF2("in SEND *** (2.c) ERR = %d, dlen = %d\n", status, spw_ioctl_send->dlen) |
|
294 | PRINTF2("in SEND *** (2.c) ERR = %d, dlen = %d\n", status, spw_ioctl_send->dlen) | |
289 | PRINTF1(" hlen = %d\n", spw_ioctl_send->hlen) |
|
295 | PRINTF1(" hlen = %d\n", spw_ioctl_send->hlen) | |
290 | } |
|
296 | } | |
291 | } |
|
297 | } | |
292 | } |
|
298 | } | |
293 | } |
|
299 | } | |
294 |
|
300 | |||
295 | status = rtems_message_queue_get_number_pending( queue_id, &count ); |
|
301 | status = rtems_message_queue_get_number_pending( queue_id, &count ); | |
296 | if (status != RTEMS_SUCCESSFUL) |
|
302 | if (status != RTEMS_SUCCESSFUL) | |
297 | { |
|
303 | { | |
298 | PRINTF1("in SEND *** (3) ERR = %d\n", status) |
|
304 | PRINTF1("in SEND *** (3) ERR = %d\n", status) | |
299 | } |
|
305 | } | |
300 | else |
|
306 | else | |
301 | { |
|
307 | { | |
302 | if (count > maxCount) |
|
308 | if (count > maxCount) | |
303 | { |
|
309 | { | |
304 | maxCount = count; |
|
310 | maxCount = count; | |
305 | } |
|
311 | } | |
306 | } |
|
312 | } | |
307 | } |
|
313 | } | |
308 | } |
|
314 | } | |
309 |
|
315 | |||
310 | rtems_id get_pkts_queue_id( void ) |
|
316 | rtems_id get_pkts_queue_id( void ) | |
311 | { |
|
317 | { | |
312 | rtems_id queue_id; |
|
318 | rtems_id queue_id; | |
313 | rtems_status_code status; |
|
319 | rtems_status_code status; | |
314 |
|
320 | |||
315 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); |
|
321 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); | |
316 | if (status != RTEMS_SUCCESSFUL) |
|
322 | if (status != RTEMS_SUCCESSFUL) | |
317 | { |
|
323 | { | |
318 | PRINTF1("in get_pkts_queue_id *** ERR %d\n", status) |
|
324 | PRINTF1("in get_pkts_queue_id *** ERR %d\n", status) | |
319 | } |
|
325 | } | |
320 | return queue_id; |
|
326 | return queue_id; | |
321 | } |
|
327 | } | |
322 |
|
328 | |||
323 |
|
329 | |||
324 |
|
330 | |||
325 |
|
331 |
@@ -1,688 +1,669 | |||||
1 | #include <fsw_processing.h> |
|
1 | #include <fsw_processing.h> | |
2 | #include <math.h> |
|
2 | #include <math.h> | |
3 |
|
3 | |||
4 | #include <fsw_processing_globals.c> |
|
4 | #include <fsw_processing_globals.c> | |
5 |
|
5 | |||
6 | unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_SM_F0 * 9 ]; |
|
6 | unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_SM_F0 * 9 ]; | |
7 | BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ]; |
|
7 | BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ]; | |
8 | float averaged_spec_mat_f0[ TOTAL_SIZE_SM ]; |
|
8 | float averaged_spec_mat_f0[ TOTAL_SIZE_SM ]; | |
9 | char averaged_spec_mat_f0_char[ TOTAL_SIZE_SM * 2 ]; |
|
9 | char averaged_spec_mat_f0_char[ TOTAL_SIZE_SM * 2 ]; | |
10 | float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ]; |
|
10 | float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ]; | |
11 |
|
11 | |||
12 | //*********************************************************** |
|
12 | //*********************************************************** | |
13 | // Interrupt Service Routine for spectral matrices processing |
|
13 | // Interrupt Service Routine for spectral matrices processing | |
14 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
14 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) | |
15 | { |
|
15 | { | |
16 | unsigned char status; |
|
16 | unsigned char status; | |
17 | unsigned char i; |
|
17 | unsigned char i; | |
18 |
|
18 | |||
19 | status = spectral_matrix_regs->status; //[f2 f1 f0_1 f0_0] |
|
19 | status = spectral_matrix_regs->status; //[f2 f1 f0_1 f0_0] | |
20 | for (i=0; i<4; i++) |
|
20 | for (i=0; i<4; i++) | |
21 | { |
|
21 | { | |
22 | if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation |
|
22 | if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation | |
23 | { |
|
23 | { | |
24 | switch(i) |
|
24 | switch(i) | |
25 | { |
|
25 | { | |
26 | case 0: |
|
26 | case 0: | |
27 | if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0) |
|
27 | if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0) | |
28 | { |
|
28 | { | |
29 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0_bis; |
|
29 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0_bis; | |
30 | } |
|
30 | } | |
31 | else |
|
31 | else | |
32 | { |
|
32 | { | |
33 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0; |
|
33 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0; | |
34 | } |
|
34 | } | |
35 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; |
|
35 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; | |
36 | break; |
|
36 | break; | |
37 | case 1: |
|
37 | case 1: | |
38 | if (spectral_matrix_regs->matrixFO_Address1 == (int) spec_mat_f0_1) |
|
38 | if (spectral_matrix_regs->matrixFO_Address1 == (int) spec_mat_f0_1) | |
39 | { |
|
39 | { | |
40 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1_bis; |
|
40 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1_bis; | |
41 | } |
|
41 | } | |
42 | else |
|
42 | else | |
43 | { |
|
43 | { | |
44 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1; |
|
44 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1; | |
45 | } |
|
45 | } | |
46 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; |
|
46 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; | |
47 | break; |
|
47 | break; | |
48 | case 2: |
|
48 | case 2: | |
49 | if (spectral_matrix_regs->matrixF1_Address == (int) spec_mat_f1) |
|
49 | if (spectral_matrix_regs->matrixF1_Address == (int) spec_mat_f1) | |
50 | { |
|
50 | { | |
51 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1_bis; |
|
51 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1_bis; | |
52 | } |
|
52 | } | |
53 | else |
|
53 | else | |
54 | { |
|
54 | { | |
55 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1; |
|
55 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1; | |
56 | } |
|
56 | } | |
57 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffb; |
|
57 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffb; | |
58 | break; |
|
58 | break; | |
59 | case 3: |
|
59 | case 3: | |
60 | if (spectral_matrix_regs->matrixF2_Address == (int) spec_mat_f2) |
|
60 | if (spectral_matrix_regs->matrixF2_Address == (int) spec_mat_f2) | |
61 | { |
|
61 | { | |
62 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2_bis; |
|
62 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2_bis; | |
63 | } |
|
63 | } | |
64 | else |
|
64 | else | |
65 | { |
|
65 | { | |
66 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2; |
|
66 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2; | |
67 | } |
|
67 | } | |
68 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff7; |
|
68 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff7; | |
69 | break; |
|
69 | break; | |
70 | default: |
|
70 | default: | |
71 | break; |
|
71 | break; | |
72 | } |
|
72 | } | |
73 | } |
|
73 | } | |
74 | } |
|
74 | } | |
75 |
|
75 | |||
76 | // reset error codes to 0 |
|
76 | // reset error codes to 0 | |
77 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111] |
|
77 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111] | |
78 |
|
78 | |||
79 | if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
79 | if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
80 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 ); |
|
80 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 ); | |
81 | } |
|
81 | } | |
82 | } |
|
82 | } | |
83 |
|
83 | |||
84 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
84 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) | |
85 | { |
|
85 | { | |
86 | if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
86 | if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
87 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 ); |
|
87 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 ); | |
88 | } |
|
88 | } | |
89 | } |
|
89 | } | |
90 |
|
90 | |||
91 | //************ |
|
91 | //************ | |
92 | // RTEMS TASKS |
|
92 | // RTEMS TASKS | |
93 |
|
93 | |||
94 | rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ |
|
94 | rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ | |
95 | { |
|
95 | { | |
96 | rtems_event_set event_out; |
|
96 | rtems_event_set event_out; | |
97 | unsigned int nb_interrupt_f0 = 0; |
|
97 | unsigned int nb_interrupt_f0 = 0; | |
98 |
|
98 | |||
99 | BOOT_PRINTF("in SMIQ *** \n") |
|
99 | BOOT_PRINTF("in SMIQ *** \n") | |
100 |
|
100 | |||
101 | while(1){ |
|
101 | while(1){ | |
102 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
102 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
103 | nb_interrupt_f0 = nb_interrupt_f0 + 1; |
|
103 | nb_interrupt_f0 = nb_interrupt_f0 + 1; | |
104 | if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){ |
|
104 | if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){ | |
105 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
105 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
106 | { |
|
106 | { | |
107 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
107 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
108 | } |
|
108 | } | |
109 | nb_interrupt_f0 = 0; |
|
109 | nb_interrupt_f0 = 0; | |
110 | } |
|
110 | } | |
111 | } |
|
111 | } | |
112 | } |
|
112 | } | |
113 |
|
113 | |||
114 | //rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ |
|
114 | //rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ | |
115 | //{ |
|
115 | //{ | |
116 | // rtems_event_set event_out; |
|
116 | // rtems_event_set event_out; | |
117 | // unsigned int nb_interrupt_f0 = 0; |
|
117 | // unsigned int nb_interrupt_f0 = 0; | |
118 |
|
118 | |||
119 | // PRINTF("in SMIQ *** \n") |
|
119 | // PRINTF("in SMIQ *** \n") | |
120 |
|
120 | |||
121 | // while(1){ |
|
121 | // while(1){ | |
122 | // rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
122 | // rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
123 | // nb_interrupt_f0 = nb_interrupt_f0 + 1; |
|
123 | // nb_interrupt_f0 = nb_interrupt_f0 + 1; | |
124 | // if (nb_interrupt_f0 == param_local.local_nb_interrupt_f0_MAX ){ |
|
124 | // if (nb_interrupt_f0 == param_local.local_nb_interrupt_f0_MAX ){ | |
125 | // if (rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
125 | // if (rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
126 | // { |
|
126 | // { | |
127 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
127 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
128 | // } |
|
128 | // } | |
129 | // nb_interrupt_f0 = 0; |
|
129 | // nb_interrupt_f0 = 0; | |
130 | // } |
|
130 | // } | |
131 | // } |
|
131 | // } | |
132 | //} |
|
132 | //} | |
133 |
|
133 | |||
134 | rtems_task spw_bppr_task(rtems_task_argument argument) |
|
134 | rtems_task spw_bppr_task(rtems_task_argument argument) | |
135 | { |
|
135 | { | |
136 | rtems_status_code status; |
|
136 | rtems_status_code status; | |
137 | rtems_event_set event_out; |
|
137 | rtems_event_set event_out; | |
138 | static int Nb_average_f0 = 0; |
|
|||
139 | //static int nb_average_f1 = 0; |
|
|||
140 | //static int nb_average_f2 = 0; |
|
|||
141 |
|
138 | |||
142 | BOOT_PRINTF("in BPPR ***\n"); |
|
139 | BOOT_PRINTF("in BPPR ***\n"); | |
143 |
|
140 | |||
144 | while(true){ // wait for an event to begin with the processing |
|
141 | while( true ){ // wait for an event to begin with the processing | |
145 | status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); |
|
142 | status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); | |
146 | if (status == RTEMS_SUCCESSFUL) { |
|
|||
147 | if ((spectral_matrix_regs->status & 0x00000001)==1) { |
|
|||
148 | matrix_average(spec_mat_f0_0, averaged_spec_mat_f0); |
|
|||
149 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; |
|
|||
150 | //printf("f0_a\n"); |
|
|||
151 | Nb_average_f0++; |
|
|||
152 | } |
|
|||
153 | if (((spectral_matrix_regs->status>>1) & 0x00000001)==1) { |
|
|||
154 | matrix_average(spec_mat_f0_1, compressed_spec_mat_f0); |
|
|||
155 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; |
|
|||
156 | //printf("f0_b\n"); |
|
|||
157 | Nb_average_f0++; |
|
|||
158 | } |
|
|||
159 | if (Nb_average_f0 == NB_AVERAGE_NORMAL_f0) { |
|
|||
160 | matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0); |
|
|||
161 | //printf("f0 compressed\n"); |
|
|||
162 | Nb_average_f0 = 0; |
|
|||
163 | matrix_reset(averaged_spec_mat_f0); |
|
|||
164 | } |
|
|||
165 | } |
|
|||
166 | } |
|
143 | } | |
167 | } |
|
144 | } | |
168 |
|
145 | |||
169 | rtems_task avf0_task(rtems_task_argument argument) |
|
146 | rtems_task avf0_task(rtems_task_argument argument) | |
170 | { |
|
147 | { | |
171 | int i; |
|
148 | int i; | |
172 | static int nb_average; |
|
149 | static int nb_average; | |
173 | rtems_event_set event_out; |
|
150 | rtems_event_set event_out; | |
174 | rtems_status_code status; |
|
151 | rtems_status_code status; | |
175 |
|
152 | |||
176 | nb_average = 0; |
|
153 | nb_average = 0; | |
177 |
|
154 | |||
178 | BOOT_PRINTF("in AVFO *** \n") |
|
155 | BOOT_PRINTF("in AVFO *** \n") | |
179 |
|
156 | |||
180 | while(1){ |
|
157 | while(1){ | |
181 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
158 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
182 | for(i=0; i<TOTAL_SIZE_SM; i++){ |
|
159 | for(i=0; i<TOTAL_SIZE_SM; i++){ | |
183 | averaged_spec_mat_f0[i] = averaged_spec_mat_f0[i] + spec_mat_f0_a[i] |
|
160 | averaged_spec_mat_f0[i] = averaged_spec_mat_f0[i] + spec_mat_f0_a[i] | |
184 | + spec_mat_f0_b[i] |
|
161 | + spec_mat_f0_b[i] | |
185 | + spec_mat_f0_c[i] |
|
162 | + spec_mat_f0_c[i] | |
186 | + spec_mat_f0_d[i] |
|
163 | + spec_mat_f0_d[i] | |
187 | + spec_mat_f0_e[i] |
|
164 | + spec_mat_f0_e[i] | |
188 | + spec_mat_f0_f[i] |
|
165 | + spec_mat_f0_f[i] | |
189 | + spec_mat_f0_g[i] |
|
166 | + spec_mat_f0_g[i] | |
190 | + spec_mat_f0_h[i]; |
|
167 | + spec_mat_f0_h[i]; | |
191 | } |
|
168 | } | |
192 | nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0; |
|
169 | nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0; | |
193 | if (nb_average == NB_AVERAGE_NORMAL_f0) { |
|
170 | if (nb_average == NB_AVERAGE_NORMAL_f0) { | |
194 | nb_average = 0; |
|
171 | nb_average = 0; | |
195 | status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0 |
|
172 | status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0 | |
196 | if (status != RTEMS_SUCCESSFUL) { |
|
173 | if (status != RTEMS_SUCCESSFUL) { | |
197 | printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status); |
|
174 | printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status); | |
198 | } |
|
175 | } | |
199 | } |
|
176 | } | |
200 | } |
|
177 | } | |
201 | } |
|
178 | } | |
202 |
|
179 | |||
203 | rtems_task bpf0_task(rtems_task_argument argument) |
|
180 | rtems_task bpf0_task(rtems_task_argument argument) | |
204 | { |
|
181 | { | |
205 | rtems_event_set event_out; |
|
182 | rtems_event_set event_out; | |
206 |
|
183 | |||
207 | BOOT_PRINTF("in BPFO *** \n") |
|
184 | BOOT_PRINTF("in BPFO *** \n") | |
208 |
|
185 | |||
209 | while(1){ |
|
186 | while(1){ | |
210 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
187 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
211 | matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0); |
|
188 | matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0); | |
212 | BP1_set(compressed_spec_mat_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0); |
|
189 | BP1_set(compressed_spec_mat_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0); | |
213 | //PRINTF("IN TASK BPF0 *** Matrix compressed, parameters calculated\n") |
|
190 | //PRINTF("IN TASK BPF0 *** Matrix compressed, parameters calculated\n") | |
214 | } |
|
191 | } | |
215 | } |
|
192 | } | |
216 |
|
193 | |||
217 | rtems_task matr_task(rtems_task_argument argument) |
|
194 | rtems_task matr_task(rtems_task_argument argument) | |
218 | { |
|
195 | { | |
219 | spw_ioctl_pkt_send spw_ioctl_send_ASM; |
|
196 | spw_ioctl_pkt_send spw_ioctl_send_ASM; | |
220 | rtems_event_set event_out; |
|
197 | rtems_event_set event_out; | |
221 | rtems_status_code status; |
|
198 | rtems_status_code status; | |
222 | rtems_id queue_id; |
|
199 | rtems_id queue_id; | |
223 | Header_TM_LFR_SCIENCE_ASM_t headerASM; |
|
200 | Header_TM_LFR_SCIENCE_ASM_t headerASM; | |
224 |
|
201 | |||
225 | init_header_asm( &headerASM ); |
|
202 | init_header_asm( &headerASM ); | |
226 |
|
203 | |||
227 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); |
|
204 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); | |
228 | if (status != RTEMS_SUCCESSFUL) |
|
205 | if (status != RTEMS_SUCCESSFUL) | |
229 | { |
|
206 | { | |
230 | PRINTF1("in MATR *** ERR getting queue id, %d\n", status) |
|
207 | PRINTF1("in MATR *** ERR getting queue id, %d\n", status) | |
231 | } |
|
208 | } | |
232 |
|
209 | |||
233 | BOOT_PRINTF("in MATR *** \n") |
|
210 | BOOT_PRINTF("in MATR *** \n") | |
234 |
|
211 | |||
235 | fill_averaged_spectral_matrix( ); |
|
212 | fill_averaged_spectral_matrix( ); | |
236 |
|
213 | |||
237 | while(1){ |
|
214 | while(1){ | |
238 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
215 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
239 |
|
216 | |||
240 | #ifdef GSA |
|
217 | #ifdef GSA | |
241 | #else |
|
218 | #else | |
242 | fill_averaged_spectral_matrix( ); |
|
219 | fill_averaged_spectral_matrix( ); | |
243 | #endif |
|
220 | #endif | |
244 | convert_averaged_spectral_matrix( averaged_spec_mat_f0, averaged_spec_mat_f0_char); |
|
221 | convert_averaged_spectral_matrix( averaged_spec_mat_f0, averaged_spec_mat_f0_char); | |
245 |
|
222 | |||
246 | send_spectral_matrix( &headerASM, averaged_spec_mat_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); |
|
223 | send_spectral_matrix( &headerASM, averaged_spec_mat_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); | |
247 | } |
|
224 | } | |
248 | } |
|
225 | } | |
249 |
|
226 | |||
250 | //***************************** |
|
227 | //***************************** | |
251 | // Spectral matrices processing |
|
228 | // Spectral matrices processing | |
252 | void matrix_average(volatile int *spec_mat, volatile float *averaged_spec_mat) |
|
|||
253 | { |
|
|||
254 | int i; |
|
|||
255 | for(i=0; i<TOTAL_SIZE_SM; i++){ |
|
|||
256 | averaged_spec_mat[i] = averaged_spec_mat[i] + spec_mat_f0_0[i] |
|
|||
257 | + spec_mat_f0_1[i] |
|
|||
258 | + spec_mat_f0_c[i] |
|
|||
259 | + spec_mat_f0_d[i] |
|
|||
260 | + spec_mat_f0_e[i] |
|
|||
261 | + spec_mat_f0_f[i] |
|
|||
262 | + spec_mat_f0_g[i] |
|
|||
263 | + spec_mat_f0_h[i]; |
|
|||
264 | } |
|
|||
265 | } |
|
|||
266 |
|
229 | |||
267 | void matrix_reset(volatile float *averaged_spec_mat) |
|
230 | void matrix_reset(volatile float *averaged_spec_mat) | |
268 | { |
|
231 | { | |
269 | // int i; |
|
232 | // int i; | |
270 | // for(i=0; i<TOTAL_SIZE_SM; i++){ |
|
233 | // for(i=0; i<TOTAL_SIZE_SM; i++){ | |
271 | // averaged_spec_mat_f0[i] = 0; |
|
234 | // averaged_spec_mat_f0[i] = 0; | |
272 | // } |
|
235 | // } | |
273 | } |
|
236 | } | |
274 |
|
237 | |||
275 | void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat) |
|
238 | void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat) | |
276 | { |
|
239 | { | |
277 | int i; |
|
240 | int i; | |
278 | int j; |
|
241 | int j; | |
279 | switch (fChannel){ |
|
242 | switch (fChannel){ | |
280 | case 0: |
|
243 | case 0: | |
281 | for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){ |
|
244 | for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){ | |
282 | j = 17 + (i * 8); |
|
245 | j = 17 + (i * 8); | |
283 | compressed_spec_mat[i] = (averaged_spec_mat[j] |
|
246 | compressed_spec_mat[i] = (averaged_spec_mat[j] | |
284 | + averaged_spec_mat[j+1] |
|
247 | + averaged_spec_mat[j+1] | |
285 | + averaged_spec_mat[j+2] |
|
248 | + averaged_spec_mat[j+2] | |
286 | + averaged_spec_mat[j+3] |
|
249 | + averaged_spec_mat[j+3] | |
287 | + averaged_spec_mat[j+4] |
|
250 | + averaged_spec_mat[j+4] | |
288 | + averaged_spec_mat[j+5] |
|
251 | + averaged_spec_mat[j+5] | |
289 | + averaged_spec_mat[j+6] |
|
252 | + averaged_spec_mat[j+6] | |
290 | + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0); |
|
253 | + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0); | |
291 | } |
|
254 | } | |
292 | break; |
|
255 | break; | |
293 | case 1: |
|
256 | case 1: | |
294 | // case fChannel = f1 to be completed later |
|
257 | // case fChannel = f1 to be completed later | |
295 | break; |
|
258 | break; | |
296 | case 2: |
|
259 | case 2: | |
297 | // case fChannel = f1 to be completed later |
|
260 | // case fChannel = f1 to be completed later | |
298 | break; |
|
261 | break; | |
299 | default: |
|
262 | default: | |
300 | break; |
|
263 | break; | |
301 | } |
|
264 | } | |
302 | } |
|
265 | } | |
303 |
|
266 | |||
304 | void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){ |
|
267 | void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){ | |
305 | int i; |
|
268 | int i; | |
306 | int j; |
|
269 | int j; | |
307 | unsigned char tmp_u_char; |
|
270 | unsigned char tmp_u_char; | |
308 | unsigned char * pt_char = NULL; |
|
271 | unsigned char * pt_char = NULL; | |
309 | float PSDB, PSDE; |
|
272 | float PSDB, PSDE; | |
310 | float NVEC_V0; |
|
273 | float NVEC_V0; | |
311 | float NVEC_V1; |
|
274 | float NVEC_V1; | |
312 | float NVEC_V2; |
|
275 | float NVEC_V2; | |
313 | //float significand; |
|
276 | //float significand; | |
314 | //int exponent; |
|
277 | //int exponent; | |
315 | float aux; |
|
278 | float aux; | |
316 | float tr_SB_SB; |
|
279 | float tr_SB_SB; | |
317 | float tmp; |
|
280 | float tmp; | |
318 | float sx_re; |
|
281 | float sx_re; | |
319 | float sx_im; |
|
282 | float sx_im; | |
320 | float nebx_re = 0; |
|
283 | float nebx_re = 0; | |
321 | float nebx_im = 0; |
|
284 | float nebx_im = 0; | |
322 | float ny = 0; |
|
285 | float ny = 0; | |
323 | float nz = 0; |
|
286 | float nz = 0; | |
324 | float bx_bx_star = 0; |
|
287 | float bx_bx_star = 0; | |
325 | for(i=0; i<nb_bins_compressed_spec_mat; i++){ |
|
288 | for(i=0; i<nb_bins_compressed_spec_mat; i++){ | |
326 | //============================================== |
|
289 | //============================================== | |
327 | // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits |
|
290 | // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits | |
328 | PSDB = compressed_spec_mat[i*30] // S11 |
|
291 | PSDB = compressed_spec_mat[i*30] // S11 | |
329 | + compressed_spec_mat[(i*30) + 10] // S22 |
|
292 | + compressed_spec_mat[(i*30) + 10] // S22 | |
330 | + compressed_spec_mat[(i*30) + 18]; // S33 |
|
293 | + compressed_spec_mat[(i*30) + 18]; // S33 | |
331 | //significand = frexp(PSDB, &exponent); |
|
294 | //significand = frexp(PSDB, &exponent); | |
332 | pt_char = (unsigned char*) &PSDB; |
|
295 | pt_char = (unsigned char*) &PSDB; | |
333 | LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float |
|
296 | LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float | |
334 | LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float |
|
297 | LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float | |
335 | //============================================== |
|
298 | //============================================== | |
336 | // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits |
|
299 | // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits | |
337 | PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44 |
|
300 | PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44 | |
338 | + compressed_spec_mat[(i*30) + 28] * K55_pe // S55 |
|
301 | + compressed_spec_mat[(i*30) + 28] * K55_pe // S55 | |
339 | + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45 |
|
302 | + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45 | |
340 | - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45 |
|
303 | - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45 | |
341 | pt_char = (unsigned char*) &PSDE; |
|
304 | pt_char = (unsigned char*) &PSDE; | |
342 | LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float |
|
305 | LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float | |
343 | LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float |
|
306 | LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float | |
344 | //============================================================================== |
|
307 | //============================================================================== | |
345 | // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits |
|
308 | // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits | |
346 | // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits |
|
309 | // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits | |
347 | // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits |
|
310 | // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits | |
348 | tmp = sqrt( |
|
311 | tmp = sqrt( | |
349 | compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12 |
|
312 | compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12 | |
350 | +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13 |
|
313 | +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13 | |
351 | +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23 |
|
314 | +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23 | |
352 | ); |
|
315 | ); | |
353 | NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23 |
|
316 | NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23 | |
354 | NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13 |
|
317 | NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13 | |
355 | NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12 |
|
318 | NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12 | |
356 | LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127); |
|
319 | LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127); | |
357 | LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127); |
|
320 | LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127); | |
358 | pt_char = (unsigned char*) &NVEC_V2; |
|
321 | pt_char = (unsigned char*) &NVEC_V2; | |
359 | LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2 |
|
322 | LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2 | |
360 | //======================================================= |
|
323 | //======================================================= | |
361 | // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits |
|
324 | // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits | |
362 | aux = 2*tmp / PSDB; // compute the ellipticity |
|
325 | aux = 2*tmp / PSDB; // compute the ellipticity | |
363 | tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity |
|
326 | tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity | |
364 | LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char |
|
327 | LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char | |
365 | //============================================================== |
|
328 | //============================================================== | |
366 | // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits |
|
329 | // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits | |
367 | for(j = 0; j<NB_VALUES_PER_SM;j++){ |
|
330 | for(j = 0; j<NB_VALUES_PER_SM;j++){ | |
368 | tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30] |
|
331 | tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30] | |
369 | + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10] |
|
332 | + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10] | |
370 | + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18] |
|
333 | + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18] | |
371 | + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2] |
|
334 | + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2] | |
372 | + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3] |
|
335 | + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3] | |
373 | + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4] |
|
336 | + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4] | |
374 | + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5] |
|
337 | + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5] | |
375 | + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12] |
|
338 | + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12] | |
376 | + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13]; |
|
339 | + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13]; | |
377 | } |
|
340 | } | |
378 | aux = PSDB*PSDB; |
|
341 | aux = PSDB*PSDB; | |
379 | tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) ); |
|
342 | tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) ); | |
380 | tmp_u_char = (unsigned char) (NVEC_V0*(8-1)); |
|
343 | tmp_u_char = (unsigned char) (NVEC_V0*(8-1)); | |
381 | LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char |
|
344 | LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char | |
382 | //======================================================================================= |
|
345 | //======================================================================================= | |
383 | // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1) |
|
346 | // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1) | |
384 | sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re |
|
347 | sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re | |
385 | + compressed_spec_mat[(i*30) + 6] * K14_sx_re |
|
348 | + compressed_spec_mat[(i*30) + 6] * K14_sx_re | |
386 | + compressed_spec_mat[(i*30) + 8] * K15_sx_re |
|
349 | + compressed_spec_mat[(i*30) + 8] * K15_sx_re | |
387 | + compressed_spec_mat[(i*30) + 14] * K24_sx_re |
|
350 | + compressed_spec_mat[(i*30) + 14] * K24_sx_re | |
388 | + compressed_spec_mat[(i*30) + 16] * K25_sx_re |
|
351 | + compressed_spec_mat[(i*30) + 16] * K25_sx_re | |
389 | + compressed_spec_mat[(i*30) + 22] * K35_sx_re; |
|
352 | + compressed_spec_mat[(i*30) + 22] * K35_sx_re; | |
390 | sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im |
|
353 | sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im | |
391 | + compressed_spec_mat[(i*30) + 7] * K14_sx_im |
|
354 | + compressed_spec_mat[(i*30) + 7] * K14_sx_im | |
392 | + compressed_spec_mat[(i*30) + 9] * K15_sx_im |
|
355 | + compressed_spec_mat[(i*30) + 9] * K15_sx_im | |
393 | + compressed_spec_mat[(i*30) + 15] * K24_sx_im |
|
356 | + compressed_spec_mat[(i*30) + 15] * K24_sx_im | |
394 | + compressed_spec_mat[(i*30) + 17] * K25_sx_im |
|
357 | + compressed_spec_mat[(i*30) + 17] * K25_sx_im | |
395 | + compressed_spec_mat[(i*30) + 23] * K35_sx_im; |
|
358 | + compressed_spec_mat[(i*30) + 23] * K35_sx_im; | |
396 | LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression |
|
359 | LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression | |
397 | if ( abs(sx_re) > abs(sx_im) ) { |
|
360 | if ( abs(sx_re) > abs(sx_im) ) { | |
398 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx |
|
361 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx | |
399 | } |
|
362 | } | |
400 | else { |
|
363 | else { | |
401 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx |
|
364 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx | |
402 | } |
|
365 | } | |
403 | //====================================================================== |
|
366 | //====================================================================== | |
404 | // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1) |
|
367 | // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1) | |
405 | ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2; |
|
368 | ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2; | |
406 | nz = NVEC_V0; |
|
369 | nz = NVEC_V0; | |
407 | bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22 |
|
370 | bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22 | |
408 | + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33 |
|
371 | + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33 | |
409 | - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23 |
|
372 | - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23 | |
410 | nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re |
|
373 | nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re | |
411 | +compressed_spec_mat[(i*30) + 16] * K25_ny_re |
|
374 | +compressed_spec_mat[(i*30) + 16] * K25_ny_re | |
412 | +compressed_spec_mat[(i*30) + 20] * K34_ny_re |
|
375 | +compressed_spec_mat[(i*30) + 20] * K34_ny_re | |
413 | +compressed_spec_mat[(i*30) + 22] * K35_ny_re) |
|
376 | +compressed_spec_mat[(i*30) + 22] * K35_ny_re) | |
414 | + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re |
|
377 | + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re | |
415 | +compressed_spec_mat[(i*30) + 16] * K25_nz_re |
|
378 | +compressed_spec_mat[(i*30) + 16] * K25_nz_re | |
416 | +compressed_spec_mat[(i*30) + 20] * K34_nz_re |
|
379 | +compressed_spec_mat[(i*30) + 20] * K34_nz_re | |
417 | +compressed_spec_mat[(i*30) + 22] * K35_nz_re); |
|
380 | +compressed_spec_mat[(i*30) + 22] * K35_nz_re); | |
418 | nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re |
|
381 | nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re | |
419 | +compressed_spec_mat[(i*30) + 17] * K25_ny_re |
|
382 | +compressed_spec_mat[(i*30) + 17] * K25_ny_re | |
420 | +compressed_spec_mat[(i*30) + 21] * K34_ny_re |
|
383 | +compressed_spec_mat[(i*30) + 21] * K34_ny_re | |
421 | +compressed_spec_mat[(i*30) + 23] * K35_ny_re) |
|
384 | +compressed_spec_mat[(i*30) + 23] * K35_ny_re) | |
422 | + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im |
|
385 | + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im | |
423 | +compressed_spec_mat[(i*30) + 17] * K25_nz_im |
|
386 | +compressed_spec_mat[(i*30) + 17] * K25_nz_im | |
424 | +compressed_spec_mat[(i*30) + 21] * K34_nz_im |
|
387 | +compressed_spec_mat[(i*30) + 21] * K34_nz_im | |
425 | +compressed_spec_mat[(i*30) + 23] * K35_nz_im); |
|
388 | +compressed_spec_mat[(i*30) + 23] * K35_nz_im); | |
426 | tmp = nebx_re / bx_bx_star; |
|
389 | tmp = nebx_re / bx_bx_star; | |
427 | LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression |
|
390 | LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression | |
428 | if ( abs(nebx_re) > abs(nebx_im) ) { |
|
391 | if ( abs(nebx_re) > abs(nebx_im) ) { | |
429 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx |
|
392 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx | |
430 | } |
|
393 | } | |
431 | else { |
|
394 | else { | |
432 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx |
|
395 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx | |
433 | } |
|
396 | } | |
434 | } |
|
397 | } | |
435 |
|
398 | |||
436 | } |
|
399 | } | |
437 |
|
400 | |||
438 | void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){ |
|
401 | void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){ | |
439 | // BP2 autocorrelation |
|
402 | // BP2 autocorrelation | |
440 | int i; |
|
403 | int i; | |
441 | int aux = 0; |
|
404 | int aux = 0; | |
442 |
|
405 | |||
443 | for(i = 0; i<nb_bins_compressed_spec_mat; i++){ |
|
406 | for(i = 0; i<nb_bins_compressed_spec_mat; i++){ | |
444 | // S12 |
|
407 | // S12 | |
445 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]); |
|
408 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]); | |
446 | compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux; |
|
409 | compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux; | |
447 | compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux; |
|
410 | compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux; | |
448 | // S13 |
|
411 | // S13 | |
449 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]); |
|
412 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]); | |
450 | compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux; |
|
413 | compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux; | |
451 | compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux; |
|
414 | compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux; | |
452 | // S23 |
|
415 | // S23 | |
453 | aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]); |
|
416 | aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]); | |
454 | compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux; |
|
417 | compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux; | |
455 | compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux; |
|
418 | compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux; | |
456 | // S45 |
|
419 | // S45 | |
457 | aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]); |
|
420 | aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]); | |
458 | compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux; |
|
421 | compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux; | |
459 | compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux; |
|
422 | compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux; | |
460 | // S14 |
|
423 | // S14 | |
461 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]); |
|
424 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]); | |
462 | compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux; |
|
425 | compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux; | |
463 | compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux; |
|
426 | compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux; | |
464 | // S15 |
|
427 | // S15 | |
465 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]); |
|
428 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]); | |
466 | compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux; |
|
429 | compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux; | |
467 | compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux; |
|
430 | compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux; | |
468 | // S24 |
|
431 | // S24 | |
469 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]); |
|
432 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]); | |
470 | compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux; |
|
433 | compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux; | |
471 | compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux; |
|
434 | compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux; | |
472 | // S25 |
|
435 | // S25 | |
473 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]); |
|
436 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]); | |
474 | compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux; |
|
437 | compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux; | |
475 | compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux; |
|
438 | compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux; | |
476 | // S34 |
|
439 | // S34 | |
477 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]); |
|
440 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]); | |
478 | compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux; |
|
441 | compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux; | |
479 | compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux; |
|
442 | compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux; | |
480 | // S35 |
|
443 | // S35 | |
481 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]); |
|
444 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]); | |
482 | compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux; |
|
445 | compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux; | |
483 | compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux; |
|
446 | compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux; | |
484 | } |
|
447 | } | |
485 | } |
|
448 | } | |
486 |
|
449 | |||
487 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header) |
|
450 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header) | |
488 | { |
|
451 | { | |
489 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
452 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
490 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
453 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
491 | header->reserved = 0x00; |
|
454 | header->reserved = 0x00; | |
492 | header->userApplication = CCSDS_USER_APP; |
|
455 | header->userApplication = CCSDS_USER_APP; | |
493 | header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
456 | header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |
494 | header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
457 | header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |
495 | header->packetSequenceControl[0] = 0xc0; |
|
458 | header->packetSequenceControl[0] = 0xc0; | |
496 | header->packetSequenceControl[1] = 0x00; |
|
459 | header->packetSequenceControl[1] = 0x00; | |
497 | header->packetLength[0] = 0x00; |
|
460 | header->packetLength[0] = 0x00; | |
498 | header->packetLength[1] = 0x00; |
|
461 | header->packetLength[1] = 0x00; | |
499 | // DATA FIELD HEADER |
|
462 | // DATA FIELD HEADER | |
500 | header->spare1_pusVersion_spare2 = 0x10; |
|
463 | header->spare1_pusVersion_spare2 = 0x10; | |
501 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
464 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
502 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
465 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
503 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
466 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
504 | // AUXILIARY DATA HEADER |
|
467 | // AUXILIARY DATA HEADER | |
505 | header->sid = 0x00; |
|
468 | header->sid = 0x00; | |
506 | header->biaStatusInfo = 0x00; |
|
469 | header->biaStatusInfo = 0x00; | |
507 | header->cntASM = 0x00; |
|
470 | header->cntASM = 0x00; | |
508 | header->nrASM = 0x00; |
|
471 | header->nrASM = 0x00; | |
509 | header->time[0] = 0x00; |
|
472 | header->time[0] = 0x00; | |
510 | header->time[0] = 0x00; |
|
473 | header->time[0] = 0x00; | |
511 | header->time[0] = 0x00; |
|
474 | header->time[0] = 0x00; | |
512 | header->time[0] = 0x00; |
|
475 | header->time[0] = 0x00; | |
513 | header->time[0] = 0x00; |
|
476 | header->time[0] = 0x00; | |
514 | header->time[0] = 0x00; |
|
477 | header->time[0] = 0x00; | |
515 | header->blkNr[0] = 0x00; // BLK_NR MSB |
|
478 | header->blkNr[0] = 0x00; // BLK_NR MSB | |
516 | header->blkNr[1] = 0x00; // BLK_NR LSB |
|
479 | header->blkNr[1] = 0x00; // BLK_NR LSB | |
517 | } |
|
480 | } | |
518 |
|
481 | |||
519 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
482 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
520 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) |
|
483 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) | |
521 | { |
|
484 | { | |
522 | unsigned int i; |
|
485 | unsigned int i; | |
523 | unsigned int length = 0; |
|
486 | unsigned int length = 0; | |
524 | rtems_status_code status; |
|
487 | rtems_status_code status; | |
525 |
|
488 | |||
526 | header->sid = (unsigned char) sid; |
|
489 | header->sid = (unsigned char) sid; | |
527 |
|
490 | |||
528 | for (i=0; i<2; i++) |
|
491 | for (i=0; i<2; i++) | |
529 | { |
|
492 | { | |
530 | // BUILD THE DATA |
|
493 | // BUILD THE DATA | |
531 | spw_ioctl_send->dlen = TOTAL_SIZE_SM; |
|
494 | spw_ioctl_send->dlen = TOTAL_SIZE_SM; | |
532 | spw_ioctl_send->data = &spectral_matrix[ i * TOTAL_SIZE_SM]; |
|
495 | spw_ioctl_send->data = &spectral_matrix[ i * TOTAL_SIZE_SM]; | |
533 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
496 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
534 | spw_ioctl_send->hdr = (char *) header; |
|
497 | spw_ioctl_send->hdr = (char *) header; | |
535 | spw_ioctl_send->options = 0; |
|
498 | spw_ioctl_send->options = 0; | |
536 |
|
499 | |||
537 | // BUILD THE HEADER |
|
500 | // BUILD THE HEADER | |
538 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM; |
|
501 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM; | |
539 | header->packetLength[0] = (unsigned char) (length>>8); |
|
502 | header->packetLength[0] = (unsigned char) (length>>8); | |
540 | header->packetLength[1] = (unsigned char) (length); |
|
503 | header->packetLength[1] = (unsigned char) (length); | |
541 | header->sid = (unsigned char) sid; // SID |
|
504 | header->sid = (unsigned char) sid; // SID | |
542 | header->cntASM = 2; |
|
505 | header->cntASM = 2; | |
543 | header->nrASM = (unsigned char) (i+1); |
|
506 | header->nrASM = (unsigned char) (i+1); | |
544 | header->blkNr[0] =(unsigned char) ( (NB_BINS_PER_SM/2) >> 8 ); // BLK_NR MSB |
|
507 | header->blkNr[0] =(unsigned char) ( (NB_BINS_PER_SM/2) >> 8 ); // BLK_NR MSB | |
545 | header->blkNr[1] = (unsigned char) (NB_BINS_PER_SM/2); // BLK_NR LSB |
|
508 | header->blkNr[1] = (unsigned char) (NB_BINS_PER_SM/2); // BLK_NR LSB | |
546 | // SET PACKET TIME |
|
509 | // SET PACKET TIME | |
547 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
510 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
548 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
511 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
549 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
512 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
550 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
513 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); | |
551 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
514 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
552 | header->time[5] = (unsigned char) (time_management_regs->fine_time); |
|
515 | header->time[5] = (unsigned char) (time_management_regs->fine_time); | |
553 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
516 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
554 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
517 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
555 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
518 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
556 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); |
|
519 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); | |
557 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
520 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
558 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
521 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
559 | // SEND PACKET |
|
522 | // SEND PACKET | |
560 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
523 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
561 | if (status != RTEMS_SUCCESSFUL) { |
|
524 | if (status != RTEMS_SUCCESSFUL) { | |
562 | printf("in send_spectral_matrix *** ERR %d\n", (int) status); |
|
525 | printf("in send_spectral_matrix *** ERR %d\n", (int) status); | |
563 | } |
|
526 | } | |
564 | } |
|
527 | } | |
565 | } |
|
528 | } | |
566 |
|
529 | |||
567 | void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix) |
|
530 | void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix) | |
568 | { |
|
531 | { | |
569 | unsigned int i; |
|
532 | unsigned int i; | |
570 | unsigned int j; |
|
533 | unsigned int j; | |
571 | char * pt_char_input; |
|
534 | char * pt_char_input; | |
572 | char * pt_char_output; |
|
535 | char * pt_char_output; | |
573 |
|
536 | |||
574 | pt_char_input = NULL; |
|
537 | pt_char_input = NULL; | |
575 | pt_char_output = NULL; |
|
538 | pt_char_output = NULL; | |
576 |
|
539 | |||
577 | for( i=0; i<NB_BINS_PER_SM; i++) |
|
540 | for( i=0; i<NB_BINS_PER_SM; i++) | |
578 | { |
|
541 | { | |
579 | for ( j=0; j<NB_VALUES_PER_SM; j++) |
|
542 | for ( j=0; j<NB_VALUES_PER_SM; j++) | |
580 | { |
|
543 | { | |
581 | pt_char_input = (char*) &input_matrix[ (i*NB_VALUES_PER_SM) + j ]; |
|
544 | pt_char_input = (char*) &input_matrix[ (i*NB_VALUES_PER_SM) + j ]; | |
582 | pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ]; |
|
545 | pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ]; | |
583 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float |
|
546 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float | |
584 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float |
|
547 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float | |
585 | } |
|
548 | } | |
586 | } |
|
549 | } | |
587 | } |
|
550 | } | |
588 |
|
551 | |||
589 |
void fill_averaged_spectral_matrix( |
|
552 | void fill_averaged_spectral_matrix(void) | |
590 | { |
|
553 | { | |
|
554 | /** This function fills spectral matrices related buffers with arbitrary data. | |||
|
555 | * | |||
|
556 | * This function is for testing purpose only. | |||
|
557 | * | |||
|
558 | */ | |||
591 |
|
559 | |||
592 | #ifdef GSA |
|
560 | #ifdef GSA | |
593 | float offset = 10.; |
|
561 | float offset = 10.; | |
594 | float coeff = 100000.; |
|
562 | float coeff = 100000.; | |
595 |
|
563 | |||
596 | averaged_spec_mat_f0[ 0 + 25 * 0 ] = 0. + offset; |
|
564 | averaged_spec_mat_f0[ 0 + 25 * 0 ] = 0. + offset; | |
597 | averaged_spec_mat_f0[ 0 + 25 * 1 ] = 1. + offset; |
|
565 | averaged_spec_mat_f0[ 0 + 25 * 1 ] = 1. + offset; | |
598 | averaged_spec_mat_f0[ 0 + 25 * 2 ] = 2. + offset; |
|
566 | averaged_spec_mat_f0[ 0 + 25 * 2 ] = 2. + offset; | |
599 | averaged_spec_mat_f0[ 0 + 25 * 3 ] = 3. + offset; |
|
567 | averaged_spec_mat_f0[ 0 + 25 * 3 ] = 3. + offset; | |
600 | averaged_spec_mat_f0[ 0 + 25 * 4 ] = 4. + offset; |
|
568 | averaged_spec_mat_f0[ 0 + 25 * 4 ] = 4. + offset; | |
601 | averaged_spec_mat_f0[ 0 + 25 * 5 ] = 5. + offset; |
|
569 | averaged_spec_mat_f0[ 0 + 25 * 5 ] = 5. + offset; | |
602 | averaged_spec_mat_f0[ 0 + 25 * 6 ] = 6. + offset; |
|
570 | averaged_spec_mat_f0[ 0 + 25 * 6 ] = 6. + offset; | |
603 | averaged_spec_mat_f0[ 0 + 25 * 7 ] = 7. + offset; |
|
571 | averaged_spec_mat_f0[ 0 + 25 * 7 ] = 7. + offset; | |
604 | averaged_spec_mat_f0[ 0 + 25 * 8 ] = 8. + offset; |
|
572 | averaged_spec_mat_f0[ 0 + 25 * 8 ] = 8. + offset; | |
605 | averaged_spec_mat_f0[ 0 + 25 * 9 ] = 9. + offset; |
|
573 | averaged_spec_mat_f0[ 0 + 25 * 9 ] = 9. + offset; | |
606 | averaged_spec_mat_f0[ 0 + 25 * 10 ] = 10. + offset; |
|
574 | averaged_spec_mat_f0[ 0 + 25 * 10 ] = 10. + offset; | |
607 | averaged_spec_mat_f0[ 0 + 25 * 11 ] = 11. + offset; |
|
575 | averaged_spec_mat_f0[ 0 + 25 * 11 ] = 11. + offset; | |
608 | averaged_spec_mat_f0[ 0 + 25 * 12 ] = 12. + offset; |
|
576 | averaged_spec_mat_f0[ 0 + 25 * 12 ] = 12. + offset; | |
609 | averaged_spec_mat_f0[ 0 + 25 * 13 ] = 13. + offset; |
|
577 | averaged_spec_mat_f0[ 0 + 25 * 13 ] = 13. + offset; | |
610 | averaged_spec_mat_f0[ 0 + 25 * 14 ] = 14. + offset; |
|
578 | averaged_spec_mat_f0[ 0 + 25 * 14 ] = 14. + offset; | |
611 | averaged_spec_mat_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff; |
|
579 | averaged_spec_mat_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff; | |
612 | averaged_spec_mat_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff; |
|
580 | averaged_spec_mat_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff; | |
613 | averaged_spec_mat_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff; |
|
581 | averaged_spec_mat_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff; | |
614 | averaged_spec_mat_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff; |
|
582 | averaged_spec_mat_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff; | |
615 | averaged_spec_mat_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff; |
|
583 | averaged_spec_mat_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff; | |
616 | averaged_spec_mat_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff; |
|
584 | averaged_spec_mat_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff; | |
617 | averaged_spec_mat_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff; |
|
585 | averaged_spec_mat_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff; | |
618 | averaged_spec_mat_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff; |
|
586 | averaged_spec_mat_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff; | |
619 | averaged_spec_mat_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff; |
|
587 | averaged_spec_mat_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff; | |
620 | averaged_spec_mat_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff; |
|
588 | averaged_spec_mat_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff; | |
621 | averaged_spec_mat_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff; |
|
589 | averaged_spec_mat_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff; | |
622 | averaged_spec_mat_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff; |
|
590 | averaged_spec_mat_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff; | |
623 | averaged_spec_mat_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff; |
|
591 | averaged_spec_mat_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff; | |
624 | averaged_spec_mat_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff; |
|
592 | averaged_spec_mat_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff; | |
625 | averaged_spec_mat_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff; |
|
593 | averaged_spec_mat_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff; | |
626 | offset = 10000000; |
|
594 | offset = 10000000; | |
627 | averaged_spec_mat_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff; |
|
595 | averaged_spec_mat_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff; | |
628 | averaged_spec_mat_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff; |
|
596 | averaged_spec_mat_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff; | |
629 | averaged_spec_mat_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff; |
|
597 | averaged_spec_mat_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff; | |
630 | averaged_spec_mat_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff; |
|
598 | averaged_spec_mat_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff; | |
631 | averaged_spec_mat_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff; |
|
599 | averaged_spec_mat_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff; | |
632 | averaged_spec_mat_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff; |
|
600 | averaged_spec_mat_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff; | |
633 | averaged_spec_mat_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff; |
|
601 | averaged_spec_mat_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff; | |
634 | averaged_spec_mat_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff; |
|
602 | averaged_spec_mat_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff; | |
635 | averaged_spec_mat_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff; |
|
603 | averaged_spec_mat_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff; | |
636 | averaged_spec_mat_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff; |
|
604 | averaged_spec_mat_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff; | |
637 | averaged_spec_mat_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff; |
|
605 | averaged_spec_mat_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff; | |
638 | averaged_spec_mat_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff; |
|
606 | averaged_spec_mat_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff; | |
639 | averaged_spec_mat_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff; |
|
607 | averaged_spec_mat_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff; | |
640 | averaged_spec_mat_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff; |
|
608 | averaged_spec_mat_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff; | |
641 | averaged_spec_mat_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff; |
|
609 | averaged_spec_mat_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff; | |
642 |
|
610 | |||
643 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_spec_mat_f0[ 0 ]; |
|
611 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_spec_mat_f0[ 0 ]; | |
644 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_spec_mat_f0[ 1 ]; |
|
612 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_spec_mat_f0[ 1 ]; | |
645 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_spec_mat_f0[ 2 ]; |
|
613 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_spec_mat_f0[ 2 ]; | |
646 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_spec_mat_f0[ 3 ]; |
|
614 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_spec_mat_f0[ 3 ]; | |
647 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_spec_mat_f0[ 4 ]; |
|
615 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_spec_mat_f0[ 4 ]; | |
648 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_spec_mat_f0[ 5 ]; |
|
616 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_spec_mat_f0[ 5 ]; | |
649 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_spec_mat_f0[ 6 ]; |
|
617 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_spec_mat_f0[ 6 ]; | |
650 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_spec_mat_f0[ 7 ]; |
|
618 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_spec_mat_f0[ 7 ]; | |
651 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_spec_mat_f0[ 8 ]; |
|
619 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_spec_mat_f0[ 8 ]; | |
652 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_spec_mat_f0[ 9 ]; |
|
620 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_spec_mat_f0[ 9 ]; | |
653 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_spec_mat_f0[ 10 ]; |
|
621 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_spec_mat_f0[ 10 ]; | |
654 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_spec_mat_f0[ 11 ]; |
|
622 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_spec_mat_f0[ 11 ]; | |
655 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_spec_mat_f0[ 12 ]; |
|
623 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_spec_mat_f0[ 12 ]; | |
656 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_spec_mat_f0[ 13 ]; |
|
624 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_spec_mat_f0[ 13 ]; | |
657 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_spec_mat_f0[ 14 ]; |
|
625 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_spec_mat_f0[ 14 ]; | |
658 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_spec_mat_f0[ 15 ]; |
|
626 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_spec_mat_f0[ 15 ]; | |
659 | #else |
|
627 | #else | |
660 | unsigned int i; |
|
628 | unsigned int i; | |
661 |
|
629 | |||
662 | for(i=0; i<TOTAL_SIZE_SM; i++) |
|
630 | for(i=0; i<TOTAL_SIZE_SM; i++) | |
663 | { |
|
631 | { | |
664 | if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0) |
|
632 | if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0) | |
665 | averaged_spec_mat_f0[i] = (float) spec_mat_f0_0_bis[ SM_HEADER + i ]; |
|
633 | averaged_spec_mat_f0[i] = (float) spec_mat_f0_0_bis[ SM_HEADER + i ]; | |
666 | else |
|
634 | else | |
667 | averaged_spec_mat_f0[i] = (float) spec_mat_f0_0[ SM_HEADER + i ]; |
|
635 | averaged_spec_mat_f0[i] = (float) spec_mat_f0_0[ SM_HEADER + i ]; | |
668 | } |
|
636 | } | |
669 | #endif |
|
637 | #endif | |
670 | } |
|
638 | } | |
671 |
|
639 | |||
672 | void reset_spectral_matrix_regs() |
|
640 | void reset_spectral_matrix_regs() | |
673 | { |
|
641 | { | |
|
642 | /** This function resets the spectral matrices module registers. | |||
|
643 | * | |||
|
644 | * The registers affected by this function are located at the following offset addresses: | |||
|
645 | * | |||
|
646 | * - 0x00 config | |||
|
647 | * - 0x04 status | |||
|
648 | * - 0x08 matrixF0_Address0 | |||
|
649 | * - 0x10 matrixFO_Address1 | |||
|
650 | * - 0x14 matrixF1_Address | |||
|
651 | * - 0x18 matrixF2_Address | |||
|
652 | * | |||
|
653 | */ | |||
|
654 | ||||
674 | #ifdef GSA |
|
655 | #ifdef GSA | |
675 | #else |
|
656 | #else | |
676 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0; |
|
657 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0; | |
677 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1; |
|
658 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1; | |
678 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1; |
|
659 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1; | |
679 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2; |
|
660 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2; | |
680 | #endif |
|
661 | #endif | |
681 | } |
|
662 | } | |
682 |
|
663 | |||
683 | //****************** |
|
664 | //****************** | |
684 | // general functions |
|
665 | // general functions | |
685 |
|
666 | |||
686 |
|
667 | |||
687 |
|
668 | |||
688 |
|
669 |
@@ -1,200 +1,207 | |||||
1 | #include "fsw_spacewire.h" |
|
1 | #include "fsw_spacewire.h" | |
2 |
|
2 | |||
3 | char *lstates[6] = {"Error-reset", |
|
3 | char *lstates[6] = {"Error-reset", | |
4 | "Error-wait", |
|
4 | "Error-wait", | |
5 | "Ready", |
|
5 | "Ready", | |
6 | "Started", |
|
6 | "Started", | |
7 | "Connecting", |
|
7 | "Connecting", | |
8 | "Run" |
|
8 | "Run" | |
9 | }; |
|
9 | }; | |
10 |
|
10 | |||
11 | // RTEMS TASK |
|
11 | // RTEMS TASK | |
12 | rtems_task spiq_task(rtems_task_argument unused) |
|
12 | rtems_task spiq_task(rtems_task_argument unused) | |
13 | { |
|
13 | { | |
14 | rtems_event_set event_out; |
|
14 | rtems_event_set event_out; | |
15 | rtems_status_code status; |
|
15 | rtems_status_code status; | |
16 | unsigned char lfrMode; |
|
16 | unsigned char lfrMode; | |
17 |
|
17 | |||
18 | while(true){ |
|
18 | while(true){ | |
19 | BOOT_PRINTF("in SPIQ *** Waiting for SPW_LINKERR_EVENT\n") |
|
19 | BOOT_PRINTF("in SPIQ *** Waiting for SPW_LINKERR_EVENT\n") | |
20 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT |
|
20 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT | |
21 |
|
21 | |||
22 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; // get the current mode |
|
22 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; // get the current mode | |
23 |
|
23 | |||
24 | status = spacewire_wait_for_link(); |
|
24 | status = spacewire_wait_for_link(); | |
25 |
|
25 | |||
26 | if (status != RTEMS_SUCCESSFUL) |
|
26 | if (status != RTEMS_SUCCESSFUL) | |
27 | { |
|
27 | { | |
28 | //**************** |
|
28 | //**************** | |
29 | // STOP THE SYSTEM |
|
29 | // STOP THE SYSTEM | |
30 | spacewire_compute_stats_offsets(); |
|
30 | spacewire_compute_stats_offsets(); | |
31 | stop_current_mode(); |
|
31 | stop_current_mode(); | |
32 | if (rtems_task_suspend(Task_id[TASKID_RECV])!=RTEMS_SUCCESSFUL) { // suspend RECV task |
|
32 | if (rtems_task_suspend(Task_id[TASKID_RECV])!=RTEMS_SUCCESSFUL) { // suspend RECV task | |
33 | PRINTF("in SPIQ *** Error suspending RECV Task\n") |
|
33 | PRINTF("in SPIQ *** Error suspending RECV Task\n") | |
34 | } |
|
34 | } | |
35 | if (rtems_task_suspend(Task_id[TASKID_HOUS])!=RTEMS_SUCCESSFUL) { // suspend HOUS task |
|
35 | if (rtems_task_suspend(Task_id[TASKID_HOUS])!=RTEMS_SUCCESSFUL) { // suspend HOUS task | |
36 | PRINTF("in SPIQ *** Error suspending HOUS Task\n") |
|
36 | PRINTF("in SPIQ *** Error suspending HOUS Task\n") | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | //*************************** |
|
39 | //*************************** | |
40 | // RESTART THE SPACEWIRE LINK |
|
40 | // RESTART THE SPACEWIRE LINK | |
41 | spacewire_configure_link(); |
|
41 | spacewire_configure_link(); | |
42 |
|
42 | |||
43 | //******************* |
|
43 | //******************* | |
44 | // RESTART THE SYSTEM |
|
44 | // RESTART THE SYSTEM | |
45 | //ioctl(fdSPW, SPACEWIRE_IOCTRL_CLR_STATISTICS); // clear statistics |
|
45 | //ioctl(fdSPW, SPACEWIRE_IOCTRL_CLR_STATISTICS); // clear statistics | |
46 | status = rtems_task_restart( Task_id[TASKID_HOUS], 1 ); |
|
46 | status = rtems_task_restart( Task_id[TASKID_HOUS], 1 ); | |
47 | if (status != RTEMS_SUCCESSFUL) { |
|
47 | if (status != RTEMS_SUCCESSFUL) { | |
48 | PRINTF1("in SPIQ *** Error restarting HOUS Task *** code %d\n", status) |
|
48 | PRINTF1("in SPIQ *** Error restarting HOUS Task *** code %d\n", status) | |
49 | } |
|
49 | } | |
50 | status = rtems_task_restart(Task_id[TASKID_RECV], 1); |
|
50 | status = rtems_task_restart(Task_id[TASKID_RECV], 1); | |
51 | if ( status != RTEMS_SUCCESSFUL) { |
|
51 | if ( status != RTEMS_SUCCESSFUL) { | |
52 | PRINTF("in SPIQ *** Error restarting RECV Task\n") |
|
52 | PRINTF("in SPIQ *** Error restarting RECV Task\n") | |
53 | } |
|
53 | } | |
54 | enter_mode(lfrMode, NULL); // enter the mode that was running before the SpaceWire interruption |
|
54 | enter_mode(lfrMode, NULL); // enter the mode that was running before the SpaceWire interruption | |
55 | } |
|
55 | } | |
56 | } |
|
56 | } | |
57 | } |
|
57 | } | |
58 |
|
58 | |||
59 | int spacewire_configure_link( void ) |
|
59 | int spacewire_configure_link( void ) | |
60 | { |
|
60 | { | |
61 | rtems_status_code status; |
|
61 | rtems_status_code status; | |
62 |
|
62 | |||
63 | close(fdSPW); // close the device if it is already open |
|
63 | close(fdSPW); // close the device if it is already open | |
64 | BOOT_PRINTF("OK *** in configure_spw_link *** try to open "GRSPW_DEVICE_NAME"\n") |
|
64 | BOOT_PRINTF("OK *** in configure_spw_link *** try to open "GRSPW_DEVICE_NAME"\n") | |
65 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call reset the hardware |
|
65 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call reset the hardware | |
66 | if ( fdSPW<0 ) { |
|
66 | if ( fdSPW<0 ) { | |
67 | PRINTF("ERR *** in configure_spw_link *** Error opening"GRSPW_DEVICE_NAME"\n") |
|
67 | PRINTF("ERR *** in configure_spw_link *** Error opening"GRSPW_DEVICE_NAME"\n") | |
68 | } |
|
68 | } | |
69 |
|
69 | |||
70 | while(ioctl(fdSPW, SPACEWIRE_IOCTRL_START, -1) != RTEMS_SUCCESSFUL){ |
|
70 | while(ioctl(fdSPW, SPACEWIRE_IOCTRL_START, -1) != RTEMS_SUCCESSFUL){ | |
71 | PRINTF(".") |
|
71 | PRINTF(".") | |
72 | fflush( stdout ); |
|
72 | fflush( stdout ); | |
73 | close( fdSPW ); // close the device |
|
73 | close( fdSPW ); // close the device | |
74 | fdSPW = open( GRSPW_DEVICE_NAME, O_RDWR ); // open the device. the open call reset the hardware |
|
74 | fdSPW = open( GRSPW_DEVICE_NAME, O_RDWR ); // open the device. the open call reset the hardware | |
75 | if (fdSPW<0) { |
|
75 | if (fdSPW<0) { | |
76 | PRINTF("ERR *** In configure_spw_link *** Error opening"GRSPW_DEVICE_NAME"\n") |
|
76 | PRINTF("ERR *** In configure_spw_link *** Error opening"GRSPW_DEVICE_NAME"\n") | |
77 | } |
|
77 | } | |
78 | rtems_task_wake_after(100); |
|
78 | rtems_task_wake_after(100); | |
79 | } |
|
79 | } | |
80 |
|
80 | |||
81 | BOOT_PRINTF("OK *** In configure_spw_link *** "GRSPW_DEVICE_NAME" opened and started successfully\n") |
|
81 | BOOT_PRINTF("OK *** In configure_spw_link *** "GRSPW_DEVICE_NAME" opened and started successfully\n") | |
82 |
|
82 | |||
83 | spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force |
|
83 | spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force | |
84 | spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration |
|
84 | spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration | |
85 |
|
85 | |||
86 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception |
|
86 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception | |
87 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n") |
|
87 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n") | |
88 | // |
|
88 | // | |
89 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a |
|
89 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a | |
90 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs |
|
90 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs | |
91 | // |
|
91 | // | |
92 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts |
|
92 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts | |
93 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n") |
|
93 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n") | |
94 | // |
|
94 | // | |
95 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit |
|
95 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit | |
96 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n") |
|
96 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n") | |
97 | // |
|
97 | // | |
98 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks |
|
98 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks | |
99 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n") |
|
99 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n") | |
100 | // |
|
100 | // | |
101 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 0); // transmission blocks on full |
|
101 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 0); // transmission blocks on full | |
102 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n") |
|
102 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n") | |
103 | // |
|
103 | // | |
104 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ] |
|
104 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ] | |
105 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n") |
|
105 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n") | |
106 |
|
106 | |||
107 | BOOT_PRINTF("OK *** in configure_spw_link *** "GRSPW_DEVICE_NAME" configured successfully\n") |
|
107 | BOOT_PRINTF("OK *** in configure_spw_link *** "GRSPW_DEVICE_NAME" configured successfully\n") | |
108 |
|
108 | |||
109 | return RTEMS_SUCCESSFUL; |
|
109 | return RTEMS_SUCCESSFUL; | |
110 | } |
|
110 | } | |
111 |
|
111 | |||
112 | int spacewire_wait_for_link(void) |
|
112 | int spacewire_wait_for_link(void) | |
113 | { |
|
113 | { | |
114 | unsigned int i; |
|
114 | unsigned int i; | |
115 | int linkStatus; |
|
115 | int linkStatus; | |
116 | rtems_status_code status = RTEMS_UNSATISFIED; |
|
116 | rtems_status_code status = RTEMS_UNSATISFIED; | |
117 |
|
117 | |||
118 | for(i = 0; i< 10; i++){ |
|
118 | for(i = 0; i< 10; i++){ | |
119 | PRINTF(".") |
|
119 | PRINTF(".") | |
120 | fflush( stdout ); |
|
120 | fflush( stdout ); | |
121 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
121 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |
122 | PRINTF1("in spacewire_wait_for_link *** link status is: %s\n", lstates[linkStatus]) |
|
122 | PRINTF1("in spacewire_wait_for_link *** link status is: %s\n", lstates[linkStatus]) | |
123 | if ( linkStatus == 5) { |
|
123 | if ( linkStatus == 5) { | |
124 | PRINTF("in spacewire_wait_for_link *** link is running\n") |
|
124 | PRINTF("in spacewire_wait_for_link *** link is running\n") | |
125 | status = RTEMS_SUCCESSFUL; |
|
125 | status = RTEMS_SUCCESSFUL; | |
126 | break; |
|
126 | break; | |
127 | } |
|
127 | } | |
128 | rtems_task_wake_after(100); |
|
128 | rtems_task_wake_after(100); | |
129 | } |
|
129 | } | |
130 |
|
130 | |||
131 | return status; |
|
131 | return status; | |
132 | } |
|
132 | } | |
133 |
|
133 | |||
134 | void spacewire_set_NP(unsigned char val, unsigned int regAddr) // [N]o [P]ort force |
|
134 | void spacewire_set_NP(unsigned char val, unsigned int regAddr) // [N]o [P]ort force | |
135 | { |
|
135 | { | |
136 | unsigned int *spwptr = (unsigned int*) regAddr; |
|
136 | unsigned int *spwptr = (unsigned int*) regAddr; | |
137 |
|
137 | |||
138 | if (val == 1) { |
|
138 | if (val == 1) { | |
139 | *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit |
|
139 | *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit | |
140 | } |
|
140 | } | |
141 | if (val== 0) { |
|
141 | if (val== 0) { | |
142 | *spwptr = *spwptr & 0xffdfffff; |
|
142 | *spwptr = *spwptr & 0xffdfffff; | |
143 | } |
|
143 | } | |
144 | } |
|
144 | } | |
145 |
|
145 | |||
146 | void spacewire_set_RE(unsigned char val, unsigned int regAddr) // [R]MAP [E]nable |
|
146 | void spacewire_set_RE(unsigned char val, unsigned int regAddr) // [R]MAP [E]nable | |
147 | { |
|
147 | { | |
148 | unsigned int *spwptr = (unsigned int*) regAddr; |
|
148 | unsigned int *spwptr = (unsigned int*) regAddr; | |
149 |
|
149 | |||
150 | if (val == 1) |
|
150 | if (val == 1) | |
151 | { |
|
151 | { | |
152 | *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit |
|
152 | *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit | |
153 | } |
|
153 | } | |
154 | if (val== 0) |
|
154 | if (val== 0) | |
155 | { |
|
155 | { | |
156 | *spwptr = *spwptr & 0xfffdffff; |
|
156 | *spwptr = *spwptr & 0xfffdffff; | |
157 | } |
|
157 | } | |
158 | } |
|
158 | } | |
159 |
|
159 | |||
160 | void spacewire_compute_stats_offsets() |
|
160 | void spacewire_compute_stats_offsets( void ) | |
161 | { |
|
161 | { | |
|
162 | /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising. | |||
|
163 | * | |||
|
164 | * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics | |||
|
165 | * to keep the counters consistent even after a reset of the SpaceWire driver. | |||
|
166 | * | |||
|
167 | */ | |||
|
168 | ||||
162 | spw_stats spacewire_stats_grspw; |
|
169 | spw_stats spacewire_stats_grspw; | |
163 | rtems_status_code status; |
|
170 | rtems_status_code status; | |
164 |
|
171 | |||
165 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); |
|
172 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); | |
166 |
|
173 | |||
167 | spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received |
|
174 | spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received | |
168 | + spacewire_stats.packets_received; |
|
175 | + spacewire_stats.packets_received; | |
169 | spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent |
|
176 | spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent | |
170 | + spacewire_stats.packets_sent; |
|
177 | + spacewire_stats.packets_sent; | |
171 | spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err |
|
178 | spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err | |
172 | + spacewire_stats.parity_err; |
|
179 | + spacewire_stats.parity_err; | |
173 | spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err |
|
180 | spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err | |
174 | + spacewire_stats.disconnect_err; |
|
181 | + spacewire_stats.disconnect_err; | |
175 | spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err |
|
182 | spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err | |
176 | + spacewire_stats.escape_err; |
|
183 | + spacewire_stats.escape_err; | |
177 | spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err |
|
184 | spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err | |
178 | + spacewire_stats.credit_err; |
|
185 | + spacewire_stats.credit_err; | |
179 | spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err |
|
186 | spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err | |
180 | + spacewire_stats.write_sync_err; |
|
187 | + spacewire_stats.write_sync_err; | |
181 | spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err |
|
188 | spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err | |
182 | + spacewire_stats.rx_rmap_header_crc_err; |
|
189 | + spacewire_stats.rx_rmap_header_crc_err; | |
183 | spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err |
|
190 | spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err | |
184 | + spacewire_stats.rx_rmap_data_crc_err; |
|
191 | + spacewire_stats.rx_rmap_data_crc_err; | |
185 | spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep |
|
192 | spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep | |
186 | + spacewire_stats.early_ep; |
|
193 | + spacewire_stats.early_ep; | |
187 | spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address |
|
194 | spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address | |
188 | + spacewire_stats.invalid_address; |
|
195 | + spacewire_stats.invalid_address; | |
189 | spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err |
|
196 | spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err | |
190 | + spacewire_stats.rx_eep_err; |
|
197 | + spacewire_stats.rx_eep_err; | |
191 | spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated |
|
198 | spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated | |
192 | + spacewire_stats.rx_truncated; |
|
199 | + spacewire_stats.rx_truncated; | |
193 | } |
|
200 | } | |
194 |
|
201 | |||
195 | void timecode_irq_handler(void *pDev, void *regs, int minor, unsigned int tc) |
|
202 | void timecode_irq_handler(void *pDev, void *regs, int minor, unsigned int tc) | |
196 | { |
|
203 | { | |
197 | //if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) { |
|
204 | //if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) { | |
198 | // printf("In timecode_irq_handler *** Error sending event to DUMB\n"); |
|
205 | // printf("In timecode_irq_handler *** Error sending event to DUMB\n"); | |
199 | //} |
|
206 | //} | |
200 | } |
|
207 | } |
This diff has been collapsed as it changes many lines, (950 lines changed) Show them Hide them | |||||
@@ -1,1476 +1,1284 | |||||
1 | #include <tc_handler.h> |
|
1 | /** Functions and tasks related to TeleCommand handling. | |
2 | #include <fsw_params.h> |
|
2 | * | |
|
3 | * @file | |||
|
4 | * @author P. LEROY | |||
|
5 | * | |||
|
6 | * A group of functions to handle TeleCommands:\n | |||
|
7 | * action launching\n | |||
|
8 | * TC parsing\n | |||
|
9 | * ... | |||
|
10 | * | |||
|
11 | */ | |||
|
12 | ||||
|
13 | #include "tc_handler.h" | |||
3 |
|
14 | |||
4 | char *DumbMessages[6] = {"in DUMB *** default", // RTEMS_EVENT_0 |
|
15 | char *DumbMessages[6] = {"in DUMB *** default", // RTEMS_EVENT_0 | |
5 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 |
|
16 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 | |
6 | "in DUMB *** waveforms_isr", // RTEMS_EVENT_2 |
|
17 | "in DUMB *** waveforms_isr", // RTEMS_EVENT_2 | |
7 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 |
|
18 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 | |
8 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 |
|
19 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 | |
9 | "in DUMB *** waveforms_simulator_isr" // RTEMS_EVENT_5 |
|
20 | "in DUMB *** waveforms_simulator_isr" // RTEMS_EVENT_5 | |
10 | }; |
|
21 | }; | |
11 |
|
22 | |||
12 | unsigned char currentTC_LEN_RCV[2]; // SHALL be equal to the current TC packet estimated packet length field |
|
23 | unsigned char currentTC_LEN_RCV[2]; // SHALL be equal to the current TC packet estimated packet length field | |
13 | unsigned char currentTC_COMPUTED_CRC[2]; |
|
|||
14 | unsigned int currentTC_LEN_RCV_AsUnsignedInt; |
|
24 | unsigned int currentTC_LEN_RCV_AsUnsignedInt; | |
15 | unsigned int currentTM_length; |
|
25 | unsigned int currentTM_length; | |
16 | unsigned char currentTC_processedFlag; |
|
26 | unsigned char currentTC_processedFlag; | |
17 |
|
27 | |||
18 | unsigned int lookUpTableForCRC[256]; |
|
28 | unsigned int lookUpTableForCRC[256]; | |
19 |
|
29 | |||
20 | //********************** |
|
30 | //********************** | |
21 | // GENERAL USE FUNCTIONS |
|
31 | // GENERAL USE FUNCTIONS | |
22 | unsigned int Crc_opt( unsigned char D, unsigned int Chk) |
|
32 | unsigned int Crc_opt( unsigned char D, unsigned int Chk) | |
23 | { |
|
33 | { | |
|
34 | /** This function generate the CRC for one byte and returns the value of the new syndrome. | |||
|
35 | * | |||
|
36 | * @param D is the current byte of data. | |||
|
37 | * @param Chk is the current syndrom value. | |||
|
38 | * @return the value of the new syndrome on two bytes. | |||
|
39 | * | |||
|
40 | */ | |||
|
41 | ||||
24 | return(((Chk << 8) & 0xff00)^lookUpTableForCRC [(((Chk >> 8)^D) & 0x00ff)]); |
|
42 | return(((Chk << 8) & 0xff00)^lookUpTableForCRC [(((Chk >> 8)^D) & 0x00ff)]); | |
25 | } |
|
43 | } | |
26 |
|
44 | |||
27 | void initLookUpTableForCRC( void ) |
|
45 | void initLookUpTableForCRC( void ) | |
28 | { |
|
46 | { | |
|
47 | /** This function is used to initiates the look-up table for fast CRC computation. | |||
|
48 | * | |||
|
49 | * The global table lookUpTableForCRC[256] is initiated. | |||
|
50 | * | |||
|
51 | */ | |||
|
52 | ||||
29 | unsigned int i; |
|
53 | unsigned int i; | |
30 | unsigned int tmp; |
|
54 | unsigned int tmp; | |
31 |
|
55 | |||
32 | for (i=0; i<256; i++) |
|
56 | for (i=0; i<256; i++) | |
33 | { |
|
57 | { | |
34 | tmp = 0; |
|
58 | tmp = 0; | |
35 | if((i & 1) != 0) { |
|
59 | if((i & 1) != 0) { | |
36 | tmp = tmp ^ 0x1021; |
|
60 | tmp = tmp ^ 0x1021; | |
37 | } |
|
61 | } | |
38 | if((i & 2) != 0) { |
|
62 | if((i & 2) != 0) { | |
39 | tmp = tmp ^ 0x2042; |
|
63 | tmp = tmp ^ 0x2042; | |
40 | } |
|
64 | } | |
41 | if((i & 4) != 0) { |
|
65 | if((i & 4) != 0) { | |
42 | tmp = tmp ^ 0x4084; |
|
66 | tmp = tmp ^ 0x4084; | |
43 | } |
|
67 | } | |
44 | if((i & 8) != 0) { |
|
68 | if((i & 8) != 0) { | |
45 | tmp = tmp ^ 0x8108; |
|
69 | tmp = tmp ^ 0x8108; | |
46 | } |
|
70 | } | |
47 | if((i & 16) != 0) { |
|
71 | if((i & 16) != 0) { | |
48 | tmp = tmp ^ 0x1231; |
|
72 | tmp = tmp ^ 0x1231; | |
49 | } |
|
73 | } | |
50 | if((i & 32) != 0) { |
|
74 | if((i & 32) != 0) { | |
51 | tmp = tmp ^ 0x2462; |
|
75 | tmp = tmp ^ 0x2462; | |
52 | } |
|
76 | } | |
53 | if((i & 64) != 0) { |
|
77 | if((i & 64) != 0) { | |
54 | tmp = tmp ^ 0x48c4; |
|
78 | tmp = tmp ^ 0x48c4; | |
55 | } |
|
79 | } | |
56 | if((i & 128) != 0) { |
|
80 | if((i & 128) != 0) { | |
57 | tmp = tmp ^ 0x9188; |
|
81 | tmp = tmp ^ 0x9188; | |
58 | } |
|
82 | } | |
59 | lookUpTableForCRC[i] = tmp; |
|
83 | lookUpTableForCRC[i] = tmp; | |
60 | } |
|
84 | } | |
61 | } |
|
85 | } | |
62 |
|
86 | |||
63 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData) |
|
87 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData) | |
64 | { |
|
88 | { | |
|
89 | /** This function calculates a two bytes Cyclic Redundancy Code. | |||
|
90 | * | |||
|
91 | * @param data points to a buffer containing the data on which to compute the CRC. | |||
|
92 | * @param crcAsTwoBytes points points to a two bytes buffer in which the CRC is stored. | |||
|
93 | * @param sizeOfData is the number of bytes of *data* used to compute the CRC. | |||
|
94 | * | |||
|
95 | * The specification of the Cyclic Redundancy Code is described in the following document: ECSS-E-70-41-A. | |||
|
96 | * | |||
|
97 | */ | |||
|
98 | ||||
65 | unsigned int Chk; |
|
99 | unsigned int Chk; | |
66 | int j; |
|
100 | int j; | |
67 | Chk = 0xffff; // reset the syndrom to all ones |
|
101 | Chk = 0xffff; // reset the syndrom to all ones | |
68 | for (j=0; j<sizeOfData; j++) { |
|
102 | for (j=0; j<sizeOfData; j++) { | |
69 | Chk = Crc_opt(data[j], Chk); |
|
103 | Chk = Crc_opt(data[j], Chk); | |
70 | } |
|
104 | } | |
71 | crcAsTwoBytes[0] = (unsigned char) (Chk >> 8); |
|
105 | crcAsTwoBytes[0] = (unsigned char) (Chk >> 8); | |
72 | crcAsTwoBytes[1] = (unsigned char) (Chk & 0x00ff); |
|
106 | crcAsTwoBytes[1] = (unsigned char) (Chk & 0x00ff); | |
73 | } |
|
107 | } | |
74 |
|
108 | |||
75 | void updateLFRCurrentMode() |
|
109 | void updateLFRCurrentMode() | |
76 | { |
|
110 | { | |
|
111 | /** This function updates the value of the global variable lfrCurrentMode. | |||
|
112 | * | |||
|
113 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. | |||
|
114 | * | |||
|
115 | */ | |||
|
116 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure | |||
77 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
117 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
78 | } |
|
118 | } | |
79 |
|
119 | |||
80 | //********************* |
|
120 | //********************* | |
81 | // ACCEPTANCE FUNCTIONS |
|
121 | // ACCEPTANCE FUNCTIONS | |
82 |
int |
|
122 | int tc_acceptance(ccsdsTelecommandPacket_t *TC, unsigned int tc_len_recv, rtems_id queue_queu_id, rtems_id queue_pkts_id) | |
83 | { |
|
123 | { | |
|
124 | /** This function executes the TeleCommand acceptance steps. | |||
|
125 | * | |||
|
126 | * @param TC points to the TeleCommand packet which is under investigation. | |||
|
127 | * @param tc_len_recv contains the length of the packet that has been received. | |||
|
128 | * @param queue_queu_id is the id of the rtems queue in which messages are written if the acceptance is not successful | |||
|
129 | * @param queue_pkts_id is the id of the rtems queue in which messages are written if the acceptance is successful | |||
|
130 | * @return status code | |||
|
131 | * | |||
|
132 | * The acceptance steps can result in two different actions. | |||
|
133 | * 1. If the acceptance is successful, the TC is sent in the receiving queue for processing. | |||
|
134 | * 2. If the acceptance fails, a TM packet is transmitted to report the error. | |||
|
135 | * | |||
|
136 | */ | |||
|
137 | ||||
84 | int ret = 0; |
|
138 | int ret = 0; | |
85 | rtems_status_code status; |
|
139 | rtems_status_code status; | |
86 | Packet_TM_LFR_TC_EXE_CORRUPTED_t packet; |
|
|||
87 | unsigned int parserCode = 0; |
|
140 | unsigned int parserCode = 0; | |
88 | unsigned char computed_CRC[2]; |
|
141 | unsigned char computed_CRC[2]; | |
89 | unsigned int packetLength; |
|
|||
90 | unsigned char *packetDataField; |
|
|||
91 |
|
142 | |||
92 | GetCRCAsTwoBytes( (unsigned char*) TC->packetID, computed_CRC, tc_len_recv + 5 ); |
|
143 | GetCRCAsTwoBytes( (unsigned char*) TC->packetID, computed_CRC, tc_len_recv + 5 ); | |
93 |
parserCode = |
|
144 | parserCode = tc_parser( TC, tc_len_recv ) ; | |
94 | if ( (parserCode == ILLEGAL_APID) | (parserCode == WRONG_LEN_PACKET) | (parserCode == INCOR_CHECKSUM) |
|
145 | if ( (parserCode == ILLEGAL_APID) | (parserCode == WRONG_LEN_PACKET) | (parserCode == INCOR_CHECKSUM) | |
95 | | (parserCode == ILL_TYPE) | (parserCode == ILL_SUBTYPE) | (parserCode == WRONG_APP_DATA) ) |
|
146 | | (parserCode == ILL_TYPE) | (parserCode == ILL_SUBTYPE) | (parserCode == WRONG_APP_DATA) ) | |
96 |
{ // |
|
147 | { // send TM_LFR_TC_EXE_CORRUPTED | |
97 | packetDataField = (unsigned char *) &TC->headerFlag_pusVersion_Ack; // get the beginning of the data field |
|
148 | send_tm_lfr_tc_exe_corrupted( TC, queue_queu_id, computed_CRC, currentTC_LEN_RCV ); | |
98 | packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1]; // compute the packet length |
|
|||
99 | // |
|
|||
100 | packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
|||
101 | packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
|||
102 | packet.reserved = DEFAULT_RESERVED; |
|
|||
103 | packet.userApplication = CCSDS_USER_APP; |
|
|||
104 | // PACKET HEADER |
|
|||
105 | packet.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
|||
106 | packet.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
|||
107 | packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
|||
108 | packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
|||
109 | packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8); |
|
|||
110 | packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED ); |
|
|||
111 | // DATA FIELD HEADER |
|
|||
112 | packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
|||
113 | packet.serviceType = TM_TYPE_TC_EXE; |
|
|||
114 | packet.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
|||
115 | packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
|||
116 | packet.time[0] = (time_management_regs->coarse_time>>24 ); |
|
|||
117 | packet.time[1] = (time_management_regs->coarse_time>>16 ); |
|
|||
118 | packet.time[2] = (time_management_regs->coarse_time>>8 ); |
|
|||
119 | packet.time[3] = (time_management_regs->coarse_time ); |
|
|||
120 | packet.time[4] = (time_management_regs->fine_time>>8 ); |
|
|||
121 | packet.time[5] = (time_management_regs->fine_time ); |
|
|||
122 | // |
|
|||
123 | packet.tc_failure_code[0] = (unsigned char) (FAILURE_CODE_CORRUPTED >> 8); |
|
|||
124 | packet.tc_failure_code[1] = (unsigned char) (FAILURE_CODE_CORRUPTED ); |
|
|||
125 | packet.telecommand_pkt_id[0] = TC->packetID[0]; |
|
|||
126 | packet.telecommand_pkt_id[1] = TC->packetID[1]; |
|
|||
127 | packet.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
|||
128 | packet.pkt_seq_control[0] = TC->packetSequenceControl[1]; |
|
|||
129 | packet.tc_service = TC->serviceType; |
|
|||
130 | packet.tc_subtype = TC->serviceSubType; |
|
|||
131 | packet.pkt_len_rcv_value[0] = TC->packetLength[0]; |
|
|||
132 | packet.pkt_len_rcv_value[1] = TC->packetLength[1]; |
|
|||
133 | packet.pkt_datafieldsize_cnt[0] = currentTC_LEN_RCV[0]; |
|
|||
134 | packet.pkt_datafieldsize_cnt[1] = currentTC_LEN_RCV[1]; |
|
|||
135 | packet.rcv_crc[0] = packetDataField[ packetLength - 1 ]; |
|
|||
136 | packet.rcv_crc[1] = packetDataField[ packetLength ]; |
|
|||
137 | packet.computed_crc[0] = computed_CRC[0]; |
|
|||
138 | packet.computed_crc[1] = computed_CRC[1]; |
|
|||
139 | // SEND DATA |
|
|||
140 | status = rtems_message_queue_urgent( queue_pkts_id, &packet, PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + 4); |
|
|||
141 | if (status != RTEMS_SUCCESSFUL) { |
|
|||
142 | PRINTF("in TC_acceptance *** ERR rtems_message_queue_urgent\n") |
|
|||
143 | ret = LFR_DEFAULT; |
|
|||
144 | } |
|
|||
145 | } |
|
149 | } | |
146 | else { // send valid TC to the action launcher |
|
150 | else { // send valid TC to the action launcher | |
147 | status = rtems_message_queue_send( queue_queu_id, TC, tc_len_recv + CCSDS_TC_TM_PACKET_OFFSET + 3); |
|
151 | status = rtems_message_queue_send( queue_queu_id, TC, tc_len_recv + CCSDS_TC_TM_PACKET_OFFSET + 3); | |
148 | ret = LFR_SUCCESSFUL; |
|
152 | ret = LFR_SUCCESSFUL; | |
149 | } |
|
153 | } | |
150 | return ret; |
|
154 | return ret; | |
151 | } |
|
155 | } | |
152 |
|
156 | |||
153 |
|
|
157 | int tc_parser(ccsdsTelecommandPacket_t * TCPacket, unsigned int TC_LEN_RCV) | |
154 | { |
|
158 | { | |
155 | unsigned char ret = 0; |
|
159 | /** This function parses TeleCommands. | |
156 | unsigned char pid = 0; |
|
160 | * | |
157 | unsigned char category = 0; |
|
161 | * @param TC points to the TeleCommand that will be parsed. | |
158 | unsigned int length = 0; |
|
162 | * @param TC_LEN_RCV is the received packet length. | |
159 | unsigned char packetType = 0; |
|
163 | * @return Status code of the parsing. | |
160 | unsigned char packetSubtype = 0; |
|
164 | * | |
161 | unsigned char * CCSDSContent = NULL; |
|
165 | * The parsing checks: | |
|
166 | * - process id | |||
|
167 | * - category | |||
|
168 | * - length: a global check is performed and a per subtype check also | |||
|
169 | * - type | |||
|
170 | * - subtype | |||
|
171 | * - crc | |||
|
172 | * | |||
|
173 | */ | |||
|
174 | ||||
|
175 | int status; | |||
|
176 | unsigned char pid; | |||
|
177 | unsigned char category; | |||
|
178 | unsigned int length; | |||
|
179 | unsigned char packetType; | |||
|
180 | unsigned char packetSubtype; | |||
|
181 | ||||
|
182 | status = CCSDS_TM_VALID; | |||
162 |
|
183 | |||
163 | // APID check *** APID on 2 bytes |
|
184 | // APID check *** APID on 2 bytes | |
164 | pid = ((TCPacket->packetID[0] & 0x07)<<4) + ( (TCPacket->packetID[1]>>4) & 0x0f ); // PID = 11 *** 7 bits xxxxx210 7654xxxx |
|
185 | pid = ((TCPacket->packetID[0] & 0x07)<<4) + ( (TCPacket->packetID[1]>>4) & 0x0f ); // PID = 11 *** 7 bits xxxxx210 7654xxxx | |
165 | category = (TCPacket->packetID[1] & 0x0f); // PACKET_CATEGORY = 12 *** 4 bits xxxxxxxx xxxx3210 |
|
186 | category = (TCPacket->packetID[1] & 0x0f); // PACKET_CATEGORY = 12 *** 4 bits xxxxxxxx xxxx3210 | |
166 | length = (TCPacket->packetLength[0] * 256) + TCPacket->packetLength[1]; |
|
187 | length = (TCPacket->packetLength[0] * 256) + TCPacket->packetLength[1]; | |
167 | packetType = TCPacket->serviceType; |
|
188 | packetType = TCPacket->serviceType; | |
168 | packetSubtype = TCPacket->serviceSubType; |
|
189 | packetSubtype = TCPacket->serviceSubType; | |
169 |
|
190 | |||
170 |
if ( pid != CCSDS_PROCESS_ID ) |
|
191 | if ( pid != CCSDS_PROCESS_ID ) // CHECK THE PROCESS ID | |
171 | ret = ILLEGAL_APID; |
|
192 | { | |
|
193 | status = ILLEGAL_APID; | |||
|
194 | } | |||
|
195 | if (status == CCSDS_TM_VALID) // CHECK THE CATEGORY | |||
|
196 | { | |||
|
197 | if ( category != CCSDS_PACKET_CATEGORY ) | |||
|
198 | { | |||
|
199 | status = ILLEGAL_APID; | |||
|
200 | } | |||
|
201 | } | |||
|
202 | if (status == CCSDS_TM_VALID) // CHECK THE PACKET LENGTH FIELD AND THE ACTUAL LENGTH COMPLIANCE | |||
|
203 | { | |||
|
204 | if (length != TC_LEN_RCV ) { | |||
|
205 | status = WRONG_LEN_PACKET; | |||
|
206 | } | |||
172 | } |
|
207 | } | |
173 | else if ( category != CCSDS_PACKET_CATEGORY ) { |
|
208 | if (status == CCSDS_TM_VALID) // CHECK THAT THE PACKET DOES NOT EXCEED THE MAX SIZE | |
174 | ret = ILLEGAL_APID; |
|
209 | { | |
|
210 | if ( length >= CCSDS_TC_PKT_MAX_SIZE ) { | |||
|
211 | status = WRONG_LEN_PACKET; | |||
|
212 | } | |||
|
213 | } | |||
|
214 | if (status == CCSDS_TM_VALID) // CHECK THE TYPE | |||
|
215 | { | |||
|
216 | status = tc_check_type( packetType ); | |||
|
217 | } | |||
|
218 | if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE | |||
|
219 | { | |||
|
220 | status = tc_check_subtype( packetSubtype ); | |||
|
221 | } | |||
|
222 | if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE AND LENGTH COMPLIANCE | |||
|
223 | { | |||
|
224 | status = tc_check_length( packetSubtype, length ); | |||
|
225 | } | |||
|
226 | if (status == CCSDS_TM_VALID ) // CHECK CRC | |||
|
227 | { | |||
|
228 | status = tc_check_crc( TCPacket, length ); | |||
|
229 | } | |||
|
230 | ||||
|
231 | return status; | |||
175 | } |
|
232 | } | |
176 | else if (length != TC_LEN_RCV ) { // packet length check |
|
233 | ||
177 | ret = WRONG_LEN_PACKET; // LEN RCV != SIZE FIELD |
|
234 | int tc_check_type( unsigned char packetType ) | |
|
235 | { | |||
|
236 | /** This function checks that the type of a TeleCommand is valid. | |||
|
237 | * | |||
|
238 | * @param packetType is the type to check. | |||
|
239 | * @return Status code CCSDS_TM_VALID or ILL_TYPE. | |||
|
240 | * | |||
|
241 | */ | |||
|
242 | ||||
|
243 | int status; | |||
|
244 | ||||
|
245 | if ( (packetType == TC_TYPE_GEN) || (packetType == TC_TYPE_TIME)) | |||
|
246 | { | |||
|
247 | status = CCSDS_TM_VALID; | |||
|
248 | } | |||
|
249 | else | |||
|
250 | { | |||
|
251 | status = ILL_TYPE; | |||
|
252 | } | |||
|
253 | ||||
|
254 | return status; | |||
178 | } |
|
255 | } | |
179 | else if ( length >= CCSDS_TC_PKT_MAX_SIZE ) { |
|
256 | ||
180 | ret = WRONG_LEN_PACKET; // check that the packet does not exceed the MAX size |
|
257 | int tc_check_subtype( unsigned char packetSubType ) | |
|
258 | { | |||
|
259 | /** This function checks that the subtype of a TeleCommand is valid. | |||
|
260 | * | |||
|
261 | * @param packetSubType is the subtype to check. | |||
|
262 | * @return Status code CCSDS_TM_VALID or ILL_SUBTYPE. | |||
|
263 | * | |||
|
264 | */ | |||
|
265 | ||||
|
266 | int status; | |||
|
267 | ||||
|
268 | if ( (packetSubType == TC_SUBTYPE_RESET) | |||
|
269 | || (packetSubType == TC_SUBTYPE_LOAD_COMM) | |||
|
270 | || (packetSubType == TC_SUBTYPE_LOAD_NORM) || (packetSubType == TC_SUBTYPE_LOAD_BURST) | |||
|
271 | || (packetSubType == TC_SUBTYPE_LOAD_SBM1) || (packetSubType == TC_SUBTYPE_LOAD_SBM2) | |||
|
272 | || (packetSubType == TC_SUBTYPE_DUMP) | |||
|
273 | || (packetSubType == TC_SUBTYPE_ENTER) | |||
|
274 | || (packetSubType == TC_SUBTYPE_UPDT_INFO) || (packetSubType == TC_SUBTYPE_UPDT_TIME) | |||
|
275 | || (packetSubType == TC_SUBTYPE_EN_CAL) || (packetSubType == TC_SUBTYPE_DIS_CAL) ) | |||
|
276 | { | |||
|
277 | status = CCSDS_TM_VALID; | |||
181 | } |
|
278 | } | |
182 | else if ( packetType == TC_TYPE_GEN ){ // service type, subtype and packet length check |
|
279 | else | |
183 | switch(packetSubtype){ //subtype, autorized values are 3, 20, 21, 24, 27, 28, 30, 40, 50, 60, 61 |
|
280 | { | |
|
281 | status = ILL_TYPE; | |||
|
282 | } | |||
|
283 | ||||
|
284 | return status; | |||
|
285 | } | |||
|
286 | ||||
|
287 | int tc_check_length( unsigned char packetSubType, unsigned int length ) | |||
|
288 | { | |||
|
289 | /** This function checks that the subtype and the length are compliant. | |||
|
290 | * | |||
|
291 | * @param packetSubType is the subtype to check. | |||
|
292 | * @param length is the length to check. | |||
|
293 | * @return Status code CCSDS_TM_VALID or ILL_TYPE. | |||
|
294 | * | |||
|
295 | */ | |||
|
296 | ||||
|
297 | int status; | |||
|
298 | ||||
|
299 | status = LFR_SUCCESSFUL; | |||
|
300 | ||||
|
301 | switch(packetSubType) | |||
|
302 | { | |||
184 |
|
|
303 | case TC_SUBTYPE_RESET: | |
185 |
|
|
304 | if (length!=(TC_LEN_RESET-CCSDS_TC_TM_PACKET_OFFSET)) { | |
186 |
|
|
305 | status = WRONG_LEN_PACKET; | |
187 |
|
|
306 | } | |
188 |
|
|
307 | else { | |
189 |
|
|
308 | status = CCSDS_TM_VALID; | |
190 |
|
|
309 | } | |
191 |
|
|
310 | break; | |
192 |
|
|
311 | case TC_SUBTYPE_LOAD_COMM: | |
193 |
|
|
312 | if (length!=(TC_LEN_LOAD_COMM-CCSDS_TC_TM_PACKET_OFFSET)) { | |
194 |
|
|
313 | status = WRONG_LEN_PACKET; | |
195 |
|
|
314 | } | |
196 |
|
|
315 | else { | |
197 |
|
|
316 | status = CCSDS_TM_VALID; | |
198 |
|
|
317 | } | |
199 |
|
|
318 | break; | |
200 |
|
|
319 | case TC_SUBTYPE_LOAD_NORM: | |
201 |
|
|
320 | if (length!=(TC_LEN_LOAD_NORM-CCSDS_TC_TM_PACKET_OFFSET)) { | |
202 |
|
|
321 | status = WRONG_LEN_PACKET; | |
203 |
|
|
322 | } | |
204 |
|
|
323 | else { | |
205 |
|
|
324 | status = CCSDS_TM_VALID; | |
206 |
|
|
325 | } | |
207 |
|
|
326 | break; | |
208 |
|
|
327 | case TC_SUBTYPE_LOAD_BURST: | |
209 |
|
|
328 | if (length!=(TC_LEN_LOAD_BURST-CCSDS_TC_TM_PACKET_OFFSET)) { | |
210 |
|
|
329 | status = WRONG_LEN_PACKET; | |
211 |
|
|
330 | } | |
212 |
|
|
331 | else { | |
213 |
|
|
332 | status = CCSDS_TM_VALID; | |
214 |
|
|
333 | } | |
215 |
|
|
334 | break; | |
216 |
|
|
335 | case TC_SUBTYPE_LOAD_SBM1: | |
217 |
|
|
336 | if (length!=(TC_LEN_LOAD_SBM1-CCSDS_TC_TM_PACKET_OFFSET)) { | |
218 |
|
|
337 | status = WRONG_LEN_PACKET; | |
219 |
|
|
338 | } | |
220 |
|
|
339 | else { | |
221 |
|
|
340 | status = CCSDS_TM_VALID; | |
222 |
|
|
341 | } | |
223 |
|
|
342 | break; | |
224 |
|
|
343 | case TC_SUBTYPE_LOAD_SBM2: | |
225 |
|
|
344 | if (length!=(TC_LEN_LOAD_SBM2-CCSDS_TC_TM_PACKET_OFFSET)) { | |
226 |
|
|
345 | status = WRONG_LEN_PACKET; | |
227 |
|
|
346 | } | |
228 |
|
|
347 | else { | |
229 |
|
|
348 | status = CCSDS_TM_VALID; | |
230 |
|
|
349 | } | |
231 |
|
|
350 | break; | |
232 |
|
|
351 | case TC_SUBTYPE_DUMP: | |
233 |
|
|
352 | if (length!=(TC_LEN_DUMP-CCSDS_TC_TM_PACKET_OFFSET)) { | |
234 |
|
|
353 | status = WRONG_LEN_PACKET; | |
235 |
|
|
354 | } | |
236 |
|
|
355 | else { | |
237 |
|
|
356 | status = CCSDS_TM_VALID; | |
238 |
|
|
357 | } | |
239 |
|
|
358 | break; | |
240 |
|
|
359 | case TC_SUBTYPE_ENTER: | |
241 |
|
|
360 | if (length!=(TC_LEN_ENTER-CCSDS_TC_TM_PACKET_OFFSET)) { | |
242 |
|
|
361 | status = WRONG_LEN_PACKET; | |
243 |
|
|
362 | } | |
244 |
|
|
363 | else { | |
245 |
|
|
364 | status = CCSDS_TM_VALID; | |
246 |
|
|
365 | } | |
247 |
|
|
366 | break; | |
248 |
|
|
367 | case TC_SUBTYPE_UPDT_INFO: | |
249 |
|
|
368 | if (length!=(TC_LEN_UPDT_INFO-CCSDS_TC_TM_PACKET_OFFSET)) { | |
250 |
|
|
369 | status = WRONG_LEN_PACKET; | |
251 |
|
|
370 | } | |
252 |
|
|
371 | else { | |
253 |
|
|
372 | status = CCSDS_TM_VALID; | |
254 |
|
|
373 | } | |
255 |
|
|
374 | break; | |
256 |
|
|
375 | case TC_SUBTYPE_EN_CAL: | |
257 |
|
|
376 | if (length!=(TC_LEN_EN_CAL-CCSDS_TC_TM_PACKET_OFFSET)) { | |
258 |
|
|
377 | status = WRONG_LEN_PACKET; | |
259 |
|
|
378 | } | |
260 |
|
|
379 | else { | |
261 |
|
|
380 | status = CCSDS_TM_VALID; | |
262 |
|
|
381 | } | |
263 |
|
|
382 | break; | |
264 |
|
|
383 | case TC_SUBTYPE_DIS_CAL: | |
265 |
|
|
384 | if (length!=(TC_LEN_DIS_CAL-CCSDS_TC_TM_PACKET_OFFSET)) { | |
266 |
|
|
385 | status = WRONG_LEN_PACKET; | |
267 |
|
|
386 | } | |
268 |
|
|
387 | else { | |
269 |
|
|
388 | status = CCSDS_TM_VALID; | |
270 |
|
|
389 | } | |
271 |
|
|
390 | break; | |
272 | default: |
|
391 | case TC_SUBTYPE_UPDT_TIME: | |
273 | ret = ILL_SUBTYPE; |
|
392 | if (length!=(TC_LEN_UPDT_TIME-CCSDS_TC_TM_PACKET_OFFSET)) { | |
|
393 | status = WRONG_LEN_PACKET; | |||
|
394 | } | |||
|
395 | else { | |||
|
396 | status = CCSDS_TM_VALID; | |||
|
397 | } | |||
|
398 | break; | |||
|
399 | default: // if the subtype is not a legal value, return ILL_SUBTYPE | |||
|
400 | status = ILL_SUBTYPE; | |||
274 |
|
|
401 | break ; | |
275 |
|
|
402 | } | |
276 | } |
|
403 | ||
277 | else if ( packetType == TC_TYPE_TIME ){ |
|
404 | return status; | |
278 | if (packetSubtype!=TC_SUBTYPE_UPDT_TIME) { |
|
|||
279 | ret = ILL_SUBTYPE; |
|
|||
280 | } |
|
|||
281 | else if (length!=(TC_LEN_UPDT_TIME-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
|||
282 | ret = WRONG_LEN_PACKET; |
|
|||
283 | } |
|
|||
284 | else { |
|
|||
285 | ret = CCSDS_TM_VALID; |
|
|||
286 | } |
|
|||
287 | } |
|
|||
288 | else { |
|
|||
289 | ret = ILL_TYPE; |
|
|||
290 | } |
|
405 | } | |
291 |
|
406 | |||
292 | // source ID check // Source ID not documented in the ICD |
|
407 | int tc_check_crc( ccsdsTelecommandPacket_t * TCPacket, unsigned int length ) | |
|
408 | { | |||
|
409 | /** This function checks the CRC validity of the corresponding TeleCommand packet. | |||
|
410 | * | |||
|
411 | * @param TCPacket points to the TeleCommand packet to check. | |||
|
412 | * @param length is the length of the TC packet. | |||
|
413 | * @return Status code CCSDS_TM_VALID or INCOR_CHECKSUM. | |||
|
414 | * | |||
|
415 | */ | |||
293 |
|
416 | |||
294 | // packet error control, CRC check |
|
417 | int status; | |
295 | if ( ret == CCSDS_TM_VALID ) { |
|
418 | unsigned char * CCSDSContent; | |
|
419 | unsigned char currentTC_COMPUTED_CRC[2]; | |||
|
420 | ||||
296 |
|
|
421 | CCSDSContent = (unsigned char*) TCPacket->packetID; | |
297 |
|
|
422 | GetCRCAsTwoBytes(CCSDSContent, currentTC_COMPUTED_CRC, length + CCSDS_TC_TM_PACKET_OFFSET - 2); // 2 CRC bytes removed from the calculation of the CRC | |
298 |
|
|
423 | if (currentTC_COMPUTED_CRC[0] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -2]) { | |
299 |
|
|
424 | status = INCOR_CHECKSUM; | |
300 |
|
|
425 | } | |
301 |
|
|
426 | else if (currentTC_COMPUTED_CRC[1] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -1]) { | |
302 |
|
|
427 | status = INCOR_CHECKSUM; | |
303 |
|
|
428 | } | |
304 |
|
|
429 | else { | |
305 |
|
|
430 | status = CCSDS_TM_VALID; | |
306 | } |
|
|||
307 | } |
|
431 | } | |
308 |
|
432 | |||
309 |
return |
|
433 | return status; | |
310 | } |
|
434 | } | |
311 |
|
435 | |||
312 | //*********** |
|
436 | //*********** | |
313 | // RTEMS TASK |
|
437 | // RTEMS TASK | |
314 | rtems_task recv_task( rtems_task_argument unused ) |
|
438 | rtems_task recv_task( rtems_task_argument unused ) | |
315 | { |
|
439 | { | |
|
440 | /** This RTEMS task is dedicated to the reception of incoming TeleCommands. | |||
|
441 | * | |||
|
442 | * @param unused is the starting argument of the RTEMS task | |||
|
443 | * | |||
|
444 | * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked: | |||
|
445 | * 1. It reads the incoming data. | |||
|
446 | * 2. Launches the acceptance procedure. | |||
|
447 | * 3. If the Telecommand is valid, sends it to the ACTN task using an RTEMS message queue. | |||
|
448 | * | |||
|
449 | */ | |||
|
450 | ||||
316 | int len = 0; |
|
451 | int len = 0; | |
317 | unsigned int i = 0; |
|
452 | unsigned int i = 0; | |
318 | ccsdsTelecommandPacket_t currentTC; |
|
453 | ccsdsTelecommandPacket_t currentTC; | |
319 | char data[100]; |
|
454 | char data[100]; | |
320 | rtems_status_code status; |
|
455 | rtems_status_code status; | |
321 | rtems_id queue_queu_id; |
|
456 | rtems_id queue_queu_id; | |
322 | rtems_id queue_pkts_id; |
|
457 | rtems_id queue_pkts_id; | |
323 |
|
458 | |||
324 | for(i=0; i<100; i++) data[i] = 0; |
|
459 | for(i=0; i<100; i++) data[i] = 0; | |
325 |
|
460 | |||
|
461 | initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes | |||
|
462 | ||||
326 | status = rtems_message_queue_ident( misc_name[QUEUE_QUEU], 0, &queue_queu_id ); |
|
463 | status = rtems_message_queue_ident( misc_name[QUEUE_QUEU], 0, &queue_queu_id ); | |
327 | if (status != RTEMS_SUCCESSFUL) |
|
464 | if (status != RTEMS_SUCCESSFUL) | |
328 | { |
|
465 | { | |
329 | PRINTF1("in RECV *** ERR getting queue_queu id, %d\n", status) |
|
466 | PRINTF1("in RECV *** ERR getting queue_queu id, %d\n", status) | |
330 | } |
|
467 | } | |
331 |
|
468 | |||
332 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_pkts_id ); |
|
469 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_pkts_id ); | |
333 | if (status != RTEMS_SUCCESSFUL) |
|
470 | if (status != RTEMS_SUCCESSFUL) | |
334 | { |
|
471 | { | |
335 | PRINTF1("in RECV *** ERR getting queue_pkts id, %d\n", status) |
|
472 | PRINTF1("in RECV *** ERR getting queue_pkts id, %d\n", status) | |
336 | } |
|
473 | } | |
337 |
|
474 | |||
338 | BOOT_PRINTF("in RECV *** \n") |
|
475 | BOOT_PRINTF("in RECV *** \n") | |
339 |
|
476 | |||
340 | while(1) |
|
477 | while(1) | |
341 | { |
|
478 | { | |
342 | len = read(fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE); // the call to read is blocking |
|
479 | len = read(fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE); // the call to read is blocking | |
343 | if (len == -1){ // error during the read call |
|
480 | if (len == -1){ // error during the read call | |
344 | PRINTF("In RECV *** last read call returned -1\n") |
|
481 | PRINTF("In RECV *** last read call returned -1\n") | |
345 | } |
|
482 | } | |
346 | else { |
|
483 | else { | |
347 | if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) { |
|
484 | if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) { | |
348 | PRINTF("In RECV *** packet lenght too short\n") |
|
485 | PRINTF("In RECV *** packet lenght too short\n") | |
349 | } |
|
486 | } | |
350 | else { |
|
487 | else { | |
351 | currentTC_LEN_RCV[0] = 0x00; |
|
488 | currentTC_LEN_RCV[0] = 0x00; | |
352 | currentTC_LEN_RCV[1] = (unsigned char) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // build the corresponding packet size field |
|
489 | currentTC_LEN_RCV[1] = (unsigned char) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // build the corresponding packet size field | |
353 | currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes |
|
490 | currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes | |
354 | // CHECK THE TC |
|
491 | // CHECK THE TC | |
355 |
|
|
492 | tc_acceptance(¤tTC, currentTC_LEN_RCV_AsUnsignedInt, queue_queu_id, queue_pkts_id); | |
356 | } |
|
493 | } | |
357 | } |
|
494 | } | |
358 | } |
|
495 | } | |
359 | } |
|
496 | } | |
360 |
|
497 | |||
361 | rtems_task actn_task( rtems_task_argument unused ) |
|
498 | rtems_task actn_task( rtems_task_argument unused ) | |
362 | { |
|
499 | { | |
|
500 | /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands. | |||
|
501 | * | |||
|
502 | * @param unused is the starting argument of the RTEMS task | |||
|
503 | * | |||
|
504 | * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending | |||
|
505 | * on the incoming TeleCommand. | |||
|
506 | * | |||
|
507 | */ | |||
|
508 | ||||
363 | int result; |
|
509 | int result; | |
364 | rtems_status_code status; // RTEMS status code |
|
510 | rtems_status_code status; // RTEMS status code | |
365 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task |
|
511 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task | |
366 | size_t size; // size of the incoming TC packet |
|
512 | size_t size; // size of the incoming TC packet | |
367 | unsigned char subtype; // subtype of the current TC packet |
|
513 | unsigned char subtype; // subtype of the current TC packet | |
368 | rtems_id queue_rcv_id; |
|
514 | rtems_id queue_rcv_id; | |
369 | rtems_id queue_snd_id; |
|
515 | rtems_id queue_snd_id; | |
370 |
|
516 | |||
371 | status = rtems_message_queue_ident( misc_name[QUEUE_QUEU], 0, &queue_rcv_id ); |
|
517 | status = rtems_message_queue_ident( misc_name[QUEUE_QUEU], 0, &queue_rcv_id ); | |
372 | if (status != RTEMS_SUCCESSFUL) |
|
518 | if (status != RTEMS_SUCCESSFUL) | |
373 | { |
|
519 | { | |
374 | PRINTF1("in ACTN *** ERR getting queue_rcv_id %d\n", status) |
|
520 | PRINTF1("in ACTN *** ERR getting queue_rcv_id %d\n", status) | |
375 | } |
|
521 | } | |
376 |
|
522 | |||
377 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_snd_id ); |
|
523 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_snd_id ); | |
378 | if (status != RTEMS_SUCCESSFUL) |
|
524 | if (status != RTEMS_SUCCESSFUL) | |
379 | { |
|
525 | { | |
380 | PRINTF1("in ACTN *** ERR getting queue_snd_id %d\n", status) |
|
526 | PRINTF1("in ACTN *** ERR getting queue_snd_id %d\n", status) | |
381 | } |
|
527 | } | |
382 |
|
528 | |||
383 | result = LFR_SUCCESSFUL; |
|
529 | result = LFR_SUCCESSFUL; | |
384 | subtype = 0; // subtype of the current TC packet |
|
530 | subtype = 0; // subtype of the current TC packet | |
385 |
|
531 | |||
386 | BOOT_PRINTF("in ACTN *** \n") |
|
532 | BOOT_PRINTF("in ACTN *** \n") | |
387 |
|
533 | |||
388 | while(1) |
|
534 | while(1) | |
389 | { |
|
535 | { | |
390 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, |
|
536 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, | |
391 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); |
|
537 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); | |
392 | if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) |
|
538 | if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) | |
393 | else |
|
539 | else | |
394 | { |
|
540 | { | |
395 | subtype = TC.serviceSubType; |
|
541 | subtype = TC.serviceSubType; | |
396 | switch(subtype) |
|
542 | switch(subtype) | |
397 | { |
|
543 | { | |
398 | case TC_SUBTYPE_RESET: |
|
544 | case TC_SUBTYPE_RESET: | |
399 | result = action_reset( &TC, queue_snd_id ); |
|
545 | result = action_reset( &TC, queue_snd_id ); | |
400 | close_action( &TC, result, queue_snd_id ); |
|
546 | close_action( &TC, result, queue_snd_id ); | |
401 | break; |
|
547 | break; | |
402 | // |
|
548 | // | |
403 | case TC_SUBTYPE_LOAD_COMM: |
|
549 | case TC_SUBTYPE_LOAD_COMM: | |
404 | result = action_load_common_par( &TC ); |
|
550 | result = action_load_common_par( &TC ); | |
405 | close_action( &TC, result, queue_snd_id ); |
|
551 | close_action( &TC, result, queue_snd_id ); | |
406 | break; |
|
552 | break; | |
407 | // |
|
553 | // | |
408 | case TC_SUBTYPE_LOAD_NORM: |
|
554 | case TC_SUBTYPE_LOAD_NORM: | |
409 | result = action_load_normal_par( &TC, queue_snd_id ); |
|
555 | result = action_load_normal_par( &TC, queue_snd_id ); | |
410 | close_action( &TC, result, queue_snd_id ); |
|
556 | close_action( &TC, result, queue_snd_id ); | |
411 | break; |
|
557 | break; | |
412 | // |
|
558 | // | |
413 | case TC_SUBTYPE_LOAD_BURST: |
|
559 | case TC_SUBTYPE_LOAD_BURST: | |
414 | result = action_load_burst_par( &TC, queue_snd_id ); |
|
560 | result = action_load_burst_par( &TC, queue_snd_id ); | |
415 | close_action( &TC, result, queue_snd_id ); |
|
561 | close_action( &TC, result, queue_snd_id ); | |
416 | break; |
|
562 | break; | |
417 | // |
|
563 | // | |
418 | case TC_SUBTYPE_LOAD_SBM1: |
|
564 | case TC_SUBTYPE_LOAD_SBM1: | |
419 | result = action_load_sbm1_par( &TC, queue_snd_id ); |
|
565 | result = action_load_sbm1_par( &TC, queue_snd_id ); | |
420 | close_action( &TC, result, queue_snd_id ); |
|
566 | close_action( &TC, result, queue_snd_id ); | |
421 | break; |
|
567 | break; | |
422 | // |
|
568 | // | |
423 | case TC_SUBTYPE_LOAD_SBM2: |
|
569 | case TC_SUBTYPE_LOAD_SBM2: | |
424 | result = action_load_sbm2_par( &TC, queue_snd_id ); |
|
570 | result = action_load_sbm2_par( &TC, queue_snd_id ); | |
425 | close_action( &TC, result, queue_snd_id ); |
|
571 | close_action( &TC, result, queue_snd_id ); | |
426 | break; |
|
572 | break; | |
427 | // |
|
573 | // | |
428 | case TC_SUBTYPE_DUMP: |
|
574 | case TC_SUBTYPE_DUMP: | |
429 |
result = action_dump_par( |
|
575 | result = action_dump_par( queue_snd_id ); | |
430 | close_action( &TC, result, queue_snd_id ); |
|
576 | close_action( &TC, result, queue_snd_id ); | |
431 | break; |
|
577 | break; | |
432 | // |
|
578 | // | |
433 | case TC_SUBTYPE_ENTER: |
|
579 | case TC_SUBTYPE_ENTER: | |
434 | result = action_enter_mode( &TC, queue_snd_id ); |
|
580 | result = action_enter_mode( &TC, queue_snd_id ); | |
435 | close_action( &TC, result, queue_snd_id ); |
|
581 | close_action( &TC, result, queue_snd_id ); | |
436 | break; |
|
582 | break; | |
437 | // |
|
583 | // | |
438 | case TC_SUBTYPE_UPDT_INFO: |
|
584 | case TC_SUBTYPE_UPDT_INFO: | |
439 | result = action_update_info( &TC, queue_snd_id ); |
|
585 | result = action_update_info( &TC, queue_snd_id ); | |
440 | close_action( &TC, result, queue_snd_id ); |
|
586 | close_action( &TC, result, queue_snd_id ); | |
441 | break; |
|
587 | break; | |
442 | // |
|
588 | // | |
443 | case TC_SUBTYPE_EN_CAL: |
|
589 | case TC_SUBTYPE_EN_CAL: | |
444 | result = action_enable_calibration( &TC, queue_snd_id ); |
|
590 | result = action_enable_calibration( &TC, queue_snd_id ); | |
445 | close_action( &TC, result, queue_snd_id ); |
|
591 | close_action( &TC, result, queue_snd_id ); | |
446 | break; |
|
592 | break; | |
447 | // |
|
593 | // | |
448 | case TC_SUBTYPE_DIS_CAL: |
|
594 | case TC_SUBTYPE_DIS_CAL: | |
449 | result = action_disable_calibration( &TC, queue_snd_id ); |
|
595 | result = action_disable_calibration( &TC, queue_snd_id ); | |
450 | close_action( &TC, result, queue_snd_id ); |
|
596 | close_action( &TC, result, queue_snd_id ); | |
451 | break; |
|
597 | break; | |
452 | // |
|
598 | // | |
453 | case TC_SUBTYPE_UPDT_TIME: |
|
599 | case TC_SUBTYPE_UPDT_TIME: | |
454 | result = action_update_time( &TC ); |
|
600 | result = action_update_time( &TC ); | |
455 | close_action( &TC, result, queue_snd_id ); |
|
601 | close_action( &TC, result, queue_snd_id ); | |
456 | break; |
|
602 | break; | |
457 | // |
|
603 | // | |
458 | default: |
|
604 | default: | |
459 | break; |
|
605 | break; | |
460 | } |
|
606 | } | |
461 | } |
|
607 | } | |
462 | } |
|
608 | } | |
463 | } |
|
609 | } | |
464 |
|
610 | |||
465 | rtems_task dumb_task( rtems_task_argument unused ) |
|
611 | rtems_task dumb_task( rtems_task_argument unused ) | |
466 | { |
|
612 | { | |
|
613 | /** This RTEMS taks is used to print messages without affecting the general behaviour of the software. | |||
|
614 | * | |||
|
615 | * @param unused is the starting argument of the RTEMS task | |||
|
616 | * | |||
|
617 | * The DUMB taks waits for RTEMS events and print messages depending on the incoming events. | |||
|
618 | * | |||
|
619 | */ | |||
|
620 | ||||
467 | unsigned int i; |
|
621 | unsigned int i; | |
468 | unsigned int intEventOut; |
|
622 | unsigned int intEventOut; | |
469 | unsigned int coarse_time = 0; |
|
623 | unsigned int coarse_time = 0; | |
470 | unsigned int fine_time = 0; |
|
624 | unsigned int fine_time = 0; | |
471 | rtems_event_set event_out; |
|
625 | rtems_event_set event_out; | |
472 |
|
626 | |||
473 | BOOT_PRINTF("in DUMB *** \n") |
|
627 | BOOT_PRINTF("in DUMB *** \n") | |
474 |
|
628 | |||
475 | while(1){ |
|
629 | while(1){ | |
476 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | RTEMS_EVENT_4 | RTEMS_EVENT_5, |
|
630 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | RTEMS_EVENT_4 | RTEMS_EVENT_5, | |
477 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT |
|
631 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT | |
478 | intEventOut = (unsigned int) event_out; |
|
632 | intEventOut = (unsigned int) event_out; | |
479 | for ( i=0; i<32; i++) |
|
633 | for ( i=0; i<32; i++) | |
480 | { |
|
634 | { | |
481 | if ( ((intEventOut >> i) & 0x0001) != 0) |
|
635 | if ( ((intEventOut >> i) & 0x0001) != 0) | |
482 | { |
|
636 | { | |
483 | coarse_time = time_management_regs->coarse_time; |
|
637 | coarse_time = time_management_regs->coarse_time; | |
484 | fine_time = time_management_regs->fine_time; |
|
638 | fine_time = time_management_regs->fine_time; | |
485 | printf("in DUMB *** time = coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); |
|
639 | printf("in DUMB *** time = coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); | |
486 | } |
|
640 | } | |
487 | } |
|
641 | } | |
488 | } |
|
642 | } | |
489 | } |
|
643 | } | |
490 |
|
644 | |||
491 | //*********** |
|
645 | //*********** | |
492 | // TC ACTIONS |
|
646 | // TC ACTIONS | |
493 |
|
647 | |||
494 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
648 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
495 | { |
|
649 | { | |
|
650 | /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received. | |||
|
651 | * | |||
|
652 | * @param TC points to the TeleCommand packet that is being processed | |||
|
653 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |||
|
654 | * | |||
|
655 | */ | |||
|
656 | ||||
496 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); |
|
657 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); | |
497 | return LFR_DEFAULT; |
|
658 | return LFR_DEFAULT; | |
498 | } |
|
659 | } | |
499 |
|
660 | |||
500 | int action_load_common_par(ccsdsTelecommandPacket_t *TC) |
|
|||
501 | { |
|
|||
502 | parameter_dump_packet.unused0 = TC->dataAndCRC[0]; |
|
|||
503 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1]; |
|
|||
504 |
|
||||
505 | set_wfp_data_shaping(parameter_dump_packet.bw_sp0_sp1_r0_r1); |
|
|||
506 |
|
||||
507 | return LFR_SUCCESSFUL; |
|
|||
508 | } |
|
|||
509 |
|
||||
510 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
|||
511 | { |
|
|||
512 | int result; |
|
|||
513 | unsigned int tmp; |
|
|||
514 |
|
||||
515 | result = LFR_SUCCESSFUL; |
|
|||
516 |
|
||||
517 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
|||
518 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
|||
519 | result = LFR_DEFAULT; |
|
|||
520 | } |
|
|||
521 | else { |
|
|||
522 | // sy_lfr_n_swf_l |
|
|||
523 | parameter_dump_packet.sy_lfr_n_swf_l[0] = TC->dataAndCRC[0]; |
|
|||
524 | parameter_dump_packet.sy_lfr_n_swf_l[1] = TC->dataAndCRC[1]; |
|
|||
525 |
|
||||
526 | // sy_lfr_n_swf_p |
|
|||
527 | tmp = ( unsigned int ) floor( |
|
|||
528 | (TC->dataAndCRC[2] * 256 |
|
|||
529 | + TC->dataAndCRC[3])/8 |
|
|||
530 | ) * 8; |
|
|||
531 | if ( (tmp < 16) || (tmp>65528) ) |
|
|||
532 | { |
|
|||
533 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, 12, TC->dataAndCRC[2]); |
|
|||
534 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, 13, TC->dataAndCRC[3]); |
|
|||
535 | result = LFR_DEFAULT; |
|
|||
536 | } |
|
|||
537 | else |
|
|||
538 | { |
|
|||
539 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8); |
|
|||
540 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp ); |
|
|||
541 | } |
|
|||
542 |
|
||||
543 | // sy_lfr_n_asm_p |
|
|||
544 | parameter_dump_packet.sy_lfr_n_asm_p[0] = TC->dataAndCRC[4]; |
|
|||
545 | parameter_dump_packet.sy_lfr_n_asm_p[1] = TC->dataAndCRC[5]; |
|
|||
546 |
|
||||
547 | // sy_lfr_n_bp_p0 |
|
|||
548 | parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[6]; |
|
|||
549 |
|
||||
550 | // sy_lfr_n_bp_p1 |
|
|||
551 | parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[7]; |
|
|||
552 | } |
|
|||
553 |
|
||||
554 | return result; |
|
|||
555 | } |
|
|||
556 |
|
||||
557 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
|||
558 | { |
|
|||
559 | int result; |
|
|||
560 | unsigned char lfrMode; |
|
|||
561 |
|
||||
562 | result = LFR_DEFAULT; |
|
|||
563 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
|||
564 |
|
||||
565 | if ( lfrMode == LFR_MODE_BURST ) { |
|
|||
566 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
|||
567 | result = LFR_DEFAULT; |
|
|||
568 | } |
|
|||
569 | else { |
|
|||
570 | parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0]; |
|
|||
571 | parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1]; |
|
|||
572 |
|
||||
573 | result = LFR_SUCCESSFUL; |
|
|||
574 | } |
|
|||
575 |
|
||||
576 | return result; |
|
|||
577 | } |
|
|||
578 |
|
||||
579 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
|||
580 | { |
|
|||
581 | int result; |
|
|||
582 | unsigned char lfrMode; |
|
|||
583 |
|
||||
584 | result = LFR_DEFAULT; |
|
|||
585 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
|||
586 |
|
||||
587 | if ( lfrMode == LFR_MODE_SBM1 ) { |
|
|||
588 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
|||
589 | result = LFR_DEFAULT; |
|
|||
590 | } |
|
|||
591 | else { |
|
|||
592 | parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0]; |
|
|||
593 | parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1]; |
|
|||
594 |
|
||||
595 | result = LFR_SUCCESSFUL; |
|
|||
596 | } |
|
|||
597 |
|
||||
598 | return result; |
|
|||
599 | } |
|
|||
600 |
|
||||
601 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
|||
602 | { |
|
|||
603 | int result; |
|
|||
604 | unsigned char lfrMode; |
|
|||
605 |
|
||||
606 | result = LFR_DEFAULT; |
|
|||
607 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
|||
608 |
|
||||
609 | if ( lfrMode == LFR_MODE_SBM2 ) { |
|
|||
610 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
|||
611 | result = LFR_DEFAULT; |
|
|||
612 | } |
|
|||
613 | else { |
|
|||
614 | parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0]; |
|
|||
615 | parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1]; |
|
|||
616 |
|
||||
617 | result = LFR_SUCCESSFUL; |
|
|||
618 | } |
|
|||
619 |
|
||||
620 | return result; |
|
|||
621 | } |
|
|||
622 |
|
||||
623 | int action_dump_par(ccsdsTelecommandPacket_t *TC) |
|
|||
624 | { |
|
|||
625 | int status; |
|
|||
626 | // send parameter dump packet |
|
|||
627 | status = write(fdSPW, (char *) ¶meter_dump_packet, |
|
|||
628 | PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + 4); |
|
|||
629 | if (status == -1) |
|
|||
630 | { |
|
|||
631 | PRINTF1("in action_dump *** ERR sending packet, code %d", status) |
|
|||
632 | status = RTEMS_UNSATISFIED; |
|
|||
633 | } |
|
|||
634 | else |
|
|||
635 | { |
|
|||
636 | status = RTEMS_SUCCESSFUL; |
|
|||
637 | } |
|
|||
638 |
|
||||
639 | return status; |
|
|||
640 | } |
|
|||
641 |
|
||||
642 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
661 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
643 | { |
|
662 | { | |
|
663 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. | |||
|
664 | * | |||
|
665 | * @param TC points to the TeleCommand packet that is being processed | |||
|
666 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |||
|
667 | * | |||
|
668 | */ | |||
|
669 | ||||
644 | rtems_status_code status; |
|
670 | rtems_status_code status; | |
645 | unsigned char requestedMode; |
|
671 | unsigned char requestedMode; | |
646 |
|
672 | |||
647 | requestedMode = TC->dataAndCRC[1]; |
|
673 | requestedMode = TC->dataAndCRC[1]; | |
648 |
|
674 | |||
649 | if ( (requestedMode != LFR_MODE_STANDBY) |
|
675 | if ( (requestedMode != LFR_MODE_STANDBY) | |
650 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) |
|
676 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) | |
651 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) |
|
677 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) | |
652 | { |
|
678 | { | |
653 | status = RTEMS_UNSATISFIED; |
|
679 | status = RTEMS_UNSATISFIED; | |
654 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode ); |
|
680 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode ); | |
655 | } |
|
681 | } | |
656 | else |
|
682 | else | |
657 | { |
|
683 | { | |
658 | printf("try to enter mode %d\n", requestedMode); |
|
684 | printf("try to enter mode %d\n", requestedMode); | |
659 |
|
685 | |||
660 | #ifdef PRINT_TASK_STATISTICS |
|
686 | #ifdef PRINT_TASK_STATISTICS | |
661 | if (requestedMode != LFR_MODE_STANDBY) |
|
687 | if (requestedMode != LFR_MODE_STANDBY) | |
662 | { |
|
688 | { | |
663 | rtems_cpu_usage_reset(); |
|
689 | rtems_cpu_usage_reset(); | |
664 | maxCount = 0; |
|
690 | maxCount = 0; | |
665 | } |
|
691 | } | |
666 | #endif |
|
692 | #endif | |
667 |
|
693 | |||
668 | status = transition_validation(requestedMode); |
|
694 | status = transition_validation(requestedMode); | |
669 |
|
695 | |||
670 | if ( status == LFR_SUCCESSFUL ) { |
|
696 | if ( status == LFR_SUCCESSFUL ) { | |
671 | if ( lfrCurrentMode != LFR_MODE_STANDBY) |
|
697 | if ( lfrCurrentMode != LFR_MODE_STANDBY) | |
672 | { |
|
698 | { | |
673 | status = stop_current_mode(); |
|
699 | status = stop_current_mode(); | |
674 | } |
|
700 | } | |
675 | if (status != RTEMS_SUCCESSFUL) |
|
701 | if (status != RTEMS_SUCCESSFUL) | |
676 | { |
|
702 | { | |
677 | PRINTF("ERR *** in action_enter *** stop_current_mode\n") |
|
703 | PRINTF("ERR *** in action_enter *** stop_current_mode\n") | |
678 | } |
|
704 | } | |
679 | status = enter_mode(requestedMode, TC); |
|
705 | status = enter_mode(requestedMode, TC); | |
680 | } |
|
706 | } | |
681 | else |
|
707 | else | |
682 | { |
|
708 | { | |
683 | PRINTF("ERR *** in action_enter *** transition rejected\n") |
|
709 | PRINTF("ERR *** in action_enter *** transition rejected\n") | |
684 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
710 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
685 | } |
|
711 | } | |
686 | } |
|
712 | } | |
687 |
|
713 | |||
688 | return status; |
|
714 | return status; | |
689 | } |
|
715 | } | |
690 |
|
716 | |||
691 |
int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
717 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
|
718 | { | |||
|
719 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. | |||
|
720 | * | |||
|
721 | * @param TC points to the TeleCommand packet that is being processed | |||
|
722 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |||
|
723 | * | |||
|
724 | */ | |||
|
725 | ||||
692 | unsigned int val; |
|
726 | unsigned int val; | |
693 | int result; |
|
727 | int result; | |
694 | unsigned char lfrMode; |
|
728 | unsigned char lfrMode; | |
695 |
|
729 | |||
696 | result = LFR_DEFAULT; |
|
730 | result = LFR_DEFAULT; | |
697 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
731 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
698 |
|
732 | |||
699 | if ( (lfrMode == LFR_MODE_STANDBY) ) { |
|
733 | if ( (lfrMode == LFR_MODE_STANDBY) ) { | |
700 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); |
|
734 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); | |
701 | result = LFR_DEFAULT; |
|
735 | result = LFR_DEFAULT; | |
702 | } |
|
736 | } | |
703 | else { |
|
737 | else { | |
704 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 |
|
738 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 | |
705 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; |
|
739 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; | |
706 | val++; |
|
740 | val++; | |
707 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); |
|
741 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); | |
708 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); |
|
742 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); | |
709 | result = LFR_SUCCESSFUL; |
|
743 | result = LFR_SUCCESSFUL; | |
710 | } |
|
744 | } | |
711 |
|
745 | |||
712 | return result; |
|
746 | return result; | |
713 | } |
|
747 | } | |
714 |
|
748 | |||
715 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
749 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
716 | { |
|
750 | { | |
|
751 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. | |||
|
752 | * | |||
|
753 | * @param TC points to the TeleCommand packet that is being processed | |||
|
754 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |||
|
755 | * | |||
|
756 | */ | |||
|
757 | ||||
717 | int result; |
|
758 | int result; | |
718 | unsigned char lfrMode; |
|
759 | unsigned char lfrMode; | |
719 |
|
760 | |||
720 | result = LFR_DEFAULT; |
|
761 | result = LFR_DEFAULT; | |
721 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
762 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
722 |
|
763 | |||
723 | if ( (lfrMode == LFR_MODE_STANDBY) | (lfrMode == LFR_MODE_BURST) | (lfrMode == LFR_MODE_SBM2) ) { |
|
764 | if ( (lfrMode == LFR_MODE_STANDBY) | (lfrMode == LFR_MODE_BURST) | (lfrMode == LFR_MODE_SBM2) ) { | |
724 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
765 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
725 | result = LFR_DEFAULT; |
|
766 | result = LFR_DEFAULT; | |
726 | } |
|
767 | } | |
727 | else { |
|
768 | else { | |
728 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); |
|
769 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); | |
729 | result = LFR_DEFAULT; |
|
770 | result = LFR_DEFAULT; | |
730 | } |
|
771 | } | |
731 | return result; |
|
772 | return result; | |
732 | } |
|
773 | } | |
733 |
|
774 | |||
734 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
775 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
735 | { |
|
776 | { | |
|
777 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. | |||
|
778 | * | |||
|
779 | * @param TC points to the TeleCommand packet that is being processed | |||
|
780 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |||
|
781 | * | |||
|
782 | */ | |||
|
783 | ||||
736 | int result; |
|
784 | int result; | |
737 | unsigned char lfrMode; |
|
785 | unsigned char lfrMode; | |
738 |
|
786 | |||
739 | result = LFR_DEFAULT; |
|
787 | result = LFR_DEFAULT; | |
740 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
788 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
741 |
|
789 | |||
742 | if ( (lfrMode == LFR_MODE_STANDBY) | (lfrMode == LFR_MODE_BURST) | (lfrMode == LFR_MODE_SBM2) ) { |
|
790 | if ( (lfrMode == LFR_MODE_STANDBY) | (lfrMode == LFR_MODE_BURST) | (lfrMode == LFR_MODE_SBM2) ) { | |
743 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
791 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
744 | result = LFR_DEFAULT; |
|
792 | result = LFR_DEFAULT; | |
745 | } |
|
793 | } | |
746 | else { |
|
794 | else { | |
747 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); |
|
795 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); | |
748 | result = LFR_DEFAULT; |
|
796 | result = LFR_DEFAULT; | |
749 | } |
|
797 | } | |
750 | return result; |
|
798 | return result; | |
751 | } |
|
799 | } | |
752 |
|
800 | |||
753 | int action_update_time(ccsdsTelecommandPacket_t *TC) |
|
801 | int action_update_time(ccsdsTelecommandPacket_t *TC) | |
754 | { |
|
802 | { | |
|
803 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. | |||
|
804 | * | |||
|
805 | * @param TC points to the TeleCommand packet that is being processed | |||
|
806 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver | |||
|
807 | * | |||
|
808 | */ | |||
|
809 | ||||
755 | unsigned int val; |
|
810 | unsigned int val; | |
756 |
|
811 | |||
757 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) |
|
812 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) | |
758 | + (TC->dataAndCRC[1] << 16) |
|
813 | + (TC->dataAndCRC[1] << 16) | |
759 | + (TC->dataAndCRC[2] << 8) |
|
814 | + (TC->dataAndCRC[2] << 8) | |
760 | + TC->dataAndCRC[3]; |
|
815 | + TC->dataAndCRC[3]; | |
761 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 |
|
816 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 | |
762 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; |
|
817 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; | |
763 | val++; |
|
818 | val++; | |
764 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); |
|
819 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); | |
765 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); |
|
820 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); | |
766 | time_management_regs->ctrl = time_management_regs->ctrl | 1; |
|
821 | time_management_regs->ctrl = time_management_regs->ctrl | 1; | |
767 |
|
822 | |||
768 | return LFR_SUCCESSFUL; |
|
823 | return LFR_SUCCESSFUL; | |
769 | } |
|
824 | } | |
770 |
|
825 | |||
771 | //******************* |
|
826 | //******************* | |
772 | // ENTERING THE MODES |
|
827 | // ENTERING THE MODES | |
773 |
|
828 | |||
774 | int transition_validation(unsigned char requestedMode) |
|
829 | int transition_validation(unsigned char requestedMode) | |
775 | { |
|
830 | { | |
776 | int status; |
|
831 | int status; | |
777 |
|
832 | |||
778 | switch (requestedMode) |
|
833 | switch (requestedMode) | |
779 | { |
|
834 | { | |
780 | case LFR_MODE_STANDBY: |
|
835 | case LFR_MODE_STANDBY: | |
781 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { |
|
836 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { | |
782 | status = LFR_DEFAULT; |
|
837 | status = LFR_DEFAULT; | |
783 | } |
|
838 | } | |
784 | else |
|
839 | else | |
785 | { |
|
840 | { | |
786 | status = LFR_SUCCESSFUL; |
|
841 | status = LFR_SUCCESSFUL; | |
787 | } |
|
842 | } | |
788 | break; |
|
843 | break; | |
789 | case LFR_MODE_NORMAL: |
|
844 | case LFR_MODE_NORMAL: | |
790 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
845 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { | |
791 | status = LFR_DEFAULT; |
|
846 | status = LFR_DEFAULT; | |
792 | } |
|
847 | } | |
793 | else { |
|
848 | else { | |
794 | status = LFR_SUCCESSFUL; |
|
849 | status = LFR_SUCCESSFUL; | |
795 | } |
|
850 | } | |
796 | break; |
|
851 | break; | |
797 | case LFR_MODE_BURST: |
|
852 | case LFR_MODE_BURST: | |
798 | if ( lfrCurrentMode == LFR_MODE_BURST ) { |
|
853 | if ( lfrCurrentMode == LFR_MODE_BURST ) { | |
799 | status = LFR_DEFAULT; |
|
854 | status = LFR_DEFAULT; | |
800 | } |
|
855 | } | |
801 | else { |
|
856 | else { | |
802 | status = LFR_SUCCESSFUL; |
|
857 | status = LFR_SUCCESSFUL; | |
803 | } |
|
858 | } | |
804 | break; |
|
859 | break; | |
805 | case LFR_MODE_SBM1: |
|
860 | case LFR_MODE_SBM1: | |
806 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { |
|
861 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { | |
807 | status = LFR_DEFAULT; |
|
862 | status = LFR_DEFAULT; | |
808 | } |
|
863 | } | |
809 | else { |
|
864 | else { | |
810 | status = LFR_SUCCESSFUL; |
|
865 | status = LFR_SUCCESSFUL; | |
811 | } |
|
866 | } | |
812 | break; |
|
867 | break; | |
813 | case LFR_MODE_SBM2: |
|
868 | case LFR_MODE_SBM2: | |
814 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { |
|
869 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { | |
815 | status = LFR_DEFAULT; |
|
870 | status = LFR_DEFAULT; | |
816 | } |
|
871 | } | |
817 | else { |
|
872 | else { | |
818 | status = LFR_SUCCESSFUL; |
|
873 | status = LFR_SUCCESSFUL; | |
819 | } |
|
874 | } | |
820 | break; |
|
875 | break; | |
821 | default: |
|
876 | default: | |
822 | status = LFR_DEFAULT; |
|
877 | status = LFR_DEFAULT; | |
823 | break; |
|
878 | break; | |
824 | } |
|
879 | } | |
825 |
|
880 | |||
826 | return status; |
|
881 | return status; | |
827 | } |
|
882 | } | |
828 |
|
883 | |||
829 | int stop_current_mode() |
|
884 | int stop_current_mode() | |
830 | { |
|
885 | { | |
|
886 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. | |||
|
887 | * | |||
|
888 | * @return RTEMS directive status codes: | |||
|
889 | * - RTEMS_SUCCESSFUL - task restarted successfully | |||
|
890 | * - RTEMS_INVALID_ID - task id invalid | |||
|
891 | * - RTEMS_ALREADY_SUSPENDED - task already suspended | |||
|
892 | * | |||
|
893 | */ | |||
|
894 | ||||
831 | rtems_status_code status; |
|
895 | rtems_status_code status; | |
832 |
|
896 | |||
833 | status = RTEMS_SUCCESSFUL; |
|
897 | status = RTEMS_SUCCESSFUL; | |
834 |
|
898 | |||
835 | // mask all IRQ lines related to signal processing |
|
899 | // mask all IRQ lines related to signal processing | |
836 | LEON_Mask_interrupt( IRQ_SM ); // mask spectral matrices interrupt (coming from the timer VHDL IP) |
|
900 | LEON_Mask_interrupt( IRQ_SM ); // mask spectral matrices interrupt (coming from the timer VHDL IP) | |
837 | LEON_Clear_interrupt( IRQ_SM ); // clear spectral matrices interrupt (coming from the timer VHDL IP) |
|
901 | LEON_Clear_interrupt( IRQ_SM ); // clear spectral matrices interrupt (coming from the timer VHDL IP) | |
838 |
|
902 | |||
839 | #ifdef GSA |
|
903 | #ifdef GSA | |
840 | LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP) |
|
904 | LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP) | |
841 | LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP) |
|
905 | LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP) | |
842 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); |
|
906 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); | |
843 | #else |
|
907 | #else | |
844 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt |
|
908 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt | |
845 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
909 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt | |
846 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt |
|
910 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt | |
847 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
911 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt | |
848 | LEON_Mask_interrupt( IRQ_SM ); // for SM simulation |
|
912 | LEON_Mask_interrupt( IRQ_SM ); // for SM simulation | |
849 | LEON_Clear_interrupt( IRQ_SM ); // for SM simulation |
|
913 | LEON_Clear_interrupt( IRQ_SM ); // for SM simulation | |
850 | #endif |
|
914 | #endif | |
851 | //********************** |
|
915 | //********************** | |
852 | // suspend several tasks |
|
916 | // suspend several tasks | |
853 | if (lfrCurrentMode != LFR_MODE_STANDBY) { |
|
917 | if (lfrCurrentMode != LFR_MODE_STANDBY) { | |
854 | suspend_science_tasks(); |
|
918 | status = suspend_science_tasks(); | |
855 | } |
|
919 | } | |
856 |
|
920 | |||
857 | if (status != RTEMS_SUCCESSFUL) |
|
921 | if (status != RTEMS_SUCCESSFUL) | |
858 | { |
|
922 | { | |
859 |
PRINTF(" |
|
923 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) | |
860 | } |
|
924 | } | |
861 |
|
925 | |||
862 | //************************* |
|
926 | //************************* | |
863 | // initialize the registers |
|
927 | // initialize the registers | |
864 | #ifdef GSA |
|
928 | #ifdef GSA | |
865 | #else |
|
929 | #else | |
866 | reset_wfp_burst_enable(); // reset burst and enable bits |
|
930 | reset_wfp_burst_enable(); // reset burst and enable bits | |
867 | reset_wfp_status(); // reset all the status bits |
|
931 | reset_wfp_status(); // reset all the status bits | |
868 | #endif |
|
932 | #endif | |
869 |
|
933 | |||
870 | return status; |
|
934 | return status; | |
871 | } |
|
935 | } | |
872 |
|
936 | |||
873 | int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC ) |
|
937 | int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC ) | |
874 | { |
|
938 | { | |
875 | rtems_status_code status; |
|
939 | rtems_status_code status; | |
876 |
|
940 | |||
877 | status = RTEMS_UNSATISFIED; |
|
941 | status = RTEMS_UNSATISFIED; | |
878 |
|
942 | |||
879 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d); |
|
943 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d); | |
880 | lfrCurrentMode = mode; |
|
944 | lfrCurrentMode = mode; | |
881 |
|
945 | |||
882 | switch(mode){ |
|
946 | switch(mode){ | |
883 | case LFR_MODE_STANDBY: |
|
947 | case LFR_MODE_STANDBY: | |
884 | status = enter_standby_mode( TC ); |
|
948 | status = enter_standby_mode( TC ); | |
885 | break; |
|
949 | break; | |
886 | case LFR_MODE_NORMAL: |
|
950 | case LFR_MODE_NORMAL: | |
887 | status = enter_normal_mode( TC ); |
|
951 | status = enter_normal_mode( TC ); | |
888 | break; |
|
952 | break; | |
889 | case LFR_MODE_BURST: |
|
953 | case LFR_MODE_BURST: | |
890 | status = enter_burst_mode( TC ); |
|
954 | status = enter_burst_mode( TC ); | |
891 | break; |
|
955 | break; | |
892 | case LFR_MODE_SBM1: |
|
956 | case LFR_MODE_SBM1: | |
893 | status = enter_sbm1_mode( TC ); |
|
957 | status = enter_sbm1_mode( TC ); | |
894 | break; |
|
958 | break; | |
895 | case LFR_MODE_SBM2: |
|
959 | case LFR_MODE_SBM2: | |
896 | status = enter_sbm2_mode( TC ); |
|
960 | status = enter_sbm2_mode( TC ); | |
897 | break; |
|
961 | break; | |
898 | default: |
|
962 | default: | |
899 | status = RTEMS_UNSATISFIED; |
|
963 | status = RTEMS_UNSATISFIED; | |
900 | } |
|
964 | } | |
901 |
|
965 | |||
902 | if (status != RTEMS_SUCCESSFUL) |
|
966 | if (status != RTEMS_SUCCESSFUL) | |
903 | { |
|
967 | { | |
904 | PRINTF("in enter_mode *** ERR\n") |
|
968 | PRINTF("in enter_mode *** ERR\n") | |
905 | status = RTEMS_UNSATISFIED; |
|
969 | status = RTEMS_UNSATISFIED; | |
906 | } |
|
970 | } | |
907 |
|
971 | |||
908 | return status; |
|
972 | return status; | |
909 | } |
|
973 | } | |
910 |
|
974 | |||
911 | int enter_standby_mode() |
|
975 | int enter_standby_mode() | |
912 | { |
|
976 | { | |
913 | reset_waveform_picker_regs(); |
|
977 | reset_waveform_picker_regs(); | |
914 |
|
978 | |||
915 | PRINTF1("maxCount = %d\n", maxCount) |
|
979 | PRINTF1("maxCount = %d\n", maxCount) | |
916 |
|
980 | |||
917 | #ifdef PRINT_TASK_STATISTICS |
|
981 | #ifdef PRINT_TASK_STATISTICS | |
918 | rtems_cpu_usage_report(); |
|
982 | rtems_cpu_usage_report(); | |
919 | #endif |
|
983 | #endif | |
920 |
|
984 | |||
921 | #ifdef PRINT_STACK_REPORT |
|
985 | #ifdef PRINT_STACK_REPORT | |
922 | rtems_stack_checker_report_usage(); |
|
986 | rtems_stack_checker_report_usage(); | |
923 | #endif |
|
987 | #endif | |
924 |
|
988 | |||
925 | return LFR_SUCCESSFUL; |
|
989 | return LFR_SUCCESSFUL; | |
926 | } |
|
990 | } | |
927 |
|
991 | |||
928 | int enter_normal_mode() |
|
992 | int enter_normal_mode() | |
929 | { |
|
993 | { | |
930 | rtems_status_code status; |
|
994 | rtems_status_code status; | |
931 |
|
995 | |||
932 | status = restart_science_tasks(); |
|
996 | status = restart_science_tasks(); | |
933 |
|
997 | |||
934 | #ifdef GSA |
|
998 | #ifdef GSA | |
935 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); |
|
999 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); | |
936 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
1000 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
937 | LEON_Clear_interrupt( IRQ_WF ); |
|
1001 | LEON_Clear_interrupt( IRQ_WF ); | |
938 | LEON_Unmask_interrupt( IRQ_WF ); |
|
1002 | LEON_Unmask_interrupt( IRQ_WF ); | |
939 | // |
|
1003 | // | |
940 | set_local_nb_interrupt_f0_MAX(); |
|
1004 | set_local_nb_interrupt_f0_MAX(); | |
941 | LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board |
|
1005 | LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board | |
942 | LEON_Unmask_interrupt( IRQ_SM ); |
|
1006 | LEON_Unmask_interrupt( IRQ_SM ); | |
943 | #else |
|
1007 | #else | |
944 | //**************** |
|
1008 | //**************** | |
945 | // waveform picker |
|
1009 | // waveform picker | |
946 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
1010 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
947 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
1011 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
948 | reset_waveform_picker_regs(); |
|
1012 | reset_waveform_picker_regs(); | |
949 | set_wfp_burst_enable_register(LFR_MODE_NORMAL); |
|
1013 | set_wfp_burst_enable_register(LFR_MODE_NORMAL); | |
950 | //**************** |
|
1014 | //**************** | |
951 | // spectral matrix |
|
1015 | // spectral matrix | |
952 | // set_local_nb_interrupt_f0_MAX(); |
|
1016 | // set_local_nb_interrupt_f0_MAX(); | |
953 | // LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board |
|
1017 | // LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board | |
954 | // LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
1018 | // LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); | |
955 | // spectral_matrix_regs->config = 0x01; |
|
1019 | // spectral_matrix_regs->config = 0x01; | |
956 | // spectral_matrix_regs->status = 0x00; |
|
1020 | // spectral_matrix_regs->status = 0x00; | |
957 | #endif |
|
1021 | #endif | |
958 |
|
1022 | |||
959 | return status; |
|
1023 | return status; | |
960 | } |
|
1024 | } | |
961 |
|
1025 | |||
962 | int enter_burst_mode() |
|
1026 | int enter_burst_mode() | |
963 | { |
|
1027 | { | |
964 | rtems_status_code status; |
|
1028 | rtems_status_code status; | |
965 |
|
1029 | |||
966 | status = restart_science_tasks(); |
|
1030 | status = restart_science_tasks(); | |
967 |
|
1031 | |||
968 | #ifdef GSA |
|
1032 | #ifdef GSA | |
969 | LEON_Unmask_interrupt( IRQ_SM ); |
|
1033 | LEON_Unmask_interrupt( IRQ_SM ); | |
970 | #else |
|
1034 | #else | |
971 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
1035 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
972 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
1036 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
973 | reset_waveform_picker_regs(); |
|
1037 | reset_waveform_picker_regs(); | |
974 | set_wfp_burst_enable_register(LFR_MODE_BURST); |
|
1038 | set_wfp_burst_enable_register(LFR_MODE_BURST); | |
975 | #endif |
|
1039 | #endif | |
976 |
|
1040 | |||
977 | return status; |
|
1041 | return status; | |
978 | } |
|
1042 | } | |
979 |
|
1043 | |||
980 | int enter_sbm1_mode() |
|
1044 | int enter_sbm1_mode() | |
981 | { |
|
1045 | { | |
982 | rtems_status_code status; |
|
1046 | rtems_status_code status; | |
983 |
|
1047 | |||
984 | status = restart_science_tasks(); |
|
1048 | status = restart_science_tasks(); | |
985 |
|
1049 | |||
986 | set_local_sbm1_nb_cwf_max(); |
|
1050 | set_local_sbm1_nb_cwf_max(); | |
987 |
|
1051 | |||
988 | reset_local_sbm1_nb_cwf_sent(); |
|
1052 | reset_local_sbm1_nb_cwf_sent(); | |
989 |
|
1053 | |||
990 | #ifdef GSA |
|
1054 | #ifdef GSA | |
991 | LEON_Unmask_interrupt( IRQ_SM ); |
|
1055 | LEON_Unmask_interrupt( IRQ_SM ); | |
992 | #else |
|
1056 | #else | |
993 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
1057 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
994 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
1058 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
995 | reset_waveform_picker_regs(); |
|
1059 | reset_waveform_picker_regs(); | |
996 | set_wfp_burst_enable_register(LFR_MODE_SBM1); |
|
1060 | set_wfp_burst_enable_register(LFR_MODE_SBM1); | |
997 | // SM simulation |
|
1061 | // SM simulation | |
998 | // timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
1062 | // timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
999 | // LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board |
|
1063 | // LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board | |
1000 | // LEON_Unmask_interrupt( IRQ_SM ); |
|
1064 | // LEON_Unmask_interrupt( IRQ_SM ); | |
1001 | #endif |
|
1065 | #endif | |
1002 |
|
1066 | |||
1003 | return status; |
|
1067 | return status; | |
1004 | } |
|
1068 | } | |
1005 |
|
1069 | |||
1006 | int enter_sbm2_mode() |
|
1070 | int enter_sbm2_mode() | |
1007 | { |
|
1071 | { | |
1008 | rtems_status_code status; |
|
1072 | rtems_status_code status; | |
1009 |
|
1073 | |||
1010 | status = restart_science_tasks(); |
|
1074 | status = restart_science_tasks(); | |
1011 |
|
1075 | |||
1012 | set_local_sbm2_nb_cwf_max(); |
|
1076 | set_local_sbm2_nb_cwf_max(); | |
1013 |
|
1077 | |||
1014 | reset_local_sbm2_nb_cwf_sent(); |
|
1078 | reset_local_sbm2_nb_cwf_sent(); | |
1015 |
|
1079 | |||
1016 | #ifdef GSA |
|
1080 | #ifdef GSA | |
1017 | LEON_Unmask_interrupt( IRQ_SM ); |
|
1081 | LEON_Unmask_interrupt( IRQ_SM ); | |
1018 | #else |
|
1082 | #else | |
1019 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
1083 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); | |
1020 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
1084 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
1021 | reset_waveform_picker_regs(); |
|
1085 | reset_waveform_picker_regs(); | |
1022 | set_wfp_burst_enable_register(LFR_MODE_SBM2); |
|
1086 | set_wfp_burst_enable_register(LFR_MODE_SBM2); | |
1023 | #endif |
|
1087 | #endif | |
1024 |
|
1088 | |||
1025 | return status; |
|
1089 | return status; | |
1026 | } |
|
1090 | } | |
1027 |
|
1091 | |||
1028 | int restart_science_tasks() |
|
1092 | int restart_science_tasks() | |
1029 | { |
|
1093 | { | |
1030 | rtems_status_code status[6]; |
|
1094 | rtems_status_code status[6]; | |
1031 | rtems_status_code ret; |
|
1095 | rtems_status_code ret; | |
1032 |
|
1096 | |||
1033 | ret = RTEMS_SUCCESSFUL; |
|
1097 | ret = RTEMS_SUCCESSFUL; | |
1034 |
|
1098 | |||
1035 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 ); |
|
1099 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 ); | |
1036 | if (status[0] != RTEMS_SUCCESSFUL) |
|
1100 | if (status[0] != RTEMS_SUCCESSFUL) | |
1037 | { |
|
1101 | { | |
1038 | PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0]) |
|
1102 | PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0]) | |
1039 | } |
|
1103 | } | |
1040 |
|
1104 | |||
1041 | status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 ); |
|
1105 | status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 ); | |
1042 | if (status[1] != RTEMS_SUCCESSFUL) |
|
1106 | if (status[1] != RTEMS_SUCCESSFUL) | |
1043 | { |
|
1107 | { | |
1044 | PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1]) |
|
1108 | PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1]) | |
1045 | } |
|
1109 | } | |
1046 |
|
1110 | |||
1047 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
1111 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); | |
1048 | if (status[2] != RTEMS_SUCCESSFUL) |
|
1112 | if (status[2] != RTEMS_SUCCESSFUL) | |
1049 | { |
|
1113 | { | |
1050 | PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2]) |
|
1114 | PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2]) | |
1051 | } |
|
1115 | } | |
1052 |
|
1116 | |||
1053 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); |
|
1117 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); | |
1054 | if (status[3] != RTEMS_SUCCESSFUL) |
|
1118 | if (status[3] != RTEMS_SUCCESSFUL) | |
1055 | { |
|
1119 | { | |
1056 | PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3]) |
|
1120 | PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3]) | |
1057 | } |
|
1121 | } | |
1058 |
|
1122 | |||
1059 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); |
|
1123 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); | |
1060 | if (status[4] != RTEMS_SUCCESSFUL) |
|
1124 | if (status[4] != RTEMS_SUCCESSFUL) | |
1061 | { |
|
1125 | { | |
1062 | PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4]) |
|
1126 | PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4]) | |
1063 | } |
|
1127 | } | |
1064 |
|
1128 | |||
1065 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); |
|
1129 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); | |
1066 | if (status[5] != RTEMS_SUCCESSFUL) |
|
1130 | if (status[5] != RTEMS_SUCCESSFUL) | |
1067 | { |
|
1131 | { | |
1068 | PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5]) |
|
1132 | PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5]) | |
1069 | } |
|
1133 | } | |
1070 |
|
1134 | |||
1071 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || |
|
1135 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || | |
1072 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) |
|
1136 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) | |
1073 | { |
|
1137 | { | |
1074 | ret = RTEMS_UNSATISFIED; |
|
1138 | ret = RTEMS_UNSATISFIED; | |
1075 | } |
|
1139 | } | |
1076 |
|
1140 | |||
1077 | return ret; |
|
1141 | return ret; | |
1078 | } |
|
1142 | } | |
1079 |
|
1143 | |||
1080 | int suspend_science_tasks() |
|
1144 | int suspend_science_tasks() | |
1081 | { |
|
1145 | { | |
1082 | rtems_status_code status[6]; |
|
1146 | /** This function suspends the science tasks. | |
1083 | rtems_status_code ret; |
|
1147 | * | |
1084 |
|
1148 | * @return RTEMS directive status codes: | ||
1085 | ret = RTEMS_SUCCESSFUL; |
|
1149 | * - RTEMS_SUCCESSFUL - task restarted successfully | |
|
1150 | * - RTEMS_INVALID_ID - task id invalid | |||
|
1151 | * - RTEMS_ALREADY_SUSPENDED - task already suspended | |||
|
1152 | * | |||
|
1153 | */ | |||
1086 |
|
1154 | |||
1087 | status[0] = rtems_task_suspend( Task_id[TASKID_AVF0] ); |
|
1155 | rtems_status_code status; | |
1088 | if (status[0] != RTEMS_SUCCESSFUL) |
|
|||
1089 | { |
|
|||
1090 | PRINTF1("in suspend_science_task *** 0 ERR %d\n", status[0]) |
|
|||
1091 | } |
|
|||
1092 |
|
1156 | |||
1093 |
status |
|
1157 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); | |
1094 |
if (status |
|
1158 | if (status != RTEMS_SUCCESSFUL) | |
1095 | { |
|
1159 | { | |
1096 |
PRINTF1("in suspend_science_task *** |
|
1160 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) | |
1097 | } |
|
1161 | } | |
1098 |
|
1162 | if (status == RTEMS_SUCCESSFUL) // suspend BPF0 | ||
1099 | status[2] = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
1163 | { | |
1100 | if (status[2] != RTEMS_SUCCESSFUL) |
|
1164 | status = rtems_task_suspend( Task_id[TASKID_BPF0] ); | |
|
1165 | if (status != RTEMS_SUCCESSFUL) | |||
1101 | { |
|
1166 | { | |
1102 |
PRINTF1("in suspend_science_task *** |
|
1167 | PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status) | |
|
1168 | } | |||
|
1169 | } | |||
|
1170 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM | |||
|
1171 | { | |||
|
1172 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); | |||
|
1173 | if (status != RTEMS_SUCCESSFUL) | |||
|
1174 | { | |||
|
1175 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) | |||
|
1176 | } | |||
1103 | } |
|
1177 | } | |
1104 |
|
1178 | |||
1105 | status[3] = rtems_task_suspend( Task_id[TASKID_CWF3] ); |
|
1179 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 | |
1106 | if (status[3] != RTEMS_SUCCESSFUL) |
|
|||
1107 | { |
|
1180 | { | |
1108 | PRINTF1("in suspend_science_task *** 3 ERR %d\n", status[3]) |
|
1181 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); | |
|
1182 | if (status != RTEMS_SUCCESSFUL) | |||
|
1183 | { | |||
|
1184 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) | |||
|
1185 | } | |||
1109 | } |
|
1186 | } | |
1110 |
|
1187 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 | ||
1111 | status[4] = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
1188 | { | |
1112 | if (status[4] != RTEMS_SUCCESSFUL) |
|
1189 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); | |
|
1190 | if (status != RTEMS_SUCCESSFUL) | |||
1113 | { |
|
1191 | { | |
1114 |
PRINTF1("in suspend_science_task *** |
|
1192 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) | |
|
1193 | } | |||
|
1194 | } | |||
|
1195 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 | |||
|
1196 | { | |||
|
1197 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); | |||
|
1198 | if (status != RTEMS_SUCCESSFUL) | |||
|
1199 | { | |||
|
1200 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) | |||
|
1201 | } | |||
1115 | } |
|
1202 | } | |
1116 |
|
1203 | |||
1117 | status[5] = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
1204 | return status; | |
1118 | if (status[5] != RTEMS_SUCCESSFUL) |
|
|||
1119 | { |
|
|||
1120 | PRINTF1("in suspend_science_task *** 5 ERR %d\n", status[5]) |
|
|||
1121 | } |
|
|||
1122 |
|
||||
1123 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || |
|
|||
1124 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) |
|
|||
1125 | { |
|
|||
1126 | ret = RTEMS_UNSATISFIED; |
|
|||
1127 | } |
|
|||
1128 |
|
||||
1129 | return ret; |
|
|||
1130 | } |
|
1205 | } | |
1131 |
|
1206 | |||
1132 | //**************** |
|
1207 | //**************** | |
1133 | // CLOSING ACTIONS |
|
1208 | // CLOSING ACTIONS | |
1134 |
|
||||
1135 | int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
|||
1136 | { |
|
|||
1137 | int ret; |
|
|||
1138 | rtems_status_code status; |
|
|||
1139 | Packet_TM_LFR_TC_EXE_SUCCESS_t TM; |
|
|||
1140 | unsigned char messageSize; |
|
|||
1141 |
|
||||
1142 | ret = LFR_SUCCESSFUL; |
|
|||
1143 |
|
||||
1144 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
|||
1145 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
|||
1146 | TM.reserved = DEFAULT_RESERVED; |
|
|||
1147 | TM.userApplication = CCSDS_USER_APP; |
|
|||
1148 | // PACKET HEADER |
|
|||
1149 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
|||
1150 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
|||
1151 | TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8); |
|
|||
1152 | TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE ); |
|
|||
1153 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8); |
|
|||
1154 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS ); |
|
|||
1155 | // DATA FIELD HEADER |
|
|||
1156 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
|||
1157 | TM.serviceType = TM_TYPE_TC_EXE; |
|
|||
1158 | TM.serviceSubType = TM_SUBTYPE_EXE_OK; |
|
|||
1159 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id |
|
|||
1160 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
|||
1161 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
|||
1162 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
|||
1163 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
|||
1164 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
|||
1165 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
|||
1166 | // |
|
|||
1167 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
|||
1168 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
|||
1169 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
|||
1170 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
|||
1171 |
|
||||
1172 | messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
|||
1173 |
|
||||
1174 | // SEND DATA |
|
|||
1175 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); |
|
|||
1176 | if (status != RTEMS_SUCCESSFUL) { |
|
|||
1177 | PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n") |
|
|||
1178 | ret = LFR_DEFAULT; |
|
|||
1179 | } |
|
|||
1180 |
|
||||
1181 | return LFR_SUCCESSFUL; |
|
|||
1182 | } |
|
|||
1183 |
|
||||
1184 | int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
|||
1185 | unsigned char byte_position, unsigned char rcv_value) |
|
|||
1186 | { |
|
|||
1187 | int ret; |
|
|||
1188 | rtems_status_code status; |
|
|||
1189 | Packet_TM_LFR_TC_EXE_INCONSISTENT_t TM; |
|
|||
1190 | unsigned char messageSize; |
|
|||
1191 |
|
||||
1192 | ret = LFR_SUCCESSFUL; |
|
|||
1193 |
|
||||
1194 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
|||
1195 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
|||
1196 | TM.reserved = DEFAULT_RESERVED; |
|
|||
1197 | TM.userApplication = CCSDS_USER_APP; |
|
|||
1198 | // PACKET HEADER |
|
|||
1199 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
|||
1200 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
|||
1201 | TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8); |
|
|||
1202 | TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE ); |
|
|||
1203 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8); |
|
|||
1204 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT ); |
|
|||
1205 | // DATA FIELD HEADER |
|
|||
1206 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
|||
1207 | TM.serviceType = TM_TYPE_TC_EXE; |
|
|||
1208 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
|||
1209 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id |
|
|||
1210 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
|||
1211 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
|||
1212 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
|||
1213 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
|||
1214 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
|||
1215 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
|||
1216 | // |
|
|||
1217 | TM.tc_failure_code[0] = (char) (FAILURE_CODE_INCONSISTENT >> 8); |
|
|||
1218 | TM.tc_failure_code[1] = (char) (FAILURE_CODE_INCONSISTENT ); |
|
|||
1219 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
|||
1220 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
|||
1221 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
|||
1222 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
|||
1223 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
|||
1224 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
|||
1225 | TM.byte_position = byte_position; |
|
|||
1226 | TM.rcv_value = rcv_value; |
|
|||
1227 |
|
||||
1228 | messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
|||
1229 |
|
||||
1230 | // SEND DATA |
|
|||
1231 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); |
|
|||
1232 | if (status != RTEMS_SUCCESSFUL) { |
|
|||
1233 | PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n") |
|
|||
1234 | ret = LFR_DEFAULT; |
|
|||
1235 | } |
|
|||
1236 |
|
||||
1237 | return LFR_SUCCESSFUL; |
|
|||
1238 | } |
|
|||
1239 |
|
||||
1240 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
|||
1241 | { |
|
|||
1242 | int ret; |
|
|||
1243 | rtems_status_code status; |
|
|||
1244 | Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t TM; |
|
|||
1245 | unsigned char messageSize; |
|
|||
1246 |
|
||||
1247 | ret = LFR_SUCCESSFUL; |
|
|||
1248 |
|
||||
1249 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
|||
1250 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
|||
1251 | TM.reserved = DEFAULT_RESERVED; |
|
|||
1252 | TM.userApplication = CCSDS_USER_APP; |
|
|||
1253 | // PACKET HEADER |
|
|||
1254 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
|||
1255 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
|||
1256 | TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8); |
|
|||
1257 | TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE ); |
|
|||
1258 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8); |
|
|||
1259 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE ); |
|
|||
1260 | // DATA FIELD HEADER |
|
|||
1261 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
|||
1262 | TM.serviceType = TM_TYPE_TC_EXE; |
|
|||
1263 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
|||
1264 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id |
|
|||
1265 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
|||
1266 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
|||
1267 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
|||
1268 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
|||
1269 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
|||
1270 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
|||
1271 | // |
|
|||
1272 | TM.tc_failure_code[0] = (char) (FAILURE_CODE_NOT_EXECUTABLE >> 8); |
|
|||
1273 | TM.tc_failure_code[1] = (char) (FAILURE_CODE_NOT_EXECUTABLE ); |
|
|||
1274 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
|||
1275 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
|||
1276 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
|||
1277 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
|||
1278 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
|||
1279 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
|||
1280 | TM.lfr_status_word[0] = housekeeping_packet.lfr_status_word[0]; |
|
|||
1281 | TM.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1]; |
|
|||
1282 |
|
||||
1283 | messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
|||
1284 |
|
||||
1285 | // SEND DATA |
|
|||
1286 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); |
|
|||
1287 | if (status != RTEMS_SUCCESSFUL) { |
|
|||
1288 | PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n") |
|
|||
1289 | ret = LFR_DEFAULT; |
|
|||
1290 | } |
|
|||
1291 |
|
||||
1292 | return LFR_SUCCESSFUL; |
|
|||
1293 | } |
|
|||
1294 |
|
||||
1295 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
|||
1296 | { |
|
|||
1297 | int ret; |
|
|||
1298 | rtems_status_code status; |
|
|||
1299 | Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t TM; |
|
|||
1300 | unsigned char messageSize; |
|
|||
1301 |
|
||||
1302 | ret = LFR_SUCCESSFUL; |
|
|||
1303 |
|
||||
1304 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
|||
1305 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
|||
1306 | TM.reserved = DEFAULT_RESERVED; |
|
|||
1307 | TM.userApplication = CCSDS_USER_APP; |
|
|||
1308 | // PACKET HEADER |
|
|||
1309 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
|||
1310 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
|||
1311 | TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8); |
|
|||
1312 | TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE ); |
|
|||
1313 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8); |
|
|||
1314 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED ); |
|
|||
1315 | // DATA FIELD HEADER |
|
|||
1316 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
|||
1317 | TM.serviceType = TM_TYPE_TC_EXE; |
|
|||
1318 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
|||
1319 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id |
|
|||
1320 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
|||
1321 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
|||
1322 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
|||
1323 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
|||
1324 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
|||
1325 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
|||
1326 | // |
|
|||
1327 | TM.tc_failure_code[0] = (char) (FAILURE_CODE_NOT_IMPLEMENTED >> 8); |
|
|||
1328 | TM.tc_failure_code[1] = (char) (FAILURE_CODE_NOT_IMPLEMENTED ); |
|
|||
1329 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
|||
1330 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
|||
1331 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
|||
1332 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
|||
1333 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
|||
1334 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
|||
1335 |
|
||||
1336 | messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
|||
1337 |
|
||||
1338 | // SEND DATA |
|
|||
1339 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); |
|
|||
1340 | if (status != RTEMS_SUCCESSFUL) { |
|
|||
1341 | PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n") |
|
|||
1342 | ret = LFR_DEFAULT; |
|
|||
1343 | } |
|
|||
1344 |
|
||||
1345 | return LFR_SUCCESSFUL; |
|
|||
1346 | } |
|
|||
1347 |
|
||||
1348 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
|||
1349 | { |
|
|||
1350 | int ret; |
|
|||
1351 | rtems_status_code status; |
|
|||
1352 | Packet_TM_LFR_TC_EXE_ERROR_t TM; |
|
|||
1353 | unsigned char messageSize; |
|
|||
1354 |
|
||||
1355 | ret = LFR_SUCCESSFUL; |
|
|||
1356 |
|
||||
1357 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
|||
1358 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
|||
1359 | TM.reserved = DEFAULT_RESERVED; |
|
|||
1360 | TM.userApplication = CCSDS_USER_APP; |
|
|||
1361 | // PACKET HEADER |
|
|||
1362 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
|||
1363 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
|||
1364 | TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8); |
|
|||
1365 | TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE ); |
|
|||
1366 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8); |
|
|||
1367 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR ); |
|
|||
1368 | // DATA FIELD HEADER |
|
|||
1369 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
|||
1370 | TM.serviceType = TM_TYPE_TC_EXE; |
|
|||
1371 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
|||
1372 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id |
|
|||
1373 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
|||
1374 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
|||
1375 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
|||
1376 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
|||
1377 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
|||
1378 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
|||
1379 | // |
|
|||
1380 | TM.tc_failure_code[0] = (char) (FAILURE_CODE_ERROR >> 8); |
|
|||
1381 | TM.tc_failure_code[1] = (char) (FAILURE_CODE_ERROR ); |
|
|||
1382 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
|||
1383 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
|||
1384 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
|||
1385 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
|||
1386 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
|||
1387 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
|||
1388 |
|
||||
1389 | messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
|||
1390 |
|
||||
1391 | // SEND DATA |
|
|||
1392 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); |
|
|||
1393 | if (status != RTEMS_SUCCESSFUL) { |
|
|||
1394 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") |
|
|||
1395 | ret = LFR_DEFAULT; |
|
|||
1396 | } |
|
|||
1397 |
|
||||
1398 | return LFR_SUCCESSFUL; |
|
|||
1399 | } |
|
|||
1400 |
|
||||
1401 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC) |
|
1209 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC) | |
1402 | { |
|
1210 | { | |
1403 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; |
|
1211 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; | |
1404 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; |
|
1212 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; | |
1405 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; |
|
1213 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; | |
1406 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
1214 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; | |
1407 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
1215 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; | |
1408 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
1216 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; | |
1409 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
1217 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
1410 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
1218 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
1411 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
1219 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
1412 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
1220 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); | |
1413 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
1221 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
1414 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time); |
|
1222 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time); | |
1415 | } |
|
1223 | } | |
1416 |
|
1224 | |||
1417 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC) |
|
1225 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC) | |
1418 | { |
|
1226 | { | |
1419 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; |
|
1227 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; | |
1420 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; |
|
1228 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; | |
1421 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; |
|
1229 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; | |
1422 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
1230 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; | |
1423 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
1231 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; | |
1424 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
1232 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; | |
1425 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
1233 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
1426 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
1234 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
1427 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
1235 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
1428 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
1236 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); | |
1429 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
1237 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
1430 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time); |
|
1238 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time); | |
1431 | } |
|
1239 | } | |
1432 |
|
1240 | |||
1433 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id) |
|
1241 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id) | |
1434 | { |
|
1242 | { | |
1435 | unsigned int val = 0; |
|
1243 | unsigned int val = 0; | |
1436 | if (result == LFR_SUCCESSFUL) |
|
1244 | if (result == LFR_SUCCESSFUL) | |
1437 | { |
|
1245 | { | |
1438 | if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) ) |
|
1246 | if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) ) | |
1439 | { |
|
1247 | { | |
1440 | send_tm_lfr_tc_exe_success( TC, queue_id ); |
|
1248 | send_tm_lfr_tc_exe_success( TC, queue_id ); | |
1441 | } |
|
1249 | } | |
1442 | update_last_TC_exe( TC ); |
|
1250 | update_last_TC_exe( TC ); | |
1443 | val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1]; |
|
1251 | val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1]; | |
1444 | val++; |
|
1252 | val++; | |
1445 | housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8); |
|
1253 | housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8); | |
1446 | housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val); |
|
1254 | housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val); | |
1447 | } |
|
1255 | } | |
1448 | else |
|
1256 | else | |
1449 | { |
|
1257 | { | |
1450 | update_last_TC_rej( TC ); |
|
1258 | update_last_TC_rej( TC ); | |
1451 | val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1]; |
|
1259 | val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1]; | |
1452 | val++; |
|
1260 | val++; | |
1453 | housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8); |
|
1261 | housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8); | |
1454 | housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val); |
|
1262 | housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val); | |
1455 | } |
|
1263 | } | |
1456 | } |
|
1264 | } | |
1457 |
|
1265 | |||
1458 | //*************************** |
|
1266 | //*************************** | |
1459 | // Interrupt Service Routines |
|
1267 | // Interrupt Service Routines | |
1460 | rtems_isr commutation_isr1( rtems_vector_number vector ) |
|
1268 | rtems_isr commutation_isr1( rtems_vector_number vector ) | |
1461 | { |
|
1269 | { | |
1462 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
1270 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
1463 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); |
|
1271 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); | |
1464 | } |
|
1272 | } | |
1465 | } |
|
1273 | } | |
1466 |
|
1274 | |||
1467 | rtems_isr commutation_isr2( rtems_vector_number vector ) |
|
1275 | rtems_isr commutation_isr2( rtems_vector_number vector ) | |
1468 | { |
|
1276 | { | |
1469 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
1277 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
1470 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); |
|
1278 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); | |
1471 | } |
|
1279 | } | |
1472 | } |
|
1280 | } | |
1473 |
|
1281 | |||
1474 |
|
1282 | |||
1475 |
|
1283 | |||
1476 |
|
1284 |
@@ -1,973 +1,1106 | |||||
1 | #include <wf_handler.h> |
|
1 | /** Functions and tasks related to waveform packet generation. | |
|
2 | * | |||
|
3 | * @file | |||
|
4 | * @author P. LEROY | |||
|
5 | * | |||
|
6 | * A group of functions to handle waveforms, in snapshot or continuous format.\n | |||
|
7 | * | |||
|
8 | */ | |||
|
9 | ||||
|
10 | #include "wf_handler.h" | |||
2 |
|
11 | |||
3 | // SWF |
|
12 | // SWF | |
4 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7]; |
|
13 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7]; | |
5 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7]; |
|
14 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7]; | |
6 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7]; |
|
15 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7]; | |
7 | // CWF |
|
16 | // CWF | |
8 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7]; |
|
17 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7]; | |
9 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7]; |
|
18 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7]; | |
10 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7]; |
|
19 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7]; | |
11 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7]; |
|
20 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7]; | |
12 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7]; |
|
21 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7]; | |
13 |
|
22 | |||
14 | unsigned char doubleSendCWF1 = 0; |
|
23 | unsigned char doubleSendCWF1 = 0; | |
15 | unsigned char doubleSendCWF2 = 0; |
|
24 | unsigned char doubleSendCWF2 = 0; | |
16 |
|
25 | |||
17 | rtems_isr waveforms_isr( rtems_vector_number vector ) |
|
26 | rtems_isr waveforms_isr( rtems_vector_number vector ) | |
18 | { |
|
27 | { | |
19 |
|
28 | |||
20 | #ifdef GSA |
|
29 | #ifdef GSA | |
21 | #else |
|
30 | #else | |
22 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
31 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
23 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
32 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
24 | { // in modes other than STANDBY and BURST, send the CWF_F3 data |
|
33 | { // in modes other than STANDBY and BURST, send the CWF_F3 data | |
25 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full |
|
34 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full | |
26 | // (1) change the receiving buffer for the waveform picker |
|
35 | // (1) change the receiving buffer for the waveform picker | |
27 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) { |
|
36 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) { | |
28 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_bis); |
|
37 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_bis); | |
29 | } |
|
38 | } | |
30 | else { |
|
39 | else { | |
31 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); |
|
40 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); | |
32 | } |
|
41 | } | |
33 | // (2) send an event for the waveforms transmission |
|
42 | // (2) send an event for the waveforms transmission | |
34 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
43 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
35 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
44 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
36 | } |
|
45 | } | |
37 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] |
|
46 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] | |
38 | } |
|
47 | } | |
39 | } |
|
48 | } | |
40 | #endif |
|
49 | #endif | |
41 |
|
50 | |||
42 | switch(lfrCurrentMode) |
|
51 | switch(lfrCurrentMode) | |
43 | { |
|
52 | { | |
44 | //******** |
|
53 | //******** | |
45 | // STANDBY |
|
54 | // STANDBY | |
46 | case(LFR_MODE_STANDBY): |
|
55 | case(LFR_MODE_STANDBY): | |
47 | break; |
|
56 | break; | |
48 |
|
57 | |||
49 | //****** |
|
58 | //****** | |
50 | // NORMAL |
|
59 | // NORMAL | |
51 | case(LFR_MODE_NORMAL): |
|
60 | case(LFR_MODE_NORMAL): | |
52 | #ifdef GSA |
|
61 | #ifdef GSA | |
53 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
62 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") | |
54 | #else |
|
63 | #else | |
55 | if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){ // if no channel is enable |
|
64 | if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){ // if no channel is enable | |
56 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
65 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
57 | } |
|
66 | } | |
58 | else { |
|
67 | else { | |
59 | if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full |
|
68 | if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full | |
60 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable & 0x08; |
|
69 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable & 0x08; | |
61 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
70 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { | |
62 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
71 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
63 | } |
|
72 | } | |
64 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00; |
|
73 | waveform_picker_regs->status = waveform_picker_regs->status & 0x00; | |
65 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x07; // [0111] enable f2 f1 f0 |
|
74 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x07; // [0111] enable f2 f1 f0 | |
66 | } |
|
75 | } | |
67 | } |
|
76 | } | |
68 | #endif |
|
77 | #endif | |
69 | break; |
|
78 | break; | |
70 |
|
79 | |||
71 | //****** |
|
80 | //****** | |
72 | // BURST |
|
81 | // BURST | |
73 | case(LFR_MODE_BURST): |
|
82 | case(LFR_MODE_BURST): | |
74 | #ifdef GSA |
|
83 | #ifdef GSA | |
75 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
84 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") | |
76 | #else |
|
85 | #else | |
77 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit |
|
86 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit | |
78 | // (1) change the receiving buffer for the waveform picker |
|
87 | // (1) change the receiving buffer for the waveform picker | |
79 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { |
|
88 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { | |
80 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); |
|
89 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); | |
81 | } |
|
90 | } | |
82 | else { |
|
91 | else { | |
83 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); |
|
92 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); | |
84 | } |
|
93 | } | |
85 | // (2) send an event for the waveforms transmission |
|
94 | // (2) send an event for the waveforms transmission | |
86 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { |
|
95 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { | |
87 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
96 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
88 | } |
|
97 | } | |
89 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0 |
|
98 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0 | |
90 | } |
|
99 | } | |
91 | #endif |
|
100 | #endif | |
92 | break; |
|
101 | break; | |
93 |
|
102 | |||
94 | //***** |
|
103 | //***** | |
95 | // SBM1 |
|
104 | // SBM1 | |
96 | case(LFR_MODE_SBM1): |
|
105 | case(LFR_MODE_SBM1): | |
97 | #ifdef GSA |
|
106 | #ifdef GSA | |
98 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
107 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") | |
99 | #else |
|
108 | #else | |
100 | if ((waveform_picker_regs->status & 0x02) == 0x02){ // [0010] check the f1 full bit |
|
109 | if ((waveform_picker_regs->status & 0x02) == 0x02){ // [0010] check the f1 full bit | |
101 | // (1) change the receiving buffer for the waveform picker |
|
110 | // (1) change the receiving buffer for the waveform picker | |
102 | if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) ) |
|
111 | if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) ) | |
103 | { |
|
112 | { | |
104 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_norm); |
|
113 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_norm); | |
105 | } |
|
114 | } | |
106 | else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1_norm ) |
|
115 | else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1_norm ) | |
107 | { |
|
116 | { | |
108 | doubleSendCWF1 = 1; |
|
117 | doubleSendCWF1 = 1; | |
109 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); |
|
118 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); | |
110 | } |
|
119 | } | |
111 | else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1 ) { |
|
120 | else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1 ) { | |
112 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis); |
|
121 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis); | |
113 | } |
|
122 | } | |
114 | else { |
|
123 | else { | |
115 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); |
|
124 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); | |
116 | } |
|
125 | } | |
117 | // (2) send an event for the waveforms transmission |
|
126 | // (2) send an event for the waveforms transmission | |
118 | if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) { |
|
127 | if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) { | |
119 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
128 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
120 | } |
|
129 | } | |
121 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0 |
|
130 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0 | |
122 | } |
|
131 | } | |
123 | if ( ( (waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] check the f2 and f0 full bit |
|
132 | if ( ( (waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] check the f2 and f0 full bit | |
124 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
133 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { | |
125 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
134 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
126 | } |
|
135 | } | |
127 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0 |
|
136 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0 | |
128 | reset_local_sbm1_nb_cwf_sent(); |
|
137 | reset_local_sbm1_nb_cwf_sent(); | |
129 | } |
|
138 | } | |
130 |
|
139 | |||
131 | #endif |
|
140 | #endif | |
132 | break; |
|
141 | break; | |
133 |
|
142 | |||
134 | //***** |
|
143 | //***** | |
135 | // SBM2 |
|
144 | // SBM2 | |
136 | case(LFR_MODE_SBM2): |
|
145 | case(LFR_MODE_SBM2): | |
137 | #ifdef GSA |
|
146 | #ifdef GSA | |
138 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
147 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") | |
139 | #else |
|
148 | #else | |
140 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit |
|
149 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit | |
141 | // (1) change the receiving buffer for the waveform picker |
|
150 | // (1) change the receiving buffer for the waveform picker | |
142 | if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) ) |
|
151 | if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) ) | |
143 | { |
|
152 | { | |
144 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_norm); |
|
153 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_norm); | |
145 | } |
|
154 | } | |
146 | else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2_norm ) { |
|
155 | else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2_norm ) { | |
147 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); |
|
156 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); | |
148 | doubleSendCWF2 = 1; |
|
157 | doubleSendCWF2 = 1; | |
149 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2_WFRM ) != RTEMS_SUCCESSFUL) { |
|
158 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2_WFRM ) != RTEMS_SUCCESSFUL) { | |
150 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
159 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
151 | } |
|
160 | } | |
152 | reset_local_sbm2_nb_cwf_sent(); |
|
161 | reset_local_sbm2_nb_cwf_sent(); | |
153 | } |
|
162 | } | |
154 | else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) { |
|
163 | else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) { | |
155 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); |
|
164 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); | |
156 | } |
|
165 | } | |
157 | else { |
|
166 | else { | |
158 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); |
|
167 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); | |
159 | } |
|
168 | } | |
160 | // (2) send an event for the waveforms transmission |
|
169 | // (2) send an event for the waveforms transmission | |
161 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { |
|
170 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { | |
162 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
171 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
163 | } |
|
172 | } | |
164 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
173 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 | |
165 | } |
|
174 | } | |
166 | if ( ( (waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, f1 and f0 are full |
|
175 | if ( ( (waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, f1 and f0 are full | |
167 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { |
|
176 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { | |
168 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
177 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
169 | } |
|
178 | } | |
170 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 |
|
179 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 | |
171 | } |
|
180 | } | |
172 | #endif |
|
181 | #endif | |
173 | break; |
|
182 | break; | |
174 |
|
183 | |||
175 | //******** |
|
184 | //******** | |
176 | // DEFAULT |
|
185 | // DEFAULT | |
177 | default: |
|
186 | default: | |
178 | break; |
|
187 | break; | |
179 | } |
|
188 | } | |
180 | } |
|
189 | } | |
181 |
|
190 | |||
182 | rtems_isr waveforms_simulator_isr( rtems_vector_number vector ) |
|
191 | rtems_isr waveforms_simulator_isr( rtems_vector_number vector ) | |
183 | { |
|
192 | { | |
184 | unsigned char lfrMode; |
|
193 | unsigned char lfrMode; | |
185 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
194 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
186 |
|
195 | |||
187 | switch(lfrMode) { |
|
196 | switch(lfrMode) { | |
188 | case (LFR_MODE_STANDBY): |
|
197 | case (LFR_MODE_STANDBY): | |
189 | break; |
|
198 | break; | |
190 | case (LFR_MODE_NORMAL): |
|
199 | case (LFR_MODE_NORMAL): | |
191 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
200 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { | |
192 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_5 ); |
|
201 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_5 ); | |
193 | } |
|
202 | } | |
194 | break; |
|
203 | break; | |
195 | case (LFR_MODE_BURST): |
|
204 | case (LFR_MODE_BURST): | |
196 | break; |
|
205 | break; | |
197 | case (LFR_MODE_SBM1): |
|
206 | case (LFR_MODE_SBM1): | |
198 | break; |
|
207 | break; | |
199 | case (LFR_MODE_SBM2): |
|
208 | case (LFR_MODE_SBM2): | |
200 | break; |
|
209 | break; | |
201 | } |
|
210 | } | |
202 | } |
|
211 | } | |
203 |
|
212 | |||
204 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
213 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
205 | { |
|
214 | { | |
206 | rtems_event_set event_out; |
|
215 | rtems_event_set event_out; | |
207 | rtems_id queue_id; |
|
216 | rtems_id queue_id; | |
208 | rtems_status_code status; |
|
217 | rtems_status_code status; | |
209 |
|
218 | |||
210 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); |
|
219 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); | |
211 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); |
|
220 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); | |
212 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); |
|
221 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); | |
213 |
|
222 | |||
214 | init_waveforms(); |
|
223 | init_waveforms(); | |
215 |
|
224 | |||
216 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); |
|
225 | status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id ); | |
217 | if (status != RTEMS_SUCCESSFUL) |
|
226 | if (status != RTEMS_SUCCESSFUL) | |
218 | { |
|
227 | { | |
219 | PRINTF1("in WFRM *** ERR getting queue id, %d\n", status) |
|
228 | PRINTF1("in WFRM *** ERR getting queue id, %d\n", status) | |
220 | } |
|
229 | } | |
221 |
|
230 | |||
222 | BOOT_PRINTF("in WFRM ***\n") |
|
231 | BOOT_PRINTF("in WFRM ***\n") | |
223 |
|
232 | |||
224 | while(1){ |
|
233 | while(1){ | |
225 | // wait for an RTEMS_EVENT |
|
234 | // wait for an RTEMS_EVENT | |
226 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 |
|
235 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 | |
227 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, |
|
236 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, | |
228 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
237 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
229 |
|
238 | |||
230 | if (event_out == RTEMS_EVENT_MODE_NORMAL) |
|
239 | if (event_out == RTEMS_EVENT_MODE_NORMAL) | |
231 | { |
|
240 | { | |
232 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
241 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
233 | send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
242 | send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
234 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
243 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
235 | #ifdef GSA |
|
244 | #ifdef GSA | |
236 | waveform_picker_regs->status = waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0 |
|
245 | waveform_picker_regs->status = waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0 | |
237 | #endif |
|
246 | #endif | |
238 | } |
|
247 | } | |
239 | else if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
248 | else if (event_out == RTEMS_EVENT_MODE_SBM1) | |
240 | { |
|
249 | { | |
241 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
250 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
242 | send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
251 | send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
243 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
252 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
244 | #ifdef GSA |
|
253 | #ifdef GSA | |
245 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0 |
|
254 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0 | |
246 | #endif |
|
255 | #endif | |
247 | } |
|
256 | } | |
248 | else if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
257 | else if (event_out == RTEMS_EVENT_MODE_SBM2) | |
249 | { |
|
258 | { | |
250 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
259 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
251 | send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
260 | send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
252 | #ifdef GSA |
|
261 | #ifdef GSA | |
253 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 |
|
262 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 | |
254 | #endif |
|
263 | #endif | |
255 | } |
|
264 | } | |
256 | else if (event_out == RTEMS_EVENT_MODE_SBM2_WFRM) |
|
265 | else if (event_out == RTEMS_EVENT_MODE_SBM2_WFRM) | |
257 | { |
|
266 | { | |
258 | send_waveform_SWF(wf_snap_f2_norm, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
267 | send_waveform_SWF(wf_snap_f2_norm, SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
259 | } |
|
268 | } | |
260 | else |
|
269 | else | |
261 | { |
|
270 | { | |
262 | PRINTF("in WFRM *** unexpected event") |
|
271 | PRINTF("in WFRM *** unexpected event") | |
263 | } |
|
272 | } | |
264 |
|
273 | |||
265 |
|
274 | |||
266 | #ifdef GSA |
|
275 | #ifdef GSA | |
267 | // irq processed, reset the related register of the timer unit |
|
276 | // irq processed, reset the related register of the timer unit | |
268 | gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl = gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl | 0x00000010; |
|
277 | gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl = gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl | 0x00000010; | |
269 | // clear the interruption |
|
278 | // clear the interruption | |
270 | LEON_Unmask_interrupt( IRQ_WF ); |
|
279 | LEON_Unmask_interrupt( IRQ_WF ); | |
271 | #endif |
|
280 | #endif | |
272 | } |
|
281 | } | |
273 | } |
|
282 | } | |
274 |
|
283 | |||
275 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
284 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP | |
276 | { |
|
285 | { | |
277 | rtems_event_set event_out; |
|
286 | rtems_event_set event_out; | |
278 | rtems_id queue_id; |
|
287 | rtems_id queue_id; | |
279 |
|
288 | |||
280 | init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 ); |
|
289 | init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 ); | |
281 | init_header_continuous_wf3_light_table( headerCWF_F3_light ); |
|
290 | init_header_continuous_wf3_light_table( headerCWF_F3_light ); | |
282 |
|
291 | |||
283 | queue_id = get_pkts_queue_id(); |
|
292 | queue_id = get_pkts_queue_id(); | |
284 |
|
293 | |||
285 | BOOT_PRINTF("in CWF3 ***\n") |
|
294 | BOOT_PRINTF("in CWF3 ***\n") | |
286 |
|
295 | |||
287 | while(1){ |
|
296 | while(1){ | |
288 | // wait for an RTEMS_EVENT |
|
297 | // wait for an RTEMS_EVENT | |
289 | rtems_event_receive( RTEMS_EVENT_0, |
|
298 | rtems_event_receive( RTEMS_EVENT_0, | |
290 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
299 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
291 | PRINTF("send CWF F3 \n") |
|
300 | PRINTF("send CWF F3 \n") | |
292 | #ifdef GSA |
|
301 | #ifdef GSA | |
293 | #else |
|
302 | #else | |
294 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) { |
|
303 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) { | |
295 | send_waveform_CWF3_light( wf_cont_f3_bis, headerCWF_F3_light, queue_id ); |
|
304 | send_waveform_CWF3_light( wf_cont_f3_bis, headerCWF_F3_light, queue_id ); | |
296 | } |
|
305 | } | |
297 | else { |
|
306 | else { | |
298 | send_waveform_CWF3_light( wf_cont_f3, headerCWF_F3_light, queue_id ); |
|
307 | send_waveform_CWF3_light( wf_cont_f3, headerCWF_F3_light, queue_id ); | |
299 | } |
|
308 | } | |
300 | #endif |
|
309 | #endif | |
301 | } |
|
310 | } | |
302 | } |
|
311 | } | |
303 |
|
312 | |||
304 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 |
|
313 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 | |
305 | { |
|
314 | { | |
306 | rtems_event_set event_out; |
|
315 | rtems_event_set event_out; | |
307 | rtems_id queue_id; |
|
316 | rtems_id queue_id; | |
308 |
|
317 | |||
309 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); |
|
318 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); | |
310 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); |
|
319 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); | |
311 |
|
320 | |||
312 | queue_id = get_pkts_queue_id(); |
|
321 | queue_id = get_pkts_queue_id(); | |
313 |
|
322 | |||
314 | BOOT_PRINTF("in CWF2 ***\n") |
|
323 | BOOT_PRINTF("in CWF2 ***\n") | |
315 |
|
324 | |||
316 | while(1){ |
|
325 | while(1){ | |
317 | // wait for an RTEMS_EVENT |
|
326 | // wait for an RTEMS_EVENT | |
318 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, |
|
327 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, | |
319 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
328 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
320 |
|
329 | |||
321 | if (event_out == RTEMS_EVENT_MODE_BURST) |
|
330 | if (event_out == RTEMS_EVENT_MODE_BURST) | |
322 | { |
|
331 | { | |
323 | // F2 |
|
332 | // F2 | |
324 | #ifdef GSA |
|
333 | #ifdef GSA | |
325 | #else |
|
334 | #else | |
326 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { |
|
335 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { | |
327 | send_waveform_CWF( wf_snap_f2_bis, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); |
|
336 | send_waveform_CWF( wf_snap_f2_bis, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); | |
328 | } |
|
337 | } | |
329 | else { |
|
338 | else { | |
330 | send_waveform_CWF( wf_snap_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); |
|
339 | send_waveform_CWF( wf_snap_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); | |
331 | } |
|
340 | } | |
332 | #endif |
|
341 | #endif | |
333 | } |
|
342 | } | |
334 |
|
343 | |||
335 | else if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
344 | else if (event_out == RTEMS_EVENT_MODE_SBM2) | |
336 | { |
|
345 | { | |
337 | #ifdef GSA |
|
346 | #ifdef GSA | |
338 | #else |
|
347 | #else | |
339 | if (doubleSendCWF2 == 1) |
|
348 | if (doubleSendCWF2 == 1) | |
340 | { |
|
349 | { | |
341 | doubleSendCWF2 = 0; |
|
350 | doubleSendCWF2 = 0; | |
342 | send_waveform_CWF( wf_snap_f2_norm, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
351 | send_waveform_CWF( wf_snap_f2_norm, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); | |
343 | } |
|
352 | } | |
344 | else if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { |
|
353 | else if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { | |
345 | send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
354 | send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); | |
346 | } |
|
355 | } | |
347 | else { |
|
356 | else { | |
348 | send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
357 | send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); | |
349 | } |
|
358 | } | |
350 | param_local.local_sbm2_nb_cwf_sent ++; |
|
359 | param_local.local_sbm2_nb_cwf_sent ++; | |
351 | #endif |
|
360 | #endif | |
352 | } |
|
361 | } | |
353 | else |
|
362 | else | |
354 | { |
|
363 | { | |
355 | PRINTF1("in CWF2 *** ERR mode = %d\n", lfrCurrentMode) |
|
364 | PRINTF1("in CWF2 *** ERR mode = %d\n", lfrCurrentMode) | |
356 | } |
|
365 | } | |
357 | } |
|
366 | } | |
358 | } |
|
367 | } | |
359 |
|
368 | |||
360 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 |
|
369 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 | |
361 | { |
|
370 | { | |
362 | rtems_event_set event_out; |
|
371 | rtems_event_set event_out; | |
363 | rtems_id queue_id; |
|
372 | rtems_id queue_id; | |
364 |
|
373 | |||
365 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); |
|
374 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); | |
366 |
|
375 | |||
367 | queue_id = get_pkts_queue_id(); |
|
376 | queue_id = get_pkts_queue_id(); | |
368 |
|
377 | |||
369 | BOOT_PRINTF("in CWF1 ***\n") |
|
378 | BOOT_PRINTF("in CWF1 ***\n") | |
370 |
|
379 | |||
371 | while(1){ |
|
380 | while(1){ | |
372 | // wait for an RTEMS_EVENT |
|
381 | // wait for an RTEMS_EVENT | |
373 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, |
|
382 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, | |
374 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
383 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
375 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
384 | if (event_out == RTEMS_EVENT_MODE_SBM1) | |
376 | { |
|
385 | { | |
377 | #ifdef GSA |
|
386 | #ifdef GSA | |
378 | #else |
|
387 | #else | |
379 | if (doubleSendCWF1 == 1) |
|
388 | if (doubleSendCWF1 == 1) | |
380 | { |
|
389 | { | |
381 | doubleSendCWF1 = 0; |
|
390 | doubleSendCWF1 = 0; | |
382 | send_waveform_CWF( wf_snap_f1_norm, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
391 | send_waveform_CWF( wf_snap_f1_norm, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); | |
383 | } |
|
392 | } | |
384 | else if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) { |
|
393 | else if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) { | |
385 | send_waveform_CWF( wf_snap_f1_bis, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
394 | send_waveform_CWF( wf_snap_f1_bis, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); | |
386 | } |
|
395 | } | |
387 | else { |
|
396 | else { | |
388 | send_waveform_CWF( wf_snap_f1, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
397 | send_waveform_CWF( wf_snap_f1, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); | |
389 | } |
|
398 | } | |
390 | param_local.local_sbm1_nb_cwf_sent ++; |
|
399 | param_local.local_sbm1_nb_cwf_sent ++; | |
391 | #endif |
|
400 | #endif | |
392 | } |
|
401 | } | |
393 | else |
|
402 | else | |
394 | { |
|
403 | { | |
395 | PRINTF1("in CWF1 *** ERR mode = %d\n", lfrCurrentMode) |
|
404 | PRINTF1("in CWF1 *** ERR mode = %d\n", lfrCurrentMode) | |
396 | } |
|
405 | } | |
397 | } |
|
406 | } | |
398 | } |
|
407 | } | |
399 |
|
408 | |||
400 | //****************** |
|
409 | //****************** | |
401 | // general functions |
|
410 | // general functions | |
402 | void init_waveforms( void ) |
|
411 | void init_waveforms( void ) | |
403 | { |
|
412 | { | |
404 | int i = 0; |
|
413 | int i = 0; | |
405 |
|
414 | |||
406 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
415 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) | |
407 | { |
|
416 | { | |
408 | //*** |
|
417 | //*** | |
409 | // F0 |
|
418 | // F0 | |
410 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; // |
|
419 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; // | |
411 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; // |
|
420 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; // | |
412 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; // |
|
421 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; // | |
413 |
|
422 | |||
414 | //*** |
|
423 | //*** | |
415 | // F1 |
|
424 | // F1 | |
416 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111; |
|
425 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111; | |
417 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333; |
|
426 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333; | |
418 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
427 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; | |
419 |
|
428 | |||
420 | //*** |
|
429 | //*** | |
421 | // F2 |
|
430 | // F2 | |
422 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333; |
|
431 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333; | |
423 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; |
|
432 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; | |
424 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
433 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; | |
425 |
|
434 | |||
426 | //*** |
|
435 | //*** | |
427 | // F3 |
|
436 | // F3 | |
428 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1; |
|
437 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1; | |
429 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2; |
|
438 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2; | |
430 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000; |
|
439 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000; | |
431 | } |
|
440 | } | |
432 | } |
|
441 | } | |
433 |
|
442 | |||
434 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) |
|
443 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) | |
435 | { |
|
444 | { | |
436 | unsigned char i; |
|
445 | unsigned char i; | |
437 |
|
446 | |||
438 | for (i=0; i<7; i++) |
|
447 | for (i=0; i<7; i++) | |
439 | { |
|
448 | { | |
440 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
449 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
441 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
450 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
442 | headerSWF[ i ].reserved = DEFAULT_RESERVED; |
|
451 | headerSWF[ i ].reserved = DEFAULT_RESERVED; | |
443 | headerSWF[ i ].userApplication = CCSDS_USER_APP; |
|
452 | headerSWF[ i ].userApplication = CCSDS_USER_APP; | |
444 | headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
453 | headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |
445 | headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
454 | headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |
446 | if (i == 0) |
|
455 | if (i == 0) | |
447 | { |
|
456 | { | |
448 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; |
|
457 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; | |
449 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8); |
|
458 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8); | |
450 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 ); |
|
459 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 ); | |
451 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
460 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
452 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
461 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
453 | } |
|
462 | } | |
454 | else if (i == 6) |
|
463 | else if (i == 6) | |
455 | { |
|
464 | { | |
456 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; |
|
465 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; | |
457 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8); |
|
466 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8); | |
458 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 ); |
|
467 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 ); | |
459 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); |
|
468 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); | |
460 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); |
|
469 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); | |
461 | } |
|
470 | } | |
462 | else |
|
471 | else | |
463 | { |
|
472 | { | |
464 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; |
|
473 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; | |
465 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8); |
|
474 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8); | |
466 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 ); |
|
475 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 ); | |
467 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
476 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
468 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
477 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
469 | } |
|
478 | } | |
470 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
479 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
471 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT |
|
480 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT | |
472 | headerSWF[ i ].pktNr = i+1; // PKT_NR |
|
481 | headerSWF[ i ].pktNr = i+1; // PKT_NR | |
473 | // DATA FIELD HEADER |
|
482 | // DATA FIELD HEADER | |
474 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
483 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
475 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
484 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
476 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
485 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
477 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
486 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
478 | // AUXILIARY DATA HEADER |
|
487 | // AUXILIARY DATA HEADER | |
479 | headerSWF[ i ].sid = sid; |
|
488 | headerSWF[ i ].sid = sid; | |
480 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
489 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; | |
481 | headerSWF[ i ].time[0] = 0x00; |
|
490 | headerSWF[ i ].time[0] = 0x00; | |
482 | headerSWF[ i ].time[0] = 0x00; |
|
491 | headerSWF[ i ].time[0] = 0x00; | |
483 | headerSWF[ i ].time[0] = 0x00; |
|
492 | headerSWF[ i ].time[0] = 0x00; | |
484 | headerSWF[ i ].time[0] = 0x00; |
|
493 | headerSWF[ i ].time[0] = 0x00; | |
485 | headerSWF[ i ].time[0] = 0x00; |
|
494 | headerSWF[ i ].time[0] = 0x00; | |
486 | headerSWF[ i ].time[0] = 0x00; |
|
495 | headerSWF[ i ].time[0] = 0x00; | |
487 | } |
|
496 | } | |
488 | return LFR_SUCCESSFUL; |
|
497 | return LFR_SUCCESSFUL; | |
489 | } |
|
498 | } | |
490 |
|
499 | |||
491 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
500 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) | |
492 | { |
|
501 | { | |
493 | unsigned int i; |
|
502 | unsigned int i; | |
494 |
|
503 | |||
495 | for (i=0; i<7; i++) |
|
504 | for (i=0; i<7; i++) | |
496 | { |
|
505 | { | |
497 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
506 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
498 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
507 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
499 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
508 | headerCWF[ i ].reserved = DEFAULT_RESERVED; | |
500 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
509 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
501 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) |
|
510 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) | |
502 | { |
|
511 | { | |
503 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8); |
|
512 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8); | |
504 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2); |
|
513 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2); | |
505 | } |
|
514 | } | |
506 | else |
|
515 | else | |
507 | { |
|
516 | { | |
508 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
517 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |
509 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
518 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |
510 | } |
|
519 | } | |
511 | if (i == 0) |
|
520 | if (i == 0) | |
512 | { |
|
521 | { | |
513 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; |
|
522 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; | |
514 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8); |
|
523 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8); | |
515 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 ); |
|
524 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 ); | |
516 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
525 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
517 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
526 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
518 | } |
|
527 | } | |
519 | else if (i == 6) |
|
528 | else if (i == 6) | |
520 | { |
|
529 | { | |
521 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; |
|
530 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; | |
522 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8); |
|
531 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8); | |
523 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 ); |
|
532 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 ); | |
524 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); |
|
533 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); | |
525 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); |
|
534 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); | |
526 | } |
|
535 | } | |
527 | else |
|
536 | else | |
528 | { |
|
537 | { | |
529 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; |
|
538 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; | |
530 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8); |
|
539 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8); | |
531 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 ); |
|
540 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 ); | |
532 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
541 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
533 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
542 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
534 | } |
|
543 | } | |
535 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
544 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
536 | // PKT_CNT |
|
545 | // PKT_CNT | |
537 | // PKT_NR |
|
546 | // PKT_NR | |
538 | // DATA FIELD HEADER |
|
547 | // DATA FIELD HEADER | |
539 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
548 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
540 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
549 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
541 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
550 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
542 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
551 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
543 | // AUXILIARY DATA HEADER |
|
552 | // AUXILIARY DATA HEADER | |
544 | headerCWF[ i ].sid = sid; |
|
553 | headerCWF[ i ].sid = sid; | |
545 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
554 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; | |
546 | headerCWF[ i ].time[0] = 0x00; |
|
555 | headerCWF[ i ].time[0] = 0x00; | |
547 | headerCWF[ i ].time[0] = 0x00; |
|
556 | headerCWF[ i ].time[0] = 0x00; | |
548 | headerCWF[ i ].time[0] = 0x00; |
|
557 | headerCWF[ i ].time[0] = 0x00; | |
549 | headerCWF[ i ].time[0] = 0x00; |
|
558 | headerCWF[ i ].time[0] = 0x00; | |
550 | headerCWF[ i ].time[0] = 0x00; |
|
559 | headerCWF[ i ].time[0] = 0x00; | |
551 | headerCWF[ i ].time[0] = 0x00; |
|
560 | headerCWF[ i ].time[0] = 0x00; | |
552 | } |
|
561 | } | |
553 | return LFR_SUCCESSFUL; |
|
562 | return LFR_SUCCESSFUL; | |
554 | } |
|
563 | } | |
555 |
|
564 | |||
556 | int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
565 | int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) | |
557 | { |
|
566 | { | |
558 | unsigned int i; |
|
567 | unsigned int i; | |
559 |
|
568 | |||
560 | for (i=0; i<7; i++) |
|
569 | for (i=0; i<7; i++) | |
561 | { |
|
570 | { | |
562 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
571 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
563 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
572 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
564 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
573 | headerCWF[ i ].reserved = DEFAULT_RESERVED; | |
565 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
574 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
566 |
|
575 | |||
567 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
576 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |
568 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
577 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |
569 | if (i == 0) |
|
578 | if (i == 0) | |
570 | { |
|
579 | { | |
571 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; |
|
580 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; | |
572 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8); |
|
581 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8); | |
573 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 ); |
|
582 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 ); | |
574 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
583 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
575 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
584 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
576 | } |
|
585 | } | |
577 | else if (i == 6) |
|
586 | else if (i == 6) | |
578 | { |
|
587 | { | |
579 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; |
|
588 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; | |
580 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 >> 8); |
|
589 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 >> 8); | |
581 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 ); |
|
590 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 ); | |
582 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); |
|
591 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); | |
583 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); |
|
592 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); | |
584 | } |
|
593 | } | |
585 | else |
|
594 | else | |
586 | { |
|
595 | { | |
587 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; |
|
596 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; | |
588 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8); |
|
597 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8); | |
589 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 ); |
|
598 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 ); | |
590 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
599 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
591 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
600 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
592 | } |
|
601 | } | |
593 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
602 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
594 | // DATA FIELD HEADER |
|
603 | // DATA FIELD HEADER | |
595 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
604 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
596 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
605 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
597 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
606 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
598 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
607 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
599 | // AUXILIARY DATA HEADER |
|
608 | // AUXILIARY DATA HEADER | |
600 | headerCWF[ i ].sid = SID_NORM_CWF_F3; |
|
609 | headerCWF[ i ].sid = SID_NORM_CWF_F3; | |
601 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
610 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; | |
602 | headerCWF[ i ].time[0] = 0x00; |
|
611 | headerCWF[ i ].time[0] = 0x00; | |
603 | headerCWF[ i ].time[0] = 0x00; |
|
612 | headerCWF[ i ].time[0] = 0x00; | |
604 | headerCWF[ i ].time[0] = 0x00; |
|
613 | headerCWF[ i ].time[0] = 0x00; | |
605 | headerCWF[ i ].time[0] = 0x00; |
|
614 | headerCWF[ i ].time[0] = 0x00; | |
606 | headerCWF[ i ].time[0] = 0x00; |
|
615 | headerCWF[ i ].time[0] = 0x00; | |
607 | headerCWF[ i ].time[0] = 0x00; |
|
616 | headerCWF[ i ].time[0] = 0x00; | |
608 | } |
|
617 | } | |
609 | return LFR_SUCCESSFUL; |
|
618 | return LFR_SUCCESSFUL; | |
610 | } |
|
619 | } | |
611 |
|
620 | |||
612 | void reset_waveforms( void ) |
|
621 | void reset_waveforms( void ) | |
613 | { |
|
622 | { | |
614 | int i = 0; |
|
623 | int i = 0; | |
615 |
|
624 | |||
616 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
625 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) | |
617 | { |
|
626 | { | |
618 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000; |
|
627 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000; | |
619 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000; |
|
628 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000; | |
620 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000; |
|
629 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000; | |
621 |
|
630 | |||
622 | //*** |
|
631 | //*** | |
623 | // F1 |
|
632 | // F1 | |
624 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000; |
|
633 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000; | |
625 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000; |
|
634 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000; | |
626 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000; |
|
635 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000; | |
627 |
|
636 | |||
628 | //*** |
|
637 | //*** | |
629 | // F2 |
|
638 | // F2 | |
630 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000; |
|
639 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000; | |
631 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000; |
|
640 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000; | |
632 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000; |
|
641 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000; | |
633 |
|
642 | |||
634 | //*** |
|
643 | //*** | |
635 | // F3 |
|
644 | // F3 | |
636 | /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1 |
|
645 | /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1 | |
637 | wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1 |
|
646 | wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1 | |
638 | wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/ |
|
647 | wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/ | |
639 | } |
|
648 | } | |
640 | } |
|
649 | } | |
641 |
|
650 | |||
642 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, |
|
651 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, | |
643 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) |
|
652 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) | |
644 | { |
|
653 | { | |
|
654 | /** This function sends SWF CCSDS packets (F2, F1 or F0). | |||
|
655 | * | |||
|
656 | * @param waveform points to the buffer containing the data that will be send. | |||
|
657 | * @param sid is the source identifier of the data that will be sent. | |||
|
658 | * @param headerSWF points to a table of headers that have been prepared for the data transmission. | |||
|
659 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |||
|
660 | * contain information to setup the transmission of the data packets. | |||
|
661 | * | |||
|
662 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. | |||
|
663 | * | |||
|
664 | */ | |||
|
665 | ||||
645 | unsigned int i; |
|
666 | unsigned int i; | |
646 | int ret; |
|
667 | int ret; | |
647 | rtems_status_code status; |
|
668 | rtems_status_code status; | |
648 | spw_ioctl_pkt_send spw_ioctl_send_SWF; |
|
669 | spw_ioctl_pkt_send spw_ioctl_send_SWF; | |
649 |
|
670 | |||
650 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header |
|
671 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header | |
651 | spw_ioctl_send_SWF.options = 0; |
|
672 | spw_ioctl_send_SWF.options = 0; | |
652 |
|
673 | |||
653 | ret = LFR_DEFAULT; |
|
674 | ret = LFR_DEFAULT; | |
654 |
|
675 | |||
655 | for (i=0; i<7; i++) // send waveform |
|
676 | for (i=0; i<7; i++) // send waveform | |
656 | { |
|
677 | { | |
657 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; |
|
678 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; | |
658 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; |
|
679 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; | |
659 | // BUILD THE DATA |
|
680 | // BUILD THE DATA | |
660 | if (i==6) { |
|
681 | if (i==6) { | |
661 | spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK; |
|
682 | spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK; | |
662 | } |
|
683 | } | |
663 | else { |
|
684 | else { | |
664 | spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK; |
|
685 | spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK; | |
665 | } |
|
686 | } | |
666 | // SET PACKET TIME |
|
687 | // SET PACKET TIME | |
667 | headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
688 | headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
668 | headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
689 | headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
669 | headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
690 | headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
670 | headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
691 | headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); | |
671 | headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
692 | headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
672 | headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); |
|
693 | headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); | |
673 | headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
694 | headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
674 | headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
695 | headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
675 | headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
696 | headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
676 | headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); |
|
697 | headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); | |
677 | headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
698 | headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
678 | headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
699 | headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
679 | // SEND PACKET |
|
700 | // SEND PACKET | |
680 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
701 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
681 | if (status != RTEMS_SUCCESSFUL) { |
|
702 | if (status != RTEMS_SUCCESSFUL) { | |
682 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
703 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
683 | ret = LFR_DEFAULT; |
|
704 | ret = LFR_DEFAULT; | |
684 | } |
|
705 | } | |
685 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds |
|
706 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds | |
686 | } |
|
707 | } | |
687 |
|
708 | |||
688 | return ret; |
|
709 | return ret; | |
689 | } |
|
710 | } | |
690 |
|
711 | |||
691 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, |
|
712 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, | |
692 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
713 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) | |
693 | { |
|
714 | { | |
|
715 | /** This function sends CWF CCSDS packets (F2, F1 or F0). | |||
|
716 | * | |||
|
717 | * @param waveform points to the buffer containing the data that will be send. | |||
|
718 | * @param sid is the source identifier of the data that will be sent. | |||
|
719 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. | |||
|
720 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |||
|
721 | * contain information to setup the transmission of the data packets. | |||
|
722 | * | |||
|
723 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. | |||
|
724 | * | |||
|
725 | */ | |||
|
726 | ||||
694 | unsigned int i; |
|
727 | unsigned int i; | |
695 | int ret; |
|
728 | int ret; | |
696 | rtems_status_code status; |
|
729 | rtems_status_code status; | |
697 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
730 | spw_ioctl_pkt_send spw_ioctl_send_CWF; | |
698 |
|
731 | |||
699 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
732 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header | |
700 | spw_ioctl_send_CWF.options = 0; |
|
733 | spw_ioctl_send_CWF.options = 0; | |
701 |
|
734 | |||
702 | ret = LFR_DEFAULT; |
|
735 | ret = LFR_DEFAULT; | |
703 |
|
736 | |||
704 | for (i=0; i<7; i++) // send waveform |
|
737 | for (i=0; i<7; i++) // send waveform | |
705 | { |
|
738 | { | |
706 | int coarseTime = 0x00; |
|
739 | int coarseTime = 0x00; | |
707 | int fineTime = 0x00; |
|
740 | int fineTime = 0x00; | |
708 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; |
|
741 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; | |
709 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
742 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; | |
710 | // BUILD THE DATA |
|
743 | // BUILD THE DATA | |
711 | if (i==6) { |
|
744 | if (i==6) { | |
712 | spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK; |
|
745 | spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK; | |
713 | } |
|
746 | } | |
714 | else { |
|
747 | else { | |
715 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK; |
|
748 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK; | |
716 | } |
|
749 | } | |
717 | // SET PACKET TIME |
|
750 | // SET PACKET TIME | |
718 | coarseTime = time_management_regs->coarse_time; |
|
751 | coarseTime = time_management_regs->coarse_time; | |
719 | fineTime = time_management_regs->fine_time; |
|
752 | fineTime = time_management_regs->fine_time; | |
720 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); |
|
753 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); | |
721 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); |
|
754 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); | |
722 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); |
|
755 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); | |
723 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); |
|
756 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); | |
724 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); |
|
757 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); | |
725 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); |
|
758 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); | |
726 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); |
|
759 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); | |
727 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); |
|
760 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); | |
728 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); |
|
761 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); | |
729 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); |
|
762 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); | |
730 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); |
|
763 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); | |
731 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); |
|
764 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); | |
732 | // SEND PACKET |
|
765 | // SEND PACKET | |
733 | if (sid == SID_NORM_CWF_F3) |
|
766 | if (sid == SID_NORM_CWF_F3) | |
734 | { |
|
767 | { | |
735 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
768 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
736 | if (status != RTEMS_SUCCESSFUL) { |
|
769 | if (status != RTEMS_SUCCESSFUL) { | |
737 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
770 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
738 | ret = LFR_DEFAULT; |
|
771 | ret = LFR_DEFAULT; | |
739 | } |
|
772 | } | |
740 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
773 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); | |
741 | } |
|
774 | } | |
742 | else |
|
775 | else | |
743 | { |
|
776 | { | |
744 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
777 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
745 | if (status != RTEMS_SUCCESSFUL) { |
|
778 | if (status != RTEMS_SUCCESSFUL) { | |
746 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
779 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
747 | ret = LFR_DEFAULT; |
|
780 | ret = LFR_DEFAULT; | |
748 | } |
|
781 | } | |
749 | } |
|
782 | } | |
750 | } |
|
783 | } | |
751 |
|
784 | |||
752 | return ret; |
|
785 | return ret; | |
753 | } |
|
786 | } | |
754 |
|
787 | |||
755 | int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
788 | int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) | |
756 | { |
|
789 | { | |
|
790 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. | |||
|
791 | * | |||
|
792 | * @param waveform points to the buffer containing the data that will be send. | |||
|
793 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. | |||
|
794 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures | |||
|
795 | * contain information to setup the transmission of the data packets. | |||
|
796 | * | |||
|
797 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer | |||
|
798 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. | |||
|
799 | * | |||
|
800 | */ | |||
|
801 | ||||
757 | unsigned int i; |
|
802 | unsigned int i; | |
758 | int ret; |
|
803 | int ret; | |
759 | rtems_status_code status; |
|
804 | rtems_status_code status; | |
760 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
805 | spw_ioctl_pkt_send spw_ioctl_send_CWF; | |
761 | char *sample; |
|
806 | char *sample; | |
762 |
|
807 | |||
763 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
808 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header | |
764 | spw_ioctl_send_CWF.options = 0; |
|
809 | spw_ioctl_send_CWF.options = 0; | |
765 |
|
810 | |||
766 | ret = LFR_DEFAULT; |
|
811 | ret = LFR_DEFAULT; | |
767 |
|
812 | |||
768 | //********************** |
|
813 | //********************** | |
769 | // BUILD CWF3_light DATA |
|
814 | // BUILD CWF3_light DATA | |
770 | for ( i=0; i< 2048; i++) |
|
815 | for ( i=0; i< 2048; i++) | |
771 | { |
|
816 | { | |
772 | sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ]; |
|
817 | sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ]; | |
773 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ]; |
|
818 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ]; | |
774 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ]; |
|
819 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ]; | |
775 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ]; |
|
820 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ]; | |
776 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ]; |
|
821 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ]; | |
777 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ]; |
|
822 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ]; | |
778 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ]; |
|
823 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ]; | |
779 | } |
|
824 | } | |
780 |
|
825 | |||
781 | //********************* |
|
826 | //********************* | |
782 | // SEND CWF3_light DATA |
|
827 | // SEND CWF3_light DATA | |
783 |
|
828 | |||
784 | for (i=0; i<7; i++) // send waveform |
|
829 | for (i=0; i<7; i++) // send waveform | |
785 | { |
|
830 | { | |
786 | int coarseTime = 0x00; |
|
831 | int coarseTime = 0x00; | |
787 | int fineTime = 0x00; |
|
832 | int fineTime = 0x00; | |
788 | spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * 340 * NB_BYTES_CWF3_LIGHT_BLK) ]; |
|
833 | spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * 340 * NB_BYTES_CWF3_LIGHT_BLK) ]; | |
789 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
834 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; | |
790 | // BUILD THE DATA |
|
835 | // BUILD THE DATA | |
791 | if ( i == WFRM_INDEX_OF_LAST_PACKET ) { |
|
836 | if ( i == WFRM_INDEX_OF_LAST_PACKET ) { | |
792 | spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_CWF3_LIGHT_BLK; |
|
837 | spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_CWF3_LIGHT_BLK; | |
793 | } |
|
838 | } | |
794 | else { |
|
839 | else { | |
795 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK; |
|
840 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK; | |
796 | } |
|
841 | } | |
797 | // SET PACKET TIME |
|
842 | // SET PACKET TIME | |
798 | coarseTime = time_management_regs->coarse_time; |
|
843 | coarseTime = time_management_regs->coarse_time; | |
799 | fineTime = time_management_regs->fine_time; |
|
844 | fineTime = time_management_regs->fine_time; | |
800 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); |
|
845 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); | |
801 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); |
|
846 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); | |
802 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); |
|
847 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); | |
803 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); |
|
848 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); | |
804 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); |
|
849 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); | |
805 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); |
|
850 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); | |
806 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); |
|
851 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); | |
807 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); |
|
852 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); | |
808 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); |
|
853 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); | |
809 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); |
|
854 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); | |
810 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); |
|
855 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); | |
811 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); |
|
856 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); | |
812 | // SEND PACKET |
|
857 | // SEND PACKET | |
813 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
858 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
814 | if (status != RTEMS_SUCCESSFUL) { |
|
859 | if (status != RTEMS_SUCCESSFUL) { | |
815 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); |
|
860 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); | |
816 | ret = LFR_DEFAULT; |
|
861 | ret = LFR_DEFAULT; | |
817 | } |
|
862 | } | |
818 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
863 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); | |
819 | } |
|
864 | } | |
820 |
|
865 | |||
821 | return ret; |
|
866 | return ret; | |
822 | } |
|
867 | } | |
823 |
|
868 | |||
824 |
|
869 | |||
825 | //************** |
|
870 | //************** | |
826 | // wfp registers |
|
871 | // wfp registers | |
827 | void set_wfp_data_shaping() |
|
872 | void set_wfp_data_shaping() | |
828 | { |
|
873 | { | |
|
874 | /** This function sets the data_shaping register of the waveform picker module. | |||
|
875 | * | |||
|
876 | * The value is read from one field of the parameter_dump_packet structure:\n | |||
|
877 | * bw_sp0_sp1_r0_r1 | |||
|
878 | * | |||
|
879 | */ | |||
|
880 | ||||
829 | unsigned char data_shaping; |
|
881 | unsigned char data_shaping; | |
830 |
|
882 | |||
831 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register |
|
883 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register | |
832 | // waveform picker : [R1 R0 SP1 SP0 BW] |
|
884 | // waveform picker : [R1 R0 SP1 SP0 BW] | |
833 |
|
885 | |||
834 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; |
|
886 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; | |
835 |
|
887 | |||
836 | #ifdef GSA |
|
888 | #ifdef GSA | |
837 | #else |
|
889 | #else | |
838 | waveform_picker_regs->data_shaping = |
|
890 | waveform_picker_regs->data_shaping = | |
839 | ( (data_shaping & 0x10) >> 4 ) // BW |
|
891 | ( (data_shaping & 0x10) >> 4 ) // BW | |
840 | + ( (data_shaping & 0x08) >> 2 ) // SP0 |
|
892 | + ( (data_shaping & 0x08) >> 2 ) // SP0 | |
841 | + ( (data_shaping & 0x04) ) // SP1 |
|
893 | + ( (data_shaping & 0x04) ) // SP1 | |
842 | + ( (data_shaping & 0x02) << 2 ) // R0 |
|
894 | + ( (data_shaping & 0x02) << 2 ) // R0 | |
843 | + ( (data_shaping & 0x01) << 4 ); // R1 |
|
895 | + ( (data_shaping & 0x01) << 4 ); // R1 | |
844 | #endif |
|
896 | #endif | |
845 | } |
|
897 | } | |
846 |
|
898 | |||
847 | char set_wfp_delta_snapshot() |
|
899 | char set_wfp_delta_snapshot() | |
848 | { |
|
900 | { | |
|
901 | /** This function sets the delta_snapshot register of the waveform picker module. | |||
|
902 | * | |||
|
903 | * The value is read from two (unsigned char) of the parameter_dump_packet structure:\n | |||
|
904 | * sy_lfr_n_swf_p[0] \n | |||
|
905 | * sy_lfr_n_swf_p[1] | |||
|
906 | * | |||
|
907 | */ | |||
|
908 | ||||
849 | char ret; |
|
909 | char ret; | |
850 | unsigned int delta_snapshot; |
|
910 | unsigned int delta_snapshot; | |
851 | unsigned int aux; |
|
911 | unsigned int aux; | |
852 |
|
912 | |||
853 | aux = 0; |
|
913 | aux = 0; | |
854 | ret = LFR_DEFAULT; |
|
914 | ret = LFR_DEFAULT; | |
855 |
|
915 | |||
856 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 |
|
916 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 | |
857 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; |
|
917 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; | |
858 |
|
918 | |||
859 | #ifdef GSA |
|
919 | #ifdef GSA | |
860 | #else |
|
920 | #else | |
861 | if ( delta_snapshot < MIN_DELTA_SNAPSHOT ) |
|
921 | if ( delta_snapshot < MIN_DELTA_SNAPSHOT ) | |
862 | { |
|
922 | { | |
863 | aux = MIN_DELTA_SNAPSHOT; |
|
923 | aux = MIN_DELTA_SNAPSHOT; | |
864 | ret = LFR_DEFAULT; |
|
924 | ret = LFR_DEFAULT; | |
865 | } |
|
925 | } | |
866 | else |
|
926 | else | |
867 | { |
|
927 | { | |
868 | aux = delta_snapshot ; |
|
928 | aux = delta_snapshot ; | |
869 | ret = LFR_SUCCESSFUL; |
|
929 | ret = LFR_SUCCESSFUL; | |
870 | } |
|
930 | } | |
871 | waveform_picker_regs->delta_snapshot = aux; // max 2 bytes |
|
931 | waveform_picker_regs->delta_snapshot = aux; // max 2 bytes | |
872 | #endif |
|
932 | #endif | |
873 |
|
933 | |||
874 | return ret; |
|
934 | return ret; | |
875 | } |
|
935 | } | |
876 |
|
936 | |||
877 | void set_wfp_burst_enable_register( unsigned char mode) |
|
937 | void set_wfp_burst_enable_register( unsigned char mode) | |
878 | { |
|
938 | { | |
|
939 | /** This function sets the waveform picker burst_enable register depending on the mode. | |||
|
940 | * | |||
|
941 | * @param mode is the LFR mode to launch. | |||
|
942 | * | |||
|
943 | * The burst bits shall be before the enable bits. | |||
|
944 | * | |||
|
945 | */ | |||
|
946 | ||||
879 | #ifdef GSA |
|
947 | #ifdef GSA | |
880 | #else |
|
948 | #else | |
881 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 |
|
949 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 | |
882 | // the burst bits shall be set first, before the enable bits |
|
950 | // the burst bits shall be set first, before the enable bits | |
883 | switch(mode) { |
|
951 | switch(mode) { | |
884 | case(LFR_MODE_NORMAL): |
|
952 | case(LFR_MODE_NORMAL): | |
885 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable |
|
953 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable | |
886 | waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 |
|
954 | waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 | |
887 | break; |
|
955 | break; | |
888 | case(LFR_MODE_BURST): |
|
956 | case(LFR_MODE_BURST): | |
889 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
957 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
890 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2 |
|
958 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2 | |
891 | break; |
|
959 | break; | |
892 | case(LFR_MODE_SBM1): |
|
960 | case(LFR_MODE_SBM1): | |
893 | waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled |
|
961 | waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled | |
894 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
962 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
895 | break; |
|
963 | break; | |
896 | case(LFR_MODE_SBM2): |
|
964 | case(LFR_MODE_SBM2): | |
897 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
965 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled | |
898 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
966 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 | |
899 | break; |
|
967 | break; | |
900 | default: |
|
968 | default: | |
901 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled |
|
969 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled | |
902 | break; |
|
970 | break; | |
903 | } |
|
971 | } | |
904 | #endif |
|
972 | #endif | |
905 | } |
|
973 | } | |
906 |
|
974 | |||
907 | void reset_wfp_burst_enable() |
|
975 | void reset_wfp_burst_enable() | |
908 | { |
|
976 | { | |
|
977 | /** This function resets the waveform picker burst_enable register. | |||
|
978 | * | |||
|
979 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. | |||
|
980 | * | |||
|
981 | */ | |||
|
982 | ||||
909 | #ifdef GSA |
|
983 | #ifdef GSA | |
910 | #else |
|
984 | #else | |
911 | waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
985 | waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
912 | #endif |
|
986 | #endif | |
913 | } |
|
987 | } | |
914 |
|
988 | |||
915 | void reset_wfp_status() |
|
989 | void reset_wfp_status() | |
916 | { |
|
990 | { | |
|
991 | /** This function resets the waveform picker status register. | |||
|
992 | * | |||
|
993 | * All status bits are set to 0 [new_err full_err full]. | |||
|
994 | * | |||
|
995 | */ | |||
|
996 | ||||
917 | #ifdef GSA |
|
997 | #ifdef GSA | |
918 | #else |
|
998 | #else | |
919 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
999 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 | |
920 | #endif |
|
1000 | #endif | |
921 | } |
|
1001 | } | |
922 |
|
1002 | |||
923 | void reset_waveform_picker_regs() |
|
1003 | void reset_waveform_picker_regs() | |
924 | { |
|
1004 | { | |
|
1005 | /** This function resets the waveform picker module registers. | |||
|
1006 | * | |||
|
1007 | * The registers affected by this function are located at the following offset addresses: | |||
|
1008 | * - 0x00 data_shaping | |||
|
1009 | * - 0x04 burst_enable | |||
|
1010 | * - 0x08 addr_data_f0 | |||
|
1011 | * - 0x0C addr_data_f1 | |||
|
1012 | * - 0x10 addr_data_f2 | |||
|
1013 | * - 0x14 addr_data_f3 | |||
|
1014 | * - 0x18 status | |||
|
1015 | * - 0x1C delta_snapshot | |||
|
1016 | * - 0x20 delta_f2_f1 | |||
|
1017 | * - 0x24 delta_f2_f0 | |||
|
1018 | * - 0x28 nb_burst | |||
|
1019 | * - 0x2C nb_snapshot | |||
|
1020 | * | |||
|
1021 | */ | |||
|
1022 | ||||
925 | #ifdef GSA |
|
1023 | #ifdef GSA | |
926 | #else |
|
1024 | #else | |
927 | set_wfp_data_shaping(); |
|
1025 | set_wfp_data_shaping(); | |
928 | reset_wfp_burst_enable(); |
|
1026 | reset_wfp_burst_enable(); | |
929 | waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // |
|
1027 | waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // | |
930 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); // |
|
1028 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); // | |
931 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); // |
|
1029 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); // | |
932 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); // |
|
1030 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); // | |
933 | set_wfp_delta_snapshot(); // time in seconds between two snapshots |
|
1031 | set_wfp_delta_snapshot(); // time in seconds between two snapshots | |
934 | waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes) |
|
1032 | waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes) | |
935 | waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes) |
|
1033 | waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes) | |
936 | waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets) |
|
1034 | waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets) | |
937 | waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1 |
|
1035 | waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1 | |
938 | waveform_picker_regs->status = 0x00; // |
|
1036 | waveform_picker_regs->status = 0x00; // | |
939 | #endif |
|
1037 | #endif | |
940 | } |
|
1038 | } | |
941 |
|
1039 | |||
942 | //***************** |
|
1040 | //***************** | |
943 | // local parameters |
|
1041 | // local parameters | |
944 | void set_local_sbm1_nb_cwf_max() |
|
1042 | void set_local_sbm1_nb_cwf_max() | |
945 | { |
|
1043 | { | |
946 | // (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot) |
|
1044 | /** This function sets the value of the sbm1_nb_cwf_max local parameter. | |
|
1045 | * | |||
|
1046 | * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n | |||
|
1047 | * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.\n\n | |||
|
1048 | * (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot) | |||
|
1049 | * | |||
|
1050 | */ | |||
947 | param_local.local_sbm1_nb_cwf_max = 2 * |
|
1051 | param_local.local_sbm1_nb_cwf_max = 2 * | |
948 | (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 |
|
1052 | (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 | |
949 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2 |
|
1053 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2 | |
950 | } |
|
1054 | } | |
951 |
|
1055 | |||
952 | void set_local_sbm2_nb_cwf_max() |
|
1056 | void set_local_sbm2_nb_cwf_max() | |
953 | { |
|
1057 | { | |
954 | // (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz) |
|
1058 | /** This function sets the value of the sbm1_nb_cwf_max local parameter. | |
|
1059 | * | |||
|
1060 | * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n | |||
|
1061 | * This parameter is used to send CWF_F2 data as normal data when the SBM2 is active.\n\n | |||
|
1062 | * (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz) | |||
|
1063 | * | |||
|
1064 | */ | |||
|
1065 | ||||
955 | param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 |
|
1066 | param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 | |
956 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8; |
|
1067 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8; | |
957 | } |
|
1068 | } | |
958 |
|
1069 | |||
959 | void set_local_nb_interrupt_f0_MAX() |
|
1070 | void set_local_nb_interrupt_f0_MAX() | |
960 | { |
|
1071 | { | |
|
1072 | /** This function sets the value of the nb_interrupt_f0_MAX local parameter. | |||
|
1073 | * | |||
|
1074 | * This parameter is used for the SM validation only.\n | |||
|
1075 | * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices | |||
|
1076 | * module before launching a basic processing. | |||
|
1077 | * | |||
|
1078 | */ | |||
|
1079 | ||||
961 | param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256 |
|
1080 | param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256 | |
962 | + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100; |
|
1081 | + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100; | |
963 | } |
|
1082 | } | |
964 |
|
1083 | |||
965 | void reset_local_sbm1_nb_cwf_sent() |
|
1084 | void reset_local_sbm1_nb_cwf_sent() | |
966 | { |
|
1085 | { | |
|
1086 | /** This function resets the value of the sbm1_nb_cwf_sent local parameter. | |||
|
1087 | * | |||
|
1088 | * The sbm1_nb_cwf_sent parameter counts the number of CWF_F1 records that have been sent.\n | |||
|
1089 | * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active. | |||
|
1090 | * | |||
|
1091 | */ | |||
|
1092 | ||||
967 | param_local.local_sbm1_nb_cwf_sent = 0; |
|
1093 | param_local.local_sbm1_nb_cwf_sent = 0; | |
968 | } |
|
1094 | } | |
969 |
|
1095 | |||
970 | void reset_local_sbm2_nb_cwf_sent() |
|
1096 | void reset_local_sbm2_nb_cwf_sent() | |
971 | { |
|
1097 | { | |
|
1098 | /** This function resets the value of the sbm2_nb_cwf_sent local parameter. | |||
|
1099 | * | |||
|
1100 | * The sbm2_nb_cwf_sent parameter counts the number of CWF_F2 records that have been sent.\n | |||
|
1101 | * This parameter is used to send CWF_F2 data as normal data when the SBM2 mode is active. | |||
|
1102 | * | |||
|
1103 | */ | |||
|
1104 | ||||
972 | param_local.local_sbm2_nb_cwf_sent = 0; |
|
1105 | param_local.local_sbm2_nb_cwf_sent = 0; | |
973 | } |
|
1106 | } |
General Comments 0
You need to be logged in to leave comments.
Login now