@@ -1,389 +1,389 | |||
|
1 | 1 | /** Functions related to data processing. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. |
|
7 | 7 | * |
|
8 | 8 | */ |
|
9 | 9 | |
|
10 | 10 | #include "avf1_prc1.h" |
|
11 | 11 | |
|
12 | 12 | nb_sm_before_bp_asm_f1 nb_sm_before_f1; |
|
13 | 13 | |
|
14 | 14 | extern ring_node sm_ring_f1[ ]; |
|
15 | 15 | |
|
16 | 16 | //*** |
|
17 | 17 | // F1 |
|
18 | 18 | ring_node_asm asm_ring_norm_f1 [ NB_RING_NODES_ASM_NORM_F1 ]; |
|
19 | 19 | ring_node_asm asm_ring_burst_sbm_f1 [ NB_RING_NODES_ASM_BURST_SBM_F1 ]; |
|
20 | 20 | |
|
21 | 21 | ring_node ring_to_send_asm_f1 [ NB_RING_NODES_ASM_F1 ]; |
|
22 | 22 | int buffer_asm_f1 [ NB_RING_NODES_ASM_F1 * TOTAL_SIZE_SM ]; |
|
23 | 23 | |
|
24 | 24 | float asm_f1_patched_norm [ TOTAL_SIZE_SM ]; |
|
25 | 25 | float asm_f1_patched_burst_sbm [ TOTAL_SIZE_SM ]; |
|
26 | 26 | float asm_f1_reorganized [ TOTAL_SIZE_SM ]; |
|
27 | 27 | |
|
28 | 28 | char asm_f1_char [ TOTAL_SIZE_SM * 2 ]; |
|
29 | 29 | float compressed_sm_norm_f1[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F1]; |
|
30 | 30 | float compressed_sm_sbm_f1 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 ]; |
|
31 | 31 | |
|
32 | 32 | float k_coeff_intercalib_f1_norm[ NB_BINS_COMPRESSED_SM_F1 * NB_K_COEFF_PER_BIN ]; // 13 * 32 = 416 |
|
33 | 33 | float k_coeff_intercalib_f1_sbm[ NB_BINS_COMPRESSED_SM_SBM_F1 * NB_K_COEFF_PER_BIN ]; // 26 * 32 = 832 |
|
34 | 34 | |
|
35 | 35 | //************ |
|
36 | 36 | // RTEMS TASKS |
|
37 | 37 | |
|
38 | 38 | rtems_task avf1_task( rtems_task_argument lfrRequestedMode ) |
|
39 | 39 | { |
|
40 | 40 | int i; |
|
41 | 41 | |
|
42 | 42 | rtems_event_set event_out; |
|
43 | 43 | rtems_status_code status; |
|
44 | 44 | rtems_id queue_id_prc1; |
|
45 | 45 | asm_msg msgForMATR; |
|
46 | 46 | ring_node *nodeForAveraging; |
|
47 | 47 | ring_node *ring_node_tab[NB_SM_BEFORE_AVF0]; |
|
48 | 48 | ring_node_asm *current_ring_node_asm_burst_sbm_f1; |
|
49 | 49 | ring_node_asm *current_ring_node_asm_norm_f1; |
|
50 | 50 | |
|
51 | 51 | unsigned int nb_norm_bp1; |
|
52 | 52 | unsigned int nb_norm_bp2; |
|
53 | 53 | unsigned int nb_norm_asm; |
|
54 | 54 | unsigned int nb_sbm_bp1; |
|
55 | 55 | unsigned int nb_sbm_bp2; |
|
56 | 56 | |
|
57 | 57 | nb_norm_bp1 = 0; |
|
58 | 58 | nb_norm_bp2 = 0; |
|
59 | 59 | nb_norm_asm = 0; |
|
60 | 60 | nb_sbm_bp1 = 0; |
|
61 | 61 | nb_sbm_bp2 = 0; |
|
62 | 62 | |
|
63 | 63 | reset_nb_sm_f1( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions |
|
64 | 64 | ASM_generic_init_ring( asm_ring_norm_f1, NB_RING_NODES_ASM_NORM_F1 ); |
|
65 | 65 | ASM_generic_init_ring( asm_ring_burst_sbm_f1, NB_RING_NODES_ASM_BURST_SBM_F1 ); |
|
66 | 66 | current_ring_node_asm_norm_f1 = asm_ring_norm_f1; |
|
67 | 67 | current_ring_node_asm_burst_sbm_f1 = asm_ring_burst_sbm_f1; |
|
68 | 68 | |
|
69 | 69 | BOOT_PRINTF1("in AVF1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) |
|
70 | 70 | |
|
71 | 71 | status = get_message_queue_id_prc1( &queue_id_prc1 ); |
|
72 | 72 | if (status != RTEMS_SUCCESSFUL) |
|
73 | 73 | { |
|
74 | 74 | PRINTF1("in AVF1 *** ERR get_message_queue_id_prc1 %d\n", status) |
|
75 | 75 | } |
|
76 | 76 | |
|
77 | 77 | while(1){ |
|
78 | 78 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
79 | 79 | |
|
80 | 80 | //**************************************** |
|
81 | 81 | // initialize the mesage for the MATR task |
|
82 | 82 | msgForMATR.norm = current_ring_node_asm_norm_f1; |
|
83 | 83 | msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f1; |
|
84 | 84 | msgForMATR.event = 0x00; // this composite event will be sent to the PRC1 task |
|
85 | 85 | // |
|
86 | 86 | //**************************************** |
|
87 | 87 | |
|
88 | 88 | nodeForAveraging = getRingNodeForAveraging( 1 ); |
|
89 | 89 | |
|
90 | 90 | ring_node_tab[NB_SM_BEFORE_AVF1-1] = nodeForAveraging; |
|
91 | 91 | for ( i = 2; i < (NB_SM_BEFORE_AVF1+1); i++ ) |
|
92 | 92 | { |
|
93 | 93 | nodeForAveraging = nodeForAveraging->previous; |
|
94 | 94 | ring_node_tab[NB_SM_BEFORE_AVF1-i] = nodeForAveraging; |
|
95 | 95 | } |
|
96 | 96 | |
|
97 | 97 | // compute the average and store it in the averaged_sm_f1 buffer |
|
98 | 98 | SM_average( current_ring_node_asm_norm_f1->matrix, |
|
99 | 99 | current_ring_node_asm_burst_sbm_f1->matrix, |
|
100 | 100 | ring_node_tab, |
|
101 | 101 | nb_norm_bp1, nb_sbm_bp1, |
|
102 | 102 | &msgForMATR ); |
|
103 | 103 | |
|
104 | 104 | // update nb_average |
|
105 | 105 | nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF1; |
|
106 | 106 | nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF1; |
|
107 | 107 | nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF1; |
|
108 | 108 | nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF1; |
|
109 | 109 | nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF1; |
|
110 | 110 | |
|
111 | 111 | if (nb_sbm_bp1 == nb_sm_before_f1.burst_sbm_bp1) |
|
112 | 112 | { |
|
113 | 113 | nb_sbm_bp1 = 0; |
|
114 | 114 | // set another ring for the ASM storage |
|
115 | 115 | current_ring_node_asm_burst_sbm_f1 = current_ring_node_asm_burst_sbm_f1->next; |
|
116 | 116 | if ( lfrCurrentMode == LFR_MODE_BURST ) |
|
117 | 117 | { |
|
118 | 118 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_BP1_F1; |
|
119 | 119 | } |
|
120 | 120 | else if ( lfrCurrentMode == LFR_MODE_SBM2 ) |
|
121 | 121 | { |
|
122 | 122 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_SBM_BP1_F1; |
|
123 | 123 | } |
|
124 | 124 | } |
|
125 | 125 | |
|
126 | 126 | if (nb_sbm_bp2 == nb_sm_before_f1.burst_sbm_bp2) |
|
127 | 127 | { |
|
128 | 128 | nb_sbm_bp2 = 0; |
|
129 | 129 | if ( lfrCurrentMode == LFR_MODE_BURST ) |
|
130 | 130 | { |
|
131 | 131 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_BP2_F1; |
|
132 | 132 | } |
|
133 | 133 | else if ( lfrCurrentMode == LFR_MODE_SBM2 ) |
|
134 | 134 | { |
|
135 | 135 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_SBM_BP2_F1; |
|
136 | 136 | } |
|
137 | 137 | } |
|
138 | 138 | |
|
139 | 139 | if (nb_norm_bp1 == nb_sm_before_f1.norm_bp1) |
|
140 | 140 | { |
|
141 | 141 | nb_norm_bp1 = 0; |
|
142 | 142 | // set another ring for the ASM storage |
|
143 | 143 | current_ring_node_asm_norm_f1 = current_ring_node_asm_norm_f1->next; |
|
144 | 144 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
145 | 145 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
146 | 146 | { |
|
147 | 147 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F1; |
|
148 | 148 | } |
|
149 | 149 | } |
|
150 | 150 | |
|
151 | 151 | if (nb_norm_bp2 == nb_sm_before_f1.norm_bp2) |
|
152 | 152 | { |
|
153 | 153 | nb_norm_bp2 = 0; |
|
154 | 154 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
155 | 155 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
156 | 156 | { |
|
157 | 157 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F1; |
|
158 | 158 | } |
|
159 | 159 | } |
|
160 | 160 | |
|
161 | 161 | if (nb_norm_asm == nb_sm_before_f1.norm_asm) |
|
162 | 162 | { |
|
163 | 163 | nb_norm_asm = 0; |
|
164 | 164 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
165 | 165 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
166 | 166 | { |
|
167 | 167 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F1; |
|
168 | 168 | } |
|
169 | 169 | } |
|
170 | 170 | |
|
171 | 171 | //************************* |
|
172 | 172 | // send the message to MATR |
|
173 | 173 | if (msgForMATR.event != 0x00) |
|
174 | 174 | { |
|
175 | 175 | status = rtems_message_queue_send( queue_id_prc1, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC1); |
|
176 | 176 | } |
|
177 | 177 | |
|
178 | 178 | if (status != RTEMS_SUCCESSFUL) { |
|
179 | 179 | printf("in AVF1 *** Error sending message to PRC1, code %d\n", status); |
|
180 | 180 | } |
|
181 | 181 | } |
|
182 | 182 | } |
|
183 | 183 | |
|
184 | 184 | rtems_task prc1_task( rtems_task_argument lfrRequestedMode ) |
|
185 | 185 | { |
|
186 | 186 | char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer |
|
187 | 187 | size_t size; // size of the incoming TC packet |
|
188 | 188 | asm_msg *incomingMsg; |
|
189 | 189 | // |
|
190 | 190 | unsigned char sid; |
|
191 | 191 | rtems_status_code status; |
|
192 | 192 | rtems_id queue_id_send; |
|
193 | 193 | rtems_id queue_id_q_p1; |
|
194 | 194 | bp_packet_with_spare packet_norm_bp1; |
|
195 | 195 | bp_packet packet_norm_bp2; |
|
196 | 196 | bp_packet packet_sbm_bp1; |
|
197 | 197 | bp_packet packet_sbm_bp2; |
|
198 | 198 | ring_node *current_ring_node_to_send_asm_f1; |
|
199 | 199 | |
|
200 | 200 | unsigned long long int localTime; |
|
201 | 201 | |
|
202 | 202 | // init the ring of the averaged spectral matrices which will be transmitted to the DPU |
|
203 | 203 | init_ring( ring_to_send_asm_f1, NB_RING_NODES_ASM_F1, (volatile int*) buffer_asm_f1, TOTAL_SIZE_SM ); |
|
204 | 204 | current_ring_node_to_send_asm_f1 = ring_to_send_asm_f1; |
|
205 | 205 | |
|
206 | 206 | //************* |
|
207 | 207 | // NORM headers |
|
208 | 208 | BP_init_header_with_spare( &packet_norm_bp1, |
|
209 | 209 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F1, |
|
210 | 210 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1, NB_BINS_COMPRESSED_SM_F1 ); |
|
211 | 211 | BP_init_header( &packet_norm_bp2, |
|
212 | 212 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F1, |
|
213 | 213 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1, NB_BINS_COMPRESSED_SM_F1); |
|
214 | 214 | |
|
215 | 215 | //*********************** |
|
216 | 216 | // BURST and SBM2 headers |
|
217 | 217 | if ( lfrRequestedMode == LFR_MODE_BURST ) |
|
218 | 218 | { |
|
219 | 219 | BP_init_header( &packet_sbm_bp1, |
|
220 | 220 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F1, |
|
221 | 221 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1, NB_BINS_COMPRESSED_SM_SBM_F1); |
|
222 | 222 | BP_init_header( &packet_sbm_bp2, |
|
223 | 223 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F1, |
|
224 | 224 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1, NB_BINS_COMPRESSED_SM_SBM_F1); |
|
225 | 225 | } |
|
226 | 226 | else if ( lfrRequestedMode == LFR_MODE_SBM2 ) |
|
227 | 227 | { |
|
228 | 228 | BP_init_header( &packet_sbm_bp1, |
|
229 | 229 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F1, |
|
230 | 230 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1, NB_BINS_COMPRESSED_SM_SBM_F1); |
|
231 | 231 | BP_init_header( &packet_sbm_bp2, |
|
232 | 232 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F1, |
|
233 | 233 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1, NB_BINS_COMPRESSED_SM_SBM_F1); |
|
234 | 234 | } |
|
235 | 235 | else |
|
236 | 236 | { |
|
237 | 237 | PRINTF1("in PRC1 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode) |
|
238 | 238 | } |
|
239 | 239 | |
|
240 | 240 | status = get_message_queue_id_send( &queue_id_send ); |
|
241 | 241 | if (status != RTEMS_SUCCESSFUL) |
|
242 | 242 | { |
|
243 | 243 | PRINTF1("in PRC1 *** ERR get_message_queue_id_send %d\n", status) |
|
244 | 244 | } |
|
245 | 245 | status = get_message_queue_id_prc1( &queue_id_q_p1); |
|
246 | 246 | if (status != RTEMS_SUCCESSFUL) |
|
247 | 247 | { |
|
248 | 248 | PRINTF1("in PRC1 *** ERR get_message_queue_id_prc1 %d\n", status) |
|
249 | 249 | } |
|
250 | 250 | |
|
251 | 251 | BOOT_PRINTF1("in PRC1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) |
|
252 | 252 | |
|
253 | 253 | while(1){ |
|
254 | 254 | status = rtems_message_queue_receive( queue_id_q_p1, incomingData, &size, //************************************ |
|
255 | 255 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 |
|
256 | 256 | |
|
257 | 257 | incomingMsg = (asm_msg*) incomingData; |
|
258 | 258 | |
|
259 | 259 | ASM_patch( incomingMsg->norm->matrix, asm_f1_patched_norm ); |
|
260 | 260 | ASM_patch( incomingMsg->burst_sbm->matrix, asm_f1_patched_burst_sbm ); |
|
261 | 261 | |
|
262 | 262 | localTime = getTimeAsUnsignedLongLongInt( ); |
|
263 | 263 | //*********** |
|
264 | 264 | //*********** |
|
265 | 265 | // BURST SBM2 |
|
266 | 266 | //*********** |
|
267 | 267 | //*********** |
|
268 | 268 | if ( (incomingMsg->event & RTEMS_EVENT_BURST_BP1_F1) || (incomingMsg->event & RTEMS_EVENT_SBM_BP1_F1) ) |
|
269 | 269 | { |
|
270 | 270 | sid = getSID( incomingMsg->event ); |
|
271 | 271 | // 1) compress the matrix for Basic Parameters calculation |
|
272 | 272 | ASM_compress_reorganize_and_divide( asm_f1_patched_burst_sbm, compressed_sm_sbm_f1, |
|
273 | 273 | nb_sm_before_f1.burst_sbm_bp1, |
|
274 | 274 | NB_BINS_COMPRESSED_SM_SBM_F1, NB_BINS_TO_AVERAGE_ASM_SBM_F1, |
|
275 | 275 | ASM_F1_INDICE_START); |
|
276 | 276 | // 2) compute the BP1 set |
|
277 | 277 | BP1_set( compressed_sm_sbm_f1, k_coeff_intercalib_f1_sbm, NB_BINS_COMPRESSED_SM_SBM_F1, packet_sbm_bp1.data ); |
|
278 | 278 | // 3) send the BP1 set |
|
279 | 279 | set_time( packet_sbm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeSBM ); |
|
280 | 280 | set_time( packet_sbm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM ); |
|
281 | 281 | packet_sbm_bp1.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters; |
|
282 | 282 | BP_send( (char *) &packet_sbm_bp1, queue_id_send, |
|
283 | 283 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 + PACKET_LENGTH_DELTA, |
|
284 | 284 | sid ); |
|
285 | 285 | // 4) compute the BP2 set if needed |
|
286 | 286 | if ( (incomingMsg->event & RTEMS_EVENT_BURST_BP2_F1) || (incomingMsg->event & RTEMS_EVENT_SBM_BP2_F1) ) |
|
287 | 287 | { |
|
288 | 288 | // 1) compute the BP2 set |
|
289 |
BP2_set( compressed_sm_sbm_f1, NB_BINS_COMPRESSED_SM_SBM_F1, packet_ |
|
|
289 | BP2_set( compressed_sm_sbm_f1, NB_BINS_COMPRESSED_SM_SBM_F1, packet_sbm_bp2.data ); | |
|
290 | 290 | // 2) send the BP2 set |
|
291 | 291 | set_time( packet_sbm_bp2.time, (unsigned char *) &incomingMsg->coarseTimeSBM ); |
|
292 | 292 | set_time( packet_sbm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM ); |
|
293 | 293 | packet_sbm_bp2.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters; |
|
294 | 294 | BP_send( (char *) &packet_sbm_bp2, queue_id_send, |
|
295 | 295 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 + PACKET_LENGTH_DELTA, |
|
296 | 296 | sid ); |
|
297 | 297 | } |
|
298 | 298 | } |
|
299 | 299 | |
|
300 | 300 | //***** |
|
301 | 301 | //***** |
|
302 | 302 | // NORM |
|
303 | 303 | //***** |
|
304 | 304 | //***** |
|
305 | 305 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F1) |
|
306 | 306 | { |
|
307 | 307 | // 1) compress the matrix for Basic Parameters calculation |
|
308 | 308 | ASM_compress_reorganize_and_divide( asm_f1_patched_norm, compressed_sm_norm_f1, |
|
309 | 309 | nb_sm_before_f1.norm_bp1, |
|
310 | 310 | NB_BINS_COMPRESSED_SM_F1, NB_BINS_TO_AVERAGE_ASM_F1, |
|
311 | 311 | ASM_F1_INDICE_START ); |
|
312 | 312 | // 2) compute the BP1 set |
|
313 | 313 | BP1_set( compressed_sm_norm_f1, k_coeff_intercalib_f1_norm, NB_BINS_COMPRESSED_SM_F1, packet_norm_bp1.data ); |
|
314 | 314 | // 3) send the BP1 set |
|
315 | 315 | set_time( packet_norm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeNORM ); |
|
316 | 316 | set_time( packet_norm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM ); |
|
317 | 317 | packet_norm_bp1.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters; |
|
318 | 318 | BP_send( (char *) &packet_norm_bp1, queue_id_send, |
|
319 | 319 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 + PACKET_LENGTH_DELTA, |
|
320 | 320 | SID_NORM_BP1_F1 ); |
|
321 | 321 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F1) |
|
322 | 322 | { |
|
323 | 323 | // 1) compute the BP2 set |
|
324 | 324 | BP2_set( compressed_sm_norm_f1, NB_BINS_COMPRESSED_SM_F1, packet_norm_bp2.data ); |
|
325 | 325 | // 2) send the BP2 set |
|
326 | 326 | set_time( packet_norm_bp2.time, (unsigned char *) &incomingMsg->coarseTimeNORM ); |
|
327 | 327 | set_time( packet_norm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM ); |
|
328 | 328 | packet_norm_bp2.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters; |
|
329 | 329 | BP_send( (char *) &packet_norm_bp2, queue_id_send, |
|
330 | 330 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 + PACKET_LENGTH_DELTA, |
|
331 | 331 | SID_NORM_BP2_F1 ); |
|
332 | 332 | } |
|
333 | 333 | } |
|
334 | 334 | |
|
335 | 335 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F1) |
|
336 | 336 | { |
|
337 | 337 | // 1) reorganize the ASM and divide |
|
338 | 338 | ASM_reorganize_and_divide( asm_f1_patched_norm, |
|
339 | 339 | (float*) current_ring_node_to_send_asm_f1->buffer_address, |
|
340 | 340 | nb_sm_before_f1.norm_bp1 ); |
|
341 | 341 | current_ring_node_to_send_asm_f1->coarseTime = incomingMsg->coarseTimeNORM; |
|
342 | 342 | current_ring_node_to_send_asm_f1->fineTime = incomingMsg->fineTimeNORM; |
|
343 | 343 | current_ring_node_to_send_asm_f1->sid = SID_NORM_ASM_F1; |
|
344 | 344 | // 3) send the spectral matrix packets |
|
345 | 345 | status = rtems_message_queue_send( queue_id_send, ¤t_ring_node_to_send_asm_f1, sizeof( ring_node* ) ); |
|
346 | 346 | // change asm ring node |
|
347 | 347 | current_ring_node_to_send_asm_f1 = current_ring_node_to_send_asm_f1->next; |
|
348 | 348 | } |
|
349 | 349 | |
|
350 | 350 | update_queue_max_count( queue_id_q_p1, &hk_lfr_q_p1_fifo_size_max ); |
|
351 | 351 | |
|
352 | 352 | } |
|
353 | 353 | } |
|
354 | 354 | |
|
355 | 355 | //********** |
|
356 | 356 | // FUNCTIONS |
|
357 | 357 | |
|
358 | 358 | void reset_nb_sm_f1( unsigned char lfrMode ) |
|
359 | 359 | { |
|
360 | 360 | nb_sm_before_f1.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 16; |
|
361 | 361 | nb_sm_before_f1.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 16; |
|
362 | 362 | nb_sm_before_f1.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 16; |
|
363 | 363 | nb_sm_before_f1.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 16; |
|
364 | 364 | nb_sm_before_f1.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 16; |
|
365 | 365 | nb_sm_before_f1.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 16; |
|
366 | 366 | nb_sm_before_f1.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 16; |
|
367 | 367 | |
|
368 | 368 | if (lfrMode == LFR_MODE_SBM2) |
|
369 | 369 | { |
|
370 | 370 | nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.sbm2_bp1; |
|
371 | 371 | nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.sbm2_bp2; |
|
372 | 372 | } |
|
373 | 373 | else if (lfrMode == LFR_MODE_BURST) |
|
374 | 374 | { |
|
375 | 375 | nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1; |
|
376 | 376 | nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2; |
|
377 | 377 | } |
|
378 | 378 | else |
|
379 | 379 | { |
|
380 | 380 | nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1; |
|
381 | 381 | nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2; |
|
382 | 382 | } |
|
383 | 383 | } |
|
384 | 384 | |
|
385 | 385 | void init_k_coefficients_f1( void ) |
|
386 | 386 | { |
|
387 | 387 | init_k_coefficients( k_coeff_intercalib_f1_norm, NB_BINS_COMPRESSED_SM_F1 ); |
|
388 | 388 | init_k_coefficients( k_coeff_intercalib_f1_sbm, NB_BINS_COMPRESSED_SM_SBM_F1); |
|
389 | 389 | } |
General Comments 0
You need to be logged in to leave comments.
Login now