##// END OF EJS Templates
3.2.0.5...
paul -
r354:6155c628c251 R3++ draft
parent child
Show More
@@ -1,2 +1,2
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
2 5dfc0745a617f0b14b9b4c6d6c12d01f1fb9a801 header/lfr_common_headers
2 26659466eb11170e587645c796142ac8a7fd0add header/lfr_common_headers
@@ -1,371 +1,373
1 #ifndef FSW_PROCESSING_H_INCLUDED
1 #ifndef FSW_PROCESSING_H_INCLUDED
2 #define FSW_PROCESSING_H_INCLUDED
2 #define FSW_PROCESSING_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <grspw.h>
5 #include <grspw.h>
6 #include <math.h>
6 #include <math.h>
7 #include <stdlib.h> // abs() is in the stdlib
7 #include <stdlib.h> // abs() is in the stdlib
8 #include <stdio.h>
8 #include <stdio.h>
9 #include <math.h>
9 #include <math.h>
10 #include <grlib_regs.h>
10 #include <grlib_regs.h>
11
11
12 #include "fsw_params.h"
12 #include "fsw_params.h"
13
13
14 #define SBM_COEFF_PER_NORM_COEFF 2
14 #define SBM_COEFF_PER_NORM_COEFF 2
15 #define MAX_SRC_DATA 780 // MAX size is 26 bins * 30 Bytes [TM_LFR_SCIENCE_BURST_BP2_F1]
15 #define MAX_SRC_DATA 780 // MAX size is 26 bins * 30 Bytes [TM_LFR_SCIENCE_BURST_BP2_F1]
16 #define MAX_SRC_DATA_WITH_SPARE 143 // 13 bins * 11 Bytes
16 #define MAX_SRC_DATA_WITH_SPARE 143 // 13 bins * 11 Bytes
17
17
18 #define NODE_0 0
18 #define NODE_0 0
19 #define NODE_1 1
19 #define NODE_1 1
20 #define NODE_2 2
20 #define NODE_2 2
21 #define NODE_3 3
21 #define NODE_3 3
22 #define NODE_4 4
22 #define NODE_4 4
23 #define NODE_5 5
23 #define NODE_5 5
24 #define NODE_6 6
24 #define NODE_6 6
25 #define NODE_7 7
25 #define NODE_7 7
26
26
27 typedef struct ring_node_asm
27 typedef struct ring_node_asm
28 {
28 {
29 struct ring_node_asm *next;
29 struct ring_node_asm *next;
30 float matrix[ TOTAL_SIZE_SM ];
30 float matrix[ TOTAL_SIZE_SM ];
31 unsigned int status;
31 unsigned int status;
32 } ring_node_asm;
32 } ring_node_asm;
33
33
34 typedef struct
34 typedef struct
35 {
35 {
36 unsigned char targetLogicalAddress;
36 unsigned char targetLogicalAddress;
37 unsigned char protocolIdentifier;
37 unsigned char protocolIdentifier;
38 unsigned char reserved;
38 unsigned char reserved;
39 unsigned char userApplication;
39 unsigned char userApplication;
40 unsigned char packetID[BYTES_PER_PACKETID];
40 unsigned char packetID[BYTES_PER_PACKETID];
41 unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL];
41 unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL];
42 unsigned char packetLength[BYTES_PER_PKT_LEN];
42 unsigned char packetLength[BYTES_PER_PKT_LEN];
43 // DATA FIELD HEADER
43 // DATA FIELD HEADER
44 unsigned char spare1_pusVersion_spare2;
44 unsigned char spare1_pusVersion_spare2;
45 unsigned char serviceType;
45 unsigned char serviceType;
46 unsigned char serviceSubType;
46 unsigned char serviceSubType;
47 unsigned char destinationID;
47 unsigned char destinationID;
48 unsigned char time[BYTES_PER_TIME];
48 unsigned char time[BYTES_PER_TIME];
49 // AUXILIARY HEADER
49 // AUXILIARY HEADER
50 unsigned char sid;
50 unsigned char sid;
51 unsigned char pa_bia_status_info;
51 unsigned char pa_bia_status_info;
52 unsigned char sy_lfr_common_parameters_spare;
52 unsigned char sy_lfr_common_parameters_spare;
53 unsigned char sy_lfr_common_parameters;
53 unsigned char sy_lfr_common_parameters;
54 unsigned char acquisitionTime[BYTES_PER_TIME];
54 unsigned char acquisitionTime[BYTES_PER_TIME];
55 unsigned char pa_lfr_bp_blk_nr[BYTES_PER_BLKNR];
55 unsigned char pa_lfr_bp_blk_nr[BYTES_PER_BLKNR];
56 // SOURCE DATA
56 // SOURCE DATA
57 unsigned char data[ MAX_SRC_DATA ]; // MAX size is 26 bins * 30 Bytes [TM_LFR_SCIENCE_BURST_BP2_F1]
57 unsigned char data[ MAX_SRC_DATA ]; // MAX size is 26 bins * 30 Bytes [TM_LFR_SCIENCE_BURST_BP2_F1]
58 } bp_packet;
58 } bp_packet;
59
59
60 typedef struct
60 typedef struct
61 {
61 {
62 unsigned char targetLogicalAddress;
62 unsigned char targetLogicalAddress;
63 unsigned char protocolIdentifier;
63 unsigned char protocolIdentifier;
64 unsigned char reserved;
64 unsigned char reserved;
65 unsigned char userApplication;
65 unsigned char userApplication;
66 unsigned char packetID[BYTES_PER_PACKETID];
66 unsigned char packetID[BYTES_PER_PACKETID];
67 unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL];
67 unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL];
68 unsigned char packetLength[BYTES_PER_PKT_LEN];
68 unsigned char packetLength[BYTES_PER_PKT_LEN];
69 // DATA FIELD HEADER
69 // DATA FIELD HEADER
70 unsigned char spare1_pusVersion_spare2;
70 unsigned char spare1_pusVersion_spare2;
71 unsigned char serviceType;
71 unsigned char serviceType;
72 unsigned char serviceSubType;
72 unsigned char serviceSubType;
73 unsigned char destinationID;
73 unsigned char destinationID;
74 unsigned char time[BYTES_PER_TIME];
74 unsigned char time[BYTES_PER_TIME];
75 // AUXILIARY HEADER
75 // AUXILIARY HEADER
76 unsigned char sid;
76 unsigned char sid;
77 unsigned char pa_bia_status_info;
77 unsigned char pa_bia_status_info;
78 unsigned char sy_lfr_common_parameters_spare;
78 unsigned char sy_lfr_common_parameters_spare;
79 unsigned char sy_lfr_common_parameters;
79 unsigned char sy_lfr_common_parameters;
80 unsigned char acquisitionTime[BYTES_PER_TIME];
80 unsigned char acquisitionTime[BYTES_PER_TIME];
81 unsigned char source_data_spare;
81 unsigned char source_data_spare;
82 unsigned char pa_lfr_bp_blk_nr[BYTES_PER_BLKNR];
82 unsigned char pa_lfr_bp_blk_nr[BYTES_PER_BLKNR];
83 // SOURCE DATA
83 // SOURCE DATA
84 unsigned char data[ MAX_SRC_DATA_WITH_SPARE ]; // 13 bins * 11 Bytes
84 unsigned char data[ MAX_SRC_DATA_WITH_SPARE ]; // 13 bins * 11 Bytes
85 } bp_packet_with_spare; // only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1
85 } bp_packet_with_spare; // only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1
86
86
87 typedef struct asm_msg
87 typedef struct asm_msg
88 {
88 {
89 ring_node_asm *norm;
89 ring_node_asm *norm;
90 ring_node_asm *burst_sbm;
90 ring_node_asm *burst_sbm;
91 rtems_event_set event;
91 rtems_event_set event;
92 unsigned int coarseTimeNORM;
92 unsigned int coarseTimeNORM;
93 unsigned int fineTimeNORM;
93 unsigned int fineTimeNORM;
94 unsigned int coarseTimeSBM;
94 unsigned int coarseTimeSBM;
95 unsigned int fineTimeSBM;
95 unsigned int fineTimeSBM;
96 unsigned int numberOfSMInASMNORM;
96 unsigned int numberOfSMInASMNORM;
97 unsigned int numberOfSMInASMSBM;
97 unsigned int numberOfSMInASMSBM;
98 } asm_msg;
98 } asm_msg;
99
99
100 extern unsigned char thisIsAnASMRestart;
100 extern unsigned char thisIsAnASMRestart;
101
101
102 extern volatile int sm_f0[ ];
102 extern volatile int sm_f0[ ];
103 extern volatile int sm_f1[ ];
103 extern volatile int sm_f1[ ];
104 extern volatile int sm_f2[ ];
104 extern volatile int sm_f2[ ];
105 extern unsigned int acquisitionDurations[];
105 extern unsigned int acquisitionDurations[];
106
106
107 // parameters
107 // parameters
108 extern struct param_local_str param_local;
108 extern struct param_local_str param_local;
109 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
109 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
110
110
111 // registers
111 // registers
112 extern time_management_regs_t *time_management_regs;
112 extern time_management_regs_t *time_management_regs;
113 extern volatile spectral_matrix_regs_t *spectral_matrix_regs;
113 extern volatile spectral_matrix_regs_t *spectral_matrix_regs;
114
114
115 extern rtems_name misc_name[];
115 extern rtems_name misc_name[];
116 extern rtems_id Task_id[]; /* array of task ids */
116 extern rtems_id Task_id[]; /* array of task ids */
117
117
118 ring_node * getRingNodeForAveraging( unsigned char frequencyChannel);
118 ring_node * getRingNodeForAveraging( unsigned char frequencyChannel);
119 // ISR
119 // ISR
120 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
120 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
121
121
122 //******************
122 //******************
123 // Spectral Matrices
123 // Spectral Matrices
124 void reset_nb_sm( void );
124 void reset_nb_sm( void );
125 // SM
125 // SM
126 void SM_init_rings( void );
126 void SM_init_rings( void );
127 void SM_reset_current_ring_nodes( void );
127 void SM_reset_current_ring_nodes( void );
128 // ASM
128 // ASM
129 void ASM_generic_init_ring(ring_node_asm *ring, unsigned char nbNodes );
129 void ASM_generic_init_ring(ring_node_asm *ring, unsigned char nbNodes );
130
130
131 //*****************
131 //*****************
132 // Basic Parameters
132 // Basic Parameters
133
133
134 void BP_reset_current_ring_nodes( void );
134 void BP_reset_current_ring_nodes( void );
135 void BP_init_header(bp_packet *packet,
135 void BP_init_header(bp_packet *packet,
136 unsigned int apid, unsigned char sid,
136 unsigned int apid, unsigned char sid,
137 unsigned int packetLength , unsigned char blkNr);
137 unsigned int packetLength , unsigned char blkNr);
138 void BP_init_header_with_spare(bp_packet_with_spare *packet,
138 void BP_init_header_with_spare(bp_packet_with_spare *packet,
139 unsigned int apid, unsigned char sid,
139 unsigned int apid, unsigned char sid,
140 unsigned int packetLength, unsigned char blkNr );
140 unsigned int packetLength, unsigned char blkNr );
141 void BP_send( char *data,
141 void BP_send( char *data,
142 rtems_id queue_id,
142 rtems_id queue_id,
143 unsigned int nbBytesToSend , unsigned int sid );
143 unsigned int nbBytesToSend , unsigned int sid );
144 void BP_send_s1_s2(char *data,
144 void BP_send_s1_s2(char *data,
145 rtems_id queue_id,
145 rtems_id queue_id,
146 unsigned int nbBytesToSend, unsigned int sid );
146 unsigned int nbBytesToSend, unsigned int sid );
147
147
148 //******************
148 //******************
149 // general functions
149 // general functions
150 void reset_sm_status( void );
150 void reset_sm_status( void );
151 void reset_spectral_matrix_regs( void );
151 void reset_spectral_matrix_regs( void );
152 void set_time(unsigned char *time, unsigned char *timeInBuffer );
152 void set_time(unsigned char *time, unsigned char *timeInBuffer );
153 unsigned long long int get_acquisition_time( unsigned char *timePtr );
153 unsigned long long int get_acquisition_time( unsigned char *timePtr );
154 unsigned char getSID( rtems_event_set event );
154 unsigned char getSID( rtems_event_set event );
155
155
156 extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
156 extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
157 extern rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
157 extern rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
158
158
159 //***************************************
159 //***************************************
160 // DEFINITIONS OF STATIC INLINE FUNCTIONS
160 // DEFINITIONS OF STATIC INLINE FUNCTIONS
161 static inline void SM_average(float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
161 static inline void SM_average(float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
162 ring_node *ring_node_tab[],
162 ring_node *ring_node_tab[],
163 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
163 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
164 asm_msg *msgForMATR , unsigned char channel);
164 asm_msg *msgForMATR , unsigned char channel);
165
165
166 void ASM_patch( float *inputASM, float *outputASM );
166 void ASM_patch( float *inputASM, float *outputASM );
167
167
168 void extractReImVectors(float *inputASM, float *outputASM, unsigned int asmComponent );
168 void extractReImVectors(float *inputASM, float *outputASM, unsigned int asmComponent );
169
169
170 static inline void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized,
170 static inline void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized,
171 float divider );
171 float divider );
172
172
173 static inline void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat,
173 static inline void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat,
174 float divider,
174 float divider,
175 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart);
175 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart);
176
176
177 static inline void ASM_convert(volatile float *input_matrix, char *output_matrix);
177 static inline void ASM_convert(volatile float *input_matrix, char *output_matrix);
178
178
179 unsigned char isPolluted( u_int64_t t0, u_int64_t t1, u_int64_t tbad0, u_int64_t tbad1 );
180
179 unsigned char acquisitionTimeIsValid(unsigned int coarseTime, unsigned int fineTime, unsigned char channel);
181 unsigned char acquisitionTimeIsValid(unsigned int coarseTime, unsigned int fineTime, unsigned char channel);
180
182
181 void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
183 void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
182 ring_node *ring_node_tab[],
184 ring_node *ring_node_tab[],
183 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
185 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
184 asm_msg *msgForMATR, unsigned char channel )
186 asm_msg *msgForMATR, unsigned char channel )
185 {
187 {
186 float sum;
188 float sum;
187 unsigned int i;
189 unsigned int i;
188 unsigned int k;
190 unsigned int k;
189 unsigned char incomingSMIsValid[NB_SM_BEFORE_AVF0_F1];
191 unsigned char incomingSMIsValid[NB_SM_BEFORE_AVF0_F1];
190 unsigned int numberOfValidSM;
192 unsigned int numberOfValidSM;
191 unsigned char isValid;
193 unsigned char isValid;
192
194
193 //**************
195 //**************
194 // PAS FILTERING
196 // PAS FILTERING
195 // check acquisitionTime of the incoming data
197 // check acquisitionTime of the incoming data
196 numberOfValidSM = 0;
198 numberOfValidSM = 0;
197 for (k=0; k<NB_SM_BEFORE_AVF0_F1; k++)
199 for (k=0; k<NB_SM_BEFORE_AVF0_F1; k++)
198 {
200 {
199 isValid = acquisitionTimeIsValid( ring_node_tab[k]->coarseTime, ring_node_tab[k]->fineTime, channel );
201 isValid = acquisitionTimeIsValid( ring_node_tab[k]->coarseTime, ring_node_tab[k]->fineTime, channel );
200 incomingSMIsValid[k] = isValid;
202 incomingSMIsValid[k] = isValid;
201 numberOfValidSM = numberOfValidSM + isValid;
203 numberOfValidSM = numberOfValidSM + isValid;
202 }
204 }
203
205
204 //************************
206 //************************
205 // AVERAGE SPECTRAL MATRIX
207 // AVERAGE SPECTRAL MATRIX
206 for(i=0; i<TOTAL_SIZE_SM; i++)
208 for(i=0; i<TOTAL_SIZE_SM; i++)
207 {
209 {
208 sum = INIT_FLOAT;
210 sum = INIT_FLOAT;
209 for ( k = 0; k < NB_SM_BEFORE_AVF0_F1; k++ )
211 for ( k = 0; k < NB_SM_BEFORE_AVF0_F1; k++ )
210 {
212 {
211 if (incomingSMIsValid[k] == 1)
213 if (incomingSMIsValid[k] == MATRIX_IS_NOT_POLLUTED)
212 {
214 {
213 sum = sum + ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ] ;
215 sum = sum + ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ] ;
214 }
216 }
215 }
217 }
216
218
217 if ( (nbAverageNORM == 0) && (nbAverageSBM == 0) )
219 if ( (nbAverageNORM == 0) && (nbAverageSBM == 0) )
218 {
220 {
219 averaged_spec_mat_NORM[ i ] = sum;
221 averaged_spec_mat_NORM[ i ] = sum;
220 averaged_spec_mat_SBM[ i ] = sum;
222 averaged_spec_mat_SBM[ i ] = sum;
221 msgForMATR->coarseTimeNORM = ring_node_tab[0]->coarseTime;
223 msgForMATR->coarseTimeNORM = ring_node_tab[0]->coarseTime;
222 msgForMATR->fineTimeNORM = ring_node_tab[0]->fineTime;
224 msgForMATR->fineTimeNORM = ring_node_tab[0]->fineTime;
223 msgForMATR->coarseTimeSBM = ring_node_tab[0]->coarseTime;
225 msgForMATR->coarseTimeSBM = ring_node_tab[0]->coarseTime;
224 msgForMATR->fineTimeSBM = ring_node_tab[0]->fineTime;
226 msgForMATR->fineTimeSBM = ring_node_tab[0]->fineTime;
225 }
227 }
226 else if ( (nbAverageNORM != 0) && (nbAverageSBM != 0) )
228 else if ( (nbAverageNORM != 0) && (nbAverageSBM != 0) )
227 {
229 {
228 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
230 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
229 averaged_spec_mat_SBM[ i ] = ( averaged_spec_mat_SBM[ i ] + sum );
231 averaged_spec_mat_SBM[ i ] = ( averaged_spec_mat_SBM[ i ] + sum );
230 }
232 }
231 else if ( (nbAverageNORM != 0) && (nbAverageSBM == 0) )
233 else if ( (nbAverageNORM != 0) && (nbAverageSBM == 0) )
232 {
234 {
233 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
235 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
234 averaged_spec_mat_SBM[ i ] = sum;
236 averaged_spec_mat_SBM[ i ] = sum;
235 msgForMATR->coarseTimeSBM = ring_node_tab[0]->coarseTime;
237 msgForMATR->coarseTimeSBM = ring_node_tab[0]->coarseTime;
236 msgForMATR->fineTimeSBM = ring_node_tab[0]->fineTime;
238 msgForMATR->fineTimeSBM = ring_node_tab[0]->fineTime;
237 }
239 }
238 else
240 else
239 {
241 {
240 averaged_spec_mat_NORM[ i ] = sum;
242 averaged_spec_mat_NORM[ i ] = sum;
241 averaged_spec_mat_SBM[ i ] = ( averaged_spec_mat_SBM[ i ] + sum );
243 averaged_spec_mat_SBM[ i ] = ( averaged_spec_mat_SBM[ i ] + sum );
242 msgForMATR->coarseTimeNORM = ring_node_tab[0]->coarseTime;
244 msgForMATR->coarseTimeNORM = ring_node_tab[0]->coarseTime;
243 msgForMATR->fineTimeNORM = ring_node_tab[0]->fineTime;
245 msgForMATR->fineTimeNORM = ring_node_tab[0]->fineTime;
244 // PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNORM, nbAverageSBM)
246 // PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNORM, nbAverageSBM)
245 }
247 }
246 }
248 }
247
249
248 //*******************
250 //*******************
249 // UPDATE SM COUNTERS
251 // UPDATE SM COUNTERS
250 if ( (nbAverageNORM == 0) && (nbAverageSBM == 0) )
252 if ( (nbAverageNORM == 0) && (nbAverageSBM == 0) )
251 {
253 {
252 msgForMATR->numberOfSMInASMNORM = numberOfValidSM;
254 msgForMATR->numberOfSMInASMNORM = numberOfValidSM;
253 msgForMATR->numberOfSMInASMSBM = numberOfValidSM;
255 msgForMATR->numberOfSMInASMSBM = numberOfValidSM;
254 }
256 }
255 else if ( (nbAverageNORM != 0) && (nbAverageSBM != 0) )
257 else if ( (nbAverageNORM != 0) && (nbAverageSBM != 0) )
256 {
258 {
257 msgForMATR->numberOfSMInASMNORM = msgForMATR->numberOfSMInASMNORM + numberOfValidSM;
259 msgForMATR->numberOfSMInASMNORM = msgForMATR->numberOfSMInASMNORM + numberOfValidSM;
258 msgForMATR->numberOfSMInASMSBM = msgForMATR->numberOfSMInASMSBM + numberOfValidSM;
260 msgForMATR->numberOfSMInASMSBM = msgForMATR->numberOfSMInASMSBM + numberOfValidSM;
259 }
261 }
260 else if ( (nbAverageNORM != 0) && (nbAverageSBM == 0) )
262 else if ( (nbAverageNORM != 0) && (nbAverageSBM == 0) )
261 {
263 {
262 msgForMATR->numberOfSMInASMNORM = msgForMATR->numberOfSMInASMNORM + numberOfValidSM;
264 msgForMATR->numberOfSMInASMNORM = msgForMATR->numberOfSMInASMNORM + numberOfValidSM;
263 msgForMATR->numberOfSMInASMSBM = numberOfValidSM;
265 msgForMATR->numberOfSMInASMSBM = numberOfValidSM;
264 }
266 }
265 else
267 else
266 {
268 {
267 msgForMATR->numberOfSMInASMNORM = numberOfValidSM;
269 msgForMATR->numberOfSMInASMNORM = numberOfValidSM;
268 msgForMATR->numberOfSMInASMSBM = msgForMATR->numberOfSMInASMSBM + numberOfValidSM;
270 msgForMATR->numberOfSMInASMSBM = msgForMATR->numberOfSMInASMSBM + numberOfValidSM;
269 }
271 }
270 }
272 }
271
273
272 void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider )
274 void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider )
273 {
275 {
274 int frequencyBin;
276 int frequencyBin;
275 int asmComponent;
277 int asmComponent;
276 unsigned int offsetASM;
278 unsigned int offsetASM;
277 unsigned int offsetASMReorganized;
279 unsigned int offsetASMReorganized;
278
280
279 // BUILD DATA
281 // BUILD DATA
280 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
282 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
281 {
283 {
282 for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ )
284 for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ )
283 {
285 {
284 offsetASMReorganized =
286 offsetASMReorganized =
285 (frequencyBin * NB_VALUES_PER_SM)
287 (frequencyBin * NB_VALUES_PER_SM)
286 + asmComponent;
288 + asmComponent;
287 offsetASM =
289 offsetASM =
288 (asmComponent * NB_BINS_PER_SM)
290 (asmComponent * NB_BINS_PER_SM)
289 + frequencyBin;
291 + frequencyBin;
290 if ( divider != INIT_FLOAT )
292 if ( divider != INIT_FLOAT )
291 {
293 {
292 averaged_spec_mat_reorganized[offsetASMReorganized ] = averaged_spec_mat[ offsetASM ] / divider;
294 averaged_spec_mat_reorganized[offsetASMReorganized ] = averaged_spec_mat[ offsetASM ] / divider;
293 }
295 }
294 else
296 else
295 {
297 {
296 averaged_spec_mat_reorganized[offsetASMReorganized ] = INIT_FLOAT;
298 averaged_spec_mat_reorganized[offsetASMReorganized ] = INIT_FLOAT;
297 }
299 }
298 }
300 }
299 }
301 }
300 }
302 }
301
303
302 void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider,
304 void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider,
303 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart )
305 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart )
304 {
306 {
305 int frequencyBin;
307 int frequencyBin;
306 int asmComponent;
308 int asmComponent;
307 int offsetASM;
309 int offsetASM;
308 int offsetCompressed;
310 int offsetCompressed;
309 int k;
311 int k;
310
312
311 // BUILD DATA
313 // BUILD DATA
312 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
314 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
313 {
315 {
314 for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ )
316 for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ )
315 {
317 {
316 offsetCompressed = // NO TIME OFFSET
318 offsetCompressed = // NO TIME OFFSET
317 (frequencyBin * NB_VALUES_PER_SM)
319 (frequencyBin * NB_VALUES_PER_SM)
318 + asmComponent;
320 + asmComponent;
319 offsetASM = // NO TIME OFFSET
321 offsetASM = // NO TIME OFFSET
320 (asmComponent * NB_BINS_PER_SM)
322 (asmComponent * NB_BINS_PER_SM)
321 + ASMIndexStart
323 + ASMIndexStart
322 + (frequencyBin * nbBinsToAverage);
324 + (frequencyBin * nbBinsToAverage);
323 compressed_spec_mat[ offsetCompressed ] = 0;
325 compressed_spec_mat[ offsetCompressed ] = 0;
324 for ( k = 0; k < nbBinsToAverage; k++ )
326 for ( k = 0; k < nbBinsToAverage; k++ )
325 {
327 {
326 compressed_spec_mat[offsetCompressed ] =
328 compressed_spec_mat[offsetCompressed ] =
327 ( compressed_spec_mat[ offsetCompressed ]
329 ( compressed_spec_mat[ offsetCompressed ]
328 + averaged_spec_mat[ offsetASM + k ] );
330 + averaged_spec_mat[ offsetASM + k ] );
329 }
331 }
330 compressed_spec_mat[ offsetCompressed ] =
332 compressed_spec_mat[ offsetCompressed ] =
331 compressed_spec_mat[ offsetCompressed ] / (divider * nbBinsToAverage);
333 compressed_spec_mat[ offsetCompressed ] / (divider * nbBinsToAverage);
332 }
334 }
333 }
335 }
334 }
336 }
335
337
336 void ASM_convert( volatile float *input_matrix, char *output_matrix)
338 void ASM_convert( volatile float *input_matrix, char *output_matrix)
337 {
339 {
338 unsigned int frequencyBin;
340 unsigned int frequencyBin;
339 unsigned int asmComponent;
341 unsigned int asmComponent;
340 char * pt_char_input;
342 char * pt_char_input;
341 char * pt_char_output;
343 char * pt_char_output;
342 unsigned int offsetInput;
344 unsigned int offsetInput;
343 unsigned int offsetOutput;
345 unsigned int offsetOutput;
344
346
345 pt_char_input = (char*) &input_matrix;
347 pt_char_input = (char*) &input_matrix;
346 pt_char_output = (char*) &output_matrix;
348 pt_char_output = (char*) &output_matrix;
347
349
348 // convert all other data
350 // convert all other data
349 for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++)
351 for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++)
350 {
352 {
351 for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++)
353 for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++)
352 {
354 {
353 offsetInput = (frequencyBin*NB_VALUES_PER_SM) + asmComponent ;
355 offsetInput = (frequencyBin*NB_VALUES_PER_SM) + asmComponent ;
354 offsetOutput = SM_BYTES_PER_VAL * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) ;
356 offsetOutput = SM_BYTES_PER_VAL * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) ;
355 pt_char_input = (char*) &input_matrix [ offsetInput ];
357 pt_char_input = (char*) &input_matrix [ offsetInput ];
356 pt_char_output = (char*) &output_matrix[ offsetOutput ];
358 pt_char_output = (char*) &output_matrix[ offsetOutput ];
357 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
359 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
358 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
360 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
359 }
361 }
360 }
362 }
361 }
363 }
362
364
363 void ASM_compress_reorganize_and_divide_mask(float *averaged_spec_mat, float *compressed_spec_mat,
365 void ASM_compress_reorganize_and_divide_mask(float *averaged_spec_mat, float *compressed_spec_mat,
364 float divider,
366 float divider,
365 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart, unsigned char channel);
367 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart, unsigned char channel);
366
368
367 int getFBinMask(int k, unsigned char channel);
369 int getFBinMask(int k, unsigned char channel);
368
370
369 void init_kcoeff_sbm_from_kcoeff_norm( float *input_kcoeff, float *output_kcoeff, unsigned char nb_bins_norm);
371 void init_kcoeff_sbm_from_kcoeff_norm( float *input_kcoeff, float *output_kcoeff, unsigned char nb_bins_norm);
370
372
371 #endif // FSW_PROCESSING_H_INCLUDED
373 #endif // FSW_PROCESSING_H_INCLUDED
@@ -1,107 +1,107
1 cmake_minimum_required (VERSION 2.6)
1 cmake_minimum_required (VERSION 2.6)
2 project (fsw)
2 project (fsw)
3
3
4 include(sparc-rtems)
4 include(sparc-rtems)
5 include(cppcheck)
5 include(cppcheck)
6
6
7 include_directories("../header"
7 include_directories("../header"
8 "../header/lfr_common_headers"
8 "../header/lfr_common_headers"
9 "../header/processing"
9 "../header/processing"
10 "../LFR_basic-parameters"
10 "../LFR_basic-parameters"
11 "../src")
11 "../src")
12
12
13 set(SOURCES wf_handler.c
13 set(SOURCES wf_handler.c
14 tc_handler.c
14 tc_handler.c
15 fsw_misc.c
15 fsw_misc.c
16 fsw_init.c
16 fsw_init.c
17 fsw_globals.c
17 fsw_globals.c
18 fsw_spacewire.c
18 fsw_spacewire.c
19 tc_load_dump_parameters.c
19 tc_load_dump_parameters.c
20 tm_lfr_tc_exe.c
20 tm_lfr_tc_exe.c
21 tc_acceptance.c
21 tc_acceptance.c
22 processing/fsw_processing.c
22 processing/fsw_processing.c
23 processing/avf0_prc0.c
23 processing/avf0_prc0.c
24 processing/avf1_prc1.c
24 processing/avf1_prc1.c
25 processing/avf2_prc2.c
25 processing/avf2_prc2.c
26 lfr_cpu_usage_report.c
26 lfr_cpu_usage_report.c
27 ${LFR_BP_SRC}
27 ${LFR_BP_SRC}
28 ../header/wf_handler.h
28 ../header/wf_handler.h
29 ../header/tc_handler.h
29 ../header/tc_handler.h
30 ../header/grlib_regs.h
30 ../header/grlib_regs.h
31 ../header/fsw_misc.h
31 ../header/fsw_misc.h
32 ../header/fsw_init.h
32 ../header/fsw_init.h
33 ../header/fsw_spacewire.h
33 ../header/fsw_spacewire.h
34 ../header/tc_load_dump_parameters.h
34 ../header/tc_load_dump_parameters.h
35 ../header/tm_lfr_tc_exe.h
35 ../header/tm_lfr_tc_exe.h
36 ../header/tc_acceptance.h
36 ../header/tc_acceptance.h
37 ../header/processing/fsw_processing.h
37 ../header/processing/fsw_processing.h
38 ../header/processing/avf0_prc0.h
38 ../header/processing/avf0_prc0.h
39 ../header/processing/avf1_prc1.h
39 ../header/processing/avf1_prc1.h
40 ../header/processing/avf2_prc2.h
40 ../header/processing/avf2_prc2.h
41 ../header/fsw_params_wf_handler.h
41 ../header/fsw_params_wf_handler.h
42 ../header/lfr_cpu_usage_report.h
42 ../header/lfr_cpu_usage_report.h
43 ../header/lfr_common_headers/ccsds_types.h
43 ../header/lfr_common_headers/ccsds_types.h
44 ../header/lfr_common_headers/fsw_params.h
44 ../header/lfr_common_headers/fsw_params.h
45 ../header/lfr_common_headers/fsw_params_nb_bytes.h
45 ../header/lfr_common_headers/fsw_params_nb_bytes.h
46 ../header/lfr_common_headers/fsw_params_processing.h
46 ../header/lfr_common_headers/fsw_params_processing.h
47 ../header/lfr_common_headers/tm_byte_positions.h
47 ../header/lfr_common_headers/tm_byte_positions.h
48 ../LFR_basic-parameters/basic_parameters.h
48 ../LFR_basic-parameters/basic_parameters.h
49 ../LFR_basic-parameters/basic_parameters_params.h
49 ../LFR_basic-parameters/basic_parameters_params.h
50 ../header/GscMemoryLPP.hpp
50 ../header/GscMemoryLPP.hpp
51 )
51 )
52
52
53
53
54 option(FSW_verbose "Enable verbose LFR" OFF)
54 option(FSW_verbose "Enable verbose LFR" OFF)
55 option(FSW_boot_messages "Enable LFR boot messages" OFF)
55 option(FSW_boot_messages "Enable LFR boot messages" OFF)
56 option(FSW_debug_messages "Enable LFR debug messages" OFF)
56 option(FSW_debug_messages "Enable LFR debug messages" OFF)
57 option(FSW_cpu_usage_report "Enable LFR cpu usage report" OFF)
57 option(FSW_cpu_usage_report "Enable LFR cpu usage report" OFF)
58 option(FSW_stack_report "Enable LFR stack report" OFF)
58 option(FSW_stack_report "Enable LFR stack report" OFF)
59 option(FSW_vhdl_dev "?" OFF)
59 option(FSW_vhdl_dev "?" OFF)
60 option(FSW_lpp_dpu_destid "Set to debug at LPP" ON)
60 option(FSW_lpp_dpu_destid "Set to debug at LPP" ON)
61 option(FSW_debug_watchdog "Enable debug watchdog" OFF)
61 option(FSW_debug_watchdog "Enable debug watchdog" OFF)
62 option(FSW_debug_tch "?" OFF)
62 option(FSW_debug_tch "?" OFF)
63
63
64 set(SW_VERSION_N1 "3" CACHE STRING "Choose N1 FSW Version." FORCE)
64 set(SW_VERSION_N1 "3" CACHE STRING "Choose N1 FSW Version." FORCE)
65 set(SW_VERSION_N2 "2" CACHE STRING "Choose N2 FSW Version." FORCE)
65 set(SW_VERSION_N2 "2" CACHE STRING "Choose N2 FSW Version." FORCE)
66 set(SW_VERSION_N3 "0" CACHE STRING "Choose N3 FSW Version." FORCE)
66 set(SW_VERSION_N3 "0" CACHE STRING "Choose N3 FSW Version." FORCE)
67 set(SW_VERSION_N4 "3" CACHE STRING "Choose N4 FSW Version." FORCE)
67 set(SW_VERSION_N4 "5" CACHE STRING "Choose N4 FSW Version." FORCE)
68
68
69 if(FSW_verbose)
69 if(FSW_verbose)
70 add_definitions(-DPRINT_MESSAGES_ON_CONSOLE)
70 add_definitions(-DPRINT_MESSAGES_ON_CONSOLE)
71 endif()
71 endif()
72 if(FSW_boot_messages)
72 if(FSW_boot_messages)
73 add_definitions(-DBOOT_MESSAGES)
73 add_definitions(-DBOOT_MESSAGES)
74 endif()
74 endif()
75 if(FSW_debug_messages)
75 if(FSW_debug_messages)
76 add_definitions(-DDEBUG_MESSAGES)
76 add_definitions(-DDEBUG_MESSAGES)
77 endif()
77 endif()
78 if(FSW_cpu_usage_report)
78 if(FSW_cpu_usage_report)
79 add_definitions(-DPRINT_TASK_STATISTICS)
79 add_definitions(-DPRINT_TASK_STATISTICS)
80 endif()
80 endif()
81 if(FSW_stack_report)
81 if(FSW_stack_report)
82 add_definitions(-DPRINT_STACK_REPORT)
82 add_definitions(-DPRINT_STACK_REPORT)
83 endif()
83 endif()
84 if(FSW_vhdl_dev)
84 if(FSW_vhdl_dev)
85 add_definitions(-DVHDL_DEV)
85 add_definitions(-DVHDL_DEV)
86 endif()
86 endif()
87 if(FSW_lpp_dpu_destid)
87 if(FSW_lpp_dpu_destid)
88 add_definitions(-DLPP_DPU_DESTID)
88 add_definitions(-DLPP_DPU_DESTID)
89 endif()
89 endif()
90 if(FSW_debug_watchdog)
90 if(FSW_debug_watchdog)
91 add_definitions(-DDEBUG_WATCHDOG)
91 add_definitions(-DDEBUG_WATCHDOG)
92 endif()
92 endif()
93 if(FSW_debug_tch)
93 if(FSW_debug_tch)
94 add_definitions(-DDEBUG_TCH)
94 add_definitions(-DDEBUG_TCH)
95 endif()
95 endif()
96
96
97 add_definitions(-DMSB_FIRST_TCH)
97 add_definitions(-DMSB_FIRST_TCH)
98
98
99 add_definitions(-DSWVERSION=-1-0)
99 add_definitions(-DSWVERSION=-1-0)
100 add_definitions(-DSW_VERSION_N1=${SW_VERSION_N1})
100 add_definitions(-DSW_VERSION_N1=${SW_VERSION_N1})
101 add_definitions(-DSW_VERSION_N2=${SW_VERSION_N2})
101 add_definitions(-DSW_VERSION_N2=${SW_VERSION_N2})
102 add_definitions(-DSW_VERSION_N3=${SW_VERSION_N3})
102 add_definitions(-DSW_VERSION_N3=${SW_VERSION_N3})
103 add_definitions(-DSW_VERSION_N4=${SW_VERSION_N4})
103 add_definitions(-DSW_VERSION_N4=${SW_VERSION_N4})
104
104
105 add_executable(fsw ${SOURCES})
105 add_executable(fsw ${SOURCES})
106 add_test_cppcheck(fsw STYLE UNUSED_FUNCTIONS POSSIBLE_ERROR MISSING_INCLUDE)
106 add_test_cppcheck(fsw STYLE UNUSED_FUNCTIONS POSSIBLE_ERROR MISSING_INCLUDE)
107
107
@@ -1,98 +1,96
1 /** Global variables of the LFR flight software.
1 /** Global variables of the LFR flight software.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * Among global variables, there are:
6 * Among global variables, there are:
7 * - RTEMS names and id.
7 * - RTEMS names and id.
8 * - APB configuration registers.
8 * - APB configuration registers.
9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
10 * - spectral matrices buffesr, used by the hardware module to store data.
10 * - spectral matrices buffesr, used by the hardware module to store data.
11 * - variable related to LFR modes parameters.
11 * - variable related to LFR modes parameters.
12 * - the global HK packet buffer.
12 * - the global HK packet buffer.
13 * - the global dump parameter buffer.
13 * - the global dump parameter buffer.
14 *
14 *
15 */
15 */
16
16
17 #include <rtems.h>
17 #include <rtems.h>
18 #include <grspw.h>
18 #include <grspw.h>
19
19
20 #include "ccsds_types.h"
20 #include "ccsds_types.h"
21 #include "grlib_regs.h"
21 #include "grlib_regs.h"
22 #include "fsw_params.h"
22 #include "fsw_params.h"
23 #include "fsw_params_wf_handler.h"
23 #include "fsw_params_wf_handler.h"
24
24
25 #define NB_OF_TASKS 20
25 #define NB_OF_TASKS 20
26 #define NB_OF_MISC_NAMES 5
26 #define NB_OF_MISC_NAMES 5
27
27
28 // RTEMS GLOBAL VARIABLES
28 // RTEMS GLOBAL VARIABLES
29 rtems_name misc_name[NB_OF_MISC_NAMES] = {0};
29 rtems_name misc_name[NB_OF_MISC_NAMES] = {0};
30 rtems_name Task_name[NB_OF_TASKS] = {0}; /* array of task names */
30 rtems_name Task_name[NB_OF_TASKS] = {0}; /* array of task names */
31 rtems_id Task_id[NB_OF_TASKS] = {0}; /* array of task ids */
31 rtems_id Task_id[NB_OF_TASKS] = {0}; /* array of task ids */
32 rtems_name timecode_timer_name = 0;
32 rtems_name timecode_timer_name = 0;
33 rtems_id timecode_timer_id = RTEMS_ID_NONE;
33 rtems_id timecode_timer_id = RTEMS_ID_NONE;
34 rtems_name name_hk_rate_monotonic = 0; // name of the HK rate monotonic
34 rtems_name name_hk_rate_monotonic = 0; // name of the HK rate monotonic
35 rtems_id HK_id = RTEMS_ID_NONE;// id of the HK rate monotonic period
35 rtems_id HK_id = RTEMS_ID_NONE;// id of the HK rate monotonic period
36 rtems_name name_avgv_rate_monotonic = 0; // name of the AVGV rate monotonic
36 rtems_name name_avgv_rate_monotonic = 0; // name of the AVGV rate monotonic
37 rtems_id AVGV_id = RTEMS_ID_NONE;// id of the AVGV rate monotonic period
37 rtems_id AVGV_id = RTEMS_ID_NONE;// id of the AVGV rate monotonic period
38 int fdSPW = 0;
38 int fdSPW = 0;
39 int fdUART = 0;
39 int fdUART = 0;
40 unsigned char lfrCurrentMode = 0;
40 unsigned char lfrCurrentMode = 0;
41 unsigned char pa_bia_status_info = 0;
41 unsigned char pa_bia_status_info = 0;
42 unsigned char thisIsAnASMRestart = 0;
42 unsigned char thisIsAnASMRestart = 0;
43 unsigned char oneTcLfrUpdateTimeReceived = 0;
43 unsigned char oneTcLfrUpdateTimeReceived = 0;
44
44
45 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584
45 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584
46 // 97 * 256 = 24832 => delta = 248 bytes = 62 words
46 // 97 * 256 = 24832 => delta = 248 bytes = 62 words
47 // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264
47 // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264
48 // 127 * 256 = 32512 => delta = 248 bytes = 62 words
48 // 127 * 256 = 32512 => delta = 248 bytes = 62 words
49 // F0 F1 F2 F3
49 // F0 F1 F2 F3
50 volatile int wf_buffer_f0[ NB_RING_NODES_F0 * WFRM_BUFFER ] __attribute__((aligned(0x100))) = {0};
50 volatile int wf_buffer_f0[ NB_RING_NODES_F0 * WFRM_BUFFER ] __attribute__((aligned(0x100))) = {0};
51 volatile int wf_buffer_f1[ NB_RING_NODES_F1 * WFRM_BUFFER ] __attribute__((aligned(0x100))) = {0};
51 volatile int wf_buffer_f1[ NB_RING_NODES_F1 * WFRM_BUFFER ] __attribute__((aligned(0x100))) = {0};
52 volatile int wf_buffer_f2[ NB_RING_NODES_F2 * WFRM_BUFFER ] __attribute__((aligned(0x100))) = {0};
52 volatile int wf_buffer_f2[ NB_RING_NODES_F2 * WFRM_BUFFER ] __attribute__((aligned(0x100))) = {0};
53 volatile int wf_buffer_f3[ NB_RING_NODES_F3 * WFRM_BUFFER ] __attribute__((aligned(0x100))) = {0};
53 volatile int wf_buffer_f3[ NB_RING_NODES_F3 * WFRM_BUFFER ] __attribute__((aligned(0x100))) = {0};
54
54
55 //***********************************
55 //***********************************
56 // SPECTRAL MATRICES GLOBAL VARIABLES
56 // SPECTRAL MATRICES GLOBAL VARIABLES
57
57
58 // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00
58 // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00
59 volatile int sm_f0[ NB_RING_NODES_SM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))) = {0};
59 volatile int sm_f0[ NB_RING_NODES_SM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))) = {0};
60 volatile int sm_f1[ NB_RING_NODES_SM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))) = {0};
60 volatile int sm_f1[ NB_RING_NODES_SM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))) = {0};
61 volatile int sm_f2[ NB_RING_NODES_SM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))) = {0};
61 volatile int sm_f2[ NB_RING_NODES_SM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))) = {0};
62
62
63 // APB CONFIGURATION REGISTERS
63 // APB CONFIGURATION REGISTERS
64 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
64 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
65 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
65 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
66 waveform_picker_regs_0_1_18_t *waveform_picker_regs = (waveform_picker_regs_0_1_18_t*) REGS_ADDR_WAVEFORM_PICKER;
66 waveform_picker_regs_0_1_18_t *waveform_picker_regs = (waveform_picker_regs_0_1_18_t*) REGS_ADDR_WAVEFORM_PICKER;
67 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
67 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
68
68
69 // MODE PARAMETERS
69 // MODE PARAMETERS
70 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet = {0};
70 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet = {0};
71 struct param_local_str param_local = {0};
71 struct param_local_str param_local = {0};
72 unsigned int lastValidEnterModeTime = {0};
72 unsigned int lastValidEnterModeTime = {0};
73
73
74 // HK PACKETS
74 // HK PACKETS
75 Packet_TM_LFR_HK_t housekeeping_packet = {0};
75 Packet_TM_LFR_HK_t housekeeping_packet = {0};
76 // message queues occupancy
76 // message queues occupancy
77 unsigned char hk_lfr_q_sd_fifo_size_max = 0;
77 unsigned char hk_lfr_q_sd_fifo_size_max = 0;
78 unsigned char hk_lfr_q_rv_fifo_size_max = 0;
78 unsigned char hk_lfr_q_rv_fifo_size_max = 0;
79 unsigned char hk_lfr_q_p0_fifo_size_max = 0;
79 unsigned char hk_lfr_q_p0_fifo_size_max = 0;
80 unsigned char hk_lfr_q_p1_fifo_size_max = 0;
80 unsigned char hk_lfr_q_p1_fifo_size_max = 0;
81 unsigned char hk_lfr_q_p2_fifo_size_max = 0;
81 unsigned char hk_lfr_q_p2_fifo_size_max = 0;
82 // sequence counters are incremented by APID (PID + CAT) and destination ID
82 // sequence counters are incremented by APID (PID + CAT) and destination ID
83 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST __attribute__((aligned(0x4))) = 0;
83 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST __attribute__((aligned(0x4))) = 0;
84 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2 __attribute__((aligned(0x4))) = 0;
84 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2 __attribute__((aligned(0x4))) = 0;
85 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID] __attribute__((aligned(0x4))) = {0};
85 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID] __attribute__((aligned(0x4))) = {0};
86 unsigned short sequenceCounters_TM_DUMP[SEQ_CNT_NB_DEST_ID] __attribute__((aligned(0x4))) = {0};
86 unsigned short sequenceCounters_TM_DUMP[SEQ_CNT_NB_DEST_ID] __attribute__((aligned(0x4))) = {0};
87 unsigned short sequenceCounterHK __attribute__((aligned(0x4))) = {0};
87 unsigned short sequenceCounterHK __attribute__((aligned(0x4))) = {0};
88 spw_stats grspw_stats __attribute__((aligned(0x4))) = {0};
88 spw_stats grspw_stats __attribute__((aligned(0x4))) = {0};
89
89
90 // TC_LFR_UPDATE_INFO
90 // TC_LFR_UPDATE_INFO
91 rw_f_t rw_f;
91 rw_f_t rw_f;
92
92
93 // TC_LFR_LOAD_FILTER_PAR
93 // TC_LFR_LOAD_FILTER_PAR
94 filterPar_t filterPar = {0};
94 filterPar_t filterPar = {0};
95
95
96 fbins_masks_t fbins_masks = {0};
96 fbins_masks_t fbins_masks = {0};
97 unsigned int acquisitionDurations[NB_ACQUISITION_DURATION]
98 = {ACQUISITION_DURATION_F0, ACQUISITION_DURATION_F1, ACQUISITION_DURATION_F2};
@@ -1,332 +1,332
1 /** Functions related to data processing.
1 /** Functions related to data processing.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
7 *
7 *
8 */
8 */
9
9
10 #include "avf2_prc2.h"
10 #include "avf2_prc2.h"
11
11
12 nb_sm_before_bp_asm_f2 nb_sm_before_f2 = {0};
12 nb_sm_before_bp_asm_f2 nb_sm_before_f2 = {0};