##// END OF EJS Templates
sequence counters management added
paul -
r56:7b010fae8e4e default
parent child
Show More
@@ -1,6 +1,6
1 1 #############################################################################
2 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 4 # Project: fsw-qt.pro
5 5 # Template: app
6 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
@@ -1,6 +1,6
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 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 4 <qtcreator>
5 5 <data>
6 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -121,7 +121,6
121 121 #define CCSDS_TM_VALID 7
122 122
123 123 // TC SID
124 #define SID_TC_DEFAULT 0 // the default SID for TC sent to the LFR
125 124 #define SID_TC_GROUND 0
126 125 #define SID_TC_MISSION_TIMELINE 110
127 126 #define SID_TC_TC_SEQUENCES 111
@@ -135,6 +134,25
135 134 #define SID_TC_AOCS 11
136 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 156 // TM SID
139 157 #define SID_HK 1
140 158 #define SID_PARAMETER_DUMP 10
@@ -210,301 +228,301 enum TM_TYPE{
210 228
211 229 struct TMHeader_str
212 230 {
213 volatile unsigned char targetLogicalAddress;
214 volatile unsigned char protocolIdentifier;
215 volatile unsigned char reserved;
216 volatile unsigned char userApplication;
217 volatile unsigned char packetID[2];
218 volatile unsigned char packetSequenceControl[2];
219 volatile unsigned char packetLength[2];
231 unsigned char targetLogicalAddress;
232 unsigned char protocolIdentifier;
233 unsigned char reserved;
234 unsigned char userApplication;
235 unsigned char packetID[2];
236 unsigned char packetSequenceControl[2];
237 unsigned char packetLength[2];
220 238 // DATA FIELD HEADER
221 volatile unsigned char spare1_pusVersion_spare2;
222 volatile unsigned char serviceType;
223 volatile unsigned char serviceSubType;
224 volatile unsigned char destinationID;
225 volatile unsigned char time[6];
239 unsigned char spare1_pusVersion_spare2;
240 unsigned char serviceType;
241 unsigned char serviceSubType;
242 unsigned char destinationID;
243 unsigned char time[6];
226 244 };
227 245 typedef struct TMHeader_str TMHeader_t;
228 246
229 247 struct Packet_TM_LFR_TC_EXE_str
230 248 {
231 volatile unsigned char targetLogicalAddress;
232 volatile unsigned char protocolIdentifier;
233 volatile unsigned char reserved;
234 volatile unsigned char userApplication;
235 volatile unsigned char packetID[2];
236 volatile unsigned char packetSequenceControl[2];
237 volatile unsigned char packetLength[2];
249 unsigned char targetLogicalAddress;
250 unsigned char protocolIdentifier;
251 unsigned char reserved;
252 unsigned char userApplication;
253 unsigned char packetID[2];
254 unsigned char packetSequenceControl[2];
255 unsigned char packetLength[2];
238 256 // DATA FIELD HEADER
239 volatile unsigned char spare1_pusVersion_spare2;
240 volatile unsigned char serviceType;
241 volatile unsigned char serviceSubType;
242 volatile unsigned char destinationID;
243 volatile unsigned char time[6];
244 volatile unsigned char data[LENGTH_TM_LFR_TC_EXE_MAX - 10 + 1];
257 unsigned char spare1_pusVersion_spare2;
258 unsigned char serviceType;
259 unsigned char serviceSubType;
260 unsigned char destinationID;
261 unsigned char time[6];
262 unsigned char data[LENGTH_TM_LFR_TC_EXE_MAX - 10 + 1];
245 263 };
246 264 typedef struct Packet_TM_LFR_TC_EXE_str Packet_TM_LFR_TC_EXE_t;
247 265
248 266 struct Packet_TM_LFR_TC_EXE_SUCCESS_str
249 267 {
250 volatile unsigned char targetLogicalAddress;
251 volatile unsigned char protocolIdentifier;
252 volatile unsigned char reserved;
253 volatile unsigned char userApplication;
268 unsigned char targetLogicalAddress;
269 unsigned char protocolIdentifier;
270 unsigned char reserved;
271 unsigned char userApplication;
254 272 // PACKET HEADER
255 volatile unsigned char packetID[2];
256 volatile unsigned char packetSequenceControl[2];
257 volatile unsigned char packetLength[2];
273 unsigned char packetID[2];
274 unsigned char packetSequenceControl[2];
275 unsigned char packetLength[2];
258 276 // DATA FIELD HEADER
259 volatile unsigned char spare1_pusVersion_spare2;
260 volatile unsigned char serviceType;
261 volatile unsigned char serviceSubType;
262 volatile unsigned char destinationID;
263 volatile unsigned char time[6];
277 unsigned char spare1_pusVersion_spare2;
278 unsigned char serviceType;
279 unsigned char serviceSubType;
280 unsigned char destinationID;
281 unsigned char time[6];
264 282 //
265 volatile unsigned char telecommand_pkt_id[2];
266 volatile unsigned char pkt_seq_control[2];
283 unsigned char telecommand_pkt_id[2];
284 unsigned char pkt_seq_control[2];
267 285 };
268 286 typedef struct Packet_TM_LFR_TC_EXE_SUCCESS_str Packet_TM_LFR_TC_EXE_SUCCESS_t;
269 287
270 288 struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str
271 289 {
272 volatile unsigned char targetLogicalAddress;
273 volatile unsigned char protocolIdentifier;
274 volatile unsigned char reserved;
275 volatile unsigned char userApplication;
290 unsigned char targetLogicalAddress;
291 unsigned char protocolIdentifier;
292 unsigned char reserved;
293 unsigned char userApplication;
276 294 // PACKET HEADER
277 volatile unsigned char packetID[2];
278 volatile unsigned char packetSequenceControl[2];
279 volatile unsigned char packetLength[2];
295 unsigned char packetID[2];
296 unsigned char packetSequenceControl[2];
297 unsigned char packetLength[2];
280 298 // DATA FIELD HEADER
281 volatile unsigned char spare1_pusVersion_spare2;
282 volatile unsigned char serviceType;
283 volatile unsigned char serviceSubType;
284 volatile unsigned char destinationID;
285 volatile unsigned char time[6];
299 unsigned char spare1_pusVersion_spare2;
300 unsigned char serviceType;
301 unsigned char serviceSubType;
302 unsigned char destinationID;
303 unsigned char time[6];
286 304 //
287 volatile unsigned char tc_failure_code[2];
288 volatile unsigned char telecommand_pkt_id[2];
289 volatile unsigned char pkt_seq_control[2];
290 volatile unsigned char tc_service;
291 volatile unsigned char tc_subtype;
292 volatile unsigned char byte_position;
293 volatile unsigned char rcv_value;
305 unsigned char tc_failure_code[2];
306 unsigned char telecommand_pkt_id[2];
307 unsigned char pkt_seq_control[2];
308 unsigned char tc_service;
309 unsigned char tc_subtype;
310 unsigned char byte_position;
311 unsigned char rcv_value;
294 312 };
295 313 typedef struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str Packet_TM_LFR_TC_EXE_INCONSISTENT_t;
296 314
297 315 struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str
298 316 {
299 volatile unsigned char targetLogicalAddress;
300 volatile unsigned char protocolIdentifier;
301 volatile unsigned char reserved;
302 volatile unsigned char userApplication;
317 unsigned char targetLogicalAddress;
318 unsigned char protocolIdentifier;
319 unsigned char reserved;
320 unsigned char userApplication;
303 321 // PACKET HEADER
304 volatile unsigned char packetID[2];
305 volatile unsigned char packetSequenceControl[2];
306 volatile unsigned char packetLength[2];
322 unsigned char packetID[2];
323 unsigned char packetSequenceControl[2];
324 unsigned char packetLength[2];
307 325 // DATA FIELD HEADER
308 volatile unsigned char spare1_pusVersion_spare2;
309 volatile unsigned char serviceType;
310 volatile unsigned char serviceSubType;
311 volatile unsigned char destinationID;
312 volatile unsigned char time[6];
326 unsigned char spare1_pusVersion_spare2;
327 unsigned char serviceType;
328 unsigned char serviceSubType;
329 unsigned char destinationID;
330 unsigned char time[6];
313 331 //
314 volatile unsigned char tc_failure_code[2];
315 volatile unsigned char telecommand_pkt_id[2];
316 volatile unsigned char pkt_seq_control[2];
317 volatile unsigned char tc_service;
318 volatile unsigned char tc_subtype;
319 volatile unsigned char lfr_status_word[2];
332 unsigned char tc_failure_code[2];
333 unsigned char telecommand_pkt_id[2];
334 unsigned char pkt_seq_control[2];
335 unsigned char tc_service;
336 unsigned char tc_subtype;
337 unsigned char lfr_status_word[2];
320 338 };
321 339 typedef struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t;
322 340
323 341 struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str
324 342 {
325 volatile unsigned char targetLogicalAddress;
326 volatile unsigned char protocolIdentifier;
327 volatile unsigned char reserved;
328 volatile unsigned char userApplication;
343 unsigned char targetLogicalAddress;
344 unsigned char protocolIdentifier;
345 unsigned char reserved;
346 unsigned char userApplication;
329 347 // PACKET HEADER
330 volatile unsigned char packetID[2];
331 volatile unsigned char packetSequenceControl[2];
332 volatile unsigned char packetLength[2];
348 unsigned char packetID[2];
349 unsigned char packetSequenceControl[2];
350 unsigned char packetLength[2];
333 351 // DATA FIELD HEADER
334 volatile unsigned char spare1_pusVersion_spare2;
335 volatile unsigned char serviceType;
336 volatile unsigned char serviceSubType;
337 volatile unsigned char destinationID;
338 volatile unsigned char time[6];
352 unsigned char spare1_pusVersion_spare2;
353 unsigned char serviceType;
354 unsigned char serviceSubType;
355 unsigned char destinationID;
356 unsigned char time[6];
339 357 //
340 volatile unsigned char tc_failure_code[2];
341 volatile unsigned char telecommand_pkt_id[2];
342 volatile unsigned char pkt_seq_control[2];
343 volatile unsigned char tc_service;
344 volatile unsigned char tc_subtype;
358 unsigned char tc_failure_code[2];
359 unsigned char telecommand_pkt_id[2];
360 unsigned char pkt_seq_control[2];
361 unsigned char tc_service;
362 unsigned char tc_subtype;
345 363 };
346 364 typedef struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t;
347 365
348 366 struct Packet_TM_LFR_TC_EXE_ERROR_str
349 367 {
350 volatile unsigned char targetLogicalAddress;
351 volatile unsigned char protocolIdentifier;
352 volatile unsigned char reserved;
353 volatile unsigned char userApplication;
368 unsigned char targetLogicalAddress;
369 unsigned char protocolIdentifier;
370 unsigned char reserved;
371 unsigned char userApplication;
354 372 // PACKET HEADER
355 volatile unsigned char packetID[2];
356 volatile unsigned char packetSequenceControl[2];
357 volatile unsigned char packetLength[2];
373 unsigned char packetID[2];
374 unsigned char packetSequenceControl[2];
375 unsigned char packetLength[2];
358 376 // DATA FIELD HEADER
359 volatile unsigned char spare1_pusVersion_spare2;
360 volatile unsigned char serviceType;
361 volatile unsigned char serviceSubType;
362 volatile unsigned char destinationID;
363 volatile unsigned char time[6];
377 unsigned char spare1_pusVersion_spare2;
378 unsigned char serviceType;
379 unsigned char serviceSubType;
380 unsigned char destinationID;
381 unsigned char time[6];
364 382 //
365 volatile unsigned char tc_failure_code[2];
366 volatile unsigned char telecommand_pkt_id[2];
367 volatile unsigned char pkt_seq_control[2];
368 volatile unsigned char tc_service;
369 volatile unsigned char tc_subtype;
383 unsigned char tc_failure_code[2];
384 unsigned char telecommand_pkt_id[2];
385 unsigned char pkt_seq_control[2];
386 unsigned char tc_service;
387 unsigned char tc_subtype;
370 388 };
371 389 typedef struct Packet_TM_LFR_TC_EXE_ERROR_str Packet_TM_LFR_TC_EXE_ERROR_t;
372 390
373 391 struct Packet_TM_LFR_TC_EXE_CORRUPTED_str
374 392 {
375 volatile unsigned char targetLogicalAddress;
376 volatile unsigned char protocolIdentifier;
377 volatile unsigned char reserved;
378 volatile unsigned char userApplication;
393 unsigned char targetLogicalAddress;
394 unsigned char protocolIdentifier;
395 unsigned char reserved;
396 unsigned char userApplication;
379 397 // PACKET HEADER
380 volatile unsigned char packetID[2];
381 volatile unsigned char packetSequenceControl[2];
382 volatile unsigned char packetLength[2];
398 unsigned char packetID[2];
399 unsigned char packetSequenceControl[2];
400 unsigned char packetLength[2];
383 401 // DATA FIELD HEADER
384 volatile unsigned char spare1_pusVersion_spare2;
385 volatile unsigned char serviceType;
386 volatile unsigned char serviceSubType;
387 volatile unsigned char destinationID;
388 volatile unsigned char time[6];
402 unsigned char spare1_pusVersion_spare2;
403 unsigned char serviceType;
404 unsigned char serviceSubType;
405 unsigned char destinationID;
406 unsigned char time[6];
389 407 //
390 volatile unsigned char tc_failure_code[2];
391 volatile unsigned char telecommand_pkt_id[2];
392 volatile unsigned char pkt_seq_control[2];
393 volatile unsigned char tc_service;
394 volatile unsigned char tc_subtype;
395 volatile unsigned char pkt_len_rcv_value[2];
396 volatile unsigned char pkt_datafieldsize_cnt[2];
397 volatile unsigned char rcv_crc[2];
398 volatile unsigned char computed_crc[2];
408 unsigned char tc_failure_code[2];
409 unsigned char telecommand_pkt_id[2];
410 unsigned char pkt_seq_control[2];
411 unsigned char tc_service;
412 unsigned char tc_subtype;
413 unsigned char pkt_len_rcv_value[2];
414 unsigned char pkt_datafieldsize_cnt[2];
415 unsigned char rcv_crc[2];
416 unsigned char computed_crc[2];
399 417 };
400 418 typedef struct Packet_TM_LFR_TC_EXE_CORRUPTED_str Packet_TM_LFR_TC_EXE_CORRUPTED_t;
401 419
402 420 struct Header_TM_LFR_SCIENCE_SWF_str
403 421 {
404 volatile unsigned char targetLogicalAddress;
405 volatile unsigned char protocolIdentifier;
406 volatile unsigned char reserved;
407 volatile unsigned char userApplication;
408 volatile unsigned char packetID[2];
409 volatile unsigned char packetSequenceControl[2];
410 volatile unsigned char packetLength[2];
422 unsigned char targetLogicalAddress;
423 unsigned char protocolIdentifier;
424 unsigned char reserved;
425 unsigned char userApplication;
426 unsigned char packetID[2];
427 unsigned char packetSequenceControl[2];
428 unsigned char packetLength[2];
411 429 // DATA FIELD HEADER
412 volatile unsigned char spare1_pusVersion_spare2;
413 volatile unsigned char serviceType;
414 volatile unsigned char serviceSubType;
415 volatile unsigned char destinationID;
416 volatile unsigned char time[6];
430 unsigned char spare1_pusVersion_spare2;
431 unsigned char serviceType;
432 unsigned char serviceSubType;
433 unsigned char destinationID;
434 unsigned char time[6];
417 435 // AUXILIARY HEADER
418 volatile unsigned char sid;
419 volatile unsigned char hkBIA;
420 volatile unsigned char pktCnt;
421 volatile unsigned char pktNr;
422 volatile unsigned char acquisitionTime[6];
423 volatile unsigned char blkNr[2];
436 unsigned char sid;
437 unsigned char hkBIA;
438 unsigned char pktCnt;
439 unsigned char pktNr;
440 unsigned char acquisitionTime[6];
441 unsigned char blkNr[2];
424 442 };
425 443 typedef struct Header_TM_LFR_SCIENCE_SWF_str Header_TM_LFR_SCIENCE_SWF_t;
426 444
427 445 struct Header_TM_LFR_SCIENCE_CWF_str
428 446 {
429 volatile unsigned char targetLogicalAddress;
430 volatile unsigned char protocolIdentifier;
431 volatile unsigned char reserved;
432 volatile unsigned char userApplication;
433 volatile unsigned char packetID[2];
434 volatile unsigned char packetSequenceControl[2];
435 volatile unsigned char packetLength[2];
447 unsigned char targetLogicalAddress;
448 unsigned char protocolIdentifier;
449 unsigned char reserved;
450 unsigned char userApplication;
451 unsigned char packetID[2];
452 unsigned char packetSequenceControl[2];
453 unsigned char packetLength[2];
436 454 // DATA FIELD HEADER
437 volatile unsigned char spare1_pusVersion_spare2;
438 volatile unsigned char serviceType;
439 volatile unsigned char serviceSubType;
440 volatile unsigned char destinationID;
441 volatile unsigned char time[6];
455 unsigned char spare1_pusVersion_spare2;
456 unsigned char serviceType;
457 unsigned char serviceSubType;
458 unsigned char destinationID;
459 unsigned char time[6];
442 460 // AUXILIARY DATA HEADER
443 volatile unsigned char sid;
444 volatile unsigned char hkBIA;
445 volatile unsigned char acquisitionTime[6];
446 volatile unsigned char blkNr[2];
461 unsigned char sid;
462 unsigned char hkBIA;
463 unsigned char acquisitionTime[6];
464 unsigned char blkNr[2];
447 465 };
448 466 typedef struct Header_TM_LFR_SCIENCE_CWF_str Header_TM_LFR_SCIENCE_CWF_t;
449 467
450 468 struct Header_TM_LFR_SCIENCE_ASM_str
451 469 {
452 volatile unsigned char targetLogicalAddress;
453 volatile unsigned char protocolIdentifier;
454 volatile unsigned char reserved;
455 volatile unsigned char userApplication;
456 volatile unsigned char packetID[2];
457 volatile unsigned char packetSequenceControl[2];
458 volatile unsigned char packetLength[2];
470 unsigned char targetLogicalAddress;
471 unsigned char protocolIdentifier;
472 unsigned char reserved;
473 unsigned char userApplication;
474 unsigned char packetID[2];
475 unsigned char packetSequenceControl[2];
476 unsigned char packetLength[2];
459 477 // DATA FIELD HEADER
460 volatile unsigned char spare1_pusVersion_spare2;
461 volatile unsigned char serviceType;
462 volatile unsigned char serviceSubType;
463 volatile unsigned char destinationID;
464 volatile unsigned char time[6];
478 unsigned char spare1_pusVersion_spare2;
479 unsigned char serviceType;
480 unsigned char serviceSubType;
481 unsigned char destinationID;
482 unsigned char time[6];
465 483 // AUXILIARY HEADER
466 volatile unsigned char sid;
467 volatile unsigned char biaStatusInfo;
468 volatile unsigned char cntASM;
469 volatile unsigned char nrASM;
470 volatile unsigned char acquisitionTime[6];
471 volatile unsigned char blkNr[2];
484 unsigned char sid;
485 unsigned char biaStatusInfo;
486 unsigned char cntASM;
487 unsigned char nrASM;
488 unsigned char acquisitionTime[6];
489 unsigned char blkNr[2];
472 490 };
473 491 typedef struct Header_TM_LFR_SCIENCE_ASM_str Header_TM_LFR_SCIENCE_ASM_t;
474 492
475 493 struct ccsdsTelecommandPacket_str
476 494 {
477 495 //unsigned char targetLogicalAddress; // removed by the grspw module
478 volatile unsigned char protocolIdentifier;
479 volatile unsigned char reserved;
480 volatile unsigned char userApplication;
481 volatile unsigned char packetID[2];
482 volatile unsigned char packetSequenceControl[2];
483 volatile unsigned char packetLength[2];
496 unsigned char protocolIdentifier;
497 unsigned char reserved;
498 unsigned char userApplication;
499 unsigned char packetID[2];
500 unsigned char packetSequenceControl[2];
501 unsigned char packetLength[2];
484 502 // DATA FIELD HEADER
485 volatile unsigned char headerFlag_pusVersion_Ack;
486 volatile unsigned char serviceType;
487 volatile unsigned char serviceSubType;
488 volatile unsigned char sourceID;
489 volatile unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10];
503 unsigned char headerFlag_pusVersion_Ack;
504 unsigned char serviceType;
505 unsigned char serviceSubType;
506 unsigned char sourceID;
507 unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10];
490 508 };
491 509 typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t;
492 510
493 511 struct Packet_TM_LFR_HK_str
494 512 {
495 volatile unsigned char targetLogicalAddress;
496 volatile unsigned char protocolIdentifier;
497 volatile unsigned char reserved;
498 volatile unsigned char userApplication;
499 volatile unsigned char packetID[2];
500 volatile unsigned char packetSequenceControl[2];
501 volatile unsigned char packetLength[2];
502 volatile unsigned char spare1_pusVersion_spare2;
503 volatile unsigned char serviceType;
504 volatile unsigned char serviceSubType;
505 volatile unsigned char destinationID;
506 volatile unsigned char time[6];
507 volatile unsigned char sid;
513 unsigned char targetLogicalAddress;
514 unsigned char protocolIdentifier;
515 unsigned char reserved;
516 unsigned char userApplication;
517 unsigned char packetID[2];
518 unsigned char packetSequenceControl[2];
519 unsigned char packetLength[2];
520 unsigned char spare1_pusVersion_spare2;
521 unsigned char serviceType;
522 unsigned char serviceSubType;
523 unsigned char destinationID;
524 unsigned char time[6];
525 unsigned char sid;
508 526
509 527 //**************
510 528 // HK PARAMETERS
@@ -539,7 +557,7 struct Packet_TM_LFR_HK_str
539 557 unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2];
540 558 unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2];
541 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 561 // ahb error statistics
544 562 unsigned int hk_lfr_last_fail_addr;
545 563 // temperatures
@@ -594,48 +612,48 typedef struct Packet_TM_LFR_HK_str Pack
594 612
595 613 struct Packet_TM_LFR_PARAMETER_DUMP_str
596 614 {
597 volatile unsigned char targetLogicalAddress;
598 volatile unsigned char protocolIdentifier;
599 volatile unsigned char reserved;
600 volatile unsigned char userApplication;
601 volatile unsigned char packetID[2];
602 volatile unsigned char packetSequenceControl[2];
603 volatile unsigned char packetLength[2];
615 unsigned char targetLogicalAddress;
616 unsigned char protocolIdentifier;
617 unsigned char reserved;
618 unsigned char userApplication;
619 unsigned char packetID[2];
620 unsigned char packetSequenceControl[2];
621 unsigned char packetLength[2];
604 622 // DATA FIELD HEADER
605 volatile unsigned char spare1_pusVersion_spare2;
606 volatile unsigned char serviceType;
607 volatile unsigned char serviceSubType;
608 volatile unsigned char destinationID;
609 volatile unsigned char time[6];
610 volatile unsigned char sid;
623 unsigned char spare1_pusVersion_spare2;
624 unsigned char serviceType;
625 unsigned char serviceSubType;
626 unsigned char destinationID;
627 unsigned char time[6];
628 unsigned char sid;
611 629
612 630 //******************
613 631 // COMMON PARAMETERS
614 volatile unsigned char unused0;
615 volatile unsigned char bw_sp0_sp1_r0_r1;
632 unsigned char unused0;
633 unsigned char bw_sp0_sp1_r0_r1;
616 634
617 635 //******************
618 636 // NORMAL PARAMETERS
619 volatile unsigned char sy_lfr_n_swf_l[2];
620 volatile unsigned char sy_lfr_n_swf_p[2];
621 volatile unsigned char sy_lfr_n_asm_p[2];
622 volatile unsigned char sy_lfr_n_bp_p0;
623 volatile unsigned char sy_lfr_n_bp_p1;
637 unsigned char sy_lfr_n_swf_l[2];
638 unsigned char sy_lfr_n_swf_p[2];
639 unsigned char sy_lfr_n_asm_p[2];
640 unsigned char sy_lfr_n_bp_p0;
641 unsigned char sy_lfr_n_bp_p1;
624 642
625 643 //*****************
626 644 // BURST PARAMETERS
627 volatile unsigned char sy_lfr_b_bp_p0;
628 volatile unsigned char sy_lfr_b_bp_p1;
645 unsigned char sy_lfr_b_bp_p0;
646 unsigned char sy_lfr_b_bp_p1;
629 647
630 648 //****************
631 649 // SBM1 PARAMETERS
632 volatile unsigned char sy_lfr_s1_bp_p0;
633 volatile unsigned char sy_lfr_s1_bp_p1;
650 unsigned char sy_lfr_s1_bp_p0;
651 unsigned char sy_lfr_s1_bp_p1;
634 652
635 653 //****************
636 654 // SBM2 PARAMETERS
637 volatile unsigned char sy_lfr_s2_bp_p0;
638 volatile unsigned char sy_lfr_s2_bp_p1;
655 unsigned char sy_lfr_s2_bp_p0;
656 unsigned char sy_lfr_s2_bp_p1;
639 657 };
640 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 24 // MODE PARAMETERS
25 25 extern struct param_local_str param_local;
26 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 31 // RTEMS TASKS
30 32 rtems_task Init( rtems_task_argument argument);
31 33
32 34 // OTHER functions
33 35 void create_names( void );
34 rtems_status_code create_message_queues( void );
35 36 int create_all_tasks( void );
36 37 int start_all_tasks( void );
38 //
39 rtems_status_code create_message_queues( void );
40 //
37 41 int start_recv_send_tasks( void );
38 42 //
39 43 void init_local_mode_parameters( void );
@@ -32,4 +32,6 rtems_task dumb_task( rtems_task_argumen
32 32
33 33 void init_housekeeping_parameters( void );
34 34
35 void increment_seq_counter( unsigned char *packet_sequence_control);
36
35 37 #endif // FSW_MISC_H_INCLUDED
@@ -148,6 +148,8
148 148 #define TASK_PRIORITY_STAT 200
149 149 #define TASK_PRIORITY_DUMB 200
150 150
151 #define SEMQ_PRIORITY_CEILING 30
152
151 153 #define ACTION_MSG_QUEUE_COUNT 10
152 154 #define ACTION_MSG_PKTS_COUNT 50
153 155 #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
@@ -198,32 +200,6
198 200 #define NB_BYTES_CWF3_LIGHT_BLK 6
199 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 203 struct param_local_str{
228 204 unsigned int local_sbm1_nb_cwf_sent;
229 205 unsigned int local_sbm1_nb_cwf_max;
@@ -6,8 +6,10
6 6 #include <math.h>
7 7 #include <stdlib.h> // abs() is in the stdlib
8 8 #include <stdio.h> // printf()
9 #include <math.h>
9 10
10 11 #include "fsw_params.h"
12 #include "fsw_spacewire.h"
11 13
12 14
13 15 extern volatile int spec_mat_f0_0[ ];
@@ -7,6 +7,7
7 7 #include "fsw_params.h"
8 8 #include "wf_handler.h"
9 9 #include "tm_lfr_tc_exe.h"
10 #include "fsw_misc.h"
10 11
11 12 extern int fdSPW;
12 13 extern unsigned char lfrCurrentMode;
@@ -5,9 +5,11
5 5 #include <stdio.h>
6 6
7 7 #include "fsw_params.h"
8 #include "fsw_spacewire.h"
8 9
9 10 extern time_management_regs_t *time_management_regs;
10 11 extern Packet_TM_LFR_HK_t housekeeping_packet;
12 extern unsigned short sequenceCounters_TC_EXE[];
11 13
12 14 int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
13 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 20 int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
19 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 25 #endif // TM_LFR_TC_EXE_H_INCLUDED
22 26
23 27
@@ -7,6 +7,8
7 7 #include <math.h>
8 8
9 9 #include "fsw_params.h"
10 #include "fsw_spacewire.h"
11 #include "fsw_misc.h"
10 12
11 13 #define pi 3.1415
12 14
@@ -31,6 +33,9 extern Packet_TM_LFR_HK_t housekeeping_p
31 33 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
32 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 39 extern rtems_name misc_name[5];
35 40 extern rtems_name Task_name[20]; /* array of task ids */
36 41 extern rtems_id Task_id[20]; /* array of task ids */
@@ -78,4 +83,6 void set_local_nb_interrupt_f0_MAX();
78 83 void reset_local_sbm1_nb_cwf_sent();
79 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 88 #endif // WF_HANDLER_H_INCLUDED
@@ -83,7 +83,9 struct param_local_str param_local;
83 83 // HK PACKETS
84 84 Packet_TM_LFR_HK_t housekeeping_packet;
85 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 89 spw_stats spacewire_stats;
88 90 spw_stats spacewire_stats_backup;
89 91
@@ -197,8 +197,6 void init_local_mode_parameters( void )
197 197 */
198 198
199 199 unsigned int i;
200 unsigned int j;
201 unsigned int k;
202 200
203 201 // LOCAL PARAMETERS
204 202 set_local_sbm1_nb_cwf_max();
@@ -213,16 +211,13 void init_local_mode_parameters( void )
213 211 reset_local_sbm2_nb_cwf_sent();
214 212
215 213 // init sequence counters
216 for (i = 0; i<SEQ_CNT_NB_PID; i++)
214
215 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
217 216 {
218 for(j = 0; j<SEQ_CNT_NB_CAT; j++)
219 {
220 for(k = 0; k<SEQ_CNT_NB_DEST_ID; k++)
221 {
222 sequenceCounters[i][j][k] = 0x00;
223 }
224 }
217 sequenceCounters_TC_EXE[i] = 0x00;
225 218 }
219 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
220 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
226 221 }
227 222
228 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 348 status = rtems_task_create(
354 349 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
355 RTEMS_DEFAULT_MODES,
350 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
356 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 585 return ret;
591 586 }
592
@@ -204,6 +204,7 rtems_task hous_task(rtems_task_argument
204 204 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
205 205 }
206 206 else {
207 increment_seq_counter( housekeeping_packet.packetSequenceControl );
207 208 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
208 209 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
209 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 216 spacewire_update_statistics();
216 217
217 218 // SEND PACKET
218 status = rtems_message_queue_urgent( queue_id, &housekeeping_packet,
219 status = rtems_message_queue_send( queue_id, &housekeeping_packet,
219 220 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
220 221 if (status != RTEMS_SUCCESSFUL) {
221 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 10 #include <fsw_processing.h>
11 #include <math.h>
12 11
13 12 #include "fsw_processing_globals.c"
14 13
@@ -21,6 +21,9 char *lstates[6] = {"Error-reset",
21 21 "Run"
22 22 };
23 23
24 rtems_name semq_name;
25 rtems_id semq_id;
26
24 27 //***********
25 28 // RTEMS TASK
26 29 rtems_task spiq_task(rtems_task_argument unused)
@@ -600,3 +603,21 rtems_timer_service_routine user_routine
600 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 212 int status;
213 213
214 214 // UPDATE TIME
215 increment_seq_counter( parameter_dump_packet.packetSequenceControl );
215 216 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
216 217 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
217 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 43 // PACKET HEADER
44 44 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
45 45 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
46 TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
47 TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
46 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
48 47 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8);
49 48 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS );
50 49 // DATA FIELD HEADER
@@ -67,7 +66,7 int send_tm_lfr_tc_exe_success( ccsdsTel
67 66 messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
68 67
69 68 // SEND DATA
70 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
69 status = rtems_message_queue_send( queue_id, &TM, messageSize);
71 70 if (status != RTEMS_SUCCESSFUL) {
72 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 105 // PACKET HEADER
107 106 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
108 107 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
109 TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
110 TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
108 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
111 109 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8);
112 110 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT );
113 111 // DATA FIELD HEADER
114 112 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
115 113 TM.serviceType = TM_TYPE_TC_EXE;
116 114 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
117 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
115 TM.destinationID = TC->sourceID;
118 116 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
119 117 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
120 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 134 messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
137 135
138 136 // SEND DATA
139 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
137 status = rtems_message_queue_send( queue_id, &TM, messageSize);
140 138 if (status != RTEMS_SUCCESSFUL) {
141 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 170 // PACKET HEADER
173 171 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
174 172 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
175 TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
176 TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
173 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
177 174 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8);
178 175 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE );
179 176 // DATA FIELD HEADER
180 177 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
181 178 TM.serviceType = TM_TYPE_TC_EXE;
182 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 181 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
185 182 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
186 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 199 messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
203 200
204 201 // SEND DATA
205 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
202 status = rtems_message_queue_send( queue_id, &TM, messageSize);
206 203 if (status != RTEMS_SUCCESSFUL) {
207 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 235 // PACKET HEADER
239 236 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
240 237 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
241 TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
242 TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
238 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
243 239 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8);
244 240 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED );
245 241 // DATA FIELD HEADER
246 242 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
247 243 TM.serviceType = TM_TYPE_TC_EXE;
248 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 246 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
251 247 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
252 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 262 messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
267 263
268 264 // SEND DATA
269 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
265 status = rtems_message_queue_send( queue_id, &TM, messageSize);
270 266 if (status != RTEMS_SUCCESSFUL) {
271 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 298 // PACKET HEADER
303 299 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
304 300 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
305 TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
306 TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
301 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
307 302 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8);
308 303 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR );
309 304 // DATA FIELD HEADER
310 305 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
311 306 TM.serviceType = TM_TYPE_TC_EXE;
312 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 309 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
315 310 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
316 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 325 messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
331 326
332 327 // SEND DATA
333 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
328 status = rtems_message_queue_send( queue_id, &TM, messageSize);
334 329 if (status != RTEMS_SUCCESSFUL) {
335 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 369 // PACKET HEADER
375 370 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
376 371 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
377 TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
378 TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
372 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
379 373 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8);
380 374 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED );
381 375 // DATA FIELD HEADER
382 376 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
383 377 TM.serviceType = TM_TYPE_TC_EXE;
384 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 380 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
387 381 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
388 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 404 messageSize = PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
411 405
412 406 // SEND DATA
413 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
407 status = rtems_message_queue_send( queue_id, &TM, messageSize);
414 408 if (status != RTEMS_SUCCESSFUL) {
415 409 PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n")
416 410 }
417 411
418 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 533 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
534 534 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
535 535 // AUXILIARY DATA HEADER
536 headerSWF[ i ].sid = sid;
537 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
538 536 headerSWF[ i ].time[0] = 0x00;
539 537 headerSWF[ i ].time[0] = 0x00;
540 538 headerSWF[ i ].time[0] = 0x00;
541 539 headerSWF[ i ].time[0] = 0x00;
542 540 headerSWF[ i ].time[0] = 0x00;
543 541 headerSWF[ i ].time[0] = 0x00;
542 headerSWF[ i ].sid = sid;
543 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
544 544 }
545 545 return LFR_SUCCESSFUL;
546 546 }
@@ -732,6 +732,8 int send_waveform_SWF( volatile int *wav
732 732 else {
733 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 737 // SET PACKET TIME
736 738 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
737 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 797 else {
796 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 802 // SET PACKET TIME
799 803 coarseTime = time_management_regs->coarse_time;
800 804 fineTime = time_management_regs->fine_time;
@@ -887,6 +891,8 int send_waveform_CWF3_light(volatile in
887 891 else {
888 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 896 // SET PACKET TIME
891 897 coarseTime = time_management_regs->coarse_time;
892 898 fineTime = time_management_regs->fine_time;
@@ -1170,3 +1176,44 rtems_id get_pkts_queue_id( void )
1170 1176 }
1171 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