Line data Source code
1 : /*------------------------------------------------------------------------------
2 : -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
3 : -- This file is a part of the LFR FSW
4 : -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
5 : --
6 : -- This program is free software; you can redistribute it and/or modify
7 : -- it under the terms of the GNU General Public License as published by
8 : -- the Free Software Foundation; either version 2 of the License, or
9 : -- (at your option) any later version.
10 : --
11 : -- This program is distributed in the hope that it will be useful,
12 : -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : -- GNU General Public License for more details.
15 : --
16 : -- You should have received a copy of the GNU General Public License
17 : -- along with this program; if not, write to the Free Software
18 : -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 : -------------------------------------------------------------------------------*/
20 : /*-- Author : Paul Leroy
21 : -- Contact : Alexis Jeandet
22 : -- Mail : alexis.jeandet@lpp.polytechnique.fr
23 : ----------------------------------------------------------------------------*/
24 :
25 : /** Functions related to data processing.
26 : *
27 : * @file
28 : * @author P. LEROY
29 : *
30 : * These function are related to data processing, i.e. spectral matrices averaging and basic
31 : * parameters computation.
32 : *
33 : */
34 : #include <string.h>
35 :
36 : #include "avf0_prc0.h"
37 : #include "fsw_compile_warnings.h"
38 : #include "fsw_debug.h"
39 :
40 : typedef struct
41 : {
42 : unsigned int norm_bp1;
43 : unsigned int norm_bp2;
44 : unsigned int norm_asm;
45 : unsigned int burst_sbm_bp1;
46 : unsigned int burst_sbm_bp2;
47 : unsigned int burst_bp1;
48 : unsigned int burst_bp2;
49 : unsigned int sbm1_bp1;
50 : unsigned int sbm1_bp2;
51 : unsigned int sbm2_bp1;
52 : unsigned int sbm2_bp2;
53 : } nb_sm_before_bp_asm_f0;
54 :
55 :
56 : DISABLE_MISSING_FIELD_INITIALIZER_WARNING
57 : nb_sm_before_bp_asm_f0 nb_sm_before_f0 = { 0 };
58 : //***
59 : // F0
60 : ring_node_asm asm_ring_norm_f0[NB_RING_NODES_ASM_NORM_F0] = { { 0 } };
61 : ring_node_asm asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0] = { { 0 } };
62 :
63 : ring_node ring_to_send_asm_f0[NB_RING_NODES_ASM_F0] = { { 0 } };
64 : ENABLE_MISSING_FIELD_INITIALIZER_WARNING
65 :
66 : int buffer_asm_f0[NB_RING_NODES_ASM_F0 * TOTAL_SIZE_SM] = { 0 };
67 :
68 : float asm_f0_patched_norm[TOTAL_SIZE_SM] = { 0 };
69 : float asm_f0_patched_burst_sbm[TOTAL_SIZE_SM] = { 0 };
70 : float asm_f0_reorganized[TOTAL_SIZE_SM] = { 0 };
71 :
72 : float compressed_sm_norm_f0[TOTAL_SIZE_COMPRESSED_ASM_NORM_F0] = { 0 };
73 : float compressed_sm_sbm_f0[TOTAL_SIZE_COMPRESSED_ASM_SBM_F0] = { 0 };
74 :
75 :
76 : //************
77 : // RTEMS TASKS
78 :
79 146 : LFR_NO_RETURN rtems_task avf0_task(rtems_task_argument lfrRequestedMode)
80 : {
81 :
82 : rtems_event_set event_out;
83 : rtems_status_code status;
84 : rtems_id queue_id_prc0;
85 : asm_msg msgForPRC;
86 : ring_node* nodeForAveraging;
87 : ring_node* ring_node_tab[NB_SM_BEFORE_AVF0_F1];
88 : ring_node_asm* current_ring_node_asm_burst_sbm_f0;
89 : ring_node_asm* current_ring_node_asm_norm_f0;
90 :
91 : unsigned int nb_norm_bp1;
92 : unsigned int nb_norm_bp2;
93 : unsigned int nb_norm_asm;
94 : unsigned int nb_sbm_bp1;
95 : unsigned int nb_sbm_bp2;
96 :
97 146 : nb_norm_bp1 = 0;
98 146 : nb_norm_bp2 = 0;
99 146 : nb_norm_asm = 0;
100 146 : nb_sbm_bp1 = 0;
101 146 : nb_sbm_bp2 = 0;
102 146 : event_out = EVENT_SETS_NONE_PENDING;
103 146 : queue_id_prc0 = RTEMS_ID_NONE;
104 :
105 146 : reset_nb_sm_f0((char)lfrRequestedMode); // reset the sm counters that drive the BP and ASM
106 : // computations / transmissions
107 146 : ASM_generic_init_ring(asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0);
108 146 : ASM_generic_init_ring(asm_ring_burst_sbm_f0, NB_RING_NODES_ASM_BURST_SBM_F0);
109 146 : current_ring_node_asm_norm_f0 = asm_ring_norm_f0;
110 146 : current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0;
111 :
112 : BOOT_PRINTF("in AVFO *** lfrRequestedMode = %d\n", (int)lfrRequestedMode);
113 :
114 146 : status = get_message_queue_id_prc0(&queue_id_prc0);
115 146 : if (status != RTEMS_SUCCESSFUL)
116 : {
117 : LFR_PRINTF("in MATR *** ERR get_message_queue_id_prc0 %d\n", status);
118 : }
119 :
120 : while (1)
121 : {
122 15230 : status = rtems_event_receive(
123 : RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
124 : DEBUG_CHECK_STATUS(status);
125 :
126 : //****************************************
127 : // initialize the mesage for the MATR task
128 15114 : msgForPRC.norm = current_ring_node_asm_norm_f0;
129 15114 : msgForPRC.burst_sbm = current_ring_node_asm_burst_sbm_f0;
130 15114 : msgForPRC.event
131 : = EVENT_SETS_NONE_PENDING; // this composite event will be sent to the PRC0 task
132 : //
133 : //****************************************
134 :
135 15114 : nodeForAveraging = getRingNodeForAveraging(0);
136 : DEBUG_CHECK_PTR(nodeForAveraging);
137 136026 : for (int i = NB_SM_BEFORE_AVF0_F1 - 1; i >= 0; i--)
138 : {
139 120912 : ring_node_tab[i] = nodeForAveraging;
140 120912 : nodeForAveraging = nodeForAveraging->previous;
141 : }
142 :
143 : // compute the average and store it in the averaged_sm_f1 buffer
144 15114 : SM_average(current_ring_node_asm_norm_f0->matrix,
145 : current_ring_node_asm_burst_sbm_f0->matrix, ring_node_tab, nb_norm_bp1, nb_sbm_bp1,
146 : &msgForPRC, 0, ASM_F0_INDICE_START,
147 : ASM_F0_KEEP_BINS); // 0 => frequency channel 0
148 :
149 : // update nb_average
150 15084 : nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0_F1;
151 15084 : nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0_F1;
152 15084 : nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0_F1;
153 15084 : nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0_F1;
154 15084 : nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0_F1;
155 :
156 15084 : if (nb_sbm_bp1 == nb_sm_before_f0.burst_sbm_bp1)
157 : {
158 1577 : nb_sbm_bp1 = 0;
159 : // set another ring for the ASM storage
160 1577 : current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next;
161 : DEBUG_CHECK_PTR(current_ring_node_asm_burst_sbm_f0);
162 1577 : if (lfrCurrentMode == LFR_MODE_BURST)
163 : {
164 706 : msgForPRC.event = msgForPRC.event | RTEMS_EVENT_BURST_BP1_F0;
165 : }
166 871 : else if ((lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2))
167 : {
168 703 : msgForPRC.event = msgForPRC.event | RTEMS_EVENT_SBM_BP1_F0;
169 : }
170 : }
171 :
172 15084 : if (nb_sbm_bp2 == nb_sm_before_f0.burst_sbm_bp2)
173 : {
174 287 : nb_sbm_bp2 = 0;
175 287 : if (lfrCurrentMode == LFR_MODE_BURST)
176 : {
177 130 : msgForPRC.event = msgForPRC.event | RTEMS_EVENT_BURST_BP2_F0;
178 : }
179 157 : else if ((lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2))
180 : {
181 137 : msgForPRC.event = msgForPRC.event | RTEMS_EVENT_SBM_BP2_F0;
182 : }
183 : }
184 :
185 15084 : if (nb_norm_bp1 == nb_sm_before_f0.norm_bp1)
186 : {
187 246 : nb_norm_bp1 = 0;
188 : // set another ring for the ASM storage
189 246 : current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next;
190 : DEBUG_CHECK_PTR(current_ring_node_asm_norm_f0);
191 449 : if ((lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1)
192 449 : || (lfrCurrentMode == LFR_MODE_SBM2))
193 : {
194 82 : msgForPRC.event = msgForPRC.event | RTEMS_EVENT_NORM_BP1_F0;
195 : }
196 : }
197 :
198 15084 : if (nb_norm_bp2 == nb_sm_before_f0.norm_bp2)
199 : {
200 39 : nb_norm_bp2 = 0;
201 73 : if ((lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1)
202 73 : || (lfrCurrentMode == LFR_MODE_SBM2))
203 : {
204 9 : msgForPRC.event = msgForPRC.event | RTEMS_EVENT_NORM_BP2_F0;
205 : }
206 : }
207 :
208 15084 : if (nb_norm_asm == nb_sm_before_f0.norm_asm)
209 : {
210 164 : nb_norm_asm = 0;
211 313 : if ((lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1)
212 313 : || (lfrCurrentMode == LFR_MODE_SBM2))
213 : {
214 15 : msgForPRC.event = msgForPRC.event | RTEMS_EVENT_NORM_ASM_F0;
215 : }
216 : }
217 :
218 : //*************************
219 : // send the message to PRC
220 15084 : if (msgForPRC.event != EVENT_SETS_NONE_PENDING)
221 : {
222 1437 : status = rtems_message_queue_send(queue_id_prc0, (char*)&msgForPRC, sizeof(asm_msg));
223 : DEBUG_CHECK_STATUS(status);
224 : }
225 :
226 15084 : if (status != RTEMS_SUCCESSFUL)
227 : {
228 : LFR_PRINTF("in AVF0 *** Error sending message to PRC, code %d\n", status);
229 : }
230 : }
231 : }
232 :
233 146 : LFR_NO_RETURN rtems_task prc0_task(rtems_task_argument lfrRequestedMode)
234 : {
235 : char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
236 : size_t size; // size of the incoming TC packet
237 : asm_msg* incomingMsg;
238 : //
239 : rtems_id queue_id;
240 : rtems_id queue_id_q_p0;
241 : bp_packet_with_spare __attribute__((aligned(4))) packet_norm_bp1;
242 : bp_packet __attribute__((aligned(4))) packet_norm_bp2;
243 : bp_packet __attribute__((aligned(4))) packet_sbm_bp1;
244 : bp_packet __attribute__((aligned(4))) packet_sbm_bp2;
245 : ring_node* current_ring_node_to_send_asm_f0;
246 146 : float nbSMInASMNORM = 0;
247 146 : float nbSMInASMSBM = 0;
248 :
249 146 : size = 0;
250 146 : queue_id = RTEMS_ID_NONE;
251 146 : queue_id_q_p0 = RTEMS_ID_NONE;
252 146 : memset(&packet_norm_bp1, 0, sizeof(bp_packet_with_spare));
253 146 : memset(&packet_norm_bp2, 0, sizeof(bp_packet));
254 146 : memset(&packet_sbm_bp1, 0, sizeof(bp_packet));
255 146 : memset(&packet_sbm_bp2, 0, sizeof(bp_packet));
256 :
257 : // init the ring of the averaged spectral matrices which will be transmitted to the DPU
258 146 : init_ring(
259 : ring_to_send_asm_f0, NB_RING_NODES_ASM_F0, (volatile int*)buffer_asm_f0, TOTAL_SIZE_SM);
260 146 : current_ring_node_to_send_asm_f0 = ring_to_send_asm_f0;
261 : DEBUG_CHECK_PTR(current_ring_node_to_send_asm_f0);
262 :
263 : //*************
264 : // NORM headers
265 146 : BP_init_header_with_spare(&packet_norm_bp1, APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0,
266 : PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0);
267 146 : BP_init_header(&packet_norm_bp2, APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0,
268 : PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0);
269 :
270 : //****************************
271 : // BURST SBM1 and SBM2 headers
272 146 : if (lfrRequestedMode == LFR_MODE_BURST)
273 : {
274 36 : BP_init_header(&packet_sbm_bp1, APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0,
275 : PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
276 36 : BP_init_header(&packet_sbm_bp2, APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0,
277 : PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
278 : }
279 110 : else if (lfrRequestedMode == LFR_MODE_SBM1)
280 : {
281 36 : BP_init_header(&packet_sbm_bp1, APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0,
282 : PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
283 36 : BP_init_header(&packet_sbm_bp2, APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0,
284 : PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
285 : }
286 74 : else if (lfrRequestedMode == LFR_MODE_SBM2)
287 : {
288 38 : BP_init_header(&packet_sbm_bp1, APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0,
289 : PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
290 38 : BP_init_header(&packet_sbm_bp2, APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0,
291 : PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
292 : }
293 : else
294 : {
295 : LFR_PRINTF("in PRC0 *** lfrRequestedMode is %d, several headers not initialized\n",
296 : (unsigned int)lfrRequestedMode);
297 : }
298 :
299 146 : DEBUG_CHECK_STATUS(get_message_queue_id_send(&queue_id));
300 146 : DEBUG_CHECK_STATUS(get_message_queue_id_prc0(&queue_id_q_p0));
301 :
302 : BOOT_PRINTF("in PRC0 *** lfrRequestedMode = %d\n", (int)lfrRequestedMode);
303 :
304 : while (1)
305 : {
306 : // wait for a message coming from AVF0
307 1579 : DEBUG_CHECK_STATUS(rtems_message_queue_receive(
308 : queue_id_q_p0, incomingData, &size, RTEMS_WAIT, RTEMS_NO_TIMEOUT));
309 :
310 1433 : incomingMsg = (asm_msg*)incomingData;
311 : DEBUG_CHECK_PTR(incomingMsg);
312 :
313 : //****************
314 : //****************
315 : // BURST SBM1 SBM2
316 : //****************
317 : //****************
318 1433 : if ((incomingMsg->event & RTEMS_EVENT_BURST_BP1_F0)
319 : || (incomingMsg->event & RTEMS_EVENT_SBM_BP1_F0))
320 : {
321 1405 : SM_calibrate_and_reorder_f0(incomingMsg->burst_sbm->matrix, asm_f0_patched_burst_sbm);
322 1405 : nbSMInASMSBM = (float)incomingMsg->numberOfSMInASMSBM;
323 :
324 : // 1) compress the matrix for Basic Parameters calculation
325 1405 : ASM_compress_divide_and_mask(asm_f0_patched_burst_sbm, compressed_sm_sbm_f0,
326 : nbSMInASMSBM, NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0,
327 : ASM_F0_INDICE_START, CHANNELF0);
328 : // 2) compute the BP1 set
329 1405 : compute_BP1(compressed_sm_sbm_f0, NB_BINS_COMPRESSED_SM_SBM_F0, packet_sbm_bp1.data);
330 : // 3) send the BP1 set
331 1405 : set_time(packet_sbm_bp1.time, (unsigned char*)&incomingMsg->coarseTimeSBM);
332 1405 : set_time(packet_sbm_bp1.acquisitionTime, (unsigned char*)&incomingMsg->coarseTimeSBM);
333 1405 : packet_sbm_bp1.pa_bia_status_info = pa_bia_status_info;
334 1405 : packet_sbm_bp1.sy_lfr_common_parameters
335 1405 : = parameter_dump_packet.sy_lfr_common_parameters;
336 1405 : BP_send_s1_s2((char*)&packet_sbm_bp1, queue_id,
337 : PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA);
338 : // 4) compute the BP2 set if needed
339 1405 : if ((incomingMsg->event & RTEMS_EVENT_BURST_BP2_F0)
340 : || (incomingMsg->event & RTEMS_EVENT_SBM_BP2_F0))
341 : {
342 : // 1) compute the BP2 set
343 266 : compute_BP2(
344 : compressed_sm_sbm_f0, NB_BINS_COMPRESSED_SM_SBM_F0, packet_sbm_bp2.data);
345 : // 2) send the BP2 set
346 266 : set_time(packet_sbm_bp2.time, (unsigned char*)&incomingMsg->coarseTimeSBM);
347 266 : set_time(
348 266 : packet_sbm_bp2.acquisitionTime, (unsigned char*)&incomingMsg->coarseTimeSBM);
349 266 : packet_sbm_bp2.pa_bia_status_info = pa_bia_status_info;
350 266 : packet_sbm_bp2.sy_lfr_common_parameters
351 266 : = parameter_dump_packet.sy_lfr_common_parameters;
352 266 : BP_send_s1_s2((char*)&packet_sbm_bp2, queue_id,
353 : PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA);
354 : }
355 : }
356 :
357 : //*****
358 : //*****
359 : // NORM
360 : //*****
361 : //*****
362 1433 : if ((incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0)
363 : || (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0))
364 : {
365 80 : SM_calibrate_and_reorder_f0(incomingMsg->norm->matrix, asm_f0_patched_norm);
366 80 : nbSMInASMNORM = (float)incomingMsg->numberOfSMInASMNORM;
367 : }
368 :
369 1433 : if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0)
370 : {
371 : // 1) compress the matrix for Basic Parameters calculation
372 80 : ASM_compress_divide_and_mask(asm_f0_patched_norm, compressed_sm_norm_f0, nbSMInASMNORM,
373 : NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, ASM_F0_INDICE_START,
374 : CHANNELF0);
375 : // 2) compute the BP1 set
376 80 : compute_BP1(compressed_sm_norm_f0, NB_BINS_COMPRESSED_SM_F0, packet_norm_bp1.data);
377 :
378 : // 3) send the BP1 set
379 80 : set_time(packet_norm_bp1.time, (unsigned char*)&incomingMsg->coarseTimeNORM);
380 80 : set_time(packet_norm_bp1.acquisitionTime, (unsigned char*)&incomingMsg->coarseTimeNORM);
381 80 : packet_norm_bp1.pa_bia_status_info = pa_bia_status_info;
382 80 : packet_norm_bp1.sy_lfr_common_parameters
383 80 : = parameter_dump_packet.sy_lfr_common_parameters;
384 80 : BP_send((char*)&packet_norm_bp1, queue_id,
385 : PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA);
386 80 : if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0)
387 : {
388 : // 1) compute the BP2 set using the same ASM as the one used for BP1
389 9 : compute_BP2(compressed_sm_norm_f0, NB_BINS_COMPRESSED_SM_F0, packet_norm_bp2.data);
390 : // 2) send the BP2 set
391 9 : set_time(packet_norm_bp2.time, (unsigned char*)&incomingMsg->coarseTimeNORM);
392 9 : set_time(
393 9 : packet_norm_bp2.acquisitionTime, (unsigned char*)&incomingMsg->coarseTimeNORM);
394 9 : packet_norm_bp2.pa_bia_status_info = pa_bia_status_info;
395 9 : packet_norm_bp2.sy_lfr_common_parameters
396 9 : = parameter_dump_packet.sy_lfr_common_parameters;
397 9 : BP_send((char*)&packet_norm_bp2, queue_id,
398 : PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA);
399 : }
400 : }
401 :
402 1433 : if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0)
403 : {
404 : // 1) reorganize the ASM and divide
405 15 : ASM_divide(asm_f0_patched_norm,
406 15 : (float*)current_ring_node_to_send_asm_f0->buffer_address, nbSMInASMNORM,
407 : ASM_F0_INDICE_START, ASM_F0_INDICE_START + ASM_F0_KEEP_BINS);
408 15 : current_ring_node_to_send_asm_f0->coarseTime = incomingMsg->coarseTimeNORM;
409 15 : current_ring_node_to_send_asm_f0->fineTime = incomingMsg->fineTimeNORM;
410 15 : current_ring_node_to_send_asm_f0->packet_id = SID_NORM_ASM_F0;
411 :
412 : // 3) send the spectral matrix packets
413 15 : DEBUG_CHECK_STATUS(rtems_message_queue_send(
414 : queue_id, ¤t_ring_node_to_send_asm_f0, sizeof(ring_node*)));
415 :
416 : // change asm ring node
417 15 : current_ring_node_to_send_asm_f0 = current_ring_node_to_send_asm_f0->next;
418 : }
419 :
420 1433 : update_queue_max_count(queue_id_q_p0, &hk_lfr_q_p0_fifo_size_max);
421 1433 : }
422 : }
423 :
424 : //**********
425 : // FUNCTIONS
426 :
427 146 : void reset_nb_sm_f0(unsigned char lfrMode)
428 : {
429 146 : nb_sm_before_f0.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * NB_SM_PER_S_F0;
430 146 : nb_sm_before_f0.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * NB_SM_PER_S_F0;
431 292 : nb_sm_before_f0.norm_asm = ((parameter_dump_packet.sy_lfr_n_asm_p[0] * 256)
432 146 : + parameter_dump_packet.sy_lfr_n_asm_p[1])
433 : * NB_SM_PER_S_F0;
434 146 : nb_sm_before_f0.sbm1_bp1
435 146 : = parameter_dump_packet.sy_lfr_s1_bp_p0 * NB_SM_PER_S1_BP_P0; // 0.25 s per digit
436 146 : nb_sm_before_f0.sbm1_bp2 = parameter_dump_packet.sy_lfr_s1_bp_p1 * NB_SM_PER_S_F0;
437 146 : nb_sm_before_f0.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * NB_SM_PER_S_F0;
438 146 : nb_sm_before_f0.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * NB_SM_PER_S_F0;
439 146 : nb_sm_before_f0.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * NB_SM_PER_S_F0;
440 146 : nb_sm_before_f0.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * NB_SM_PER_S_F0;
441 :
442 146 : if (lfrMode == LFR_MODE_SBM1)
443 : {
444 36 : nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm1_bp1;
445 36 : nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm1_bp2;
446 : }
447 110 : else if (lfrMode == LFR_MODE_SBM2)
448 : {
449 38 : nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm2_bp1;
450 38 : nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm2_bp2;
451 : }
452 : else // if (lfrMode == LFR_MODE_BURST) Don't know why default is the same than burst
453 : {
454 72 : nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1;
455 72 : nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2;
456 : }
457 146 : }
|