##// END OF EJS Templates
Sync...
paul -
r117:7ccc2641c507 VHDLib206
parent child
Show More
@@ -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-07T06:54:09. -->
3 <!-- Written by QtCreator 3.0.1, 2014-04-11T12:08:35. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -209,8 +209,8 enum apid_destid{
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
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
211 #define PACKET_LENGTH_TM_LFR_SCIENCE_BURST_BP2_F1 (806 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 30 + 26 - 7
212 #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_SBM_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
213 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 (686 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 30 + 26 - 7
214
214
215 #define PACKET_LENGTH_DELTA 11 // 7 + 4
215 #define PACKET_LENGTH_DELTA 11 // 7 + 4
216
216
@@ -34,6 +34,7 rtems_task dumb_task( rtems_task_argumen
34 void init_housekeeping_parameters( void );
34 void init_housekeeping_parameters( void );
35 void increment_seq_counter( unsigned char *packet_sequence_control);
35 void increment_seq_counter( unsigned char *packet_sequence_control);
36 void getTime( unsigned char *time);
36 void getTime( unsigned char *time);
37 unsigned long long int getTimeAsUnsignedLongLongInt( );
37 void send_dumb_hk( void );
38 void send_dumb_hk( void );
38
39
39 #endif // FSW_MISC_H_INCLUDED
40 #endif // FSW_MISC_H_INCLUDED
@@ -18,6 +18,29 typedef struct ring_node
18 unsigned int status;
18 unsigned int status;
19 } ring_node;
19 } ring_node;
20
20
21 typedef struct {
22 unsigned int f0;
23 unsigned int norm_bp1_f0;
24 unsigned int norm_bp2_f0;
25 unsigned int norm_asm_f0;
26 unsigned int sbm_bp1_f0;
27 unsigned int sbm_bp2_f0;
28 } nb_sm_t;
29
30 typedef struct {
31 unsigned int norm_bp1_f0;
32 unsigned int norm_bp2_f0;
33 unsigned int norm_asm_f0;
34 unsigned int burst_sbm_bp1_f0;
35 unsigned int burst_sbm_bp2_f0;
36 unsigned int burst_bp1_f0;
37 unsigned int burst_bp2_f0;
38 unsigned int sbm1_bp1_f0;
39 unsigned int sbm1_bp2_f0;
40 unsigned int sbm2_bp1_f0;
41 unsigned int sbm2_bp2_f0;
42 } nb_sm_before_bp_t;
43
21 //************************
44 //************************
22 // flight software version
45 // flight software version
23 // this parameters is handled by the Qt project options
46 // this parameters is handled by the Qt project options
@@ -55,17 +78,17 typedef struct ring_node
55 #define THR_MODE_NORMAL 1
78 #define THR_MODE_NORMAL 1
56 #define THR_MODE_BURST 2
79 #define THR_MODE_BURST 2
57
80
58 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
81 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
59 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
82 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
60 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
83 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
61 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
84 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
62 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
85 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
63 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
86 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
64 #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6
87 #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6
65 #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7
88 #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7
66 #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8
89 #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8
67 #define RTEMS_EVENT_SBM1_BP1_F0 RTEMS_EVENT_9
90 #define RTEMS_EVENT_BURST_SBM_BP1_F0 RTEMS_EVENT_9
68 #define RTEMS_EVENT_SBM1_BP2_F0 RTEMS_EVENT_10
91 #define RTEMS_EVENT_BURST_SBM_BP2_F0 RTEMS_EVENT_10
69
92
70 //****************************
93 //****************************
71 // LFR DEFAULT MODE PARAMETERS
94 // LFR DEFAULT MODE PARAMETERS
@@ -126,7 +149,7 typedef struct ring_node
126
149
127 //*****
150 //*****
128 // TIME
151 // TIME
129 #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms
152 #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416
130 #define TIMER_SM_SIMULATOR 1
153 #define TIMER_SM_SIMULATOR 1
131 #define HK_PERIOD 100 // 100 * 10ms => 1s
154 #define HK_PERIOD 100 // 100 * 10ms => 1s
132 #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000
155 #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000
@@ -12,10 +12,16
12 #define DATAFIELD_POS_SY_LFR_N_CWF_LONG_F3 8
12 #define DATAFIELD_POS_SY_LFR_N_CWF_LONG_F3 8
13
13
14 // TC_LFR_LOAD_BURST_PAR
14 // TC_LFR_LOAD_BURST_PAR
15 #define DATAFIELD_POS_SY_LFR_B_BP_P0 0
16 #define DATAFIELD_POS_SY_LFR_B_BP_P1 1
15
17
16 // TC_LFR_LOAD_SBM1_PAR
18 // TC_LFR_LOAD_SBM1_PAR
19 #define DATAFIELD_POS_SY_LFR_S1_BP_P0 0
20 #define DATAFIELD_POS_SY_LFR_S1_BP_P1 1
17
21
18 // TC_LFR_LOAD_SBM2_PAR
22 // TC_LFR_LOAD_SBM2_PAR
23 #define DATAFIELD_POS_SY_LFR_S2_BP_P0 0
24 #define DATAFIELD_POS_SY_LFR_S2_BP_P1 1
19
25
20 // TC_LFR_UPDATE_INFO
26 // TC_LFR_UPDATE_INFO
21 #define BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 34
27 #define BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 34
@@ -9,11 +9,10
9 #define TOTAL_SIZE_NORM_BP1_F2 108 // 12 * 9 = 108
9 #define TOTAL_SIZE_NORM_BP1_F2 108 // 12 * 9 = 108
10 #define TOTAL_SIZE_SBM1_BP1_F0 198 // 22 * 9 = 198
10 #define TOTAL_SIZE_SBM1_BP1_F0 198 // 22 * 9 = 198
11 //
11 //
12 #define NB_RING_NODES_ASM_F0 12 // AT LEAST 3
12 #define NB_RING_NODES_SM_F0 12 // AT LEAST 3
13 #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3
13 #define NB_RING_NODES_SM_F1 3 // AT LEAST 3
14 #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3
14 #define NB_RING_NODES_SM_F2 3 // AT LEAST 3
15 #define NB_RING_NODES_SBM1_BP1 10 // AT LEAST 3
15 #define NB_RING_NODES_ASM_BURST_SBM_F0 10 // AT LEAST 3
16 #define NB_RING_NODES_SBM1_BP2 5 // AT LEAST 3
17 //
16 //
18 #define NB_BINS_PER_ASM_F0 88
17 #define NB_BINS_PER_ASM_F0 88
19 #define NB_BINS_PER_PKT_ASM_F0 44
18 #define NB_BINS_PER_PKT_ASM_F0 44
@@ -36,22 +35,32
36 #define NB_BINS_COMPRESSED_SM_F0 11
35 #define NB_BINS_COMPRESSED_SM_F0 11
37 #define NB_BINS_COMPRESSED_SM_F1 13
36 #define NB_BINS_COMPRESSED_SM_F1 13
38 #define NB_BINS_COMPRESSED_SM_F2 12
37 #define NB_BINS_COMPRESSED_SM_F2 12
39 #define NB_BINS_COMPRESSED_SM_SBM1_F0 22
38 #define NB_BINS_COMPRESSED_SM_SBM_F0 22
39
40 //
40 //
41 #define NB_BINS_TO_AVERAGE_ASM_F0 8
41 #define NB_BINS_TO_AVERAGE_ASM_F0 8
42 #define NB_BINS_TO_AVERAGE_ASM_F1 8
42 #define NB_BINS_TO_AVERAGE_ASM_F1 8
43 #define NB_BINS_TO_AVERAGE_ASM_F2 8
43 #define NB_BINS_TO_AVERAGE_ASM_F2 8
44 #define NB_BINS_TO_AVERAGE_ASM_SBM1_F0 4
44 #define NB_BINS_TO_AVERAGE_ASM_SBM_F0 4
45 //
45 //
46 #define TOTAL_SIZE_COMPRESSED_ASM_F0 275 // 11 * 25 WORDS
46 #define TOTAL_SIZE_COMPRESSED_ASM_F0 275 // 11 * 25 WORDS
47 #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 WORDS
47 #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 WORDS
48 #define TOTAL_SIZE_COMPRESSED_ASM_F2 300 // 12 * 25 WORDS
48 #define TOTAL_SIZE_COMPRESSED_ASM_F2 300 // 12 * 25 WORDS
49 #define TOTAL_SIZE_COMPRESSED_ASM_SBM1 550 // 22 * 25 WORDS
49 #define TOTAL_SIZE_COMPRESSED_ASM_SBM1 550 // 22 * 25 WORDS
50 // NORM
50 #define NB_SM_BEFORE_NORM_BP1_F0 384 // 96 * 4
51 #define NB_SM_BEFORE_NORM_BP1_F0 384 // 96 * 4
51 #define NB_SM_BEFORE_NORM_BP2_F0 1920 // 96 * 20
52 #define NB_SM_BEFORE_NORM_BP2_F0 1920 // 96 * 20
52 #define NB_SM_BEFORE_NORM_ASM_F0 384 // 384 matrices at f0 = 4.00 second
53 #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 // BURST
54 #define NB_SM_BEFORE_SBM1_BP2_F0 96 // 96 matrices at f0 = 1.00 second
55 #define NB_SM_BEFORE_BURST_BP1_F0 96 // 96 matrices at f0 = 1.00 second
56 #define NB_SM_BEFORE_BURST_BP2_F0 480 // 480 matrices at f0 = 5.00 second
57 // SBM1
58 #define NB_SM_BEFORE_SBM1_BP1_F0 24 // 24 matrices at f0 = 0.25 second
59 #define NB_SM_BEFORE_SBM1_BP2_F0 96 // 96 matrices at f0 = 1.00 second
60 // SBM2
61 #define NB_SM_BEFORE_SBM2_BP1_F0 96 // 96 matrices at f0 = 1.00 second
62 #define NB_SM_BEFORE_SBM2_BP2_F0 480 // 480 matrices at f0 = 5.00 second
63 // GENERAL
55 #define NB_SM_BEFORE_AVF0 8
64 #define NB_SM_BEFORE_AVF0 8
56
65
57 #endif // FSW_PARAMS_PROCESSING_H
66 #endif // FSW_PARAMS_PROCESSING_H
@@ -14,34 +14,35
14 typedef struct ring_node_sm
14 typedef struct ring_node_sm
15 {
15 {
16 struct ring_node_sm *previous;
16 struct ring_node_sm *previous;
17 struct ring_node_sm *next;
17 int buffer_address;
18 int buffer_address;
18 struct ring_node_sm *next;
19 unsigned int status;
19 unsigned int status;
20 unsigned int coarseTime;
20 unsigned int coarseTime;
21 unsigned int fineTime;
21 unsigned int fineTime;
22 } ring_node_sm;
22 } ring_node_sm;
23
23
24 typedef struct ring_node_bp
24 typedef struct ring_node_asm
25 {
25 {
26 struct ring_node_bp *previous;
26 struct ring_node_asm *previous;
27 struct ring_node_bp *next;
27 struct ring_node_asm *next;
28 float asm_burst_sbm_f0[ TIME_OFFSET + TOTAL_SIZE_SM ];
28 unsigned int status;
29 unsigned int status;
29 unsigned int coarseTime;
30 } ring_node_asm;
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
31
35 typedef struct ring_node_bp_with_spare
32 typedef struct bp_packet
36 {
33 {
37 struct ring_node_bp_with_spare *previous;
34 Header_TM_LFR_SCIENCE_BP_t header;
38 struct ring_node_bp_with_spare *next;
35 unsigned char data[ 30 * 22 ]; // MAX size is 22 * 30 [TM_LFR_SCIENCE_BURST_BP2_F1]
39 unsigned int status;
36 } bp_packet;
40 unsigned int coarseTime;
37
41 unsigned int fineTime;
38 typedef struct bp_packet_with_spare
39 {
42 Header_TM_LFR_SCIENCE_BP_with_spare_t header;
40 Header_TM_LFR_SCIENCE_BP_with_spare_t header;
43 unsigned char data[ 9 * 22 ];
41 unsigned char data[ 9 * 13 ]; // only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1
44 } ring_node_bp_with_spare;
42 } bp_packet_with_spare;
43
44 extern nb_sm_t nb_sm;
45 extern nb_sm_before_bp_t nb_sm_before_bp;
45
46
46 extern volatile int sm_f0[ ];
47 extern volatile int sm_f0[ ];
47 extern volatile int sm_f1[ ];
48 extern volatile int sm_f1[ ];
@@ -57,23 +58,23 extern spectral_matrix_regs_t *spectral_
57 extern rtems_name misc_name[5];
58 extern rtems_name misc_name[5];
58 extern rtems_id Task_id[20]; /* array of task ids */
59 extern rtems_id Task_id[20]; /* array of task ids */
59
60
60 void init_sm_rings( void );
61 void reset_current_sm_ring_nodes( void );
62 void reset_current_bp_ring_nodes( void );
63
64 // ISR
61 // ISR
65 void reset_nb_sm_f0( void );
62 void reset_nb_sm_f0( unsigned char lfrMode );
66 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
63 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
67 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
64 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
68
65
69 // RTEMS TASKS
66 // RTEMS TASKS
70 rtems_task avf0_task(rtems_task_argument argument);
67 rtems_task smiq_task( rtems_task_argument argument ); // added to test the spectral matrix simulator
71 rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator
68 rtems_task avf0_task( rtems_task_argument lfrRequestedMode );
72 rtems_task matr_task(rtems_task_argument argument);
69 rtems_task matr_task( rtems_task_argument lfrRequestedMode );
73
70
74 //*****************************
71 //******************
75 // Spectral matrices processing
72 // Spectral Matrices
76
73 void SM_init_rings( void );
74 void ASM_init_ring( void );
75 void SM_reset_current_ring_nodes( void );
76 void ASM_reset_current_ring_node( void );
77 void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header);
77 void SM_average(float *averaged_spec_mat_f0, float *averaged_spec_mat_f1,
78 void SM_average(float *averaged_spec_mat_f0, float *averaged_spec_mat_f1,
78 ring_node_sm *ring_node_tab[],
79 ring_node_sm *ring_node_tab[],
79 unsigned int firstTimeF0, unsigned int firstTimeF1 );
80 unsigned int firstTimeF0, unsigned int firstTimeF1 );
@@ -86,23 +87,23 void ASM_convert(volatile float *input_m
86 void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
87 void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
87 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id);
88 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id);
88
89
90 //*****************
91 // Basic Parameters
92
93 void BP_reset_current_ring_nodes( void );
94 void BP_init_header(Header_TM_LFR_SCIENCE_BP_t *header,
95 unsigned int apid, unsigned char sid,
96 unsigned int packetLength , unsigned char blkNr);
97 void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header,
98 unsigned int apid, unsigned char sid,
99 unsigned int packetLength, unsigned char blkNr );
89 void BP_send(char *data,
100 void BP_send(char *data,
90 rtems_id queue_id ,
101 rtems_id queue_id ,
91 unsigned int nbBytesToSend );
102 unsigned int nbBytesToSend );
92
103
93 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header);
104 //******************
94 void init_bp_ring_sbm1_bp1( void );
105 // general functions
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 );
103
104 void reset_spectral_matrix_regs( void );
106 void reset_spectral_matrix_regs( void );
105
107 void set_time(unsigned char *time, unsigned char *timeInBuffer );
106 void set_time( unsigned char *time, unsigned int coarseTime, unsigned int fineTime );
107
108
108 #endif // FSW_PROCESSING_H_INCLUDED
109 #endif // FSW_PROCESSING_H_INCLUDED
@@ -37,7 +37,7 int check_mode_transition( unsigned char
37 int check_transition_date( unsigned int transitionCoarseTime );
37 int check_transition_date( unsigned int transitionCoarseTime );
38 int stop_current_mode( void );
38 int stop_current_mode( void );
39 int enter_mode( unsigned char mode , unsigned int transitionCoarseTime );
39 int enter_mode( unsigned char mode , unsigned int transitionCoarseTime );
40 int restart_science_tasks();
40 int restart_science_tasks(unsigned char lfrRequestedMode );
41 int suspend_science_tasks();
41 int suspend_science_tasks();
42 void launch_waveform_picker(unsigned char mode , unsigned int transitionCoarseTime);
42 void launch_waveform_picker(unsigned char mode , unsigned int transitionCoarseTime);
43 void launch_spectral_matrix( unsigned char mode );
43 void launch_spectral_matrix( unsigned char mode );
@@ -9,6 +9,9
9 #include "tm_lfr_tc_exe.h"
9 #include "tm_lfr_tc_exe.h"
10 #include "fsw_misc.h"
10 #include "fsw_misc.h"
11
11
12 extern nb_sm_t nb_sm;
13 extern nb_sm_before_bp_t nb_sm_before_bp;
14
12 int action_load_common_par( ccsdsTelecommandPacket_t *TC );
15 int action_load_common_par( ccsdsTelecommandPacket_t *TC );
13 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
16 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
14 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
17 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
@@ -16,6 +19,7 int action_load_sbm1_par(ccsdsTelecomman
16 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
19 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
17 int action_dump_par(rtems_id queue_id );
20 int action_dump_par(rtems_id queue_id );
18
21
22 // NORMAL
19 int set_sy_lfr_n_swf_l(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
23 int set_sy_lfr_n_swf_l(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
20 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
24 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
21 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
25 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
@@ -23,6 +27,18 int set_sy_lfr_n_bp_p0( ccsdsTelecommand
23 int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
27 int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
24 int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
28 int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
25
29
30 // BURST
31 int set_sy_lfr_b_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
32 int set_sy_lfr_b_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
33
34 // SBM1
35 int set_sy_lfr_s1_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
36 int set_sy_lfr_s1_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
37
38 // SBM2
39 int set_sy_lfr_s2_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
40 int set_sy_lfr_s2_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
41
26 // TC_LFR_UPDATE_INFO
42 // TC_LFR_UPDATE_INFO
27 unsigned int check_update_info_hk_lfr_mode( unsigned char mode );
43 unsigned int check_update_info_hk_lfr_mode( unsigned char mode );
28 unsigned int check_update_info_hk_tds_mode( unsigned char mode );
44 unsigned int check_update_info_hk_tds_mode( unsigned char mode );
@@ -45,11 +45,16 volatile int wf_cont_f3_a [ (NB_SAMPL
45 volatile int wf_cont_f3_b [ (NB_SAMPLES_PER_SNAPSHOT) * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
45 volatile int wf_cont_f3_b [ (NB_SAMPLES_PER_SNAPSHOT) * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
46 char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK + TIME_OFFSET_IN_BYTES ] __attribute__((aligned(0x100)));
46 char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK + TIME_OFFSET_IN_BYTES ] __attribute__((aligned(0x100)));
47
47
48 //***********************************
48 // SPECTRAL MATRICES GLOBAL VARIABLES
49 // SPECTRAL MATRICES GLOBAL VARIABLES
50
51 nb_sm_t nb_sm;
52 nb_sm_before_bp_t nb_sm_before_bp;
53
49 // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00
54 // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00
50 volatile int sm_f0[ NB_RING_NODES_ASM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
55 volatile int sm_f0[ NB_RING_NODES_SM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
51 volatile int sm_f1[ NB_RING_NODES_ASM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
56 volatile int sm_f1[ NB_RING_NODES_SM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
52 volatile int sm_f2[ NB_RING_NODES_ASM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
57 volatile int sm_f2[ NB_RING_NODES_SM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
53
58
54 // APB CONFIGURATION REGISTERS
59 // APB CONFIGURATION REGISTERS
55 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
60 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
@@ -97,9 +97,8 rtems_task Init( rtems_task_argument ign
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 SM_init_rings(); // initialize spectral matrices rings
101 init_bp_ring_sbm1_bp1(); // initialize basic parameter ring for SBM1 BP1 set
101 ASM_init_ring(); // initialize the average spectral matrix ring (just for burst, sbm1 and sbm2 asm @ f0 storage)
102 init_bp_ring_sbm1_bp2(); // initialize basic parameter ring for SBM1 BP2 set
103
102
104 reset_wfp_burst_enable();
103 reset_wfp_burst_enable();
105 reset_wfp_status();
104 reset_wfp_status();
@@ -363,6 +363,19 void getTime( unsigned char *time)
363 time[5] = (unsigned char) (time_management_regs->fine_time);
363 time[5] = (unsigned char) (time_management_regs->fine_time);
364 }
364 }
365
365
366 unsigned long long int getTimeAsUnsignedLongLongInt( )
367 {
368 /** This function write the current local time in the time buffer passed in argument.
369 *
370 */
371 unsigned long long int time;
372
373 time = ( (unsigned long long int) (time_management_regs->coarse_time & 0x7fffffff) << 16 )
374 + time_management_regs->fine_time;
375
376 return time;
377 }
378
366 void send_dumb_hk( void )
379 void send_dumb_hk( void )
367 {
380 {
368 Packet_TM_LFR_HK_t dummy_hk_packet;
381 Packet_TM_LFR_HK_t dummy_hk_packet;
This diff has been collapsed as it changes many lines, (963 lines changed) Show them Hide them
@@ -13,56 +13,426
13
13
14 //************************
14 //************************
15 // spectral matrices rings
15 // spectral matrices rings
16 ring_node_sm sm_ring_f0[ NB_RING_NODES_ASM_F0 ];
16 ring_node_sm sm_ring_f0[ NB_RING_NODES_SM_F0 ];
17 ring_node_sm sm_ring_f1[ NB_RING_NODES_ASM_F1 ];
17 ring_node_sm sm_ring_f1[ NB_RING_NODES_SM_F1 ];
18 ring_node_sm sm_ring_f2[ NB_RING_NODES_ASM_F2 ];
18 ring_node_sm sm_ring_f2[ NB_RING_NODES_SM_F2 ];
19 ring_node_sm *current_ring_node_sm_f0;
19 ring_node_sm *current_ring_node_sm_f0;
20 ring_node_sm *ring_node_for_averaging_sm_f0;
20 ring_node_sm *ring_node_for_averaging_sm_f0;
21 ring_node_sm *current_ring_node_sm_f1;
21 ring_node_sm *current_ring_node_sm_f1;
22 ring_node_sm *current_ring_node_sm_f2;
22 ring_node_sm *current_ring_node_sm_f2;
23
23
24 //**********************
24 ring_node_asm asm_ring_burst_sbm_f0[ NB_RING_NODES_ASM_BURST_SBM_F0 ];
25 // basic parameter rings
25 ring_node_asm *current_ring_node_asm_burst_sbm_f0;
26 ring_node_bp *current_node_sbm1_bp1_f0;
26 ring_node_asm *ring_node_for_processing_asm_burst_sbm_f0;
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 ];
30
27
31 //*****
28 //*****
32 // NORM
29 // NORM
33 // F0
30 // F0
34 float asm_norm_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ];
31 float asm_norm_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ];
35 float asm_f0_reorganized [ TIME_OFFSET + TOTAL_SIZE_SM ];
32 float asm_f0_reorganized [ TIME_OFFSET + TOTAL_SIZE_SM ];
36 char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
33 char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
37 float compressed_sm_norm_f0[ TIME_OFFSET + TOTAL_SIZE_COMPRESSED_ASM_F0 ];
34 float compressed_sm_norm_f0[ TIME_OFFSET + TOTAL_SIZE_COMPRESSED_ASM_F0 ];
38
35
39 //*****
36 //*****
40 // SBM1
37 // SBM1
41 float asm_sbm1_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ];
38 float asm_sbm_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ];
42 float compressed_sm_sbm1[ TIME_OFFSET + TOTAL_SIZE_COMPRESSED_ASM_SBM1 ];
39 float compressed_sm_sbm[ TIME_OFFSET + TOTAL_SIZE_COMPRESSED_ASM_SBM1 ];
43
40
44 unsigned char LFR_BP1_F0[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_NORM_BP1_F0 * 2 ];
41 unsigned char LFR_BP1_F0[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_NORM_BP1_F0 * 2 ];
45 unsigned char LFR_BP1_F1[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_NORM_BP1_F1 ];
42 unsigned char LFR_BP1_F1[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_NORM_BP1_F1 ];
46 unsigned char LFR_BP1_F2[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_NORM_BP1_F2 ];
43 unsigned char LFR_BP1_F2[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_NORM_BP1_F2 ];
47
44
48 unsigned int nb_sm_f0;
45 //***********************************************************
46 // Interrupt Service Routine for spectral matrices processing
47 void reset_nb_sm_f0( unsigned char lfrMode )
48 {
49 nb_sm.f0 = 0;
50 nb_sm.norm_bp1_f0 = 0;
51 nb_sm.norm_bp2_f0 = 0;
52 nb_sm.norm_asm_f0 = 0;
53 nb_sm.sbm_bp1_f0 = 0;
54 nb_sm.sbm_bp2_f0 = 0;
55
56 nb_sm_before_bp.norm_bp1_f0 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96;
57 nb_sm_before_bp.norm_bp2_f0 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96;
58 nb_sm_before_bp.norm_asm_f0 = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 96;
59 nb_sm_before_bp.sbm1_bp1_f0 = parameter_dump_packet.sy_lfr_s1_bp_p0 * 24;
60 nb_sm_before_bp.sbm1_bp2_f0 = parameter_dump_packet.sy_lfr_s1_bp_p1 * 96;
61 nb_sm_before_bp.sbm2_bp1_f0 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 96;
62 nb_sm_before_bp.sbm2_bp2_f0 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 96;
63 nb_sm_before_bp.burst_bp1_f0 = parameter_dump_packet.sy_lfr_b_bp_p0 * 96;
64 nb_sm_before_bp.burst_bp2_f0 = parameter_dump_packet.sy_lfr_b_bp_p1 * 96;
65
66 if (lfrMode == LFR_MODE_SBM1)
67 {
68 nb_sm_before_bp.burst_sbm_bp1_f0 = nb_sm_before_bp.sbm1_bp1_f0;
69 nb_sm_before_bp.burst_sbm_bp2_f0 = nb_sm_before_bp.sbm1_bp2_f0;
70 }
71 else if (lfrMode == LFR_MODE_SBM2)
72 {
73 nb_sm_before_bp.burst_sbm_bp1_f0 = nb_sm_before_bp.sbm2_bp1_f0;
74 nb_sm_before_bp.burst_sbm_bp2_f0 = nb_sm_before_bp.sbm2_bp2_f0;
75 }
76 else if (lfrMode == LFR_MODE_BURST)
77 {
78 nb_sm_before_bp.burst_sbm_bp1_f0 = nb_sm_before_bp.burst_bp1_f0;
79 nb_sm_before_bp.burst_sbm_bp2_f0 = nb_sm_before_bp.burst_bp2_f0;
80 }
81 else
82 {
83 nb_sm_before_bp.burst_sbm_bp1_f0 = nb_sm_before_bp.burst_bp1_f0;
84 nb_sm_before_bp.burst_sbm_bp2_f0 = nb_sm_before_bp.burst_bp2_f0;
85 }
86 }
87
88 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
89 {
90 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
91
92 // if ( (spectral_matrix_regs->status & 0x1) == 0x01)
93 // {
94 // current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
95 // spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
96 // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110
97 // nb_sm_f0 = nb_sm_f0 + 1;
98 // }
99 // else if ( (spectral_matrix_regs->status & 0x2) == 0x02)
100 // {
101 // current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
102 // spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address;
103 // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101
104 // nb_sm_f0 = nb_sm_f0 + 1;
105 // }
106
107 // if ( (spectral_matrix_regs->status & 0x30) != 0x00)
108 // {
109 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
110 // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111
111 // }
112
113 // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011
114
115 // if (nb_sm_f0 == (NB_SM_BEFORE_AVF0-1) )
116 // {
117 // ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
118 // if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
119 // {
120 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
121 // }
122 // nb_sm_f0 = 0;
123 // }
124 // else
125 // {
126 // nb_sm.nb_sm_f0 = nb_sm.nb_sm_f0 + 1;
127 // }
128 }
129
130 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
131 {
132 if (nb_sm.f0 == (NB_SM_BEFORE_AVF0-1) )
133 {
134 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
135 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
136 {
137 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
138 }
139 nb_sm.f0 = 0;
140 }
141 else
142 {
143 nb_sm.f0 = nb_sm.f0 + 1;
144 }
145 }
146
147 //************
148 // RTEMS TASKS
149
150 rtems_task smiq_task( rtems_task_argument argument ) // process the Spectral Matrices IRQ
151 {
152 rtems_event_set event_out;
153
154 BOOT_PRINTF("in SMIQ *** \n")
155
156 while(1){
157 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
158 }
159 }
160
161 rtems_task avf0_task( rtems_task_argument lfrRequestedMode )
162 {
163 int i;
164
165 rtems_event_set event_out;
166 rtems_event_set event_for_matr;
167 rtems_status_code status;
168 ring_node_sm *ring_node_tab[8];
169 unsigned long long int localTime;
170
171 reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions
172
173 BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", lfrRequestedMode)
174
175 while(1){
176 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
177 ring_node_tab[NB_SM_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0;
178 for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ )
179 {
180 ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous;
181 ring_node_tab[NB_SM_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0;
182 }
183
184 localTime = getTimeAsUnsignedLongLongInt( );
185
186 // compute the average and store it in the averaged_sm_f1 buffer
187 SM_average( asm_norm_f0, current_ring_node_asm_burst_sbm_f0->asm_burst_sbm_f0,
188 ring_node_tab,
189 nb_sm.norm_bp1_f0, nb_sm.sbm_bp1_f0 );
190
191 localTime = getTimeAsUnsignedLongLongInt( ) - localTime;
192
193 // update nb_average
194 nb_sm.norm_bp1_f0 = nb_sm.norm_bp1_f0 + NB_SM_BEFORE_AVF0;
195 nb_sm.norm_bp2_f0 = nb_sm.norm_bp2_f0 + NB_SM_BEFORE_AVF0;
196 nb_sm.norm_asm_f0 = nb_sm.norm_asm_f0 + NB_SM_BEFORE_AVF0;
197 nb_sm.sbm_bp1_f0 = nb_sm.sbm_bp1_f0 + NB_SM_BEFORE_AVF0;
198 nb_sm.sbm_bp2_f0 = nb_sm.sbm_bp2_f0 + NB_SM_BEFORE_AVF0;
199
200 //***********************************************************
201 // build a composite event that will be sent to the MATR task
202 event_for_matr = 0x00;
203
204 if (nb_sm.sbm_bp1_f0 == nb_sm_before_bp.burst_sbm_bp1_f0)
205 {
206 nb_sm.sbm_bp1_f0 = 0;
207 // the ring node is ready for BP calculations
208 ring_node_for_processing_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0;
209 // set another ring for the ASM storage
210 current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next;
211 if ( (lfrCurrentMode == LFR_MODE_BURST)
212 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
213 {
214 event_for_matr = event_for_matr | RTEMS_EVENT_BURST_SBM_BP1_F0;
215 }
216 }
217
218 if (nb_sm.sbm_bp2_f0 == nb_sm_before_bp.burst_sbm_bp2_f0)
219 {
220 nb_sm.sbm_bp2_f0 = 0;
221 if ( (lfrCurrentMode == LFR_MODE_BURST)
222 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
223 {
224 event_for_matr = event_for_matr | RTEMS_EVENT_BURST_SBM_BP2_F0;
225 }
226 }
49
227
50 void init_sm_rings( void )
228 if (nb_sm.norm_bp1_f0 == nb_sm_before_bp.norm_bp1_f0)
229 {
230 nb_sm.norm_bp1_f0 = 0;
231 if (lfrCurrentMode == LFR_MODE_NORMAL)
232 {
233 event_for_matr = event_for_matr | RTEMS_EVENT_NORM_BP1_F0;
234 }
235 }
236
237 if (nb_sm.norm_bp2_f0 == nb_sm_before_bp.norm_bp2_f0)
238 {
239 nb_sm.norm_bp2_f0 = 0;
240 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
241 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
242 {
243 event_for_matr = event_for_matr | RTEMS_EVENT_NORM_BP2_F0;
244 }
245 }
246
247 if (nb_sm.norm_asm_f0 == nb_sm_before_bp.norm_asm_f0)
248 {
249 nb_sm.norm_asm_f0 = 0;
250 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
251 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
252 {
253 // PRINTF1("%lld\n", localTime)
254 event_for_matr = event_for_matr | RTEMS_EVENT_NORM_ASM_F0;
255 }
256 }
257
258 //*********************************
259 // send the composite event to MATR
260 status = rtems_event_send( Task_id[TASKID_MATR], event_for_matr );
261 if (status != RTEMS_SUCCESSFUL) {
262 printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status);
263 }
264 }
265 }
266
267 rtems_task matr_task( rtems_task_argument lfrRequestedMode )
268 {
269 spw_ioctl_pkt_send spw_ioctl_send_ASM;
270 rtems_event_set event_out;
271 rtems_status_code status;
272 rtems_id queue_id;
273 Header_TM_LFR_SCIENCE_ASM_t headerASM;
274 bp_packet_with_spare current_node_norm_bp1_f0;
275 bp_packet current_node_norm_bp2_f0;
276 bp_packet current_node_sbm_bp1_f0;
277 bp_packet current_node_sbm_bp2_f0;
278 unsigned long long int localTime;
279
280 ASM_init_header( &headerASM );
281
282 //*************
283 // NORM headers
284 BP_init_header_with_spare( &current_node_norm_bp1_f0.header,
285 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0,
286 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 );
287 BP_init_header( &current_node_norm_bp2_f0.header,
288 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0,
289 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0);
290
291 //****************************
292 // BURST SBM1 and SBM2 headers
293 if ( (lfrRequestedMode == LFR_MODE_BURST)
294 || (lfrRequestedMode == LFR_MODE_NORMAL) || (lfrRequestedMode == LFR_MODE_STANDBY) )
295 {
296 BP_init_header( &current_node_sbm_bp1_f0.header,
297 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0,
298 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
299 BP_init_header( &current_node_sbm_bp2_f0.header,
300 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0,
301 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
302 }
303 else if ( lfrRequestedMode == LFR_MODE_SBM1 )
304 {
305 BP_init_header( &current_node_sbm_bp1_f0.header,
306 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0,
307 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
308 BP_init_header( &current_node_sbm_bp2_f0.header,
309 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0,
310 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
311 }
312 else if ( lfrRequestedMode == LFR_MODE_SBM2 )
313 {
314 BP_init_header( &current_node_sbm_bp1_f0.header,
315 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0,
316 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
317 BP_init_header( &current_node_sbm_bp2_f0.header,
318 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0,
319 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
320 }
321 else
322 {
323 PRINTF1("ERR *** in MATR *** unexpected lfrRequestedMode passed as argument = %d\n", (unsigned int) lfrRequestedMode)
324 }
325
326 status = get_message_queue_id_send( &queue_id );
327 if (status != RTEMS_SUCCESSFUL)
328 {
329 PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status)
330 }
331
332 BOOT_PRINTF1("in MATR *** lfrRequestedMode = %d\n", lfrRequestedMode)
333
334 while(1){
335 rtems_event_receive( RTEMS_EVENT_NORM_BP1_F0 | RTEMS_EVENT_NORM_BP2_F0 | RTEMS_EVENT_NORM_ASM_F0
336 | RTEMS_EVENT_BURST_SBM_BP1_F0 | RTEMS_EVENT_BURST_SBM_BP2_F0,
337 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
338 localTime = getTimeAsUnsignedLongLongInt( );
339 //****************
340 //****************
341 // BURST SBM1 SBM2
342 //****************
343 //****************
344 if ( event_out & RTEMS_EVENT_BURST_SBM_BP1_F0 )
345 {
346 // 1) compress the matrix for Basic Parameters calculation
347 ASM_compress_reorganize_and_divide( current_ring_node_asm_burst_sbm_f0->asm_burst_sbm_f0, compressed_sm_sbm,
348 nb_sm_before_bp.burst_sbm_bp1_f0,
349 NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0,
350 ASM_F0_INDICE_START);
351 // 2) compute the BP1 set
352
353 // 3) send the BP1 set