@@ -1,6 +1,6 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <!DOCTYPE QtCreatorProject> |
|
2 | <!DOCTYPE QtCreatorProject> | |
3 |
<!-- Written by QtCreator 3.0.1, 2014-04-0 |
|
3 | <!-- Written by QtCreator 3.0.1, 2014-04-07T06:54:09. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
@@ -4,12 +4,12 | |||||
4 | #include "fsw_params_processing.h" |
|
4 | #include "fsw_params_processing.h" | |
5 |
|
5 | |||
6 | #define CCSDS_PROTOCOLE_EXTRA_BYTES 4 |
|
6 | #define CCSDS_PROTOCOLE_EXTRA_BYTES 4 | |
|
7 | #define CCSDS_TC_TM_PACKET_OFFSET 7 | |||
7 | #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4 |
|
8 | #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4 | |
8 | #define CCSDS_TM_PKT_MAX_SIZE 4412 |
|
9 | #define CCSDS_TM_PKT_MAX_SIZE 4412 | |
9 | #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4 |
|
10 | #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4 | |
10 | #define CCSDS_TC_PKT_MAX_SIZE 256 |
|
11 | #define CCSDS_TC_PKT_MAX_SIZE 256 | |
11 | #define CCSDS_TC_PKT_MIN_SIZE 16 |
|
12 | #define CCSDS_TC_PKT_MIN_SIZE 16 | |
12 | #define CCSDS_TC_TM_PACKET_OFFSET 7 |
|
|||
13 | #define CCSDS_PROCESS_ID 76 |
|
13 | #define CCSDS_PROCESS_ID 76 | |
14 | #define CCSDS_PACKET_CATEGORY 12 |
|
14 | #define CCSDS_PACKET_CATEGORY 12 | |
15 | #define CCSDS_NODE_ADDRESS 0xfe |
|
15 | #define CCSDS_NODE_ADDRESS 0xfe | |
@@ -20,18 +20,18 | |||||
20 | #define DEFAULT_HKBIA 0x1e // 0001 1110 |
|
20 | #define DEFAULT_HKBIA 0x1e // 0001 1110 | |
21 |
|
21 | |||
22 | // PACKET ID |
|
22 | // PACKET ID | |
23 |
#define |
|
23 | #define APID_TM_TC_EXE 0x0cc1 // PID 76 CAT 1 | |
24 |
#define |
|
24 | #define APID_TM_HK 0x0cc4 // PID 76 CAT 4 | |
25 |
#define |
|
25 | #define APID_TM_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9 | |
26 |
#define |
|
26 | #define APID_TM_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12 | |
27 |
#define |
|
27 | #define APID_TM_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12 | |
28 |
#define TM_PACKET_PID_DEFAULT |
|
28 | #define TM_PACKET_PID_DEFAULT 76 | |
29 |
#define TM_PACKET_PID_BURST_SBM1_SBM2 |
|
29 | #define TM_PACKET_PID_BURST_SBM1_SBM2 79 | |
30 |
#define TM_PACKET_CAT_TC_EXE |
|
30 | #define TM_PACKET_CAT_TC_EXE 1 | |
31 |
#define TM_PACKET_CAT_HK |
|
31 | #define TM_PACKET_CAT_HK 4 | |
32 |
#define TM_PACKET_CAT_PARAMETER_DUMP |
|
32 | #define TM_PACKET_CAT_PARAMETER_DUMP 9 | |
33 |
#define TM_PACKET_CAT_SCIENCE |
|
33 | #define TM_PACKET_CAT_SCIENCE 12 | |
34 |
#define TC_PACKET_CAT |
|
34 | #define TC_PACKET_CAT 12 | |
35 |
|
35 | |||
36 | // PACKET SEQUENCE CONTROL |
|
36 | // PACKET SEQUENCE CONTROL | |
37 | #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000] |
|
37 | #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000] | |
@@ -207,7 +207,12 enum apid_destid{ | |||||
207 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 (2628 - CCSDS_TC_TM_PACKET_OFFSET) // 52 * 25 * 2 + 28 - 7 |
|
207 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 (2628 - CCSDS_TC_TM_PACKET_OFFSET) // 52 * 25 * 2 + 28 - 7 | |
208 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 (2428 - CCSDS_TC_TM_PACKET_OFFSET) // 48 * 25 * 2 + 28 - 7 |
|
208 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 (2428 - CCSDS_TC_TM_PACKET_OFFSET) // 48 * 25 * 2 + 28 - 7 | |
209 | #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 (126 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 9 + 27 - 7 |
|
209 | #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 (126 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 9 + 27 - 7 | |
|
210 | #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 (356 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 30 + 25 - 7 | |||
|
211 | #define PACKET_LENGTH_TM_LFR_SCIENCE_BURST_BP2_F1 (806 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 30 + 26 - 7 | |||
210 | #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP1_F0 (224 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 9 + 26 - 7 |
|
212 | #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP1_F0 (224 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 9 + 26 - 7 | |
|
213 | #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP2_F0 (686 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 30 + 26 - 7 | |||
|
214 | ||||
|
215 | #define PACKET_LENGTH_DELTA 11 // 7 + 4 | |||
211 |
|
216 | |||
212 | #define SPARE1_PUSVERSION_SPARE2 0x10 |
|
217 | #define SPARE1_PUSVERSION_SPARE2 0x10 | |
213 |
|
218 | |||
@@ -466,9 +471,9 typedef struct { | |||||
466 | unsigned char sid; |
|
471 | unsigned char sid; | |
467 | unsigned char biaStatusInfo; |
|
472 | unsigned char biaStatusInfo; | |
468 | unsigned char acquisitionTime[6]; |
|
473 | unsigned char acquisitionTime[6]; | |
469 |
unsigned char |
|
474 | unsigned char source_data_spare[2]; | |
470 | unsigned char pa_lfr_bp_blk_nr[2]; |
|
475 | unsigned char pa_lfr_bp_blk_nr[2]; | |
471 |
} Header_TM_LFR_SCIENCE_BP_ |
|
476 | } Header_TM_LFR_SCIENCE_BP_with_spare_t; | |
472 |
|
477 | |||
473 | typedef struct { |
|
478 | typedef struct { | |
474 | unsigned char targetLogicalAddress; |
|
479 | unsigned char targetLogicalAddress; | |
@@ -489,7 +494,7 typedef struct { | |||||
489 | unsigned char biaStatusInfo; |
|
494 | unsigned char biaStatusInfo; | |
490 | unsigned char acquisitionTime[6]; |
|
495 | unsigned char acquisitionTime[6]; | |
491 | unsigned char pa_lfr_bp_blk_nr[2]; |
|
496 | unsigned char pa_lfr_bp_blk_nr[2]; | |
492 |
} Header_TM_LFR_SCIENCE_BP_ |
|
497 | } Header_TM_LFR_SCIENCE_BP_t; | |
493 |
|
498 | |||
494 | typedef struct { |
|
499 | typedef struct { | |
495 | //targetLogicalAddress is removed by the grspw module |
|
500 | //targetLogicalAddress is removed by the grspw module |
@@ -18,36 +18,6 typedef struct ring_node | |||||
18 | unsigned int status; |
|
18 | unsigned int status; | |
19 | } ring_node; |
|
19 | } ring_node; | |
20 |
|
20 | |||
21 | typedef struct ring_node_sm |
|
|||
22 | { |
|
|||
23 | struct ring_node_sm *previous; |
|
|||
24 | int buffer_address; |
|
|||
25 | struct ring_node_sm *next; |
|
|||
26 | unsigned int status; |
|
|||
27 | unsigned int coarseTime; |
|
|||
28 | unsigned int fineTime; |
|
|||
29 | } ring_node_sm; |
|
|||
30 |
|
||||
31 | typedef struct ring_node_bp |
|
|||
32 | { |
|
|||
33 | struct ring_node_bp *previous; |
|
|||
34 | struct ring_node_bp *next; |
|
|||
35 | unsigned int status; |
|
|||
36 | unsigned int coarseTime; |
|
|||
37 | unsigned int fineTime; |
|
|||
38 | Header_TM_LFR_SCIENCE_BP_SBM_t header; |
|
|||
39 | unsigned char data[ 9 * 22 ]; |
|
|||
40 | } ring_node_bp; |
|
|||
41 |
|
||||
42 | typedef struct |
|
|||
43 | { |
|
|||
44 | unsigned int status; |
|
|||
45 | unsigned int coarseTime; |
|
|||
46 | unsigned int fineTime; |
|
|||
47 | Header_TM_LFR_SCIENCE_BP_NORM_t header; |
|
|||
48 | unsigned char data[ 9 * 22 ]; |
|
|||
49 | } ring_node_norm_bp; |
|
|||
50 |
|
||||
51 | //************************ |
|
21 | //************************ | |
52 | // flight software version |
|
22 | // flight software version | |
53 | // this parameters is handled by the Qt project options |
|
23 | // this parameters is handled by the Qt project options | |
@@ -85,15 +55,17 typedef struct | |||||
85 | #define THR_MODE_NORMAL 1 |
|
55 | #define THR_MODE_NORMAL 1 | |
86 | #define THR_MODE_BURST 2 |
|
56 | #define THR_MODE_BURST 2 | |
87 |
|
57 | |||
88 |
#define RTEMS_EVENT_MODE_STANDBY |
|
58 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 | |
89 |
#define RTEMS_EVENT_MODE_NORMAL |
|
59 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 | |
90 |
#define RTEMS_EVENT_MODE_BURST |
|
60 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 | |
91 |
#define RTEMS_EVENT_MODE_SBM1 |
|
61 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 | |
92 |
#define RTEMS_EVENT_MODE_SBM2 |
|
62 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 | |
93 |
#define RTEMS_EVENT_MODE_SBM2_WFRM |
|
63 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 | |
94 |
#define RTEMS_EVENT_ |
|
64 | #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6 | |
95 |
#define RTEMS_EVENT_ |
|
65 | #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7 | |
96 |
#define RTEMS_EVENT_ |
|
66 | #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 | |
|
67 | #define RTEMS_EVENT_SBM1_BP1_F0 RTEMS_EVENT_9 | |||
|
68 | #define RTEMS_EVENT_SBM1_BP2_F0 RTEMS_EVENT_10 | |||
97 |
|
69 | |||
98 | //**************************** |
|
70 | //**************************** | |
99 | // LFR DEFAULT MODE PARAMETERS |
|
71 | // LFR DEFAULT MODE PARAMETERS | |
@@ -203,11 +175,11 typedef struct | |||||
203 | #define TASK_PRIORITY_STAT 200 |
|
175 | #define TASK_PRIORITY_STAT 200 | |
204 | #define TASK_PRIORITY_DUMB 200 |
|
176 | #define TASK_PRIORITY_DUMB 200 | |
205 |
|
177 | |||
206 | #define ACTION_MSG_QUEUE_COUNT 10 |
|
178 | #define ACTION_MSG_QUEUE_COUNT 10 | |
207 | #define ACTION_MSG_PKTS_COUNT 50 |
|
179 | #define ACTION_MSG_PKTS_COUNT 50 | |
208 | //#define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES) |
|
180 | //#define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES) | |
209 | #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP1_F0 + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES) |
|
181 | #define ACTION_MSG_PKTS_MAX_SIZE 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1 | |
210 |
#define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 |
|
182 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options | |
211 |
|
183 | |||
212 | #define QUEUE_RECV 0 |
|
184 | #define QUEUE_RECV 0 | |
213 | #define QUEUE_SEND 1 |
|
185 | #define QUEUE_SEND 1 |
@@ -12,7 +12,8 | |||||
12 | #define NB_RING_NODES_ASM_F0 12 // AT LEAST 3 |
|
12 | #define NB_RING_NODES_ASM_F0 12 // AT LEAST 3 | |
13 | #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3 |
|
13 | #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3 | |
14 | #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3 |
|
14 | #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3 | |
15 |
#define NB_RING_NODES_ |
|
15 | #define NB_RING_NODES_SBM1_BP1 10 // AT LEAST 3 | |
|
16 | #define NB_RING_NODES_SBM1_BP2 5 // AT LEAST 3 | |||
16 | // |
|
17 | // | |
17 | #define NB_BINS_PER_ASM_F0 88 |
|
18 | #define NB_BINS_PER_ASM_F0 88 | |
18 | #define NB_BINS_PER_PKT_ASM_F0 44 |
|
19 | #define NB_BINS_PER_PKT_ASM_F0 44 | |
@@ -42,12 +43,15 | |||||
42 | #define NB_BINS_TO_AVERAGE_ASM_F2 8 |
|
43 | #define NB_BINS_TO_AVERAGE_ASM_F2 8 | |
43 | #define NB_BINS_TO_AVERAGE_ASM_SBM1_F0 4 |
|
44 | #define NB_BINS_TO_AVERAGE_ASM_SBM1_F0 4 | |
44 | // |
|
45 | // | |
45 | #define TOTAL_SIZE_COMPRESSED_ASM_F0 275 // 11 * 25 WORDS |
|
46 | #define TOTAL_SIZE_COMPRESSED_ASM_F0 275 // 11 * 25 WORDS | |
46 | #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 WORDS |
|
47 | #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 WORDS | |
47 | #define TOTAL_SIZE_COMPRESSED_ASM_F2 300 // 12 * 25 WORDS |
|
48 | #define TOTAL_SIZE_COMPRESSED_ASM_F2 300 // 12 * 25 WORDS | |
48 | #define TOTAL_SIZE_COMPRESSED_ASM_SBM1 550 // 22 * 25 WORDS |
|
49 | #define TOTAL_SIZE_COMPRESSED_ASM_SBM1 550 // 22 * 25 WORDS | |
49 |
#define NB_ |
|
50 | #define NB_SM_BEFORE_NORM_BP1_F0 384 // 96 * 4 | |
50 | #define NB_AVERAGE_SBM1_F0 24 // 24 matrices at f0 = 0.25 second |
|
51 | #define NB_SM_BEFORE_NORM_BP2_F0 1920 // 96 * 20 | |
51 | #define NB_SM_TO_RECEIVE_BEFORE_AVF0 8 |
|
52 | #define NB_SM_BEFORE_NORM_ASM_F0 384 // 384 matrices at f0 = 4.00 second | |
|
53 | #define NB_SM_BEFORE_SBM1_BP1_F0 24 // 24 matrices at f0 = 0.25 second | |||
|
54 | #define NB_SM_BEFORE_SBM1_BP2_F0 96 // 96 matrices at f0 = 1.00 second | |||
|
55 | #define NB_SM_BEFORE_AVF0 8 | |||
52 |
|
56 | |||
53 | #endif // FSW_PARAMS_PROCESSING_H |
|
57 | #endif // FSW_PARAMS_PROCESSING_H |
@@ -11,6 +11,38 | |||||
11 | #include "fsw_params.h" |
|
11 | #include "fsw_params.h" | |
12 | #include "fsw_spacewire.h" |
|
12 | #include "fsw_spacewire.h" | |
13 |
|
13 | |||
|
14 | typedef struct ring_node_sm | |||
|
15 | { | |||
|
16 | struct ring_node_sm *previous; | |||
|
17 | int buffer_address; | |||
|
18 | struct ring_node_sm *next; | |||
|
19 | unsigned int status; | |||
|
20 | unsigned int coarseTime; | |||
|
21 | unsigned int fineTime; | |||
|
22 | } ring_node_sm; | |||
|
23 | ||||
|
24 | typedef struct ring_node_bp | |||
|
25 | { | |||
|
26 | struct ring_node_bp *previous; | |||
|
27 | struct ring_node_bp *next; | |||
|
28 | unsigned int status; | |||
|
29 | unsigned int coarseTime; | |||
|
30 | unsigned int fineTime; | |||
|
31 | Header_TM_LFR_SCIENCE_BP_t header; | |||
|
32 | unsigned char data[ 30 * 22 ]; // MAX size is 22 * 30 TM_LFR_SCIENCE_BURST_BP2_F1 | |||
|
33 | } ring_node_bp; | |||
|
34 | ||||
|
35 | typedef struct ring_node_bp_with_spare | |||
|
36 | { | |||
|
37 | struct ring_node_bp_with_spare *previous; | |||
|
38 | struct ring_node_bp_with_spare *next; | |||
|
39 | unsigned int status; | |||
|
40 | unsigned int coarseTime; | |||
|
41 | unsigned int fineTime; | |||
|
42 | Header_TM_LFR_SCIENCE_BP_with_spare_t header; | |||
|
43 | unsigned char data[ 9 * 22 ]; | |||
|
44 | } ring_node_bp_with_spare; | |||
|
45 | ||||
14 | extern volatile int sm_f0[ ]; |
|
46 | extern volatile int sm_f0[ ]; | |
15 | extern volatile int sm_f1[ ]; |
|
47 | extern volatile int sm_f1[ ]; | |
16 | extern volatile int sm_f2[ ]; |
|
48 | extern volatile int sm_f2[ ]; | |
@@ -27,6 +59,7 extern rtems_id Task_id[20]; | |||||
27 |
|
59 | |||
28 | void init_sm_rings( void ); |
|
60 | void init_sm_rings( void ); | |
29 | void reset_current_sm_ring_nodes( void ); |
|
61 | void reset_current_sm_ring_nodes( void ); | |
|
62 | void reset_current_bp_ring_nodes( void ); | |||
30 |
|
63 | |||
31 | // ISR |
|
64 | // ISR | |
32 | void reset_nb_sm_f0( void ); |
|
65 | void reset_nb_sm_f0( void ); | |
@@ -41,7 +74,7 rtems_task matr_task(rtems_task_argument | |||||
41 | //***************************** |
|
74 | //***************************** | |
42 | // Spectral matrices processing |
|
75 | // Spectral matrices processing | |
43 |
|
76 | |||
44 |
void |
|
77 | void SM_average(float *averaged_spec_mat_f0, float *averaged_spec_mat_f1, | |
45 | ring_node_sm *ring_node_tab[], |
|
78 | ring_node_sm *ring_node_tab[], | |
46 | unsigned int firstTimeF0, unsigned int firstTimeF1 ); |
|
79 | unsigned int firstTimeF0, unsigned int firstTimeF1 ); | |
47 | void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized, |
|
80 | void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized, | |
@@ -53,12 +86,23 void ASM_convert(volatile float *input_m | |||||
53 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
86 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
54 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id); |
|
87 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id); | |
55 |
|
88 | |||
56 | void BP1_send( ring_node_bp *ring_node_to_send, unsigned int sid, rtems_id queue_id ); |
|
89 | void BP_send(char *data, | |
|
90 | rtems_id queue_id , | |||
|
91 | unsigned int nbBytesToSend ); | |||
57 |
|
92 | |||
58 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header); |
|
93 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header); | |
59 |
void init_ |
|
94 | void init_bp_ring_sbm1_bp1( void ); | |
60 | void init_header_bp( Header_TM_LFR_SCIENCE_BP_SBM_t *header); |
|
95 | void init_bp_ring_sbm1_bp2( void ); | |
|
96 | void init_headers_bp_ring_sbm1_bp1(); | |||
|
97 | void init_header_bp(Header_TM_LFR_SCIENCE_BP_t *header, | |||
|
98 | unsigned int apid, unsigned char sid, | |||
|
99 | unsigned int packetLength , unsigned char blkNr); | |||
|
100 | void init_header_bp_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header, | |||
|
101 | unsigned int apid, unsigned char sid, | |||
|
102 | unsigned int packetLength, unsigned char blkNr ); | |||
61 |
|
103 | |||
62 | void reset_spectral_matrix_regs( void ); |
|
104 | void reset_spectral_matrix_regs( void ); | |
63 |
|
105 | |||
|
106 | void set_time( unsigned char *time, unsigned int coarseTime, unsigned int fineTime ); | |||
|
107 | ||||
64 | #endif // FSW_PROCESSING_H_INCLUDED |
|
108 | #endif // FSW_PROCESSING_H_INCLUDED |
@@ -96,8 +96,10 rtems_task Init( rtems_task_argument ign | |||||
96 | init_local_mode_parameters(); |
|
96 | init_local_mode_parameters(); | |
97 | init_housekeeping_parameters(); |
|
97 | init_housekeeping_parameters(); | |
98 |
|
98 | |||
99 | init_waveform_rings(); // initialize the waveform rings |
|
99 | init_waveform_rings(); // initialize the waveform rings | |
100 | init_sm_rings(); // initialize spectral matrices rings |
|
100 | init_sm_rings(); // initialize spectral matrices rings | |
|
101 | init_bp_ring_sbm1_bp1(); // initialize basic parameter ring for SBM1 BP1 set | |||
|
102 | init_bp_ring_sbm1_bp2(); // initialize basic parameter ring for SBM1 BP2 set | |||
101 |
|
103 | |||
102 | reset_wfp_burst_enable(); |
|
104 | reset_wfp_burst_enable(); | |
103 | reset_wfp_status(); |
|
105 | reset_wfp_status(); |
@@ -164,8 +164,8 rtems_task hous_task(rtems_task_argument | |||||
164 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
164 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
165 | housekeeping_packet.reserved = DEFAULT_RESERVED; |
|
165 | housekeeping_packet.reserved = DEFAULT_RESERVED; | |
166 | housekeeping_packet.userApplication = CCSDS_USER_APP; |
|
166 | housekeeping_packet.userApplication = CCSDS_USER_APP; | |
167 |
housekeeping_packet.packetID[0] = (unsigned char) ( |
|
167 | housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); | |
168 |
housekeeping_packet.packetID[1] = (unsigned char) ( |
|
168 | housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK); | |
169 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
169 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
170 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
170 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
171 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
171 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); | |
@@ -374,8 +374,8 void send_dumb_hk( void ) | |||||
374 | dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
374 | dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
375 | dummy_hk_packet.reserved = DEFAULT_RESERVED; |
|
375 | dummy_hk_packet.reserved = DEFAULT_RESERVED; | |
376 | dummy_hk_packet.userApplication = CCSDS_USER_APP; |
|
376 | dummy_hk_packet.userApplication = CCSDS_USER_APP; | |
377 |
dummy_hk_packet.packetID[0] = (unsigned char) ( |
|
377 | dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8); | |
378 |
dummy_hk_packet.packetID[1] = (unsigned char) ( |
|
378 | dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK); | |
379 | dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
379 | dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
380 | dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
380 | dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
381 | dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
381 | dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
@@ -24,20 +24,22 ring_node_sm *current_ring_node_sm_f2; | |||||
24 | //********************** |
|
24 | //********************** | |
25 | // basic parameter rings |
|
25 | // basic parameter rings | |
26 | ring_node_bp *current_node_sbm1_bp1_f0; |
|
26 | ring_node_bp *current_node_sbm1_bp1_f0; | |
27 | ring_node_bp bp_ring_sbm1[ NB_RING_NODES_BP1_SBM1 ]; |
|
27 | ring_node_bp *current_node_sbm1_bp2_f0; | |
|
28 | ring_node_bp bp_ring_sbm1_bp1[ NB_RING_NODES_SBM1_BP1 ]; | |||
|
29 | ring_node_bp bp_ring_sbm1_bp2[ NB_RING_NODES_SBM1_BP2 ]; | |||
28 |
|
30 | |||
29 | //***** |
|
31 | //***** | |
30 | // NORM |
|
32 | // NORM | |
31 | // F0 |
|
33 | // F0 | |
32 |
float asm_f0 |
|
34 | float asm_norm_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ]; | |
33 | float asm_f0_reorganized[ TIME_OFFSET + TOTAL_SIZE_SM ]; |
|
35 | float asm_f0_reorganized [ TIME_OFFSET + TOTAL_SIZE_SM ]; | |
34 | char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ]; |
|
36 | char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ]; | |
35 |
float compressed_sm_f0 |
|
37 | float compressed_sm_norm_f0[ TIME_OFFSET + TOTAL_SIZE_COMPRESSED_ASM_F0 ]; | |
36 |
|
38 | |||
37 | //***** |
|
39 | //***** | |
38 | // SBM1 |
|
40 | // SBM1 | |
39 |
float a |
|
41 | float asm_sbm1_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ]; | |
40 |
float compressed_sm_sbm1 |
|
42 | float compressed_sm_sbm1[ TIME_OFFSET + TOTAL_SIZE_COMPRESSED_ASM_SBM1 ]; | |
41 |
|
43 | |||
42 | unsigned char LFR_BP1_F0[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_NORM_BP1_F0 * 2 ]; |
|
44 | unsigned char LFR_BP1_F0[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_NORM_BP1_F0 * 2 ]; | |
43 | unsigned char LFR_BP1_F1[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_NORM_BP1_F1 ]; |
|
45 | unsigned char LFR_BP1_F1[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_NORM_BP1_F1 ]; | |
@@ -123,9 +125,10 void reset_current_sm_ring_nodes( void ) | |||||
123 | ring_node_for_averaging_sm_f0 = sm_ring_f0; |
|
125 | ring_node_for_averaging_sm_f0 = sm_ring_f0; | |
124 | } |
|
126 | } | |
125 |
|
127 | |||
126 |
void reset_current_node |
|
128 | void reset_current_bp_ring_nodes( void ) | |
127 | { |
|
129 | { | |
128 | current_node_sbm1_bp1_f0 = bp_ring_sbm1; |
|
130 | current_node_sbm1_bp1_f0 = bp_ring_sbm1_bp1; | |
|
131 | current_node_sbm1_bp2_f0 = bp_ring_sbm1_bp2; | |||
129 | } |
|
132 | } | |
130 |
|
133 | |||
131 | //*********************************************************** |
|
134 | //*********************************************************** | |
@@ -162,7 +165,7 rtems_isr spectral_matrices_isr( rtems_v | |||||
162 |
|
165 | |||
163 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011 |
|
166 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011 | |
164 |
|
167 | |||
165 |
if (nb_sm_f0 == (NB_SM_ |
|
168 | if (nb_sm_f0 == (NB_SM_BEFORE_AVF0-1) ) | |
166 | { |
|
169 | { | |
167 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
170 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; | |
168 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
171 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
@@ -179,7 +182,7 rtems_isr spectral_matrices_isr( rtems_v | |||||
179 |
|
182 | |||
180 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
183 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) | |
181 | { |
|
184 | { | |
182 |
if (nb_sm_f0 == (NB_SM_ |
|
185 | if (nb_sm_f0 == (NB_SM_BEFORE_AVF0-1) ) | |
183 | { |
|
186 | { | |
184 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
187 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; | |
185 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
188 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
@@ -211,64 +214,103 rtems_task smiq_task(rtems_task_argument | |||||
211 | rtems_task avf0_task(rtems_task_argument argument) |
|
214 | rtems_task avf0_task(rtems_task_argument argument) | |
212 | { |
|
215 | { | |
213 | int i; |
|
216 | int i; | |
214 |
static unsigned int nb_ |
|
217 | static unsigned int nb_sm_norm_bp1_f0; | |
215 |
static unsigned int nb_ |
|
218 | static unsigned int nb_sm_norm_bp2_f0; | |
|
219 | static unsigned int nb_sm_norm_asm_f0; | |||
|
220 | static unsigned int nb_sm_sbm1_bp1_f0; | |||
|
221 | static unsigned int nb_sm_sbm1_bp2_f0; | |||
216 | rtems_event_set event_out; |
|
222 | rtems_event_set event_out; | |
|
223 | rtems_event_set event_for_matr; | |||
217 | rtems_status_code status; |
|
224 | rtems_status_code status; | |
218 | ring_node_sm *ring_node_tab[8]; |
|
225 | ring_node_sm *ring_node_tab[8]; | |
219 |
|
226 | |||
220 |
nb_ |
|
227 | nb_sm_norm_bp1_f0 = 0; | |
221 |
nb_ |
|
228 | nb_sm_norm_bp2_f0 = 0; | |
|
229 | nb_sm_norm_asm_f0 = 0; | |||
|
230 | nb_sm_sbm1_bp1_f0 = 0; | |||
|
231 | nb_sm_sbm1_bp2_f0 = 0; | |||
222 |
|
232 | |||
223 | BOOT_PRINTF("in AVFO *** \n") |
|
233 | BOOT_PRINTF("in AVFO *** \n") | |
224 |
|
234 | |||
225 | while(1){ |
|
235 | while(1){ | |
226 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
236 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
227 |
ring_node_tab[NB_SM_ |
|
237 | ring_node_tab[NB_SM_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0; | |
228 |
for ( i = 2; i < (NB_SM_ |
|
238 | for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ ) | |
229 | { |
|
239 | { | |
230 | ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous; |
|
240 | ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous; | |
231 |
ring_node_tab[NB_SM_ |
|
241 | ring_node_tab[NB_SM_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0; | |
232 | } |
|
242 | } | |
233 |
|
243 | |||
234 | // copy time information in the asm_f0 buffer |
|
244 | // copy time information in the asm_f0 buffer | |
235 | asm_f0[0] = ring_node_tab[7]->coarseTime; |
|
245 | asm_norm_f0[0] = ring_node_tab[7]->coarseTime; | |
236 | asm_f0[1] = ring_node_tab[7]->fineTime; |
|
246 | asm_norm_f0[1] = ring_node_tab[7]->fineTime; | |
237 |
a |
|
247 | asm_sbm1_f0[0] = ring_node_tab[7]->coarseTime; | |
238 |
a |
|
248 | asm_sbm1_f0[1] = ring_node_tab[7]->fineTime; | |
239 |
|
249 | |||
240 | // compute the average and store it in the averaged_sm_f1 buffer |
|
250 | // compute the average and store it in the averaged_sm_f1 buffer | |
241 |
|
|
251 | SM_average( asm_norm_f0, asm_sbm1_f0, | |
242 | ring_node_tab, |
|
252 | ring_node_tab, | |
243 |
nb_ |
|
253 | nb_sm_norm_bp1_f0, nb_sm_sbm1_bp1_f0 ); | |
244 |
|
||||
245 |
|
254 | |||
246 | // update nb_average |
|
255 | // update nb_average | |
247 |
nb_ |
|
256 | nb_sm_norm_bp1_f0 = nb_sm_norm_bp1_f0 + NB_SM_BEFORE_AVF0; | |
248 |
nb_ |
|
257 | nb_sm_norm_bp2_f0 = nb_sm_norm_bp2_f0 + NB_SM_BEFORE_AVF0; | |
|
258 | nb_sm_norm_asm_f0 = nb_sm_norm_asm_f0 + NB_SM_BEFORE_AVF0; | |||
|
259 | nb_sm_sbm1_bp1_f0 = nb_sm_sbm1_bp1_f0 + NB_SM_BEFORE_AVF0; | |||
|
260 | nb_sm_sbm1_bp2_f0 = nb_sm_sbm1_bp2_f0 + NB_SM_BEFORE_AVF0; | |||
249 |
|
261 | |||
250 | // launch actions depending on the current mode |
|
262 | //*********************************************************** | |
|
263 | // build a composite event that will be sent to the MATR task | |||
|
264 | event_for_matr = 0x00; | |||
251 |
|
265 | |||
252 |
if (nb_ |
|
266 | if (nb_sm_sbm1_bp1_f0 == NB_SM_BEFORE_SBM1_BP1_F0) | |
253 | { |
|
267 | { | |
254 |
nb_ |
|
268 | nb_sm_sbm1_bp1_f0 = 0; | |
255 | if (lfrCurrentMode == LFR_MODE_SBM1) |
|
269 | if (lfrCurrentMode == LFR_MODE_SBM1) | |
256 | { |
|
270 | { | |
257 | status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_MODE_SBM1 ); // sending an event to the task 7, BPF0 |
|
271 | event_for_matr = event_for_matr | RTEMS_EVENT_SBM1_BP1_F0; | |
258 | if (status != RTEMS_SUCCESSFUL) |
|
|||
259 | { |
|
|||
260 | printf("in AVF0 *** Error sending RTEMS_EVENT_MODE_SBM1, code %d\n", status); |
|
|||
261 | } |
|
|||
262 | } |
|
272 | } | |
263 | } |
|
273 | } | |
264 |
|
274 | |||
265 |
if (nb_ |
|
275 | if (nb_sm_sbm1_bp2_f0 == NB_SM_BEFORE_SBM1_BP2_F0) | |
266 | nb_average_norm_f0 = 0; |
|
276 | { | |
267 | status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_MODE_NORMAL ); // sending an event to the task 7, BPF0 |
|
277 | nb_sm_sbm1_bp2_f0 = 0; | |
268 | if (status != RTEMS_SUCCESSFUL) { |
|
278 | if (lfrCurrentMode == LFR_MODE_SBM1) | |
269 | printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status); |
|
279 | { | |
|
280 | event_for_matr = event_for_matr | RTEMS_EVENT_SBM1_BP2_F0; | |||
|
281 | } | |||
|
282 | } | |||
|
283 | ||||
|
284 | if (nb_sm_norm_bp1_f0 == NB_SM_BEFORE_NORM_BP1_F0) { | |||
|
285 | nb_sm_norm_bp1_f0 = 0; | |||
|
286 | if (lfrCurrentMode == LFR_MODE_NORMAL) | |||
|
287 | { | |||
|
288 | event_for_matr = event_for_matr | RTEMS_EVENT_NORM_BP1_F0; | |||
270 | } |
|
289 | } | |
271 | } |
|
290 | } | |
|
291 | ||||
|
292 | if (nb_sm_norm_bp2_f0 == NB_SM_BEFORE_NORM_BP2_F0) { | |||
|
293 | nb_sm_norm_bp2_f0 = 0; | |||
|
294 | if (lfrCurrentMode == LFR_MODE_NORMAL) | |||
|
295 | { | |||
|
296 | event_for_matr = event_for_matr | RTEMS_EVENT_NORM_BP2_F0; | |||
|
297 | } | |||
|
298 | } | |||
|
299 | ||||
|
300 | if (nb_sm_norm_asm_f0 == NB_SM_BEFORE_NORM_ASM_F0) { | |||
|
301 | nb_sm_norm_asm_f0 = 0; | |||
|
302 | if (lfrCurrentMode == LFR_MODE_NORMAL) | |||
|
303 | { | |||
|
304 | event_for_matr = event_for_matr | RTEMS_EVENT_NORM_ASM_F0; | |||
|
305 | } | |||
|
306 | } | |||
|
307 | ||||
|
308 | //********************************* | |||
|
309 | // send the composite event to MATR | |||
|
310 | status = rtems_event_send( Task_id[TASKID_MATR], event_for_matr ); | |||
|
311 | if (status != RTEMS_SUCCESSFUL) { | |||
|
312 | printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status); | |||
|
313 | } | |||
272 | } |
|
314 | } | |
273 | } |
|
315 | } | |
274 |
|
316 | |||
@@ -279,10 +321,16 rtems_task matr_task(rtems_task_argument | |||||
279 | rtems_status_code status; |
|
321 | rtems_status_code status; | |
280 | rtems_id queue_id; |
|
322 | rtems_id queue_id; | |
281 | Header_TM_LFR_SCIENCE_ASM_t headerASM; |
|
323 | Header_TM_LFR_SCIENCE_ASM_t headerASM; | |
282 |
ring_node_ |
|
324 | ring_node_bp_with_spare current_node_norm_bp1_f0; | |
|
325 | ring_node_bp current_node_norm_bp2_f0; | |||
283 |
|
326 | |||
284 | init_header_asm( &headerASM ); |
|
327 | init_header_asm( &headerASM ); | |
285 |
|
|
328 | init_header_bp_with_spare( ¤t_node_norm_bp1_f0.header, | |
|
329 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0, | |||
|
330 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 ); | |||
|
331 | init_header_bp( ¤t_node_norm_bp2_f0.header, | |||
|
332 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0, | |||
|
333 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0); | |||
286 |
|
334 | |||
287 | status = get_message_queue_id_send( &queue_id ); |
|
335 | status = get_message_queue_id_send( &queue_id ); | |
288 | if (status != RTEMS_SUCCESSFUL) |
|
336 | if (status != RTEMS_SUCCESSFUL) | |
@@ -293,51 +341,98 rtems_task matr_task(rtems_task_argument | |||||
293 | BOOT_PRINTF("in MATR *** \n") |
|
341 | BOOT_PRINTF("in MATR *** \n") | |
294 |
|
342 | |||
295 | while(1){ |
|
343 | while(1){ | |
296 |
rtems_event_receive( RTEMS_EVENT_ |
|
344 | rtems_event_receive( RTEMS_EVENT_NORM_BP1_F0 | RTEMS_EVENT_NORM_BP2_F0 | RTEMS_EVENT_NORM_ASM_F0 | |
|
345 | | RTEMS_EVENT_SBM1_BP1_F0 | RTEMS_EVENT_SBM1_BP2_F0, | |||
297 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
346 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
298 | if (event_out==RTEMS_EVENT_MODE_NORMAL) |
|
347 | //***** | |
|
348 | //***** | |||
|
349 | // SBM1 | |||
|
350 | //***** | |||
|
351 | //***** | |||
|
352 | if (event_out & RTEMS_EVENT_SBM1_BP1_F0) | |||
299 | { |
|
353 | { | |
300 | // 1) compress the matrix for Basic Parameters calculation |
|
354 | // 1) compress the matrix for Basic Parameters calculation | |
301 |
ASM_compress_reorganize_and_divide( asm_f0, compressed_sm_ |
|
355 | ASM_compress_reorganize_and_divide( asm_sbm1_f0, compressed_sm_sbm1, | |
302 |
NB_ |
|
356 | NB_SM_BEFORE_SBM1_BP1_F0, | |
|
357 | NB_BINS_COMPRESSED_SM_SBM1_F0, NB_BINS_TO_AVERAGE_ASM_SBM1_F0, | |||
|
358 | ASM_F0_INDICE_START); | |||
|
359 | // 2) compute the BP1 set | |||
|
360 | ||||
|
361 | // 3) send the BP1 set | |||
|
362 | set_time( current_node_sbm1_bp1_f0->header.time, | |||
|
363 | current_node_sbm1_bp1_f0->coarseTime, current_node_sbm1_bp1_f0->fineTime); | |||
|
364 | set_time( current_node_sbm1_bp1_f0->header.acquisitionTime, | |||
|
365 | current_node_sbm1_bp1_f0->coarseTime, current_node_sbm1_bp1_f0->fineTime); | |||
|
366 | BP_send( (char *) ¤t_node_sbm1_bp1_f0->header, queue_id, | |||
|
367 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP1_F0 + PACKET_LENGTH_DELTA); | |||
|
368 | // 4) update current_node_sbm1_bp1_f0 | |||
|
369 | current_node_sbm1_bp1_f0 = current_node_sbm1_bp1_f0->next; | |||
|
370 | if (event_out & RTEMS_EVENT_SBM1_BP2_F0) | |||
|
371 | { | |||
|
372 | // 1) compute the BP2 set | |||
|
373 | ||||
|
374 | // 2) send the BP2 set | |||
|
375 | set_time( current_node_sbm1_bp2_f0->header.time, | |||
|
376 | current_node_sbm1_bp2_f0->coarseTime, current_node_sbm1_bp2_f0->fineTime); | |||
|
377 | set_time( current_node_sbm1_bp2_f0->header.acquisitionTime, | |||
|
378 | current_node_sbm1_bp2_f0->coarseTime, current_node_sbm1_bp2_f0->fineTime); | |||
|
379 | BP_send( (char *) ¤t_node_sbm1_bp2_f0->header, queue_id, | |||
|
380 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP1_F0 + PACKET_LENGTH_DELTA); | |||
|
381 | } | |||
|
382 | } | |||
|
383 | ||||
|
384 | //***** | |||
|
385 | //***** | |||
|
386 | // NORM | |||
|
387 | //***** | |||
|
388 | //***** | |||
|
389 | if (event_out & RTEMS_EVENT_NORM_BP1_F0) | |||
|
390 | { | |||
|
391 | // 1) compress the matrix for Basic Parameters calculation | |||
|
392 | ASM_compress_reorganize_and_divide( asm_norm_f0, compressed_sm_norm_f0, | |||
|
393 | NB_SM_BEFORE_NORM_BP1_F0, | |||
303 | NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, |
|
394 | NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, | |
304 | ASM_F0_INDICE_START ); |
|
395 | ASM_F0_INDICE_START ); | |
305 | // 2) compute the BP1 set |
|
396 | // 2) compute the BP1 set | |
306 |
|
397 | |||
307 | // 3) send the BP1 set |
|
398 | // 3) send the BP1 set | |
308 |
|
|
399 | set_time( current_node_norm_bp1_f0.header.time, | |
309 | // 4) reorganize the ASM and divide |
|
400 | current_node_norm_bp1_f0.coarseTime, current_node_norm_bp1_f0.fineTime); | |
310 | ASM_reorganize_and_divide( asm_f0, asm_f0_reorganized, NB_AVERAGE_NORMAL_F0 ); |
|
401 | set_time( current_node_norm_bp1_f0.header.acquisitionTime, | |
311 | // 5) convert the float array in a char array |
|
402 | current_node_norm_bp1_f0.coarseTime, current_node_norm_bp1_f0.fineTime); | |
|
403 | BP_send( (char *) ¤t_node_norm_bp1_f0.header, queue_id, | |||
|
404 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA); | |||
|
405 | if (event_out & RTEMS_EVENT_NORM_BP2_F0) | |||
|
406 | { | |||
|
407 | // 1) compute the BP2 set | |||
|
408 | ||||
|
409 | // 2) send the BP2 set | |||
|
410 | set_time( current_node_norm_bp2_f0.header.time, | |||
|
411 | current_node_norm_bp2_f0.coarseTime, current_node_norm_bp2_f0.fineTime); | |||
|
412 | set_time( current_node_norm_bp2_f0.header.acquisitionTime, | |||
|
413 | current_node_norm_bp2_f0.coarseTime, current_node_norm_bp2_f0.fineTime); | |||
|
414 | BP_send( (char *) ¤t_node_norm_bp2_f0.header, queue_id, | |||
|
415 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA); | |||
|
416 | } | |||
|
417 | } | |||
|
418 | ||||
|
419 | if (event_out & RTEMS_EVENT_NORM_ASM_F0) | |||
|
420 | { | |||
|
421 | // 1) reorganize the ASM and divide | |||
|
422 | ASM_reorganize_and_divide( asm_norm_f0, asm_f0_reorganized, NB_SM_BEFORE_NORM_BP1_F0 ); | |||
|
423 | // 2) convert the float array in a char array | |||
312 | ASM_convert( asm_f0_reorganized, asm_f0_char); |
|
424 | ASM_convert( asm_f0_reorganized, asm_f0_char); | |
313 |
// |
|
425 | // 3) send the spectral matrix packets | |
314 | ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); |
|
426 | ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); | |
315 | } |
|
427 | } | |
316 | else if (event_out==RTEMS_EVENT_MODE_SBM1) |
|
|||
317 | { |
|
|||
318 | // 1) compress the matrix for Basic Parameters calculation |
|
|||
319 | ASM_compress_reorganize_and_divide( averaged_sm_sbm1, compressed_sm_sbm1, |
|
|||
320 | NB_AVERAGE_SBM1_F0, |
|
|||
321 | NB_BINS_COMPRESSED_SM_SBM1_F0, NB_BINS_TO_AVERAGE_ASM_SBM1_F0, |
|
|||
322 | ASM_F0_INDICE_START); |
|
|||
323 | // 2) compute the BP1 set |
|
|||
324 |
|
428 | |||
325 | // 3) send the basic parameters set 1 packet |
|
|||
326 | BP1_send( current_node_sbm1_bp1_f0, SID_SBM1_BP1_F0, queue_id ); |
|
|||
327 | // 4) update current_node_sbm1_bp1_f0 |
|
|||
328 | current_node_sbm1_bp1_f0 = current_node_sbm1_bp1_f0->next; |
|
|||
329 | } |
|
|||
330 | else |
|
|||
331 | { |
|
|||
332 | PRINTF1("ERR *** in MATR *** unexect event = %x\n", (unsigned int) event_out) |
|
|||
333 | } |
|
|||
334 | } |
|
429 | } | |
335 | } |
|
430 | } | |
336 |
|
431 | |||
337 | //***************************** |
|
432 | //***************************** | |
338 | // Spectral matrices processing |
|
433 | // Spectral matrices processing | |
339 |
|
434 | |||
340 |
void |
|
435 | void SM_average( float *averaged_spec_mat_f0, float *averaged_spec_mat_f1, | |
341 | ring_node_sm *ring_node_tab[], |
|
436 | ring_node_sm *ring_node_tab[], | |
342 | unsigned int nbAverageNormF0, unsigned int nbAverageSBM1F0 ) |
|
437 | unsigned int nbAverageNormF0, unsigned int nbAverageSBM1F0 ) | |
343 | { |
|
438 | { | |
@@ -372,7 +467,7 void ASM_average( float *averaged_spec_m | |||||
372 | } |
|
467 | } | |
373 | else |
|
468 | else | |
374 | { |
|
469 | { | |
375 |
PRINTF2("ERR *** in |
|
470 | PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNormF0, nbAverageSBM1F0) | |
376 | } |
|
471 | } | |
377 | } |
|
472 | } | |
378 | } |
|
473 | } | |
@@ -521,65 +616,15 void ASM_send(Header_TM_LFR_SCIENCE_ASM_ | |||||
521 | } |
|
616 | } | |
522 | } |
|
617 | } | |
523 |
|
618 | |||
524 | void BP1_send( ring_node_bp *ring_node_to_send, unsigned int sid, rtems_id queue_id ) |
|
619 | void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend ) | |
525 | { |
|
620 | { | |
526 | unsigned int length = 0; |
|
|||
527 | rtems_status_code status; |
|
621 | rtems_status_code status; | |
528 | unsigned char nbBytesTosend; |
|
|||
529 |
|
622 | |||
530 | // (1) BUILD THE DATA |
|
623 | // SEND PACKET | |
531 | switch(sid) |
|
624 | status = rtems_message_queue_send( queue_id, data, nbBytesToSend); | |
532 | { |
|
|||
533 | case SID_NORM_BP1_F0: |
|
|||
534 | length = PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0; |
|
|||
535 | ring_node_to_send->header.packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
|||
536 | ring_node_to_send->header.packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
|||
537 | ring_node_to_send->header.pa_lfr_bp_blk_nr[0] = (unsigned char) ( (NB_BINS_COMPRESSED_SM_F0) >> 8 ); // BLK_NR MSB |
|
|||
538 | ring_node_to_send->header.pa_lfr_bp_blk_nr[1] = (unsigned char) (NB_BINS_COMPRESSED_SM_F0); // BLK_NR LSB |
|
|||
539 | nbBytesTosend = PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 |
|
|||
540 | + CCSDS_TC_TM_PACKET_OFFSET |
|
|||
541 | + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
|||
542 | case SID_SBM1_BP1_F0: |
|
|||
543 | length = PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP1_F0; |
|
|||
544 | ring_node_to_send->header.packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8); |
|
|||
545 | ring_node_to_send->header.packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2); |
|
|||
546 | ring_node_to_send->header.pa_lfr_bp_blk_nr[0] = (unsigned char) ( (NB_BINS_COMPRESSED_SM_SBM1_F0) >> 8 ); // BLK_NR MSB |
|
|||
547 | ring_node_to_send->header.pa_lfr_bp_blk_nr[1] = (unsigned char) (NB_BINS_COMPRESSED_SM_SBM1_F0); // BLK_NR LSB |
|
|||
548 | nbBytesTosend = PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP1_F0 |
|
|||
549 | + CCSDS_TC_TM_PACKET_OFFSET |
|
|||
550 | + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
|||
551 | break; |
|
|||
552 | default: |
|
|||
553 | nbBytesTosend = 0; |
|
|||
554 | PRINTF1("ERR *** in BP1_send *** unexpected sid %d\n", sid) |
|
|||
555 | break; |
|
|||
556 | } |
|
|||
557 |
|
||||
558 | // (2) BUILD THE HEADER |
|
|||
559 | ring_node_to_send->header.packetLength[0] = (unsigned char) (length>>8); |
|
|||
560 | ring_node_to_send->header.packetLength[1] = (unsigned char) (length); |
|
|||
561 | ring_node_to_send->header.sid = sid; |
|
|||
562 |
|
||||
563 | // (3) SET PACKET TIME |
|
|||
564 | ring_node_to_send->header.time[0] = (unsigned char) (ring_node_to_send->coarseTime>>24); |
|
|||
565 | ring_node_to_send->header.time[1] = (unsigned char) (ring_node_to_send->coarseTime>>16); |
|
|||
566 | ring_node_to_send->header.time[2] = (unsigned char) (ring_node_to_send->coarseTime>>8); |
|
|||
567 | ring_node_to_send->header.time[3] = (unsigned char) (ring_node_to_send->coarseTime); |
|
|||
568 | ring_node_to_send->header.time[4] = (unsigned char) (ring_node_to_send->fineTime>>8); |
|
|||
569 | ring_node_to_send->header.time[5] = (unsigned char) (ring_node_to_send->fineTime); |
|
|||
570 | // |
|
|||
571 | ring_node_to_send->header.acquisitionTime[0] = (unsigned char) (ring_node_to_send->coarseTime>>24); |
|
|||
572 | ring_node_to_send->header.acquisitionTime[1] = (unsigned char) (ring_node_to_send->coarseTime>>16); |
|
|||
573 | ring_node_to_send->header.acquisitionTime[2] = (unsigned char) (ring_node_to_send->coarseTime>>8); |
|
|||
574 | ring_node_to_send->header.acquisitionTime[3] = (unsigned char) (ring_node_to_send->coarseTime); |
|
|||
575 | ring_node_to_send->header.acquisitionTime[4] = (unsigned char) (ring_node_to_send->fineTime>>8); |
|
|||
576 | ring_node_to_send->header.acquisitionTime[5] = (unsigned char) (ring_node_to_send->fineTime); |
|
|||
577 |
|
||||
578 | // (4) SEND PACKET |
|
|||
579 | status = rtems_message_queue_send( queue_id, &ring_node_to_send->header, nbBytesTosend); |
|
|||
580 | if (status != RTEMS_SUCCESSFUL) |
|
625 | if (status != RTEMS_SUCCESSFUL) | |
581 | { |
|
626 | { | |
582 |
printf("ERR *** in BP |
|
627 | printf("ERR *** in BP_send *** ERR %d\n", (int) status); | |
583 | } |
|
628 | } | |
584 | } |
|
629 | } | |
585 |
|
630 | |||
@@ -589,8 +634,8 void init_header_asm( Header_TM_LFR_SCIE | |||||
589 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
634 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
590 | header->reserved = 0x00; |
|
635 | header->reserved = 0x00; | |
591 | header->userApplication = CCSDS_USER_APP; |
|
636 | header->userApplication = CCSDS_USER_APP; | |
592 |
header->packetID[0] = (unsigned char) ( |
|
637 | header->packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
593 |
header->packetID[1] = (unsigned char) ( |
|
638 | header->packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
594 | header->packetSequenceControl[0] = 0xc0; |
|
639 | header->packetSequenceControl[0] = 0xc0; | |
595 | header->packetSequenceControl[1] = 0x00; |
|
640 | header->packetSequenceControl[1] = 0x00; | |
596 | header->packetLength[0] = 0x00; |
|
641 | header->packetLength[0] = 0x00; | |
@@ -615,52 +660,87 void init_header_asm( Header_TM_LFR_SCIE | |||||
615 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB |
|
660 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB | |
616 | } |
|
661 | } | |
617 |
|
662 | |||
618 | void init_bp_ring_sbm1() |
|
663 | void init_bp_ring_sbm1_bp1( void ) | |
|
664 | { | |||
|
665 | unsigned int i; | |||
|
666 | ||||
|
667 | //******** | |||
|
668 | // F0 RING | |||
|
669 | bp_ring_sbm1_bp1[0].next = (ring_node_bp*) &bp_ring_sbm1_bp1[1]; | |||
|
670 | bp_ring_sbm1_bp1[0].previous = (ring_node_bp*) &bp_ring_sbm1_bp1[NB_RING_NODES_SBM1_BP1-1]; | |||
|
671 | ||||
|
672 | bp_ring_sbm1_bp1[NB_RING_NODES_SBM1_BP1-1].next = (ring_node_bp*) &bp_ring_sbm1_bp1[0]; | |||
|
673 | bp_ring_sbm1_bp1[NB_RING_NODES_SBM1_BP1-1].previous = (ring_node_bp*) &bp_ring_sbm1_bp1[NB_RING_NODES_SBM1_BP1-2]; | |||
|
674 | ||||
|
675 | for(i=1; i<NB_RING_NODES_SBM1_BP1-1; i++) | |||
|
676 | { | |||
|
677 | bp_ring_sbm1_bp1[i].next = (ring_node_bp*) &bp_ring_sbm1_bp1[i+1]; | |||
|
678 | bp_ring_sbm1_bp1[i].previous = (ring_node_bp*) &bp_ring_sbm1_bp1[i-1]; | |||
|
679 | } | |||
|
680 | // | |||
|
681 | //******** | |||
|
682 | ||||
|
683 | for (i=0; i<NB_RING_NODES_SBM1_BP1; i++) | |||
|
684 | { | |||
|
685 | init_header_bp( &bp_ring_sbm1_bp1[ i ].header, | |||
|
686 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0, | |||
|
687 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP1_F0, NB_BINS_COMPRESSED_SM_SBM1_F0 | |||
|
688 | ); | |||
|
689 | bp_ring_sbm1_bp1[ i ].status = 0; | |||
|
690 | } | |||
|
691 | } | |||
|
692 | ||||
|
693 | void init_bp_ring_sbm1_bp2( void ) | |||
619 | { |
|
694 | { | |
620 | unsigned int i; |
|
695 | unsigned int i; | |
621 |
|
696 | |||
622 | //******** |
|
697 | //******** | |
623 | // F0 RING |
|
698 | // F0 RING | |
624 | bp_ring_sbm1[0].next = (ring_node_bp*) &bp_ring_sbm1[1]; |
|
699 | bp_ring_sbm1_bp2[0].next = (ring_node_bp*) &bp_ring_sbm1_bp2[1]; | |
625 |
bp_ring_sbm1[0].previous = (ring_node_bp*) &bp_ring_sbm1[NB_RING_NODES_ |
|
700 | bp_ring_sbm1_bp2[0].previous = (ring_node_bp*) &bp_ring_sbm1_bp2[NB_RING_NODES_SBM1_BP2-1]; | |
626 |
|
701 | |||
627 |
bp_ring_sbm1[NB_RING_NODES_ |
|
702 | bp_ring_sbm1_bp2[NB_RING_NODES_SBM1_BP2-1].next = (ring_node_bp*) &bp_ring_sbm1_bp2[0]; | |
628 |
bp_ring_sbm1[NB_RING_NODES_ |
|
703 | bp_ring_sbm1_bp2[NB_RING_NODES_SBM1_BP2-1].previous = (ring_node_bp*) &bp_ring_sbm1_bp2[NB_RING_NODES_SBM1_BP2-2]; | |
629 |
|
704 | |||
630 |
for(i=1; i<NB_RING_NODES_ |
|
705 | for(i=1; i<NB_RING_NODES_SBM1_BP2-1; i++) | |
631 | { |
|
706 | { | |
632 | bp_ring_sbm1[i].next = (ring_node_bp*) &bp_ring_sbm1[i+1]; |
|
707 | bp_ring_sbm1_bp2[i].next = (ring_node_bp*) &bp_ring_sbm1_bp2[i+1]; | |
633 | bp_ring_sbm1[i].previous = (ring_node_bp*) &bp_ring_sbm1[i-1]; |
|
708 | bp_ring_sbm1_bp2[i].previous = (ring_node_bp*) &bp_ring_sbm1_bp2[i-1]; | |
634 | } |
|
709 | } | |
635 | // |
|
710 | // | |
636 | //******** |
|
711 | //******** | |
637 |
|
712 | |||
638 |
for (i=0; i<NB_RING_NODES_ |
|
713 | for (i=0; i<NB_RING_NODES_SBM1_BP2; i++) | |
639 | { |
|
714 | { | |
640 |
init_header_bp( |
|
715 | init_header_bp( &bp_ring_sbm1_bp2[ i ].header, | |
641 | bp_ring_sbm1[ i ].status = 0; |
|
716 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0, | |
|
717 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP2_F0, NB_BINS_COMPRESSED_SM_SBM1_F0 | |||
|
718 | ); | |||
|
719 | bp_ring_sbm1_bp2[ i ].status = 0; | |||
642 | } |
|
720 | } | |
643 | } |
|
721 | } | |
644 |
|
722 | |||
645 |
void init_header_bp(Header_TM_LFR_SCIENCE_BP |
|
723 | void init_header_bp( Header_TM_LFR_SCIENCE_BP_t *header, | |
|
724 | unsigned int apid, unsigned char sid, | |||
|
725 | unsigned int packetLength, unsigned char blkNr ) | |||
646 | { |
|
726 | { | |
647 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
727 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |
648 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
728 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
649 | header->reserved = 0x00; |
|
729 | header->reserved = 0x00; | |
650 | header->userApplication = CCSDS_USER_APP; |
|
730 | header->userApplication = CCSDS_USER_APP; | |
651 |
header->packetID[0] = (unsigned char) ( |
|
731 | header->packetID[0] = (unsigned char) (apid >> 8); | |
652 |
header->packetID[1] = (unsigned char) ( |
|
732 | header->packetID[1] = (unsigned char) (apid); | |
653 |
header->packetSequenceControl[0] = |
|
733 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
654 | header->packetSequenceControl[1] = 0x00; |
|
734 | header->packetSequenceControl[1] = 0x00; | |
655 |
header->packetLength[0] = |
|
735 | header->packetLength[0] = (unsigned char) (packetLength >> 8); | |
656 |
header->packetLength[1] = |
|
736 | header->packetLength[1] = (unsigned char) (packetLength); | |
657 | // DATA FIELD HEADER |
|
737 | // DATA FIELD HEADER | |
658 | header->spare1_pusVersion_spare2 = 0x10; |
|
738 | header->spare1_pusVersion_spare2 = 0x10; | |
659 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
739 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
660 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
740 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
661 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
741 | header->destinationID = TM_DESTINATION_ID_GROUND; | |
662 | // AUXILIARY DATA HEADER |
|
742 | // AUXILIARY DATA HEADER | |
663 |
header->sid = |
|
743 | header->sid = sid; | |
664 | header->biaStatusInfo = 0x00; |
|
744 | header->biaStatusInfo = 0x00; | |
665 | header->time[0] = 0x00; |
|
745 | header->time[0] = 0x00; | |
666 | header->time[0] = 0x00; |
|
746 | header->time[0] = 0x00; | |
@@ -669,7 +749,39 void init_header_bp(Header_TM_LFR_SCIENC | |||||
669 | header->time[0] = 0x00; |
|
749 | header->time[0] = 0x00; | |
670 | header->time[0] = 0x00; |
|
750 | header->time[0] = 0x00; | |
671 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB |
|
751 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB | |
672 |
header->pa_lfr_bp_blk_nr[1] = |
|
752 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB | |
|
753 | } | |||
|
754 | ||||
|
755 | void init_header_bp_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header, | |||
|
756 | unsigned int apid, unsigned char sid, | |||
|
757 | unsigned int packetLength , unsigned char blkNr) | |||
|
758 | { | |||
|
759 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; | |||
|
760 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; | |||
|
761 | header->reserved = 0x00; | |||
|
762 | header->userApplication = CCSDS_USER_APP; | |||
|
763 | header->packetID[0] = (unsigned char) (apid >> 8); | |||
|
764 | header->packetID[1] = (unsigned char) (apid); | |||
|
765 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |||
|
766 | header->packetSequenceControl[1] = 0x00; | |||
|
767 | header->packetLength[0] = (unsigned char) (packetLength >> 8); | |||
|
768 | header->packetLength[1] = (unsigned char) (packetLength); | |||
|
769 | // DATA FIELD HEADER | |||
|
770 | header->spare1_pusVersion_spare2 = 0x10; | |||
|
771 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type | |||
|
772 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |||
|
773 | header->destinationID = TM_DESTINATION_ID_GROUND; | |||
|
774 | // AUXILIARY DATA HEADER | |||
|
775 | header->sid = sid; | |||
|
776 | header->biaStatusInfo = 0x00; | |||
|
777 | header->time[0] = 0x00; | |||
|
778 | header->time[0] = 0x00; | |||
|
779 | header->time[0] = 0x00; | |||
|
780 | header->time[0] = 0x00; | |||
|
781 | header->time[0] = 0x00; | |||
|
782 | header->time[0] = 0x00; | |||
|
783 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB | |||
|
784 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB | |||
673 | } |
|
785 | } | |
674 |
|
786 | |||
675 | void reset_spectral_matrix_regs( void ) |
|
787 | void reset_spectral_matrix_regs( void ) | |
@@ -699,6 +811,14 void reset_spectral_matrix_regs( void ) | |||||
699 | //****************** |
|
811 | //****************** | |
700 | // general functions |
|
812 | // general functions | |
701 |
|
813 | |||
|
814 | void set_time( unsigned char *time, unsigned int coarseTime, unsigned int fineTime ) | |||
|
815 | { | |||
|
816 | time[0] = (unsigned char) (coarseTime>>24); | |||
|
817 | time[1] = (unsigned char) (coarseTime>>16); | |||
|
818 | time[2] = (unsigned char) (coarseTime>>8); | |||
|
819 | time[3] = (unsigned char) (coarseTime); | |||
|
820 | time[4] = (unsigned char) (fineTime>>8); | |||
|
821 | time[5] = (unsigned char) (fineTime); | |||
|
822 | } | |||
702 |
|
823 | |||
703 |
|
824 | |||
704 |
|
@@ -699,6 +699,7 void launch_spectral_matrix( unsigned ch | |||||
699 | { |
|
699 | { | |
700 | reset_nb_sm_f0(); |
|
700 | reset_nb_sm_f0(); | |
701 | reset_current_sm_ring_nodes(); |
|
701 | reset_current_sm_ring_nodes(); | |
|
702 | reset_current_bp_ring_nodes(); | |||
702 | reset_spectral_matrix_regs(); |
|
703 | reset_spectral_matrix_regs(); | |
703 |
|
704 | |||
704 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; |
|
705 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; | |
@@ -740,6 +741,7 void launch_spectral_matrix_simu( unsign | |||||
740 | { |
|
741 | { | |
741 | reset_nb_sm_f0(); |
|
742 | reset_nb_sm_f0(); | |
742 | reset_current_sm_ring_nodes(); |
|
743 | reset_current_sm_ring_nodes(); | |
|
744 | reset_current_bp_ring_nodes(); | |||
743 | reset_spectral_matrix_regs(); |
|
745 | reset_spectral_matrix_regs(); | |
744 |
|
746 | |||
745 | // Spectral Matrices simulator |
|
747 | // Spectral Matrices simulator |
@@ -479,8 +479,8 void init_parameter_dump( void ) | |||||
479 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
479 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
480 | parameter_dump_packet.reserved = CCSDS_RESERVED; |
|
480 | parameter_dump_packet.reserved = CCSDS_RESERVED; | |
481 | parameter_dump_packet.userApplication = CCSDS_USER_APP; |
|
481 | parameter_dump_packet.userApplication = CCSDS_USER_APP; | |
482 |
parameter_dump_packet.packetID[0] = (unsigned char) ( |
|
482 | parameter_dump_packet.packetID[0] = (unsigned char) (APID_TM_PARAMETER_DUMP >> 8); | |
483 |
parameter_dump_packet.packetID[1] = (unsigned char) |
|
483 | parameter_dump_packet.packetID[1] = (unsigned char) APID_TM_PARAMETER_DUMP; | |
484 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
484 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
485 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
485 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
486 | parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8); |
|
486 | parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8); |
@@ -41,8 +41,8 int send_tm_lfr_tc_exe_success( ccsdsTel | |||||
41 | TM.reserved = DEFAULT_RESERVED; |
|
41 | TM.reserved = DEFAULT_RESERVED; | |
42 | TM.userApplication = CCSDS_USER_APP; |
|
42 | TM.userApplication = CCSDS_USER_APP; | |
43 | // PACKET HEADER |
|
43 | // PACKET HEADER | |
44 |
TM.packetID[0] = (unsigned char) ( |
|
44 | TM.packetID[0] = (unsigned char) (APID_TM_TC_EXE >> 8); | |
45 |
TM.packetID[1] = (unsigned char) ( |
|
45 | TM.packetID[1] = (unsigned char) (APID_TM_TC_EXE ); | |
46 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
46 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
47 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8); |
|
47 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8); | |
48 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS ); |
|
48 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS ); | |
@@ -106,8 +106,8 int send_tm_lfr_tc_exe_inconsistent( ccs | |||||
106 | TM.reserved = DEFAULT_RESERVED; |
|
106 | TM.reserved = DEFAULT_RESERVED; | |
107 | TM.userApplication = CCSDS_USER_APP; |
|
107 | TM.userApplication = CCSDS_USER_APP; | |
108 | // PACKET HEADER |
|
108 | // PACKET HEADER | |
109 |
TM.packetID[0] = (unsigned char) ( |
|
109 | TM.packetID[0] = (unsigned char) (APID_TM_TC_EXE >> 8); | |
110 |
TM.packetID[1] = (unsigned char) ( |
|
110 | TM.packetID[1] = (unsigned char) (APID_TM_TC_EXE ); | |
111 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
111 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
112 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8); |
|
112 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8); | |
113 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT ); |
|
113 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT ); | |
@@ -174,8 +174,8 int send_tm_lfr_tc_exe_not_executable( c | |||||
174 | TM.reserved = DEFAULT_RESERVED; |
|
174 | TM.reserved = DEFAULT_RESERVED; | |
175 | TM.userApplication = CCSDS_USER_APP; |
|
175 | TM.userApplication = CCSDS_USER_APP; | |
176 | // PACKET HEADER |
|
176 | // PACKET HEADER | |
177 |
TM.packetID[0] = (unsigned char) ( |
|
177 | TM.packetID[0] = (unsigned char) (APID_TM_TC_EXE >> 8); | |
178 |
TM.packetID[1] = (unsigned char) ( |
|
178 | TM.packetID[1] = (unsigned char) (APID_TM_TC_EXE ); | |
179 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
179 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
180 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8); |
|
180 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8); | |
181 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE ); |
|
181 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE ); | |
@@ -242,8 +242,8 int send_tm_lfr_tc_exe_not_implemented( | |||||
242 | TM.reserved = DEFAULT_RESERVED; |
|
242 | TM.reserved = DEFAULT_RESERVED; | |
243 | TM.userApplication = CCSDS_USER_APP; |
|
243 | TM.userApplication = CCSDS_USER_APP; | |
244 | // PACKET HEADER |
|
244 | // PACKET HEADER | |
245 |
TM.packetID[0] = (unsigned char) ( |
|
245 | TM.packetID[0] = (unsigned char) (APID_TM_TC_EXE >> 8); | |
246 |
TM.packetID[1] = (unsigned char) ( |
|
246 | TM.packetID[1] = (unsigned char) (APID_TM_TC_EXE ); | |
247 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
247 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
248 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8); |
|
248 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8); | |
249 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED ); |
|
249 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED ); | |
@@ -308,8 +308,8 int send_tm_lfr_tc_exe_error( ccsdsTelec | |||||
308 | TM.reserved = DEFAULT_RESERVED; |
|
308 | TM.reserved = DEFAULT_RESERVED; | |
309 | TM.userApplication = CCSDS_USER_APP; |
|
309 | TM.userApplication = CCSDS_USER_APP; | |
310 | // PACKET HEADER |
|
310 | // PACKET HEADER | |
311 |
TM.packetID[0] = (unsigned char) ( |
|
311 | TM.packetID[0] = (unsigned char) (APID_TM_TC_EXE >> 8); | |
312 |
TM.packetID[1] = (unsigned char) ( |
|
312 | TM.packetID[1] = (unsigned char) (APID_TM_TC_EXE ); | |
313 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
313 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
314 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8); |
|
314 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8); | |
315 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR ); |
|
315 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR ); | |
@@ -383,8 +383,8 int send_tm_lfr_tc_exe_corrupted(ccsdsTe | |||||
383 | TM.reserved = DEFAULT_RESERVED; |
|
383 | TM.reserved = DEFAULT_RESERVED; | |
384 | TM.userApplication = CCSDS_USER_APP; |
|
384 | TM.userApplication = CCSDS_USER_APP; | |
385 | // PACKET HEADER |
|
385 | // PACKET HEADER | |
386 |
TM.packetID[0] = (unsigned char) ( |
|
386 | TM.packetID[0] = (unsigned char) (APID_TM_TC_EXE >> 8); | |
387 |
TM.packetID[1] = (unsigned char) ( |
|
387 | TM.packetID[1] = (unsigned char) (APID_TM_TC_EXE ); | |
388 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
388 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
389 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8); |
|
389 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8); | |
390 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED ); |
|
390 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED ); |
@@ -581,8 +581,8 int init_header_snapshot_wf_table( unsig | |||||
581 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
581 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
582 | headerSWF[ i ].reserved = DEFAULT_RESERVED; |
|
582 | headerSWF[ i ].reserved = DEFAULT_RESERVED; | |
583 | headerSWF[ i ].userApplication = CCSDS_USER_APP; |
|
583 | headerSWF[ i ].userApplication = CCSDS_USER_APP; | |
584 |
headerSWF[ i ].packetID[0] = (unsigned char) ( |
|
584 | headerSWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
585 |
headerSWF[ i ].packetID[1] = (unsigned char) ( |
|
585 | headerSWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
586 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
586 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
587 | if (i == 6) |
|
587 | if (i == 6) | |
588 | { |
|
588 | { | |
@@ -631,13 +631,13 int init_header_continuous_wf_table( uns | |||||
631 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
631 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
632 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) |
|
632 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) | |
633 | { |
|
633 | { | |
634 |
headerCWF[ i ].packetID[0] = (unsigned char) ( |
|
634 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2 >> 8); | |
635 |
headerCWF[ i ].packetID[1] = (unsigned char) ( |
|
635 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2); | |
636 | } |
|
636 | } | |
637 | else |
|
637 | else | |
638 | { |
|
638 | { | |
639 |
headerCWF[ i ].packetID[0] = (unsigned char) ( |
|
639 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
640 |
headerCWF[ i ].packetID[1] = (unsigned char) ( |
|
640 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
641 | } |
|
641 | } | |
642 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
642 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
643 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8); |
|
643 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8); | |
@@ -674,8 +674,8 int init_header_continuous_cwf3_light_ta | |||||
674 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
674 | headerCWF[ i ].reserved = DEFAULT_RESERVED; | |
675 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
675 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
676 |
|
676 | |||
677 |
headerCWF[ i ].packetID[0] = (unsigned char) ( |
|
677 | headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); | |
678 |
headerCWF[ i ].packetID[1] = (unsigned char) ( |
|
678 | headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); | |
679 |
|
679 | |||
680 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
680 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
681 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8); |
|
681 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8); |
General Comments 0
You need to be logged in to leave comments.
Login now