@@ -1,8 +1,23 | |||
|
1 | 1 | #ifndef CCSDS_TYPES_H_INCLUDED |
|
2 | 2 | #define CCSDS_TYPES_H_INCLUDED |
|
3 | 3 | |
|
4 | #define TXBDCNT 50 | |
|
5 | #define RXBDCNT 10 | |
|
6 | #define TXDATASIZE 4096 | |
|
7 | #define TXHDRSIZE 34 | |
|
8 | #define RXPKTSIZE 200 | |
|
9 | ||
|
10 | #define SPW_RXSIZE 228 | |
|
11 | #define SPW_TXDSIZE 4096 | |
|
12 | #define SPW_TXHSIZE 34 | |
|
13 | ||
|
14 | #define BITS_PID_0 0x07 | |
|
15 | #define BITS_PID_1 0x0f | |
|
16 | #define BITS_CAT 0x0f | |
|
17 | ||
|
4 | 18 | #define CCSDS_PROTOCOLE_EXTRA_BYTES 4 |
|
5 | #define CCSDS_TC_TM_PACKET_OFFSET 7 | |
|
19 | #define CCSDS_TC_TM_PACKET_OFFSET 7 | |
|
20 | #define PROTID_RES_APP 3 | |
|
6 | 21 | #define CCSDS_TELEMETRY_HEADER_LENGTH (16+4) |
|
7 | 22 | #define CCSDS_TM_PKT_MAX_SIZE 4412 |
|
8 | 23 | #define CCSDS_TELECOMMAND_HEADER_LENGTH (10+4) |
@@ -26,6 +41,7 | |||
|
26 | 41 | #define APID_TM_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12 |
|
27 | 42 | #define APID_TM_PARAMETER_DUMP 0x0cc6 // PID 76 CAT 6 |
|
28 | 43 | #define APID_TM_KCOEFFICIENTS_DUMP 0x0cc6 // PID 76 CAT 6 |
|
44 | ||
|
29 | 45 | // PACKET CAT |
|
30 | 46 | #define TM_PACKET_CAT_TC_EXE 1 |
|
31 | 47 | #define TM_PACKET_CAT_HK 4 |
@@ -37,7 +53,11 | |||
|
37 | 53 | #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000] |
|
38 | 54 | #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000] |
|
39 | 55 | #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000] |
|
40 | #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000] | |
|
56 | #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000] | |
|
57 | #define TM_PACKET_SEQ_SHIFT 8 | |
|
58 | #define SEQ_CNT_MAX 16383 | |
|
59 | #define SEQ_CNT_NB_DEST_ID 12 | |
|
60 | #define SEQ_CNT_MASK 0x3fff // [0011 1111 1111 1111] | |
|
41 | 61 | |
|
42 | 62 | // DESTINATION ID |
|
43 | 63 | #define TM_DESTINATION_ID_GROUND 0 |
@@ -194,9 +214,6 enum apid_destid{ | |||
|
194 | 214 | AOCS, |
|
195 | 215 | RPW_INTERNAL |
|
196 | 216 | }; |
|
197 | // SEQUENCE COUNTERS | |
|
198 | #define SEQ_CNT_MAX 16383 | |
|
199 | #define SEQ_CNT_NB_DEST_ID 12 | |
|
200 | 217 | |
|
201 | 218 | // TM SID |
|
202 | 219 | #define SID_HK 1 |
@@ -278,7 +295,8 enum apid_destid{ | |||
|
278 | 295 | #define TM_LEN_SCI_CWF_336 (4060 - CCSDS_TC_TM_PACKET_OFFSET) // 336 * 12 + 28 |
|
279 | 296 | #define TM_LEN_SCI_CWF_672 (4060 - CCSDS_TC_TM_PACKET_OFFSET) // 672 * 6 + 28 |
|
280 | 297 | // |
|
281 |
#define |
|
|
298 | #define PKTCNT_SWF 0x07 | |
|
299 | #define PKTCNT_ASM 3 | |
|
282 | 300 | #define BLK_NR_304 0x0130 |
|
283 | 301 | #define BLK_NR_224 0x00e0 |
|
284 | 302 | #define BLK_NR_CWF 0x0150 // 336 |
@@ -293,24 +311,48 enum TM_TYPE{ | |||
|
293 | 311 | TM_LFR_PAR_DUMP |
|
294 | 312 | }; |
|
295 | 313 | |
|
314 | #define BYTES_PER_PACKETID 2 | |
|
315 | #define BYTES_PER_SEQ_CTRL 2 | |
|
316 | #define BYTES_PER_PKT_LEN 2 | |
|
317 | #define BYTES_PER_TIME 6 | |
|
318 | #define BYTES_PER_ERR_CODE 2 | |
|
319 | #define BYTES_PER_STA_WRD 2 | |
|
320 | #define BYTES_PER_CRC 2 | |
|
321 | #define BYTES_PER_BLKNR 2 | |
|
322 | #define BYTES_PER_SW_VER 4 | |
|
323 | #define BYTES_PER_VHD_VER 3 | |
|
324 | #define COUNTER_2_BYTES 2 | |
|
325 | #define BYTES_PER_TYPE 2 | |
|
326 | #define BYTES_PER_SUBTYPE 2 | |
|
327 | #define BYTES_PER_ADDR 4 | |
|
328 | #define BYTES_PER_TEMP 2 | |
|
329 | #define BYTES_PER_V 2 | |
|
330 | #define BYTES_PER_WORD 4 | |
|
331 | #define BYTES_PER_MASK 16 | |
|
332 | #define BYTES_PER_MASKS_SET 48 // 4 * 4 * 3 | |
|
333 | ||
|
334 | #define COUNTER_2_BYTES 2 | |
|
335 | #define PARAM_2_BYTES 2 | |
|
336 | #define PARAM_4_BYTES 4 | |
|
337 | ||
|
296 | 338 | typedef struct { |
|
297 | 339 | unsigned char targetLogicalAddress; |
|
298 | 340 | unsigned char protocolIdentifier; |
|
299 | 341 | unsigned char reserved; |
|
300 | 342 | unsigned char userApplication; |
|
301 | 343 | // PACKET HEADER |
|
302 |
unsigned char packetID[ |
|
|
303 |
unsigned char packetSequenceControl[ |
|
|
304 |
unsigned char packetLength[ |
|
|
344 | unsigned char packetID[BYTES_PER_PACKETID]; | |
|
345 | unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL]; | |
|
346 | unsigned char packetLength[BYTES_PER_PKT_LEN]; | |
|
305 | 347 | // DATA FIELD HEADER |
|
306 | 348 | unsigned char spare1_pusVersion_spare2; |
|
307 | 349 | unsigned char serviceType; |
|
308 | 350 | unsigned char serviceSubType; |
|
309 | 351 | unsigned char destinationID; |
|
310 |
unsigned char time[ |
|
|
352 | unsigned char time[BYTES_PER_TIME]; | |
|
311 | 353 | // |
|
312 |
unsigned char telecommand_pkt_id[ |
|
|
313 |
unsigned char pkt_seq_control[ |
|
|
354 | unsigned char telecommand_pkt_id[BYTES_PER_PACKETID]; | |
|
355 | unsigned char pkt_seq_control[BYTES_PER_SEQ_CTRL]; | |
|
314 | 356 | } Packet_TM_LFR_TC_EXE_SUCCESS_t; |
|
315 | 357 | |
|
316 | 358 | typedef struct { |
@@ -319,19 +361,19 typedef struct { | |||
|
319 | 361 | unsigned char reserved; |
|
320 | 362 | unsigned char userApplication; |
|
321 | 363 | // PACKET HEADER |
|
322 |
unsigned char packetID[ |
|
|
323 |
unsigned char packetSequenceControl[ |
|
|
324 |
unsigned char packetLength[ |
|
|
364 | unsigned char packetID[BYTES_PER_PACKETID]; | |
|
365 | unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL]; | |
|
366 | unsigned char packetLength[BYTES_PER_PKT_LEN]; | |
|
325 | 367 | // DATA FIELD HEADER |
|
326 | 368 | unsigned char spare1_pusVersion_spare2; |
|
327 | 369 | unsigned char serviceType; |
|
328 | 370 | unsigned char serviceSubType; |
|
329 | 371 | unsigned char destinationID; |
|
330 |
unsigned char time[ |
|
|
372 | unsigned char time[BYTES_PER_TIME]; | |
|
331 | 373 | // |
|
332 |
unsigned char telecommand_pkt_id[ |
|
|
333 |
unsigned char pkt_seq_control[ |
|
|
334 |
unsigned char tc_failure_code[ |
|
|
374 | unsigned char telecommand_pkt_id[BYTES_PER_PACKETID]; | |
|
375 | unsigned char pkt_seq_control[BYTES_PER_SEQ_CTRL]; | |
|
376 | unsigned char tc_failure_code[BYTES_PER_ERR_CODE]; | |
|
335 | 377 | unsigned char tc_service; |
|
336 | 378 | unsigned char tc_subtype; |
|
337 | 379 | unsigned char byte_position; |
@@ -344,19 +386,19 typedef struct { | |||
|
344 | 386 | unsigned char reserved; |
|
345 | 387 | unsigned char userApplication; |
|
346 | 388 | // PACKET HEADER |
|
347 |
unsigned char packetID[ |
|
|
348 |
unsigned char packetSequenceControl[ |
|
|
349 |
unsigned char packetLength[ |
|
|
389 | unsigned char packetID[BYTES_PER_PACKETID]; | |
|
390 | unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL]; | |
|
391 | unsigned char packetLength[BYTES_PER_PKT_LEN]; | |
|
350 | 392 | // DATA FIELD HEADER |
|
351 | 393 | unsigned char spare1_pusVersion_spare2; |
|
352 | 394 | unsigned char serviceType; |
|
353 | 395 | unsigned char serviceSubType; |
|
354 | 396 | unsigned char destinationID; |
|
355 |
unsigned char time[ |
|
|
397 | unsigned char time[BYTES_PER_TIME]; | |
|
356 | 398 | // |
|
357 |
unsigned char telecommand_pkt_id[ |
|
|
358 |
unsigned char pkt_seq_control[ |
|
|
359 |
unsigned char tc_failure_code[ |
|
|
399 | unsigned char telecommand_pkt_id[BYTES_PER_PACKETID]; | |
|
400 | unsigned char pkt_seq_control[BYTES_PER_SEQ_CTRL]; | |
|
401 | unsigned char tc_failure_code[BYTES_PER_ERR_CODE]; | |
|
360 | 402 | unsigned char tc_service; |
|
361 | 403 | unsigned char tc_subtype; |
|
362 | 404 | unsigned char lfr_status_word[2]; |
@@ -368,19 +410,19 typedef struct { | |||
|
368 | 410 | unsigned char reserved; |
|
369 | 411 | unsigned char userApplication; |
|
370 | 412 | // PACKET HEADER |
|
371 |
unsigned char packetID[ |
|
|
372 |
unsigned char packetSequenceControl[ |
|
|
373 |
unsigned char packetLength[ |
|
|
413 | unsigned char packetID[BYTES_PER_PACKETID]; | |
|
414 | unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL]; | |
|
415 | unsigned char packetLength[BYTES_PER_PKT_LEN]; | |
|
374 | 416 | // DATA FIELD HEADER |
|
375 | 417 | unsigned char spare1_pusVersion_spare2; |
|
376 | 418 | unsigned char serviceType; |
|
377 | 419 | unsigned char serviceSubType; |
|
378 | 420 | unsigned char destinationID; |
|
379 |
unsigned char time[ |
|
|
421 | unsigned char time[BYTES_PER_TIME]; | |
|
380 | 422 | // |
|
381 |
unsigned char telecommand_pkt_id[ |
|
|
382 |
unsigned char pkt_seq_control[ |
|
|
383 |
unsigned char tc_failure_code[ |
|
|
423 | unsigned char telecommand_pkt_id[BYTES_PER_PACKETID]; | |
|
424 | unsigned char pkt_seq_control[BYTES_PER_SEQ_CTRL]; | |
|
425 | unsigned char tc_failure_code[BYTES_PER_ERR_CODE]; | |
|
384 | 426 | unsigned char tc_service; |
|
385 | 427 | unsigned char tc_subtype; |
|
386 | 428 | } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t; |
@@ -391,19 +433,19 typedef struct { | |||
|
391 | 433 | unsigned char reserved; |
|
392 | 434 | unsigned char userApplication; |
|
393 | 435 | // PACKET HEADER |
|
394 |
unsigned char packetID[ |
|
|
395 |
unsigned char packetSequenceControl[ |
|
|
396 |
unsigned char packetLength[ |
|
|
436 | unsigned char packetID[BYTES_PER_PACKETID]; | |
|
437 | unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL]; | |
|
438 | unsigned char packetLength[BYTES_PER_PKT_LEN]; | |
|
397 | 439 | // DATA FIELD HEADER |
|
398 | 440 | unsigned char spare1_pusVersion_spare2; |
|
399 | 441 | unsigned char serviceType; |
|
400 | 442 | unsigned char serviceSubType; |
|
401 | 443 | unsigned char destinationID; |
|
402 |
unsigned char time[ |
|
|
444 | unsigned char time[BYTES_PER_TIME]; | |
|
403 | 445 | // |
|
404 |
unsigned char telecommand_pkt_id[ |
|
|
405 |
unsigned char pkt_seq_control[ |
|
|
406 |
unsigned char tc_failure_code[ |
|
|
446 | unsigned char telecommand_pkt_id[BYTES_PER_PACKETID]; | |
|
447 | unsigned char pkt_seq_control[BYTES_PER_SEQ_CTRL]; | |
|
448 | unsigned char tc_failure_code[BYTES_PER_ERR_CODE]; | |
|
407 | 449 | unsigned char tc_service; |
|
408 | 450 | unsigned char tc_subtype; |
|
409 | 451 | } Packet_TM_LFR_TC_EXE_ERROR_t; |
@@ -414,25 +456,25 typedef struct { | |||
|
414 | 456 | unsigned char reserved; |
|
415 | 457 | unsigned char userApplication; |
|
416 | 458 | // PACKET HEADER |
|
417 |
unsigned char packetID[ |
|
|
418 |
unsigned char packetSequenceControl[ |
|
|
419 |
unsigned char packetLength[ |
|
|
459 | unsigned char packetID[BYTES_PER_PACKETID]; | |
|
460 | unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL]; | |
|
461 | unsigned char packetLength[BYTES_PER_PKT_LEN]; | |
|
420 | 462 | // DATA FIELD HEADER |
|
421 | 463 | unsigned char spare1_pusVersion_spare2; |
|
422 | 464 | unsigned char serviceType; |
|
423 | 465 | unsigned char serviceSubType; |
|
424 | 466 | unsigned char destinationID; |
|
425 |
unsigned char time[ |
|
|
467 | unsigned char time[BYTES_PER_TIME]; | |
|
426 | 468 | // |
|
427 |
unsigned char telecommand_pkt_id[ |
|
|
428 |
unsigned char pkt_seq_control[ |
|
|
429 |
unsigned char tc_failure_code[ |
|
|
469 | unsigned char telecommand_pkt_id[BYTES_PER_PACKETID]; | |
|
470 | unsigned char pkt_seq_control[BYTES_PER_SEQ_CTRL]; | |
|
471 | unsigned char tc_failure_code[BYTES_PER_ERR_CODE]; | |
|
430 | 472 | unsigned char tc_service; |
|
431 | 473 | unsigned char tc_subtype; |
|
432 |
unsigned char pkt_len_rcv_value[ |
|
|
433 |
unsigned char pkt_datafieldsize_cnt[ |
|
|
434 |
unsigned char rcv_crc[ |
|
|
435 |
unsigned char computed_crc[ |
|
|
474 | unsigned char pkt_len_rcv_value[BYTES_PER_PKT_LEN]; | |
|
475 | unsigned char pkt_datafieldsize_cnt[BYTES_PER_PKT_LEN]; | |
|
476 | unsigned char rcv_crc[BYTES_PER_CRC]; | |
|
477 | unsigned char computed_crc[BYTES_PER_CRC]; | |
|
436 | 478 | } Packet_TM_LFR_TC_EXE_CORRUPTED_t; |
|
437 | 479 | |
|
438 | 480 | typedef struct { |
@@ -440,15 +482,15 typedef struct { | |||
|
440 | 482 | unsigned char protocolIdentifier; |
|
441 | 483 | unsigned char reserved; |
|
442 | 484 | unsigned char userApplication; |
|
443 |
unsigned char packetID[ |
|
|
444 |
unsigned char packetSequenceControl[ |
|
|
445 |
unsigned char packetLength[ |
|
|
485 | unsigned char packetID[BYTES_PER_PACKETID]; | |
|
486 | unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL]; | |
|
487 | unsigned char packetLength[BYTES_PER_PKT_LEN]; | |
|
446 | 488 | // DATA FIELD HEADER |
|
447 | 489 | unsigned char spare1_pusVersion_spare2; |
|
448 | 490 | unsigned char serviceType; |
|
449 | 491 | unsigned char serviceSubType; |
|
450 | 492 | unsigned char destinationID; |
|
451 |
unsigned char time[ |
|
|
493 | unsigned char time[BYTES_PER_TIME]; | |
|
452 | 494 | // AUXILIARY HEADER |
|
453 | 495 | unsigned char sid; |
|
454 | 496 | unsigned char pa_bia_status_info; |
@@ -456,31 +498,36 typedef struct { | |||
|
456 | 498 | unsigned char sy_lfr_common_parameters; |
|
457 | 499 | unsigned char pktCnt; |
|
458 | 500 | unsigned char pktNr; |
|
459 |
unsigned char acquisitionTime[ |
|
|
460 |
unsigned char blkNr[ |
|
|
501 | unsigned char acquisitionTime[BYTES_PER_TIME]; | |
|
502 | unsigned char blkNr[BYTES_PER_BLKNR]; | |
|
461 | 503 | } Header_TM_LFR_SCIENCE_SWF_t; |
|
462 | 504 | |
|
505 | //******************* | |
|
506 | // TM_LFR_SCIENCE_CWF | |
|
507 | ||
|
508 | #define CWF_BLK_SIZE 6 | |
|
509 | ||
|
463 | 510 | typedef struct { |
|
464 | 511 | unsigned char targetLogicalAddress; |
|
465 | 512 | unsigned char protocolIdentifier; |
|
466 | 513 | unsigned char reserved; |
|
467 | 514 | unsigned char userApplication; |
|
468 |
unsigned char packetID[ |
|
|
469 |
unsigned char packetSequenceControl[ |
|
|
470 |
unsigned char packetLength[ |
|
|
515 | unsigned char packetID[BYTES_PER_PACKETID]; | |
|
516 | unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL]; | |
|
517 | unsigned char packetLength[BYTES_PER_PKT_LEN]; | |
|
471 | 518 | // DATA FIELD HEADER |
|
472 | 519 | unsigned char spare1_pusVersion_spare2; |
|
473 | 520 | unsigned char serviceType; |
|
474 | 521 | unsigned char serviceSubType; |
|
475 | 522 | unsigned char destinationID; |
|
476 |
unsigned char time[ |
|
|
523 | unsigned char time[BYTES_PER_TIME]; | |
|
477 | 524 | // AUXILIARY DATA HEADER |
|
478 | 525 | unsigned char sid; |
|
479 | 526 | unsigned char pa_bia_status_info; |
|
480 | 527 | unsigned char sy_lfr_common_parameters_spare; |
|
481 | 528 | unsigned char sy_lfr_common_parameters; |
|
482 |
unsigned char acquisitionTime[ |
|
|
483 |
unsigned char blkNr[ |
|
|
529 | unsigned char acquisitionTime[BYTES_PER_TIME]; | |
|
530 | unsigned char blkNr[BYTES_PER_BLKNR]; | |
|
484 | 531 | } Header_TM_LFR_SCIENCE_CWF_t; |
|
485 | 532 | |
|
486 | 533 | typedef struct { |
@@ -488,15 +535,15 typedef struct { | |||
|
488 | 535 | unsigned char protocolIdentifier; |
|
489 | 536 | unsigned char reserved; |
|
490 | 537 | unsigned char userApplication; |
|
491 |
unsigned char packetID[ |
|
|
492 |
unsigned char packetSequenceControl[ |
|
|
493 |
unsigned char packetLength[ |
|
|
538 | unsigned char packetID[BYTES_PER_PACKETID]; | |
|
539 | unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL]; | |
|
540 | unsigned char packetLength[BYTES_PER_PKT_LEN]; | |
|
494 | 541 | // DATA FIELD HEADER |
|
495 | 542 | unsigned char spare1_pusVersion_spare2; |
|
496 | 543 | unsigned char serviceType; |
|
497 | 544 | unsigned char serviceSubType; |
|
498 | 545 | unsigned char destinationID; |
|
499 |
unsigned char time[ |
|
|
546 | unsigned char time[BYTES_PER_TIME]; | |
|
500 | 547 | // AUXILIARY HEADER |
|
501 | 548 | unsigned char sid; |
|
502 | 549 | unsigned char pa_bia_status_info; |
@@ -504,8 +551,8 typedef struct { | |||
|
504 | 551 | unsigned char sy_lfr_common_parameters; |
|
505 | 552 | unsigned char pa_lfr_pkt_cnt_asm; |
|
506 | 553 | unsigned char pa_lfr_pkt_nr_asm; |
|
507 |
unsigned char acquisitionTime[ |
|
|
508 |
unsigned char pa_lfr_asm_blk_nr[ |
|
|
554 | unsigned char acquisitionTime[BYTES_PER_TIME]; | |
|
555 | unsigned char pa_lfr_asm_blk_nr[BYTES_PER_BLKNR]; | |
|
509 | 556 | } Header_TM_LFR_SCIENCE_ASM_t; |
|
510 | 557 | |
|
511 | 558 | typedef struct { |
@@ -513,23 +560,23 typedef struct { | |||
|
513 | 560 | unsigned char protocolIdentifier; |
|
514 | 561 | unsigned char reserved; |
|
515 | 562 | unsigned char userApplication; |
|
516 |
unsigned char packetID[ |
|
|
517 |
unsigned char packetSequenceControl[ |
|
|
518 |
unsigned char packetLength[ |
|
|
563 | unsigned char packetID[BYTES_PER_PACKETID]; | |
|
564 | unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL]; | |
|
565 | unsigned char packetLength[BYTES_PER_PKT_LEN]; | |
|
519 | 566 | // DATA FIELD HEADER |
|
520 | 567 | unsigned char spare1_pusVersion_spare2; |
|
521 | 568 | unsigned char serviceType; |
|
522 | 569 | unsigned char serviceSubType; |
|
523 | 570 | unsigned char destinationID; |
|
524 |
unsigned char time[ |
|
|
571 | unsigned char time[BYTES_PER_TIME]; | |
|
525 | 572 | // AUXILIARY HEADER |
|
526 | 573 | unsigned char sid; |
|
527 | 574 | unsigned char pa_bia_status_info; |
|
528 | 575 | unsigned char sy_lfr_common_parameters_spare; |
|
529 | 576 | unsigned char sy_lfr_common_parameters; |
|
530 |
unsigned char acquisitionTime[ |
|
|
577 | unsigned char acquisitionTime[BYTES_PER_TIME]; | |
|
531 | 578 | unsigned char source_data_spare; |
|
532 |
unsigned char pa_lfr_bp_blk_nr[ |
|
|
579 | unsigned char pa_lfr_bp_blk_nr[BYTES_PER_BLKNR]; | |
|
533 | 580 | } Header_TM_LFR_SCIENCE_BP_with_spare_t; |
|
534 | 581 | |
|
535 | 582 | typedef struct { |
@@ -537,22 +584,22 typedef struct { | |||
|
537 | 584 | unsigned char protocolIdentifier; |
|
538 | 585 | unsigned char reserved; |
|
539 | 586 | unsigned char userApplication; |
|
540 |
unsigned char packetID[ |
|
|
541 |
unsigned char packetSequenceControl[ |
|
|
542 |
unsigned char packetLength[ |
|
|
587 | unsigned char packetID[BYTES_PER_PACKETID]; | |
|
588 | unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL]; | |
|
589 | unsigned char packetLength[BYTES_PER_PKT_LEN]; | |
|
543 | 590 | // DATA FIELD HEADER |
|
544 | 591 | unsigned char spare1_pusVersion_spare2; |
|
545 | 592 | unsigned char serviceType; |
|
546 | 593 | unsigned char serviceSubType; |
|
547 | 594 | unsigned char destinationID; |
|
548 |
unsigned char time[ |
|
|
595 | unsigned char time[BYTES_PER_TIME]; | |
|
549 | 596 | // AUXILIARY HEADER |
|
550 | 597 | unsigned char sid; |
|
551 | 598 | unsigned char pa_bia_status_info; |
|
552 | 599 | unsigned char sy_lfr_common_parameters_spare; |
|
553 | 600 | unsigned char sy_lfr_common_parameters; |
|
554 |
unsigned char acquisitionTime[ |
|
|
555 |
unsigned char pa_lfr_bp_blk_nr[ |
|
|
601 | unsigned char acquisitionTime[BYTES_PER_TIME]; | |
|
602 | unsigned char pa_lfr_bp_blk_nr[BYTES_PER_BLKNR]; | |
|
556 | 603 | } Header_TM_LFR_SCIENCE_BP_t; |
|
557 | 604 | |
|
558 | 605 | typedef struct { |
@@ -560,9 +607,9 typedef struct { | |||
|
560 | 607 | unsigned char protocolIdentifier; |
|
561 | 608 | unsigned char reserved; |
|
562 | 609 | unsigned char userApplication; |
|
563 |
unsigned char packetID[ |
|
|
564 |
unsigned char packetSequenceControl[ |
|
|
565 |
unsigned char packetLength[ |
|
|
610 | unsigned char packetID[BYTES_PER_PACKETID]; | |
|
611 | unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL]; | |
|
612 | unsigned char packetLength[BYTES_PER_PKT_LEN]; | |
|
566 | 613 | // DATA FIELD HEADER |
|
567 | 614 | unsigned char headerFlag_pusVersion_Ack; |
|
568 | 615 | unsigned char serviceType; |
@@ -571,26 +618,47 typedef struct { | |||
|
571 | 618 | unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; |
|
572 | 619 | } ccsdsTelecommandPacket_t; |
|
573 | 620 | |
|
621 | //********** | |
|
622 | //********** | |
|
623 | // TM_LFR_HK | |
|
624 | ||
|
625 | #define STATUS_WORD_SC_POTENTIAL_FLAG_BIT 0x40 // [0100 0000] | |
|
626 | #define STATUS_WORD_SC_POTENTIAL_FLAG_MASK 0xbf // [1011 1111] | |
|
627 | #define STATUS_WORD_PAS_FILTER_ENABLED_BIT 0x20 // [0010 0000] | |
|
628 | #define STATUS_WORD_PAS_FILTER_ENABLED_MASK 0xdf // [1101 1111] | |
|
629 | #define STATUS_WORD_WATCHDOG_BIT 0x10 // [0001 0000] | |
|
630 | #define STATUS_WORD_WATCHDOG_MASK 0xef // [1110 1111] | |
|
631 | #define STATUS_WORD_CALIB_BIT 0x08 // [0000 1000] | |
|
632 | #define STATUS_WORD_CALIB_MASK 0xf7 // [1111 0111] | |
|
633 | #define STATUS_WORD_RESET_CAUSE_BITS 0x07 // [0000 0111] | |
|
634 | #define STATUS_WORD_RESET_CAUSE_MASK 0xf8 // [1111 1000] | |
|
635 | #define STATUS_WORD_LINK_STATE_BITS 0x03 // [0000 0111] | |
|
636 | #define STATUS_WORD_LINK_STATE_MASK 0xf8 // [1111 1000] | |
|
637 | #define STATUS_WORD_LFR_MODE_SHIFT 4 | |
|
638 | #define STATUS_WORD_LFR_MODE_BITS 0xf0 // [1111 0000] | |
|
639 | #define STATUS_WORD_LFR_MODE_MASK 0x0f // [0000 1111] | |
|
640 | #define STATUS_WORD_0_DEFAULT 0x0d // [0000 1101] | |
|
641 | ||
|
574 | 642 | typedef struct { |
|
575 | 643 | unsigned char targetLogicalAddress; |
|
576 | 644 | unsigned char protocolIdentifier; |
|
577 | 645 | unsigned char reserved; |
|
578 | 646 | unsigned char userApplication; |
|
579 |
unsigned char packetID[ |
|
|
580 |
unsigned char packetSequenceControl[ |
|
|
581 |
unsigned char packetLength[ |
|
|
647 | unsigned char packetID[BYTES_PER_PACKETID]; | |
|
648 | unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL]; | |
|
649 | unsigned char packetLength[BYTES_PER_PKT_LEN]; | |
|
582 | 650 | unsigned char spare1_pusVersion_spare2; |
|
583 | 651 | unsigned char serviceType; |
|
584 | 652 | unsigned char serviceSubType; |
|
585 | 653 | unsigned char destinationID; |
|
586 |
unsigned char time[ |
|
|
654 | unsigned char time[BYTES_PER_TIME]; | |
|
587 | 655 | unsigned char sid; |
|
588 | 656 | |
|
589 | 657 | //************** |
|
590 | 658 | // HK PARAMETERS |
|
591 |
unsigned char lfr_status_word[ |
|
|
592 |
unsigned char lfr_sw_version[ |
|
|
593 |
unsigned char lfr_fpga_version[ |
|
|
659 | unsigned char lfr_status_word[BYTES_PER_STA_WRD]; | |
|
660 | unsigned char lfr_sw_version[BYTES_PER_SW_VER]; | |
|
661 | unsigned char lfr_fpga_version[BYTES_PER_VHD_VER]; | |
|
594 | 662 | // ressource statistics |
|
595 | 663 | unsigned char hk_lfr_cpu_load; |
|
596 | 664 | unsigned char hk_lfr_cpu_load_max; |
@@ -606,45 +674,45 typedef struct { | |||
|
606 | 674 | unsigned char hk_lfr_q_p2_fifo_size_max; |
|
607 | 675 | unsigned char hk_lfr_q_p2_fifo_size; |
|
608 | 676 | // tc statistics |
|
609 | unsigned char hk_lfr_update_info_tc_cnt[2]; | |
|
610 | unsigned char hk_lfr_update_time_tc_cnt[2]; | |
|
611 | unsigned char hk_lfr_exe_tc_cnt[2]; | |
|
612 | unsigned char hk_lfr_rej_tc_cnt[2]; | |
|
613 |
unsigned char hk_lfr_last_exe_tc_id[ |
|
|
614 |
unsigned char hk_lfr_last_exe_tc_type[ |
|
|
615 |
unsigned char hk_lfr_last_exe_tc_subtype[ |
|
|
616 |
unsigned char hk_lfr_last_exe_tc_time[ |
|
|
617 |
unsigned char hk_lfr_last_rej_tc_id[ |
|
|
618 |
unsigned char hk_lfr_last_rej_tc_type[ |
|
|
619 |
unsigned char hk_lfr_last_rej_tc_subtype[ |
|
|
620 |
unsigned char hk_lfr_last_rej_tc_time[ |
|
|
677 | unsigned char hk_lfr_update_info_tc_cnt[COUNTER_2_BYTES]; | |
|
678 | unsigned char hk_lfr_update_time_tc_cnt[COUNTER_2_BYTES]; | |
|
679 | unsigned char hk_lfr_exe_tc_cnt[COUNTER_2_BYTES]; | |
|
680 | unsigned char hk_lfr_rej_tc_cnt[COUNTER_2_BYTES]; | |
|
681 | unsigned char hk_lfr_last_exe_tc_id[BYTES_PER_PACKETID]; | |
|
682 | unsigned char hk_lfr_last_exe_tc_type[BYTES_PER_TYPE]; | |
|
683 | unsigned char hk_lfr_last_exe_tc_subtype[BYTES_PER_SUBTYPE]; | |
|
684 | unsigned char hk_lfr_last_exe_tc_time[BYTES_PER_TIME]; | |
|
685 | unsigned char hk_lfr_last_rej_tc_id[BYTES_PER_PACKETID]; | |
|
686 | unsigned char hk_lfr_last_rej_tc_type[BYTES_PER_TYPE]; | |
|
687 | unsigned char hk_lfr_last_rej_tc_subtype[BYTES_PER_SUBTYPE]; | |
|
688 | unsigned char hk_lfr_last_rej_tc_time[BYTES_PER_TIME]; | |
|
621 | 689 | // anomaly statistics |
|
622 | unsigned char hk_lfr_le_cnt[2]; | |
|
623 | unsigned char hk_lfr_me_cnt[2]; | |
|
624 | unsigned char hk_lfr_he_cnt[2]; | |
|
625 | unsigned char hk_lfr_last_er_rid[2]; | |
|
690 | unsigned char hk_lfr_le_cnt[COUNTER_2_BYTES]; | |
|
691 | unsigned char hk_lfr_me_cnt[COUNTER_2_BYTES]; | |
|
692 | unsigned char hk_lfr_he_cnt[COUNTER_2_BYTES]; | |
|
693 | unsigned char hk_lfr_last_er_rid[COUNTER_2_BYTES]; | |
|
626 | 694 | unsigned char hk_lfr_last_er_code; |
|
627 |
unsigned char hk_lfr_last_er_time[ |
|
|
695 | unsigned char hk_lfr_last_er_time[BYTES_PER_TIME]; | |
|
628 | 696 | // vhdl_blk_status |
|
629 | 697 | unsigned char hk_lfr_vhdl_aa_sm; |
|
630 | 698 | unsigned char hk_lfr_vhdl_fft_sr; |
|
631 | 699 | unsigned char hk_lfr_vhdl_cic_hk; |
|
632 | 700 | unsigned char hk_lfr_vhdl_iir_cal; |
|
633 | 701 | // spacewire_if_statistics |
|
634 | unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2]; | |
|
635 | unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2]; | |
|
702 | unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[COUNTER_2_BYTES]; | |
|
703 | unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[COUNTER_2_BYTES]; | |
|
636 | 704 | unsigned char hk_lfr_dpu_spw_tick_out_cnt; |
|
637 | 705 | unsigned char hk_lfr_dpu_spw_last_timc; |
|
638 | 706 | // ahb error statistics |
|
639 |
unsigned char hk_lfr_last_fail_addr[ |
|
|
707 | unsigned char hk_lfr_last_fail_addr[BYTES_PER_ADDR]; | |
|
640 | 708 | // temperatures |
|
641 |
unsigned char hk_lfr_temp_scm[ |
|
|
642 |
unsigned char hk_lfr_temp_pcb[ |
|
|
643 |
unsigned char hk_lfr_temp_fpga[ |
|
|
709 | unsigned char hk_lfr_temp_scm[BYTES_PER_TEMP]; | |
|
710 | unsigned char hk_lfr_temp_pcb[BYTES_PER_TEMP]; | |
|
711 | unsigned char hk_lfr_temp_fpga[BYTES_PER_TEMP]; | |
|
644 | 712 | // spacecraft potential |
|
645 |
unsigned char hk_lfr_sc_v_f3[ |
|
|
646 |
unsigned char hk_lfr_sc_e1_f3[ |
|
|
647 |
unsigned char hk_lfr_sc_e2_f3[ |
|
|
713 | unsigned char hk_lfr_sc_v_f3[BYTES_PER_V]; | |
|
714 | unsigned char hk_lfr_sc_e1_f3[BYTES_PER_V]; | |
|
715 | unsigned char hk_lfr_sc_e2_f3[BYTES_PER_V]; | |
|
648 | 716 | // lfr common parameters |
|
649 | 717 | unsigned char sy_lfr_common_parameters_spare; |
|
650 | 718 | unsigned char sy_lfr_common_parameters; |
@@ -678,20 +746,27 typedef struct { | |||
|
678 | 746 | unsigned char hk_lfr_sc_rw_f_flags; |
|
679 | 747 | } Packet_TM_LFR_HK_t; |
|
680 | 748 | |
|
749 | //*************** | |
|
750 | //*************** | |
|
751 | // PARAMETER_DUMP | |
|
752 | ||
|
753 | #define BIT_PAS_FILTER_ENABLED 0x01 | |
|
754 | #define BIT_CWF_LONG_F3 0x01 | |
|
755 | ||
|
681 | 756 | typedef struct { |
|
682 | 757 | unsigned char targetLogicalAddress; |
|
683 | 758 | unsigned char protocolIdentifier; |
|
684 | 759 | unsigned char reserved; |
|
685 | 760 | unsigned char userApplication; |
|
686 |
unsigned char packetID[ |
|
|
687 |
unsigned char packetSequenceControl[ |
|
|
688 |
unsigned char packetLength[ |
|
|
761 | unsigned char packetID[BYTES_PER_PACKETID]; | |
|
762 | unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL]; | |
|
763 | unsigned char packetLength[BYTES_PER_PKT_LEN]; | |
|
689 | 764 | // DATA FIELD HEADER |
|
690 | 765 | unsigned char spare1_pusVersion_spare2; |
|
691 | 766 | unsigned char serviceType; |
|
692 | 767 | unsigned char serviceSubType; |
|
693 | 768 | unsigned char destinationID; |
|
694 |
unsigned char time[ |
|
|
769 | unsigned char time[BYTES_PER_TIME]; | |
|
695 | 770 | unsigned char sid; |
|
696 | 771 | |
|
697 | 772 | //****************** |
@@ -701,9 +776,9 typedef struct { | |||
|
701 | 776 | |
|
702 | 777 | //****************** |
|
703 | 778 | // NORMAL PARAMETERS |
|
704 | unsigned char sy_lfr_n_swf_l[2]; | |
|
705 | unsigned char sy_lfr_n_swf_p[2]; | |
|
706 | unsigned char sy_lfr_n_asm_p[2]; | |
|
779 | unsigned char sy_lfr_n_swf_l[PARAM_2_BYTES]; | |
|
780 | unsigned char sy_lfr_n_swf_p[PARAM_2_BYTES]; | |
|
781 | unsigned char sy_lfr_n_asm_p[PARAM_2_BYTES]; | |
|
707 | 782 | unsigned char sy_lfr_n_bp_p0; |
|
708 | 783 | unsigned char sy_lfr_n_bp_p1; |
|
709 | 784 | unsigned char sy_lfr_n_cwf_long_f3; |
@@ -727,72 +802,83 typedef struct { | |||
|
727 | 802 | // mask F0 |
|
728 | 803 | union{ |
|
729 | 804 | struct{ |
|
730 |
unsigned char f0_word1[ |
|
|
731 |
unsigned char f0_word2[ |
|
|
732 |
unsigned char f0_word3[ |
|
|
733 |
unsigned char f0_word4[ |
|
|
805 | unsigned char f0_word1[BYTES_PER_WORD]; | |
|
806 | unsigned char f0_word2[BYTES_PER_WORD]; | |
|
807 | unsigned char f0_word3[BYTES_PER_WORD]; | |
|
808 | unsigned char f0_word4[BYTES_PER_WORD]; | |
|
734 | 809 | // mask F1 |
|
735 |
unsigned char f1_word1[ |
|
|
736 |
unsigned char f1_word2[ |
|
|
737 |
unsigned char f1_word3[ |
|
|
738 |
unsigned char f1_word4[ |
|
|
810 | unsigned char f1_word1[BYTES_PER_WORD]; | |
|
811 | unsigned char f1_word2[BYTES_PER_WORD]; | |
|
812 | unsigned char f1_word3[BYTES_PER_WORD]; | |
|
813 | unsigned char f1_word4[BYTES_PER_WORD]; | |
|
739 | 814 | // mask F2 |
|
740 |
unsigned char f2_word1[ |
|
|
741 |
unsigned char f2_word2[ |
|
|
742 |
unsigned char f2_word3[ |
|
|
743 |
unsigned char f2_word4[ |
|
|
815 | unsigned char f2_word1[BYTES_PER_WORD]; | |
|
816 | unsigned char f2_word2[BYTES_PER_WORD]; | |
|
817 | unsigned char f2_word3[BYTES_PER_WORD]; | |
|
818 | unsigned char f2_word4[BYTES_PER_WORD]; | |
|
744 | 819 | } fx; |
|
745 |
unsigned char raw[ |
|
|
820 | unsigned char raw[ BYTES_PER_MASKS_SET ]; | |
|
746 | 821 | } sy_lfr_fbins; |
|
747 | 822 | |
|
748 | 823 | // PAS FILTER PARAMETERS |
|
749 | 824 | unsigned char pa_rpw_spare8_2; |
|
750 | 825 | unsigned char spare_sy_lfr_pas_filter_enabled; |
|
751 | 826 | unsigned char sy_lfr_pas_filter_modulus; |
|
752 | unsigned char sy_lfr_pas_filter_tbad[4]; | |
|
827 | unsigned char sy_lfr_pas_filter_tbad[PARAM_4_BYTES]; | |
|
753 | 828 | unsigned char sy_lfr_pas_filter_offset; |
|
754 | unsigned char sy_lfr_pas_filter_shift[4]; | |
|
755 | unsigned char sy_lfr_sc_rw_delta_f[4]; | |
|
829 | unsigned char sy_lfr_pas_filter_shift[PARAM_4_BYTES]; | |
|
830 | unsigned char sy_lfr_sc_rw_delta_f[PARAM_4_BYTES]; | |
|
756 | 831 | |
|
757 | 832 | // LFR_RW_MASK |
|
758 | 833 | union{ |
|
759 | 834 | struct{ |
|
760 |
unsigned char f0_word1[ |
|
|
761 |
unsigned char f0_word2[ |
|
|
762 |
unsigned char f0_word3[ |
|
|
763 |
unsigned char f0_word4[ |
|
|
835 | unsigned char f0_word1[BYTES_PER_WORD]; | |
|
836 | unsigned char f0_word2[BYTES_PER_WORD]; | |
|
837 | unsigned char f0_word3[BYTES_PER_WORD]; | |
|
838 | unsigned char f0_word4[BYTES_PER_WORD]; | |
|
764 | 839 | // mask F1 |
|
765 |
unsigned char f1_word1[ |
|
|
766 |
unsigned char f1_word2[ |
|
|
767 |
unsigned char f1_word3[ |
|
|
768 |
unsigned char f1_word4[ |
|
|
840 | unsigned char f1_word1[BYTES_PER_WORD]; | |
|
841 | unsigned char f1_word2[BYTES_PER_WORD]; | |
|
842 | unsigned char f1_word3[BYTES_PER_WORD]; | |
|
843 | unsigned char f1_word4[BYTES_PER_WORD]; | |
|
769 | 844 | // mask F2 |
|
770 |
unsigned char f2_word1[ |
|
|
771 |
unsigned char f2_word2[ |
|
|
772 |
unsigned char f2_word3[ |
|
|
773 |
unsigned char f2_word4[ |
|
|
845 | unsigned char f2_word1[BYTES_PER_WORD]; | |
|
846 | unsigned char f2_word2[BYTES_PER_WORD]; | |
|
847 | unsigned char f2_word3[BYTES_PER_WORD]; | |
|
848 | unsigned char f2_word4[BYTES_PER_WORD]; | |
|
774 | 849 | } fx; |
|
775 |
unsigned char raw[ |
|
|
850 | unsigned char raw[ BYTES_PER_MASKS_SET ]; | |
|
776 | 851 | } sy_lfr_rw_mask; |
|
777 | 852 | |
|
778 | 853 | // SPARE |
|
779 | 854 | unsigned char pa_rpw_spare8_3; |
|
780 | 855 | } Packet_TM_LFR_PARAMETER_DUMP_t; |
|
781 | 856 | |
|
857 | //************************** | |
|
858 | //************************** | |
|
859 | // TM_LFR_KCOEFFICIENTS_DUMP | |
|
860 | ||
|
861 | #define KCOEFF_BLK_NR_PKT1 30 | |
|
862 | #define KCOEFF_BLK_NR_PKT2 6 | |
|
863 | #define KCOEFF_BLK_SIZE 130 | |
|
864 | #define KCOEFF_PKTCNT 2 | |
|
865 | #define PKTNR_1 1 | |
|
866 | #define PKTNR_2 2 | |
|
867 | ||
|
782 | 868 | typedef struct { |
|
783 | 869 | unsigned char targetLogicalAddress; |
|
784 | 870 | unsigned char protocolIdentifier; |
|
785 | 871 | unsigned char reserved; |
|
786 | 872 | unsigned char userApplication; |
|
787 |
unsigned char packetID[ |
|
|
788 |
unsigned char packetSequenceControl[ |
|
|
789 |
unsigned char packetLength[ |
|
|
873 | unsigned char packetID[BYTES_PER_PACKETID]; | |
|
874 | unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL]; | |
|
875 | unsigned char packetLength[BYTES_PER_PKT_LEN]; | |
|
790 | 876 | // DATA FIELD HEADER |
|
791 | 877 | unsigned char spare1_pusVersion_spare2; |
|
792 | 878 | unsigned char serviceType; |
|
793 | 879 | unsigned char serviceSubType; |
|
794 | 880 | unsigned char destinationID; |
|
795 |
unsigned char time[ |
|
|
881 | unsigned char time[BYTES_PER_TIME]; | |
|
796 | 882 | unsigned char sid; |
|
797 | 883 | unsigned char pkt_cnt; |
|
798 | 884 | unsigned char pkt_nr; |
@@ -9,6 +9,76 | |||
|
9 | 9 | #define GRSPW_DEVICE_NAME "/dev/grspw0" |
|
10 | 10 | #define UART_DEVICE_NAME "/dev/console" |
|
11 | 11 | |
|
12 | //******* | |
|
13 | // MACROS | |
|
14 | #ifdef PRINT_MESSAGES_ON_CONSOLE | |
|
15 | #define PRINTF(x) printf(x); | |
|
16 | #define PRINTF1(x,y) printf(x,y); | |
|
17 | #define PRINTF2(x,y,z) printf(x,y,z); | |
|
18 | #else | |
|
19 | #define PRINTF(x) ; | |
|
20 | #define PRINTF1(x,y) ; | |
|
21 | #define PRINTF2(x,y,z) ; | |
|
22 | #endif | |
|
23 | ||
|
24 | #ifdef BOOT_MESSAGES | |
|
25 | #define BOOT_PRINTF(x) printf(x); | |
|
26 | #define BOOT_PRINTF1(x,y) printf(x,y); | |
|
27 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); | |
|
28 | #else | |
|
29 | #define BOOT_PRINTF(x) ; | |
|
30 | #define BOOT_PRINTF1(x,y) ; | |
|
31 | #define BOOT_PRINTF2(x,y,z) ; | |
|
32 | #endif | |
|
33 | ||
|
34 | #ifdef DEBUG_MESSAGES | |
|
35 | #define DEBUG_PRINTF(x) printf(x); | |
|
36 | #define DEBUG_PRINTF1(x,y) printf(x,y); | |
|
37 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); | |
|
38 | #else | |
|
39 | #define DEBUG_PRINTF(x) ; | |
|
40 | #define DEBUG_PRINTF1(x,y) ; | |
|
41 | #define DEBUG_PRINTF2(x,y,z) ; | |
|
42 | #endif | |
|
43 | ||
|
44 | #define CONST_65536 65536 // 2^16 | |
|
45 | #define CONST_2048 2048 // 2^11 | |
|
46 | #define CONST_512 512 // 2^9 | |
|
47 | #define CONST_256 256 // 2^8 | |
|
48 | #define CONST_128 128 // 2^7 | |
|
49 | #define UINT8_MAX 255 | |
|
50 | ||
|
51 | #define FLOAT_MSBYTE 0 | |
|
52 | #define FLOAT_LSBYTE 3 | |
|
53 | #define BITS_PER_BYTE 8 | |
|
54 | #define INIT_FLOAT 0. | |
|
55 | #define INIT_CHAR 0x00 | |
|
56 | #define INT8_ALL_F 0xff | |
|
57 | #define INT16_ALL_F 0xffff | |
|
58 | #define INT32_ALL_F 0xffffffff | |
|
59 | #define INT32_ALL_0 0x00000000 | |
|
60 | #define SHIFT_1_BYTE 8 | |
|
61 | #define SHIFT_2_BYTES 16 | |
|
62 | #define SHIFT_3_BYTES 24 | |
|
63 | #define SHIFT_4_BYTES 32 | |
|
64 | #define SHIFT_5_BYTES 40 | |
|
65 | #define SHIFT_2_BITS 2 | |
|
66 | #define SHIFT_3_BITS 3 | |
|
67 | #define SHIFT_4_BITS 4 | |
|
68 | #define SHIFT_5_BITS 5 | |
|
69 | #define SHIFT_6_BITS 6 | |
|
70 | #define SHIFT_7_BITS 7 | |
|
71 | #define BYTE_0 0 | |
|
72 | #define BYTE_1 1 | |
|
73 | #define BYTE_2 2 | |
|
74 | #define BYTE_3 3 | |
|
75 | #define BYTE_4 4 | |
|
76 | #define BYTE_5 5 | |
|
77 | #define BYTE_6 6 | |
|
78 | #define BYTE_7 7 | |
|
79 | #define BYTE0_MASK 0xff00 | |
|
80 | #define BYTE1_MASK 0x00ff | |
|
81 | ||
|
12 | 82 | enum lfr_transition_type_t{ |
|
13 | 83 | TRANSITION_NOT_SPECIFIC, |
|
14 | 84 | TRANSITION_NORM_TO_S1, |
@@ -93,35 +163,56 typedef struct ring_node | |||
|
93 | 163 | #define RTEMS_EVENT_BURST_BP2_F1 RTEMS_EVENT_22 |
|
94 | 164 | #define RTEMS_EVENT_SWF_RESYNCH RTEMS_EVENT_23 |
|
95 | 165 | |
|
96 | //**************************** | |
|
97 | // LFR DEFAULT MODE PARAMETERS | |
|
166 | //******************************************** | |
|
167 | //******************************************** | |
|
168 | // LFR PARAMETERS: DEFAULT, MIN AND MAX VALUES | |
|
169 | ||
|
98 | 170 | #define DEFAULT_LAST_VALID_TRANSITION_DATE 0xffffffff |
|
171 | ||
|
99 | 172 | // COMMON |
|
100 | 173 | #define DEFAULT_SY_LFR_COMMON0 0x00 |
|
101 | 174 | #define DEFAULT_SY_LFR_COMMON1 0x20 // default value bw sp0 sp1 r0 r1 r2 = 1 0 0 0 0 0 |
|
175 | ||
|
102 | 176 | // NORM |
|
103 | 177 | #define DFLT_SY_LFR_N_SWF_L 2048 // nb sample |
|
104 | 178 | #define DFLT_SY_LFR_N_SWF_P 300 // sec |
|
179 | #define MIN_SY_LFR_N_SWF_P 22 // sec | |
|
105 | 180 | #define DFLT_SY_LFR_N_ASM_P 3600 // sec |
|
106 | 181 | #define DFLT_SY_LFR_N_BP_P0 4 // sec |
|
107 | 182 | #define DFLT_SY_LFR_N_BP_P1 20 // sec |
|
108 | 183 | #define DFLT_SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3 |
|
109 | 184 | #define MIN_DELTA_SNAPSHOT 16 // sec |
|
185 | ||
|
110 | 186 | // BURST |
|
111 | 187 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec |
|
112 | 188 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec |
|
189 | ||
|
113 | 190 | // SBM1 |
|
114 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec | |
|
191 | #define S1_BP_P0_SCALE 0.25 | |
|
192 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // 0.25 sec | |
|
115 | 193 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec |
|
194 | ||
|
116 | 195 | // SBM2 |
|
117 | 196 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec |
|
118 | 197 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec |
|
198 | ||
|
119 | 199 | // ADDITIONAL PARAMETERS |
|
120 | 200 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms |
|
121 | 201 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s |
|
202 | ||
|
122 | 203 | // STATUS WORD |
|
123 | 204 | #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits |
|
205 | ||
|
124 | 206 | #define DEFAULT_STATUS_WORD_BYTE1 0x00 |
|
207 | // TC_LFR_LOAD_FILTER_PAR | |
|
208 | #define MIN_PAS_FILTER_MODULUS 4 | |
|
209 | #define MAX_PAS_FILTER_MODULUS 8 | |
|
210 | #define MIN_PAS_FILTER_TBAD 0.0 | |
|
211 | #define MAX_PAS_FILTER_TBAD 4.0 | |
|
212 | #define MIN_PAS_FILTER_OFFSET 0 | |
|
213 | #define MAX_PAS_FILTER_OFFSET 7 | |
|
214 | #define MIN_PAS_FILTER_SHIFT 0.0 | |
|
215 | #define MAX_PAS_FILTER_SHIFT 1.0 | |
|
125 | 216 | // |
|
126 | 217 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s |
|
127 | 218 | #define SY_LFR_DPU_CONNECT_ATTEMPT 3 |
@@ -139,6 +230,7 typedef struct ring_node | |||
|
139 | 230 | |
|
140 | 231 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 |
|
141 | 232 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f54 // PDB >= 0.1.28 |
|
233 | #define APB_OFFSET_VHDL_REV 0xb0 | |
|
142 | 234 | #define REGS_ADDR_VHDL_VERSION 0x80000ff0 |
|
143 | 235 | |
|
144 | 236 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
@@ -163,6 +255,8 typedef struct ring_node | |||
|
163 | 255 | #define HK_PERIOD 100 // 100 * 10ms => 1s |
|
164 | 256 | #define AVGV_PERIOD 6 // 6 * 10ms => 60ms (1 / 16 = 62.5ms) |
|
165 | 257 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s |
|
258 | #define HK_SYNC_WAIT 10 // 10 * 10 ms = 100 ms | |
|
259 | #define SPW_LINK_WAIT 10 // 10 * 10 ms = 100 ms | |
|
166 | 260 | #define TIMECODE_TIMER_TIMEOUT 120 // 120 * 10 ms = 1.2 s |
|
167 | 261 | #define TIMECODE_TIMER_TIMEOUT_INIT 200 // 200 * 10 ms = 2.0 s |
|
168 | 262 | #define TIMECODE_MASK 0x3f // 0011 1111 |
@@ -175,6 +269,8 typedef struct ring_node | |||
|
175 | 269 | |
|
176 | 270 | //****** |
|
177 | 271 | // RTEMS |
|
272 | #define STACK_SIZE_MULT 2 | |
|
273 | ||
|
178 | 274 | #define TASKID_AVGV 0 |
|
179 | 275 | #define TASKID_RECV 1 |
|
180 | 276 | #define TASKID_ACTN 2 |
@@ -234,38 +330,6 typedef struct ring_node | |||
|
234 | 330 | #define QUEUE_PRC1 3 |
|
235 | 331 | #define QUEUE_PRC2 4 |
|
236 | 332 | |
|
237 | //******* | |
|
238 | // MACROS | |
|
239 | #ifdef PRINT_MESSAGES_ON_CONSOLE | |
|
240 | #define PRINTF(x) printf(x); | |
|
241 | #define PRINTF1(x,y) printf(x,y); | |
|
242 | #define PRINTF2(x,y,z) printf(x,y,z); | |
|
243 | #else | |
|
244 | #define PRINTF(x) ; | |
|
245 | #define PRINTF1(x,y) ; | |
|
246 | #define PRINTF2(x,y,z) ; | |
|
247 | #endif | |
|
248 | ||
|
249 | #ifdef BOOT_MESSAGES | |
|
250 | #define BOOT_PRINTF(x) printf(x); | |
|
251 | #define BOOT_PRINTF1(x,y) printf(x,y); | |
|
252 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); | |
|
253 | #else | |
|
254 | #define BOOT_PRINTF(x) ; | |
|
255 | #define BOOT_PRINTF1(x,y) ; | |
|
256 | #define BOOT_PRINTF2(x,y,z) ; | |
|
257 | #endif | |
|
258 | ||
|
259 | #ifdef DEBUG_MESSAGES | |
|
260 | #define DEBUG_PRINTF(x) printf(x); | |
|
261 | #define DEBUG_PRINTF1(x,y) printf(x,y); | |
|
262 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); | |
|
263 | #else | |
|
264 | #define DEBUG_PRINTF(x) ; | |
|
265 | #define DEBUG_PRINTF1(x,y) ; | |
|
266 | #define DEBUG_PRINTF2(x,y,z) ; | |
|
267 | #endif | |
|
268 | ||
|
269 | 333 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period |
|
270 | 334 | |
|
271 | 335 | struct param_local_str{ |
@@ -275,10 +339,15 struct param_local_str{ | |||
|
275 | 339 | unsigned int local_sbm2_nb_cwf_max; |
|
276 | 340 | }; |
|
277 | 341 | |
|
342 | //************ | |
|
343 | // FBINS MASKS | |
|
344 | ||
|
345 | #define BYTES_PER_FBINS_MASK 16 | |
|
346 | ||
|
278 | 347 | typedef struct { |
|
279 |
unsigned char merged_fbins_mask_f0[ |
|
|
280 |
unsigned char merged_fbins_mask_f1[ |
|
|
281 |
unsigned char merged_fbins_mask_f2[ |
|
|
348 | unsigned char merged_fbins_mask_f0[BYTES_PER_FBINS_MASK]; | |
|
349 | unsigned char merged_fbins_mask_f1[BYTES_PER_FBINS_MASK]; | |
|
350 | unsigned char merged_fbins_mask_f2[BYTES_PER_FBINS_MASK]; | |
|
282 | 351 | } fbins_masks_t; |
|
283 | 352 | |
|
284 | 353 | #define DEFAULT_SY_LFR_PAS_FILTER_ENABLED 0 |
@@ -297,6 +366,7 typedef struct{ | |||
|
297 | 366 | float sy_lfr_sc_rw_delta_f; |
|
298 | 367 | } filterPar_t; |
|
299 | 368 | |
|
369 | #define NB_ACQUISITION_DURATION 3 | |
|
300 | 370 | #define ACQUISITION_DURATION_F0 683 // 256 / 24576 * 65536 |
|
301 | 371 | #define ACQUISITION_DURATION_F1 4096 // 256 / 4096 * 65536 |
|
302 | 372 | #define ACQUISITION_DURATION_F2 65536 // 256 / 256 * 65536 |
@@ -1,10 +1,12 | |||
|
1 |
#ifndef |
|
|
2 |
#define |
|
|
1 | #ifndef FSW_PARAMS_NB_BYTES_H | |
|
2 | #define FSW_PARAMS_NB_BYTES_H | |
|
3 | 3 | |
|
4 | 4 | #define PACKET_POS_SEQUENCE_CNT 6 // 4 + 2 |
|
5 | 5 | #define PACKET_POS_PA_LFR_SID_PKT 20 // 4 + 16 |
|
6 | 6 | #define PACKET_POS_SERVICE_TYPE 11 // 4 + 7 |
|
7 | 7 | |
|
8 | #define DATAFIELD_OFFSET 10 | |
|
9 | ||
|
8 | 10 | // TC_LFR_LOAD_COMMON_PAR |
|
9 | 11 | |
|
10 | 12 | // TC_LFR_LOAD_NORMAL_PAR |
@@ -42,14 +44,18 | |||
|
42 | 44 | #define BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW4_F2 72 |
|
43 | 45 | #define BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW_F_FLAGS 77 |
|
44 | 46 | |
|
47 | #define BITS_LFR_MODE 0x1e | |
|
48 | #define SHIFT_LFR_MODE 1 | |
|
49 | #define BITS_TDS_MODE 0xf0 | |
|
50 | #define SHIFT_TDS_MODE 4 | |
|
51 | #define BITS_THR_MODE 0x0f | |
|
52 | #define BITS_BIA 0xfe | |
|
53 | ||
|
45 | 54 | // TC_LFR_ENTER_MODE |
|
46 | 55 | #define BYTE_POS_CP_MODE_LFR_SET 11 |
|
47 | 56 | #define BYTE_POS_CP_LFR_ENTER_MODE_TIME 12 |
|
48 | 57 | |
|
49 | 58 | //TC_LFR_LOAD_FBINS_MASK |
|
50 | #define NB_FBINS_MASKS 12 | |
|
51 | #define NB_BYTES_PER_FREQ_MASK 16 | |
|
52 | #define NB_BYTES_PER_FBINS_MASK 4 | |
|
53 | 59 | |
|
54 | 60 | // TC_LFR_LOAD_FILTER_PAR |
|
55 | 61 | #define DATAFIELD_POS_PA_RPW_SPARE8_2 0 // 8 bits |
@@ -62,7 +68,10 | |||
|
62 | 68 | |
|
63 | 69 | // TC_LFR_LOAD_KCOEFFICIENTS |
|
64 | 70 | #define NB_BYTES_PER_FLOAT 4 |
|
65 | #define DATAFIELD_POS_SY_LFR_KCOEFF_FREQUENCY 0 // 10 - 10 | |
|
66 | #define DATAFIELD_POS_SY_LFR_KCOEFF_1 2 // 12 - 10 | |
|
71 | #define DATAFIELD_POS_SY_LFR_KCOEFF_FREQUENCY 0 // 10 - 10 | |
|
72 | #define DATAFIELD_POS_SY_LFR_KCOEFF_1 2 // 12 - 10 | |
|
67 | 73 | |
|
68 | #endif // TM_BYTE_POSITIONS_H | |
|
74 | // TM_LFR_KCOEFFICIENTS_DUMP | |
|
75 | #define BYTE_POS_KCOEFFICIENTS_PARAMETES 20 | |
|
76 | ||
|
77 | #endif // FSW_PARAMS_NB_BYTES_H |
@@ -4,7 +4,30 | |||
|
4 | 4 | #define CHANNELF0 0 |
|
5 | 5 | #define CHANNELF1 1 |
|
6 | 6 | #define CHANNELF2 2 |
|
7 | #define CHANNELF3 3 | |
|
7 | 8 | |
|
9 | #define NB_SM_PER_S_F0 96 | |
|
10 | #define NB_SM_PER_S_F1 16 | |
|
11 | #define NB_SM_PER_S_F2 1 | |
|
12 | #define NB_SM_PER_S1_BP_P0 24 | |
|
13 | ||
|
14 | #define ASM_COMP_B1B2 1 | |
|
15 | #define ASM_COMP_B1B3 3 | |
|
16 | #define ASM_COMP_B1E1 5 | |
|
17 | #define ASM_COMP_B1E2 7 | |
|
18 | #define ASM_COMP_B2B3 10 | |
|
19 | #define ASM_COMP_B2E1 12 | |
|
20 | #define ASM_COMP_B2E2 14 | |
|
21 | #define ASM_COMP_B3E1 17 | |
|
22 | #define ASM_COMP_B3E2 19 | |
|
23 | #define ASM_COMP_E1E2 22 | |
|
24 | #define ASM_COMP_B1B1 0 | |
|
25 | #define ASM_COMP_B2B2 9 | |
|
26 | #define ASM_COMP_B3B3 16 | |
|
27 | #define ASM_COMP_E1E1 21 | |
|
28 | #define ASM_COMP_E2E2 24 | |
|
29 | ||
|
30 | #define SM_BYTES_PER_VAL 2 | |
|
8 | 31 | #define NB_BINS_PER_SM 128 |
|
9 | 32 | #define NB_VALUES_PER_SM 25 |
|
10 | 33 | #define TOTAL_SIZE_SM 3200 // 25 * 128 = 0xC80 |
@@ -50,6 +73,7 | |||
|
50 | 73 | #define ASM_F2_INDICE_STOP 101 // 102 - 1, 2 packets of 48 bins |
|
51 | 74 | // |
|
52 | 75 | #define KCOEFF_BLK_SIZE 130 |
|
76 | #define KCOEFF_FREQ 2 | |
|
53 | 77 | #define NB_BINS_COMPRESSED_SM_F0 11 |
|
54 | 78 | #define NB_BINS_COMPRESSED_SM_F1 13 |
|
55 | 79 | #define NB_BINS_COMPRESSED_SM_F2 12 |
@@ -77,8 +101,7 | |||
|
77 | 101 | #define TOTAL_SIZE_BP2_NORM_F0 330 // 30 * 11 UNSIGNED CHAR |
|
78 | 102 | #define TOTAL_SIZE_BP1_SBM_F0 198 // 9 * 22 UNSIGNED CHAR |
|
79 | 103 | // GENERAL |
|
80 |
#define NB_SM_BEFORE_AVF0 |
|
|
81 | #define NB_SM_BEFORE_AVF1 8 // must be 8 due to the SM_average() function | |
|
104 | #define NB_SM_BEFORE_AVF0_F1 8 // must be 8 due to the SM_average() function | |
|
82 | 105 | #define NB_SM_BEFORE_AVF2 1 // must be 1 due to the SM_average_f2() function |
|
83 | 106 | |
|
84 | 107 | #endif // FSW_PARAMS_PROCESSING_H |
General Comments 0
You need to be logged in to leave comments.
Login now