##// END OF EJS Templates
sequence counters management added
paul -
r56:7b010fae8e4e default
parent child
Show More
@@ -1,6 +1,6
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: Tue Nov 5 13:12:35 2013
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Nov 7 08:03:44 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
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -1,6 +1,6
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.1, 2013-11-05T13:11:18. -->
3 <!-- Written by QtCreator 2.8.1, 2013-11-08T07:03:44. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -121,7 +121,6
121 #define CCSDS_TM_VALID 7
121 #define CCSDS_TM_VALID 7
122
122
123 // TC SID
123 // TC SID
124 #define SID_TC_DEFAULT 0 // the default SID for TC sent to the LFR
125 #define SID_TC_GROUND 0
124 #define SID_TC_GROUND 0
126 #define SID_TC_MISSION_TIMELINE 110
125 #define SID_TC_MISSION_TIMELINE 110
127 #define SID_TC_TC_SEQUENCES 111
126 #define SID_TC_TC_SEQUENCES 111
@@ -135,6 +134,25
135 #define SID_TC_AOCS 11
134 #define SID_TC_AOCS 11
136 #define SID_TC_RPW_INTERNAL 254
135 #define SID_TC_RPW_INTERNAL 254
137
136
137 enum apid_destid{
138 GROUND,
139 MISSION_TIMELINE,
140 TC_SEQUENCES,
141 RECOVERY_ACTION_CMD,
142 BACKUP_MISSION_TIMELINE,
143 DIRECT_CMD,
144 SPARE_GRD_SRC1,
145 SPARE_GRD_SRC2,
146 OBCP,
147 SYSTEM_CONTROL,
148 AOCS,
149 RPW_INTERNAL,
150 UNKNOWN
151 };
152 // SEQUENCE COUNTERS
153 #define SEQ_CNT_MAX 16383
154 #define SEQ_CNT_NB_DEST_ID 12
155
138 // TM SID
156 // TM SID
139 #define SID_HK 1
157 #define SID_HK 1
140 #define SID_PARAMETER_DUMP 10
158 #define SID_PARAMETER_DUMP 10
@@ -210,301 +228,301 enum TM_TYPE{
210
228
211 struct TMHeader_str
229 struct TMHeader_str
212 {
230 {
213 volatile unsigned char targetLogicalAddress;
231 unsigned char targetLogicalAddress;
214 volatile unsigned char protocolIdentifier;
232 unsigned char protocolIdentifier;
215 volatile unsigned char reserved;
233 unsigned char reserved;
216 volatile unsigned char userApplication;
234 unsigned char userApplication;
217 volatile unsigned char packetID[2];
235 unsigned char packetID[2];
218 volatile unsigned char packetSequenceControl[2];
236 unsigned char packetSequenceControl[2];
219 volatile unsigned char packetLength[2];
237 unsigned char packetLength[2];
220 // DATA FIELD HEADER
238 // DATA FIELD HEADER
221 volatile unsigned char spare1_pusVersion_spare2;
239 unsigned char spare1_pusVersion_spare2;
222 volatile unsigned char serviceType;
240 unsigned char serviceType;
223 volatile unsigned char serviceSubType;
241 unsigned char serviceSubType;
224 volatile unsigned char destinationID;
242 unsigned char destinationID;
225 volatile unsigned char time[6];
243 unsigned char time[6];
226 };
244 };
227 typedef struct TMHeader_str TMHeader_t;
245 typedef struct TMHeader_str TMHeader_t;
228
246
229 struct Packet_TM_LFR_TC_EXE_str
247 struct Packet_TM_LFR_TC_EXE_str
230 {
248 {
231 volatile unsigned char targetLogicalAddress;
249 unsigned char targetLogicalAddress;
232 volatile unsigned char protocolIdentifier;
250 unsigned char protocolIdentifier;
233 volatile unsigned char reserved;
251 unsigned char reserved;
234 volatile unsigned char userApplication;
252 unsigned char userApplication;
235 volatile unsigned char packetID[2];
253 unsigned char packetID[2];
236 volatile unsigned char packetSequenceControl[2];
254 unsigned char packetSequenceControl[2];
237 volatile unsigned char packetLength[2];
255 unsigned char packetLength[2];
238 // DATA FIELD HEADER
256 // DATA FIELD HEADER
239 volatile unsigned char spare1_pusVersion_spare2;
257 unsigned char spare1_pusVersion_spare2;
240 volatile unsigned char serviceType;
258 unsigned char serviceType;
241 volatile unsigned char serviceSubType;
259 unsigned char serviceSubType;
242 volatile unsigned char destinationID;
260 unsigned char destinationID;
243 volatile unsigned char time[6];
261 unsigned char time[6];
244 volatile unsigned char data[LENGTH_TM_LFR_TC_EXE_MAX - 10 + 1];
262 unsigned char data[LENGTH_TM_LFR_TC_EXE_MAX - 10 + 1];
245 };
263 };
246 typedef struct Packet_TM_LFR_TC_EXE_str Packet_TM_LFR_TC_EXE_t;
264 typedef struct Packet_TM_LFR_TC_EXE_str Packet_TM_LFR_TC_EXE_t;
247
265
248 struct Packet_TM_LFR_TC_EXE_SUCCESS_str
266 struct Packet_TM_LFR_TC_EXE_SUCCESS_str
249 {
267 {
250 volatile unsigned char targetLogicalAddress;
268 unsigned char targetLogicalAddress;
251 volatile unsigned char protocolIdentifier;
269 unsigned char protocolIdentifier;
252 volatile unsigned char reserved;
270 unsigned char reserved;
253 volatile unsigned char userApplication;
271 unsigned char userApplication;
254 // PACKET HEADER
272 // PACKET HEADER
255 volatile unsigned char packetID[2];
273 unsigned char packetID[2];
256 volatile unsigned char packetSequenceControl[2];
274 unsigned char packetSequenceControl[2];
257 volatile unsigned char packetLength[2];
275 unsigned char packetLength[2];
258 // DATA FIELD HEADER
276 // DATA FIELD HEADER
259 volatile unsigned char spare1_pusVersion_spare2;
277 unsigned char spare1_pusVersion_spare2;
260 volatile unsigned char serviceType;
278 unsigned char serviceType;
261 volatile unsigned char serviceSubType;
279 unsigned char serviceSubType;
262 volatile unsigned char destinationID;
280 unsigned char destinationID;
263 volatile unsigned char time[6];
281 unsigned char time[6];
264 //
282 //
265 volatile unsigned char telecommand_pkt_id[2];
283 unsigned char telecommand_pkt_id[2];
266 volatile unsigned char pkt_seq_control[2];
284 unsigned char pkt_seq_control[2];
267 };
285 };
268 typedef struct Packet_TM_LFR_TC_EXE_SUCCESS_str Packet_TM_LFR_TC_EXE_SUCCESS_t;
286 typedef struct Packet_TM_LFR_TC_EXE_SUCCESS_str Packet_TM_LFR_TC_EXE_SUCCESS_t;
269
287
270 struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str
288 struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str
271 {
289 {
272 volatile unsigned char targetLogicalAddress;
290 unsigned char targetLogicalAddress;
273 volatile unsigned char protocolIdentifier;
291 unsigned char protocolIdentifier;
274 volatile unsigned char reserved;
292 unsigned char reserved;
275 volatile unsigned char userApplication;
293 unsigned char userApplication;
276 // PACKET HEADER
294 // PACKET HEADER
277 volatile unsigned char packetID[2];
295 unsigned char packetID[2];
278 volatile unsigned char packetSequenceControl[2];
296 unsigned char packetSequenceControl[2];
279 volatile unsigned char packetLength[2];
297 unsigned char packetLength[2];
280 // DATA FIELD HEADER
298 // DATA FIELD HEADER
281 volatile unsigned char spare1_pusVersion_spare2;
299 unsigned char spare1_pusVersion_spare2;
282 volatile unsigned char serviceType;
300 unsigned char serviceType;
283 volatile unsigned char serviceSubType;
301 unsigned char serviceSubType;
284 volatile unsigned char destinationID;
302 unsigned char destinationID;
285 volatile unsigned char time[6];
303 unsigned char time[6];
286 //
304 //
287 volatile unsigned char tc_failure_code[2];
305 unsigned char tc_failure_code[2];
288 volatile unsigned char telecommand_pkt_id[2];
306 unsigned char telecommand_pkt_id[2];
289 volatile unsigned char pkt_seq_control[2];
307 unsigned char pkt_seq_control[2];
290 volatile unsigned char tc_service;
308 unsigned char tc_service;
291 volatile unsigned char tc_subtype;
309 unsigned char tc_subtype;
292 volatile unsigned char byte_position;
310 unsigned char byte_position;
293 volatile unsigned char rcv_value;
311 unsigned char rcv_value;
294 };
312 };
295 typedef struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str Packet_TM_LFR_TC_EXE_INCONSISTENT_t;
313 typedef struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str Packet_TM_LFR_TC_EXE_INCONSISTENT_t;
296
314
297 struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str
315 struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str
298 {
316 {
299 volatile unsigned char targetLogicalAddress;
317 unsigned char targetLogicalAddress;
300 volatile unsigned char protocolIdentifier;
318 unsigned char protocolIdentifier;
301 volatile unsigned char reserved;
319 unsigned char reserved;
302 volatile unsigned char userApplication;
320 unsigned char userApplication;
303 // PACKET HEADER
321 // PACKET HEADER
304 volatile unsigned char packetID[2];
322 unsigned char packetID[2];
305 volatile unsigned char packetSequenceControl[2];
323 unsigned char packetSequenceControl[2];
306 volatile unsigned char packetLength[2];
324 unsigned char packetLength[2];
307 // DATA FIELD HEADER
325 // DATA FIELD HEADER
308 volatile unsigned char spare1_pusVersion_spare2;
326 unsigned char spare1_pusVersion_spare2;
309 volatile unsigned char serviceType;
327 unsigned char serviceType;
310 volatile unsigned char serviceSubType;
328 unsigned char serviceSubType;
311 volatile unsigned char destinationID;
329 unsigned char destinationID;
312 volatile unsigned char time[6];
330 unsigned char time[6];
313 //
331 //
314 volatile unsigned char tc_failure_code[2];
332 unsigned char tc_failure_code[2];
315 volatile unsigned char telecommand_pkt_id[2];
333 unsigned char telecommand_pkt_id[2];
316 volatile unsigned char pkt_seq_control[2];
334 unsigned char pkt_seq_control[2];
317 volatile unsigned char tc_service;
335 unsigned char tc_service;
318 volatile unsigned char tc_subtype;
336 unsigned char tc_subtype;
319 volatile unsigned char lfr_status_word[2];
337 unsigned char lfr_status_word[2];
320 };
338 };
321 typedef struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t;
339 typedef struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t;
322
340
323 struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str
341 struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str
324 {
342 {
325 volatile unsigned char targetLogicalAddress;
343 unsigned char targetLogicalAddress;
326 volatile unsigned char protocolIdentifier;
344 unsigned char protocolIdentifier;
327 volatile unsigned char reserved;
345 unsigned char reserved;
328 volatile unsigned char userApplication;
346 unsigned char userApplication;
329 // PACKET HEADER
347 // PACKET HEADER
330 volatile unsigned char packetID[2];
348 unsigned char packetID[2];
331 volatile unsigned char packetSequenceControl[2];
349 unsigned char packetSequenceControl[2];
332 volatile unsigned char packetLength[2];
350 unsigned char packetLength[2];
333 // DATA FIELD HEADER
351 // DATA FIELD HEADER
334 volatile unsigned char spare1_pusVersion_spare2;
352 unsigned char spare1_pusVersion_spare2;
335 volatile unsigned char serviceType;
353 unsigned char serviceType;
336 volatile unsigned char serviceSubType;
354 unsigned char serviceSubType;
337 volatile unsigned char destinationID;
355 unsigned char destinationID;
338 volatile unsigned char time[6];
356 unsigned char time[6];
339 //
357 //
340 volatile unsigned char tc_failure_code[2];
358 unsigned char tc_failure_code[2];
341 volatile unsigned char telecommand_pkt_id[2];
359 unsigned char telecommand_pkt_id[2];
342 volatile unsigned char pkt_seq_control[2];
360 unsigned char pkt_seq_control[2];
343 volatile unsigned char tc_service;
361 unsigned char tc_service;
344 volatile unsigned char tc_subtype;
362 unsigned char tc_subtype;
345 };
363 };
346 typedef struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t;
364 typedef struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t;
347
365
348 struct Packet_TM_LFR_TC_EXE_ERROR_str
366 struct Packet_TM_LFR_TC_EXE_ERROR_str
349 {
367 {
350 volatile unsigned char targetLogicalAddress;
368 unsigned char targetLogicalAddress;
351 volatile unsigned char protocolIdentifier;
369 unsigned char protocolIdentifier;
352 volatile unsigned char reserved;
370 unsigned char reserved;
353 volatile unsigned char userApplication;
371 unsigned char userApplication;
354 // PACKET HEADER
372 // PACKET HEADER
355 volatile unsigned char packetID[2];
373 unsigned char packetID[2];
356 volatile unsigned char packetSequenceControl[2];
374 unsigned char packetSequenceControl[2];
357 volatile unsigned char packetLength[2];
375 unsigned char packetLength[2];
358 // DATA FIELD HEADER
376 // DATA FIELD HEADER
359 volatile unsigned char spare1_pusVersion_spare2;
377 unsigned char spare1_pusVersion_spare2;
360 volatile unsigned char serviceType;
378 unsigned char serviceType;
361 volatile unsigned char serviceSubType;
379 unsigned char serviceSubType;
362 volatile unsigned char destinationID;
380 unsigned char destinationID;
363 volatile unsigned char time[6];
381 unsigned char time[6];
364 //
382 //
365 volatile unsigned char tc_failure_code[2];
383 unsigned char tc_failure_code[2];
366 volatile unsigned char telecommand_pkt_id[2];
384 unsigned char telecommand_pkt_id[2];
367 volatile unsigned char pkt_seq_control[2];
385 unsigned char pkt_seq_control[2];
368 volatile unsigned char tc_service;
386 unsigned char tc_service;
369 volatile unsigned char tc_subtype;
387 unsigned char tc_subtype;
370 };
388 };
371 typedef struct Packet_TM_LFR_TC_EXE_ERROR_str Packet_TM_LFR_TC_EXE_ERROR_t;
389 typedef struct Packet_TM_LFR_TC_EXE_ERROR_str Packet_TM_LFR_TC_EXE_ERROR_t;
372
390
373 struct Packet_TM_LFR_TC_EXE_CORRUPTED_str
391 struct Packet_TM_LFR_TC_EXE_CORRUPTED_str
374 {
392 {
375 volatile unsigned char targetLogicalAddress;
393 unsigned char targetLogicalAddress;
376 volatile unsigned char protocolIdentifier;
394 unsigned char protocolIdentifier;
377 volatile unsigned char reserved;
395 unsigned char reserved;
378 volatile unsigned char userApplication;
396 unsigned char userApplication;
379 // PACKET HEADER
397 // PACKET HEADER
380 volatile unsigned char packetID[2];
398 unsigned char packetID[2];
381 volatile unsigned char packetSequenceControl[2];
399 unsigned char packetSequenceControl[2];
382 volatile unsigned char packetLength[2];
400 unsigned char packetLength[2];
383 // DATA FIELD HEADER
401 // DATA FIELD HEADER
384 volatile unsigned char spare1_pusVersion_spare2;
402 unsigned char spare1_pusVersion_spare2;
385 volatile unsigned char serviceType;
403 unsigned char serviceType;
386 volatile unsigned char serviceSubType;
404 unsigned char serviceSubType;
387 volatile unsigned char destinationID;
405 unsigned char destinationID;
388 volatile unsigned char time[6];
406 unsigned char time[6];
389 //
407 //
390 volatile unsigned char tc_failure_code[2];
408 unsigned char tc_failure_code[2];
391 volatile unsigned char telecommand_pkt_id[2];
409 unsigned char telecommand_pkt_id[2];
392 volatile unsigned char pkt_seq_control[2];
410 unsigned char pkt_seq_control[2];
393 volatile unsigned char tc_service;
411 unsigned char tc_service;
394 volatile unsigned char tc_subtype;
412 unsigned char tc_subtype;
395 volatile unsigned char pkt_len_rcv_value[2];
413 unsigned char pkt_len_rcv_value[2];
396 volatile unsigned char pkt_datafieldsize_cnt[2];
414 unsigned char pkt_datafieldsize_cnt[2];
397 volatile unsigned char rcv_crc[2];
415 unsigned char rcv_crc[2];
398 volatile unsigned char computed_crc[2];
416 unsigned char computed_crc[2];
399 };
417 };
400 typedef struct Packet_TM_LFR_TC_EXE_CORRUPTED_str Packet_TM_LFR_TC_EXE_CORRUPTED_t;
418 typedef struct Packet_TM_LFR_TC_EXE_CORRUPTED_str Packet_TM_LFR_TC_EXE_CORRUPTED_t;
401
419
402 struct Header_TM_LFR_SCIENCE_SWF_str
420 struct Header_TM_LFR_SCIENCE_SWF_str
403 {
421 {
404 volatile unsigned char targetLogicalAddress;
422 unsigned char targetLogicalAddress;
405 volatile unsigned char protocolIdentifier;
423 unsigned char protocolIdentifier;
406 volatile unsigned char reserved;
424 unsigned char reserved;
407 volatile unsigned char userApplication;
425 unsigned char userApplication;
408 volatile unsigned char packetID[2];
426 unsigned char packetID[2];
409 volatile unsigned char packetSequenceControl[2];
427 unsigned char packetSequenceControl[2];
410 volatile unsigned char packetLength[2];
428 unsigned char packetLength[2];
411 // DATA FIELD HEADER
429 // DATA FIELD HEADER
412 volatile unsigned char spare1_pusVersion_spare2;
430 unsigned char spare1_pusVersion_spare2;
413 volatile unsigned char serviceType;
431 unsigned char serviceType;
414 volatile unsigned char serviceSubType;
432 unsigned char serviceSubType;
415 volatile unsigned char destinationID;
433 unsigned char destinationID;
416 volatile unsigned char time[6];
434 unsigned char time[6];
417 // AUXILIARY HEADER
435 // AUXILIARY HEADER
418 volatile unsigned char sid;
436 unsigned char sid;
419 volatile unsigned char hkBIA;
437 unsigned char hkBIA;
420 volatile unsigned char pktCnt;
438 unsigned char pktCnt;
421 volatile unsigned char pktNr;
439 unsigned char pktNr;
422 volatile unsigned char acquisitionTime[6];
440 unsigned char acquisitionTime[6];
423 volatile unsigned char blkNr[2];
441 unsigned char blkNr[2];
424 };
442 };
425 typedef struct Header_TM_LFR_SCIENCE_SWF_str Header_TM_LFR_SCIENCE_SWF_t;
443 typedef struct Header_TM_LFR_SCIENCE_SWF_str Header_TM_LFR_SCIENCE_SWF_t;
426
444
427 struct Header_TM_LFR_SCIENCE_CWF_str
445 struct Header_TM_LFR_SCIENCE_CWF_str
428 {
446 {
429 volatile unsigned char targetLogicalAddress;
447 unsigned char targetLogicalAddress;
430 volatile unsigned char protocolIdentifier;
448 unsigned char protocolIdentifier;
431 volatile unsigned char reserved;
449 unsigned char reserved;
432 volatile unsigned char userApplication;
450 unsigned char userApplication;
433 volatile unsigned char packetID[2];
451 unsigned char packetID[2];
434 volatile unsigned char packetSequenceControl[2];
452 unsigned char packetSequenceControl[2];
435 volatile unsigned char packetLength[2];
453 unsigned char packetLength[2];
436 // DATA FIELD HEADER
454 // DATA FIELD HEADER
437 volatile unsigned char spare1_pusVersion_spare2;
455 unsigned char spare1_pusVersion_spare2;
438 volatile unsigned char serviceType;
456 unsigned char serviceType;
439 volatile unsigned char serviceSubType;
457 unsigned char serviceSubType;
440 volatile unsigned char destinationID;
458 unsigned char destinationID;
441 volatile unsigned char time[6];
459 unsigned char time[6];
442 // AUXILIARY DATA HEADER
460 // AUXILIARY DATA HEADER
443 volatile unsigned char sid;
461 unsigned char sid;
444 volatile unsigned char hkBIA;
462 unsigned char hkBIA;
445 volatile unsigned char acquisitionTime[6];
463 unsigned char acquisitionTime[6];
446 volatile unsigned char blkNr[2];
464 unsigned char blkNr[2];
447 };
465 };
448 typedef struct Header_TM_LFR_SCIENCE_CWF_str Header_TM_LFR_SCIENCE_CWF_t;
466 typedef struct Header_TM_LFR_SCIENCE_CWF_str Header_TM_LFR_SCIENCE_CWF_t;
449
467
450 struct Header_TM_LFR_SCIENCE_ASM_str
468 struct Header_TM_LFR_SCIENCE_ASM_str
451 {
469 {
452 volatile unsigned char targetLogicalAddress;
470 unsigned char targetLogicalAddress;
453 volatile unsigned char protocolIdentifier;
471 unsigned char protocolIdentifier;
454 volatile unsigned char reserved;
472 unsigned char reserved;
455 volatile unsigned char userApplication;
473 unsigned char userApplication;
456 volatile unsigned char packetID[2];
474 unsigned char packetID[2];
457 volatile unsigned char packetSequenceControl[2];
475 unsigned char packetSequenceControl[2];
458 volatile unsigned char packetLength[2];
476 unsigned char packetLength[2];
459 // DATA FIELD HEADER
477 // DATA FIELD HEADER
460 volatile unsigned char spare1_pusVersion_spare2;
478 unsigned char spare1_pusVersion_spare2;
461 volatile unsigned char serviceType;
479 unsigned char serviceType;
462 volatile unsigned char serviceSubType;
480 unsigned char serviceSubType;
463 volatile unsigned char destinationID;
481 unsigned char destinationID;
464 volatile unsigned char time[6];
482 unsigned char time[6];
465 // AUXILIARY HEADER
483 // AUXILIARY HEADER
466 volatile unsigned char sid;
484 unsigned char sid;
467 volatile unsigned char biaStatusInfo;
485 unsigned char biaStatusInfo;
468 volatile unsigned char cntASM;
486 unsigned char cntASM;
469 volatile unsigned char nrASM;
487 unsigned char nrASM;
470 volatile unsigned char acquisitionTime[6];
488 unsigned char acquisitionTime[6];
471 volatile unsigned char blkNr[2];
489 unsigned char blkNr[2];
472 };
490 };
473 typedef struct Header_TM_LFR_SCIENCE_ASM_str Header_TM_LFR_SCIENCE_ASM_t;
491 typedef struct Header_TM_LFR_SCIENCE_ASM_str Header_TM_LFR_SCIENCE_ASM_t;
474
492
475 struct ccsdsTelecommandPacket_str
493 struct ccsdsTelecommandPacket_str
476 {
494 {
477 //unsigned char targetLogicalAddress; // removed by the grspw module
495 //unsigned char targetLogicalAddress; // removed by the grspw module
478 volatile unsigned char protocolIdentifier;
496 unsigned char protocolIdentifier;
479 volatile unsigned char reserved;
497 unsigned char reserved;
480 volatile unsigned char userApplication;
498 unsigned char userApplication;
481 volatile unsigned char packetID[2];
499 unsigned char packetID[2];
482 volatile unsigned char packetSequenceControl[2];
500 unsigned char packetSequenceControl[2];
483 volatile unsigned char packetLength[2];
501 unsigned char packetLength[2];
484 // DATA FIELD HEADER
502 // DATA FIELD HEADER
485 volatile unsigned char headerFlag_pusVersion_Ack;
503 unsigned char headerFlag_pusVersion_Ack;
486 volatile unsigned char serviceType;
504 unsigned char serviceType;
487 volatile unsigned char serviceSubType;
505 unsigned char serviceSubType;
488 volatile unsigned char sourceID;
506 unsigned char sourceID;
489 volatile unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10];
507 unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10];
490 };
508 };
491 typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t;
509 typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t;
492
510
493 struct Packet_TM_LFR_HK_str
511 struct Packet_TM_LFR_HK_str
494 {
512 {
495 volatile unsigned char targetLogicalAddress;
513 unsigned char targetLogicalAddress;
496 volatile unsigned char protocolIdentifier;
514 unsigned char protocolIdentifier;
497 volatile unsigned char reserved;
515 unsigned char reserved;
498 volatile unsigned char userApplication;
516 unsigned char userApplication;
499 volatile unsigned char packetID[2];
517 unsigned char packetID[2];
500 volatile unsigned char packetSequenceControl[2];
518 unsigned char packetSequenceControl[2];
501 volatile unsigned char packetLength[2];
519 unsigned char packetLength[2];
502 volatile unsigned char spare1_pusVersion_spare2;
520 unsigned char spare1_pusVersion_spare2;
503 volatile unsigned char serviceType;
521 unsigned char serviceType;
504 volatile unsigned char serviceSubType;
522 unsigned char serviceSubType;
505 volatile unsigned char destinationID;
523 unsigned char destinationID;
506 volatile unsigned char time[6];
524 unsigned char time[6];
507 volatile unsigned char sid;
525 unsigned char sid;
508
526
509 //**************
527 //**************
510 // HK PARAMETERS
528 // HK PARAMETERS
@@ -539,7 +557,7 struct Packet_TM_LFR_HK_str
539 unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2];
557 unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2];
540 unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2];
558 unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2];
541 unsigned char hk_lfr_dpu_spw_tick_out_cnt;
559 unsigned char hk_lfr_dpu_spw_tick_out_cnt;
542 unsigned char hk_lfr_dpu_spw_last_timc;
560 unsigned char hk_lfr_dpu_spw_last_time;
543 // ahb error statistics
561 // ahb error statistics
544 unsigned int hk_lfr_last_fail_addr;
562 unsigned int hk_lfr_last_fail_addr;
545 // temperatures
563 // temperatures
@@ -594,48 +612,48 typedef struct Packet_TM_LFR_HK_str Pack
594
612
595 struct Packet_TM_LFR_PARAMETER_DUMP_str
613 struct Packet_TM_LFR_PARAMETER_DUMP_str
596 {
614 {
597 volatile unsigned char targetLogicalAddress;
615 unsigned char targetLogicalAddress;
598 volatile unsigned char protocolIdentifier;
616 unsigned char protocolIdentifier;
599 volatile unsigned char reserved;
617 unsigned char reserved;
600 volatile unsigned char userApplication;
618 unsigned char userApplication;
601 volatile unsigned char packetID[2];
619 unsigned char packetID[2];
602 volatile unsigned char packetSequenceControl[2];
620 unsigned char packetSequenceControl[2];
603 volatile unsigned char packetLength[2];
621 unsigned char packetLength[2];
604 // DATA FIELD HEADER
622 // DATA FIELD HEADER
605 volatile unsigned char spare1_pusVersion_spare2;
623 unsigned char spare1_pusVersion_spare2;
606 volatile unsigned char serviceType;
624 unsigned char serviceType;
607 volatile unsigned char serviceSubType;
625 unsigned char serviceSubType;
608 volatile unsigned char destinationID;
626 unsigned char destinationID;
609 volatile unsigned char time[6];
627 unsigned char time[6];
610 volatile unsigned char sid;
628 unsigned char sid;
611
629
612 //******************
630 //******************
613 // COMMON PARAMETERS
631 // COMMON PARAMETERS
614 volatile unsigned char unused0;
632 unsigned char unused0;
615 volatile unsigned char bw_sp0_sp1_r0_r1;
633 unsigned char bw_sp0_sp1_r0_r1;
616
634
617 //******************
635 //******************
618 // NORMAL PARAMETERS
636 // NORMAL PARAMETERS
619 volatile unsigned char sy_lfr_n_swf_l[2];
637 unsigned char sy_lfr_n_swf_l[2];
620 volatile unsigned char sy_lfr_n_swf_p[2];
638 unsigned char sy_lfr_n_swf_p[2];
621 volatile unsigned char sy_lfr_n_asm_p[2];
639 unsigned char sy_lfr_n_asm_p[2];
622 volatile unsigned char sy_lfr_n_bp_p0;
640 unsigned char sy_lfr_n_bp_p0;
623 volatile unsigned char sy_lfr_n_bp_p1;
641 unsigned char sy_lfr_n_bp_p1;
624
642
625 //*****************
643 //*****************
626 // BURST PARAMETERS
644 // BURST PARAMETERS
627 volatile unsigned char sy_lfr_b_bp_p0;
645 unsigned char sy_lfr_b_bp_p0;
628 volatile unsigned char sy_lfr_b_bp_p1;
646 unsigned char sy_lfr_b_bp_p1;
629
647
630 //****************
648 //****************
631 // SBM1 PARAMETERS
649 // SBM1 PARAMETERS
632 volatile unsigned char sy_lfr_s1_bp_p0;
650 unsigned char sy_lfr_s1_bp_p0;
633 volatile unsigned char sy_lfr_s1_bp_p1;
651 unsigned char sy_lfr_s1_bp_p1;
634
652
635 //****************
653 //****************
636 // SBM2 PARAMETERS
654 // SBM2 PARAMETERS
637 volatile unsigned char sy_lfr_s2_bp_p0;
655 unsigned char sy_lfr_s2_bp_p0;
638 volatile unsigned char sy_lfr_s2_bp_p1;
656 unsigned char sy_lfr_s2_bp_p1;
639 };
657 };
640 typedef struct Packet_TM_LFR_PARAMETER_DUMP_str Packet_TM_LFR_PARAMETER_DUMP_t;
658 typedef struct Packet_TM_LFR_PARAMETER_DUMP_str Packet_TM_LFR_PARAMETER_DUMP_t;
641
659
@@ -24,16 +24,20 extern unsigned char lfrCurrentMode;
24 // MODE PARAMETERS
24 // MODE PARAMETERS
25 extern struct param_local_str param_local;
25 extern struct param_local_str param_local;
26 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
26 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
27 extern unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID];
27 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
28 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
29 extern unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
28
30
29 // RTEMS TASKS
31 // RTEMS TASKS
30 rtems_task Init( rtems_task_argument argument);
32 rtems_task Init( rtems_task_argument argument);
31
33
32 // OTHER functions
34 // OTHER functions
33 void create_names( void );
35 void create_names( void );
34 rtems_status_code create_message_queues( void );
35 int create_all_tasks( void );
36 int create_all_tasks( void );
36 int start_all_tasks( void );
37 int start_all_tasks( void );
38 //
39 rtems_status_code create_message_queues( void );
40 //
37 int start_recv_send_tasks( void );
41 int start_recv_send_tasks( void );
38 //
42 //
39 void init_local_mode_parameters( void );
43 void init_local_mode_parameters( void );
@@ -32,4 +32,6 rtems_task dumb_task( rtems_task_argumen
32
32
33 void init_housekeeping_parameters( void );
33 void init_housekeeping_parameters( void );
34
34
35 void increment_seq_counter( unsigned char *packet_sequence_control);
36
35 #endif // FSW_MISC_H_INCLUDED
37 #endif // FSW_MISC_H_INCLUDED
@@ -148,6 +148,8
148 #define TASK_PRIORITY_STAT 200
148 #define TASK_PRIORITY_STAT 200
149 #define TASK_PRIORITY_DUMB 200
149 #define TASK_PRIORITY_DUMB 200
150
150
151 #define SEMQ_PRIORITY_CEILING 30
152
151 #define ACTION_MSG_QUEUE_COUNT 10
153 #define ACTION_MSG_QUEUE_COUNT 10
152 #define ACTION_MSG_PKTS_COUNT 50
154 #define ACTION_MSG_PKTS_COUNT 50
153 #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
155 #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
@@ -198,32 +200,6
198 #define NB_BYTES_CWF3_LIGHT_BLK 6
200 #define NB_BYTES_CWF3_LIGHT_BLK 6
199 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
201 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
200
202
201 //******************
202 // SEQUENCE COUNTERS
203 #define SEQ_CNT_NB_PID 2
204 #define SEQ_CNT_NB_CAT 4
205 #define SEQ_CNT_NB_DEST_ID 11
206 // pid
207 #define SEQ_CNT_PID_76 0
208 #define SEQ_CNT_PID_79 1
209 //cat
210 #define SEQ_CNT_CAT_1 0
211 #define SEQ_CNT_CAT_4 1
212 #define SEQ_CNT_CAT_9 2
213 #define SEQ_CNT_CAT_12 3
214 // destination id
215 #define SEQ_CNT_DST_ID_GROUND 0
216 #define SEQ_CNT_DST_ID_MISSION_TIMELINE 1
217 #define SEQ_CNT_DST_ID_TC_SEQUENCES 2
218 #define SEQ_CNT_DST_ID_RECOVERY_ACTION_CMD 3
219 #define SEQ_CNT_DST_ID_BACKUP_MISSION_TIMELINE 4
220 #define SEQ_CNT_DST_ID_DIRECT_CMD 5
221 #define SEQ_CNT_DST_ID_SPARE_GRD_SRC1 6
222 #define SEQ_CNT_DST_ID_SPARE_GRD_SRC2 7
223 #define SEQ_CNT_DST_ID_OBCP 8
224 #define SEQ_CNT_DST_ID_SYSTEM_CONTROL 9
225 #define SEQ_CNT_DST_ID_AOCS 10
226
227 struct param_local_str{
203 struct param_local_str{
228 unsigned int local_sbm1_nb_cwf_sent;
204 unsigned int local_sbm1_nb_cwf_sent;
229 unsigned int local_sbm1_nb_cwf_max;
205 unsigned int local_sbm1_nb_cwf_max;
@@ -6,8 +6,10
6 #include <math.h>
6 #include <math.h>
7 #include <stdlib.h> // abs() is in the stdlib
7 #include <stdlib.h> // abs() is in the stdlib
8 #include <stdio.h> // printf()
8 #include <stdio.h> // printf()
9 #include <math.h>
9
10
10 #include "fsw_params.h"
11 #include "fsw_params.h"
12 #include "fsw_spacewire.h"
11
13
12
14
13 extern volatile int spec_mat_f0_0[ ];
15 extern volatile int spec_mat_f0_0[ ];
@@ -7,6 +7,7
7 #include "fsw_params.h"
7 #include "fsw_params.h"
8 #include "wf_handler.h"
8 #include "wf_handler.h"
9 #include "tm_lfr_tc_exe.h"
9 #include "tm_lfr_tc_exe.h"
10 #include "fsw_misc.h"
10
11
11 extern int fdSPW;
12 extern int fdSPW;
12 extern unsigned char lfrCurrentMode;
13 extern unsigned char lfrCurrentMode;
@@ -5,9 +5,11
5 #include <stdio.h>
5 #include <stdio.h>
6
6
7 #include "fsw_params.h"
7 #include "fsw_params.h"
8 #include "fsw_spacewire.h"
8
9
9 extern time_management_regs_t *time_management_regs;
10 extern time_management_regs_t *time_management_regs;
10 extern Packet_TM_LFR_HK_t housekeeping_packet;
11 extern Packet_TM_LFR_HK_t housekeeping_packet;
12 extern unsigned short sequenceCounters_TC_EXE[];
11
13
12 int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
14 int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
13 int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
15 int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
@@ -18,6 +20,8 int send_tm_lfr_tc_exe_error(ccsdsTeleco
18 int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
20 int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
19 unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV);
21 unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV);
20
22
23 void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id );
24
21 #endif // TM_LFR_TC_EXE_H_INCLUDED
25 #endif // TM_LFR_TC_EXE_H_INCLUDED
22
26
23
27
@@ -7,6 +7,8
7 #include <math.h>
7 #include <math.h>
8
8
9 #include "fsw_params.h"
9 #include "fsw_params.h"
10 #include "fsw_spacewire.h"
11 #include "fsw_misc.h"
10
12
11 #define pi 3.1415
13 #define pi 3.1415
12
14
@@ -31,6 +33,9 extern Packet_TM_LFR_HK_t housekeeping_p
31 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
33 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
32 extern struct param_local_str param_local;
34 extern struct param_local_str param_local;
33
35
36 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
37 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
38
34 extern rtems_name misc_name[5];
39 extern rtems_name misc_name[5];
35 extern rtems_name Task_name[20]; /* array of task ids */
40 extern rtems_name Task_name[20]; /* array of task ids */
36 extern rtems_id Task_id[20]; /* array of task ids */
41 extern rtems_id Task_id[20]; /* array of task ids */
@@ -78,4 +83,6 void set_local_nb_interrupt_f0_MAX();
78 void reset_local_sbm1_nb_cwf_sent();
83 void reset_local_sbm1_nb_cwf_sent();
79 void reset_local_sbm2_nb_cwf_sent();
84 void reset_local_sbm2_nb_cwf_sent();
80
85
86 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
87
81 #endif // WF_HANDLER_H_INCLUDED
88 #endif // WF_HANDLER_H_INCLUDED
@@ -83,7 +83,9 struct param_local_str param_local;
83 // HK PACKETS
83 // HK PACKETS
84 Packet_TM_LFR_HK_t housekeeping_packet;
84 Packet_TM_LFR_HK_t housekeeping_packet;
85 // sequence counters are incremented by APID (PID + CAT) and destination ID
85 // sequence counters are incremented by APID (PID + CAT) and destination ID
86 unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID];
86 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
87 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
88 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
87 spw_stats spacewire_stats;
89 spw_stats spacewire_stats;
88 spw_stats spacewire_stats_backup;
90 spw_stats spacewire_stats_backup;
89
91
@@ -197,8 +197,6 void init_local_mode_parameters( void )
197 */
197 */
198
198
199 unsigned int i;
199 unsigned int i;
200 unsigned int j;
201 unsigned int k;
202
200
203 // LOCAL PARAMETERS
201 // LOCAL PARAMETERS
204 set_local_sbm1_nb_cwf_max();
202 set_local_sbm1_nb_cwf_max();
@@ -213,16 +211,13 void init_local_mode_parameters( void )
213 reset_local_sbm2_nb_cwf_sent();
211 reset_local_sbm2_nb_cwf_sent();
214
212
215 // init sequence counters
213 // init sequence counters
216 for (i = 0; i<SEQ_CNT_NB_PID; i++)
214
217 {
215 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
218 for(j = 0; j<SEQ_CNT_NB_CAT; j++)
219 {
216 {
220 for(k = 0; k<SEQ_CNT_NB_DEST_ID; k++)
217 sequenceCounters_TC_EXE[i] = 0x00;
221 {
222 sequenceCounters[i][j][k] = 0x00;
223 }
218 }
224 }
219 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
225 }
220 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
226 }
221 }
227
222
228 void create_names( void ) // create all names for tasks and queues
223 void create_names( void ) // create all names for tasks and queues
@@ -352,7 +347,7 int create_all_tasks( void ) // create a
352 {
347 {
353 status = rtems_task_create(
348 status = rtems_task_create(
354 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
349 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
355 RTEMS_DEFAULT_MODES,
350 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
356 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
351 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
357 );
352 );
358 }
353 }
@@ -589,4 +584,3 rtems_status_code create_message_queues(
589
584
590 return ret;
585 return ret;
591 }
586 }
592
@@ -204,6 +204,7 rtems_task hous_task(rtems_task_argument
204 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
204 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
205 }
205 }
206 else {
206 else {
207 increment_seq_counter( housekeeping_packet.packetSequenceControl );
207 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
208 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
208 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
209 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
209 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
210 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
@@ -215,7 +216,7 rtems_task hous_task(rtems_task_argument
215 spacewire_update_statistics();
216 spacewire_update_statistics();
216
217
217 // SEND PACKET
218 // SEND PACKET
218 status = rtems_message_queue_urgent( queue_id, &housekeeping_packet,
219 status = rtems_message_queue_send( queue_id, &housekeeping_packet,
219 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
220 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
220 if (status != RTEMS_SUCCESSFUL) {
221 if (status != RTEMS_SUCCESSFUL) {
221 PRINTF1("in HOUS *** ERR send: %d\n", status)
222 PRINTF1("in HOUS *** ERR send: %d\n", status)
@@ -293,3 +294,32 void init_housekeeping_parameters( void
293
294
294 }
295 }
295
296
297 void increment_seq_counter( unsigned char *packet_sequence_control)
298 {
299 unsigned short sequence_cnt;
300 unsigned short segmentation_grouping_flag;
301 unsigned short new_packet_sequence_control;
302
303 segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6
304 sequence_cnt = (unsigned short) (
305 ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0
306 + packet_sequence_control[1]
307 );
308
309 if ( sequence_cnt < SEQ_CNT_MAX)
310 {
311 sequence_cnt = sequence_cnt + 1;
312 }
313 else
314 {
315 sequence_cnt = 0;
316 }
317
318 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
319
320 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
321 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
322 }
323
324
325
@@ -8,7 +8,6
8 */
8 */
9
9
10 #include <fsw_processing.h>
10 #include <fsw_processing.h>
11 #include <math.h>
12
11
13 #include "fsw_processing_globals.c"
12 #include "fsw_processing_globals.c"
14
13
@@ -21,6 +21,9 char *lstates[6] = {"Error-reset",
21 "Run"
21 "Run"
22 };
22 };
23
23
24 rtems_name semq_name;
25 rtems_id semq_id;
26
24 //***********
27 //***********
25 // RTEMS TASK
28 // RTEMS TASK
26 rtems_task spiq_task(rtems_task_argument unused)
29 rtems_task spiq_task(rtems_task_argument unused)
@@ -600,3 +603,21 rtems_timer_service_routine user_routine
600 status = RTEMS_SUCCESSFUL;
603 status = RTEMS_SUCCESSFUL;
601 }
604 }
602 }
605 }
606
607 rtems_status_code rtems_message_queue_send_lfr( rtems_id id, const void *buffer, size_t size )
608 {
609 rtems_status_code status;
610 rtems_mode previous_mode_set;
611
612 // set the preemption OFF
613 status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &previous_mode_set );
614
615 // use the message queue
616 status = rtems_message_queue_send_lfr( id, buffer, size );
617
618 // set the preemption ON
619 status = rtems_task_mode( RTEMS_PREEMPT , RTEMS_PREEMPT_MASK, &previous_mode_set );
620
621 return status;
622 }
623
@@ -212,6 +212,7 int action_dump_par( rtems_id queue_id )
212 int status;
212 int status;
213
213
214 // UPDATE TIME
214 // UPDATE TIME
215 increment_seq_counter( parameter_dump_packet.packetSequenceControl );
215 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
216 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
216 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
217 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
217 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
218 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
@@ -43,8 +43,7 int send_tm_lfr_tc_exe_success( ccsdsTel
43 // PACKET HEADER
43 // PACKET HEADER
44 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
44 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
45 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
45 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
46 TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
46 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
47 TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
48 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8);
47 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8);
49 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS );
48 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS );
50 // DATA FIELD HEADER
49 // DATA FIELD HEADER
@@ -67,7 +66,7 int send_tm_lfr_tc_exe_success( ccsdsTel
67 messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
66 messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
68
67
69 // SEND DATA
68 // SEND DATA
70 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
69 status = rtems_message_queue_send( queue_id, &TM, messageSize);
71 if (status != RTEMS_SUCCESSFUL) {
70 if (status != RTEMS_SUCCESSFUL) {
72 PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n")
71 PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n")
73 }
72 }
@@ -106,15 +105,14 int send_tm_lfr_tc_exe_inconsistent( ccs
106 // PACKET HEADER
105 // PACKET HEADER
107 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
106 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
108 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
107 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
109 TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
108 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
110 TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
111 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8);
109 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8);
112 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT );
110 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT );
113 // DATA FIELD HEADER
111 // DATA FIELD HEADER
114 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
112 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
115 TM.serviceType = TM_TYPE_TC_EXE;
113 TM.serviceType = TM_TYPE_TC_EXE;
116 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
114 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
117 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
115 TM.destinationID = TC->sourceID;
118 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
116 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
119 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
117 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
120 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
118 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
@@ -136,7 +134,7 int send_tm_lfr_tc_exe_inconsistent( ccs
136 messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
134 messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
137
135
138 // SEND DATA
136 // SEND DATA
139 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
137 status = rtems_message_queue_send( queue_id, &TM, messageSize);
140 if (status != RTEMS_SUCCESSFUL) {
138 if (status != RTEMS_SUCCESSFUL) {
141 PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n")
139 PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n")
142 }
140 }
@@ -172,15 +170,14 int send_tm_lfr_tc_exe_not_executable( c
172 // PACKET HEADER
170 // PACKET HEADER
173 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
171 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
174 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
172 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
175 TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
173 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
176 TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
177 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8);
174 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8);
178 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE );
175 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE );
179 // DATA FIELD HEADER
176 // DATA FIELD HEADER
180 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
177 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
181 TM.serviceType = TM_TYPE_TC_EXE;
178 TM.serviceType = TM_TYPE_TC_EXE;
182 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
179 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
183 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
180 TM.destinationID = TC->sourceID; // default destination id
184 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
181 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
185 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
182 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
186 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
183 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
@@ -202,7 +199,7 int send_tm_lfr_tc_exe_not_executable( c
202 messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
199 messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
203
200
204 // SEND DATA
201 // SEND DATA
205 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
202 status = rtems_message_queue_send( queue_id, &TM, messageSize);
206 if (status != RTEMS_SUCCESSFUL) {
203 if (status != RTEMS_SUCCESSFUL) {
207 PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n")
204 PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n")
208 }
205 }
@@ -238,15 +235,14 int send_tm_lfr_tc_exe_not_implemented(
238 // PACKET HEADER
235 // PACKET HEADER
239 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
236 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
240 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
237 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
241 TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
238 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
242 TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
243 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8);
239 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8);
244 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED );
240 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED );
245 // DATA FIELD HEADER
241 // DATA FIELD HEADER
246 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
242 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
247 TM.serviceType = TM_TYPE_TC_EXE;
243 TM.serviceType = TM_TYPE_TC_EXE;
248 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
244 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
249 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
245 TM.destinationID = TC->sourceID; // default destination id
250 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
246 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
251 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
247 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
252 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
248 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
@@ -266,7 +262,7 int send_tm_lfr_tc_exe_not_implemented(
266 messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
262 messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
267
263
268 // SEND DATA
264 // SEND DATA
269 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
265 status = rtems_message_queue_send( queue_id, &TM, messageSize);
270 if (status != RTEMS_SUCCESSFUL) {
266 if (status != RTEMS_SUCCESSFUL) {
271 PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n")
267 PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n")
272 }
268 }
@@ -302,15 +298,14 int send_tm_lfr_tc_exe_error( ccsdsTelec
302 // PACKET HEADER
298 // PACKET HEADER
303 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
299 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
304 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
300 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
305 TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
301 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
306 TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
307 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8);
302 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8);
308 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR );
303 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR );
309 // DATA FIELD HEADER
304 // DATA FIELD HEADER
310 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
305 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
311 TM.serviceType = TM_TYPE_TC_EXE;
306 TM.serviceType = TM_TYPE_TC_EXE;
312 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
307 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
313 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
308 TM.destinationID = TC->sourceID; // default destination id
314 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
309 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
315 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
310 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
316 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
311 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
@@ -330,7 +325,7 int send_tm_lfr_tc_exe_error( ccsdsTelec
330 messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
325 messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
331
326
332 // SEND DATA
327 // SEND DATA
333 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
328 status = rtems_message_queue_send( queue_id, &TM, messageSize);
334 if (status != RTEMS_SUCCESSFUL) {
329 if (status != RTEMS_SUCCESSFUL) {
335 PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n")
330 PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n")
336 }
331 }
@@ -374,15 +369,14 int send_tm_lfr_tc_exe_corrupted(ccsdsTe
374 // PACKET HEADER
369 // PACKET HEADER
375 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
370 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
376 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
371 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
377 TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
372 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
378 TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
379 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8);
373 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8);
380 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED );
374 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED );
381 // DATA FIELD HEADER
375 // DATA FIELD HEADER
382 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
376 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
383 TM.serviceType = TM_TYPE_TC_EXE;
377 TM.serviceType = TM_TYPE_TC_EXE;
384 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
378 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
385 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
379 TM.destinationID = TC->sourceID; // default destination id
386 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
380 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
387 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
381 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
388 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
382 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
@@ -410,10 +404,87 int send_tm_lfr_tc_exe_corrupted(ccsdsTe
410 messageSize = PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
404 messageSize = PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
411
405
412 // SEND DATA
406 // SEND DATA
413 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
407 status = rtems_message_queue_send( queue_id, &TM, messageSize);
414 if (status != RTEMS_SUCCESSFUL) {
408 if (status != RTEMS_SUCCESSFUL) {
415 PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n")
409 PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n")
416 }
410 }
417
411
418 return status;
412 return status;
419 }
413 }
414
415 void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id )
416 {
417 unsigned short sequence_cnt;
418 unsigned short segmentation_grouping_flag;
419 unsigned short new_packet_sequence_control;
420 unsigned char i;
421
422 switch (destination_id)
423 {
424 case SID_TC_GROUND:
425 i = GROUND;
426 break;
427 case SID_TC_MISSION_TIMELINE:
428 i = MISSION_TIMELINE;
429 break;
430 case SID_TC_TC_SEQUENCES:
431 i = TC_SEQUENCES;
432 break;
433 case SID_TC_RECOVERY_ACTION_CMD:
434 i = RECOVERY_ACTION_CMD;
435 break;
436 case SID_TC_BACKUP_MISSION_TIMELINE:
437 i = BACKUP_MISSION_TIMELINE;
438 break;
439 case SID_TC_DIRECT_CMD:
440 i = DIRECT_CMD;
441 break;
442 case SID_TC_SPARE_GRD_SRC1:
443 i = SPARE_GRD_SRC1;
444 break;
445 case SID_TC_SPARE_GRD_SRC2:
446 i = SPARE_GRD_SRC2;
447 break;
448 case SID_TC_OBCP:
449 i = OBCP;
450 break;
451 case SID_TC_SYSTEM_CONTROL:
452 i = SYSTEM_CONTROL;
453 break;
454 case SID_TC_AOCS:
455 i = AOCS;
456 break;
457 case SID_TC_RPW_INTERNAL:
458 i = RPW_INTERNAL;
459 break;
460 default:
461 i = UNKNOWN;
462 break;
463 }
464
465 if (i != UNKNOWN)
466 {
467 segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
468 sequence_cnt = sequenceCounters_TC_EXE[ i ] & 0x3fff;
469
470 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
471
472 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
473 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
474
475 // increment the seuqence counter for the next packet
476 if ( sequenceCounters_TC_EXE[ i ] < SEQ_CNT_MAX)
477 {
478 sequenceCounters_TC_EXE[ i ] = sequenceCounters_TC_EXE[ i ] + 1;
479 }
480 else
481 {
482 sequenceCounters_TC_EXE[ i ] = 0;
483 }
484 }
485 else
486 {
487 PRINTF1("in increment_seq_counter_destination_id *** ERR destination ID %d not known\n", destination_id)
488 }
489
490 }
@@ -533,14 +533,14 int init_header_snapshot_wf_table( unsig
533 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
533 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
534 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
534 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
535 // AUXILIARY DATA HEADER
535 // AUXILIARY DATA HEADER
536 headerSWF[ i ].sid = sid;
537 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
538 headerSWF[ i ].time[0] = 0x00;
536 headerSWF[ i ].time[0] = 0x00;
539 headerSWF[ i ].time[0] = 0x00;
537 headerSWF[ i ].time[0] = 0x00;
540 headerSWF[ i ].time[0] = 0x00;
538 headerSWF[ i ].time[0] = 0x00;
541 headerSWF[ i ].time[0] = 0x00;
539 headerSWF[ i ].time[0] = 0x00;
542 headerSWF[ i ].time[0] = 0x00;
540 headerSWF[ i ].time[0] = 0x00;
543 headerSWF[ i ].time[0] = 0x00;
541 headerSWF[ i ].time[0] = 0x00;
542 headerSWF[ i ].sid = sid;
543 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
544 }
544 }
545 return LFR_SUCCESSFUL;
545 return LFR_SUCCESSFUL;
546 }
546 }
@@ -732,6 +732,8 int send_waveform_SWF( volatile int *wav
732 else {
732 else {
733 spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK;
733 spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK;
734 }
734 }
735 // SET PACKET SEQUENCE COUNTER
736 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
735 // SET PACKET TIME
737 // SET PACKET TIME
736 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
738 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
737 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
739 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
@@ -795,6 +797,8 int send_waveform_CWF(volatile int *wave
795 else {
797 else {
796 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK;
798 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK;
797 }
799 }
800 // SET PACKET SEQUENCE COUNTER
801 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
798 // SET PACKET TIME
802 // SET PACKET TIME
799 coarseTime = time_management_regs->coarse_time;
803 coarseTime = time_management_regs->coarse_time;
800 fineTime = time_management_regs->fine_time;
804 fineTime = time_management_regs->fine_time;
@@ -887,6 +891,8 int send_waveform_CWF3_light(volatile in
887 else {
891 else {
888 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK;
892 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK;
889 }
893 }
894 // SET PACKET SEQUENCE COUNTER
895 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
890 // SET PACKET TIME
896 // SET PACKET TIME
891 coarseTime = time_management_regs->coarse_time;
897 coarseTime = time_management_regs->coarse_time;
892 fineTime = time_management_regs->fine_time;
898 fineTime = time_management_regs->fine_time;
@@ -1170,3 +1176,44 rtems_id get_pkts_queue_id( void )
1170 }
1176 }
1171 return queue_id;
1177 return queue_id;
1172 }
1178 }
1179
1180 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1181 {
1182 unsigned short *sequence_cnt;
1183 unsigned short segmentation_grouping_flag;
1184 unsigned short new_packet_sequence_control;
1185
1186 if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2)
1187 || (sid ==SID_BURST_CWF_F2) )
1188 {
1189 sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST;
1190 }
1191 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) )
1192 {
1193 sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2;
1194 }
1195 else
1196 {
1197 sequence_cnt = &sequenceCounters_TC_EXE[ UNKNOWN ];
1198 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1199 }
1200
1201 segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8;
1202 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1203
1204 new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ;
1205
1206 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1207 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1208
1209 // increment the seuqence counter for the next packet
1210 if ( *sequence_cnt < SEQ_CNT_MAX)
1211 {
1212 *sequence_cnt = *sequence_cnt + 1;
1213 }
1214 else
1215 {
1216 *sequence_cnt = 0;
1217 }
1218
1219 }
General Comments 0
You need to be logged in to leave comments. Login now