LCOV - code coverage report
Current view: top level - src/processing - avf1_prc1.c (source / functions) Hit Total Coverage
Test: trace.info Lines: 128 151 84.8 %
Date: 2023-02-20 11:47:14 Functions: 3 3 100.0 %

          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             : 
      35             : #include "avf1_prc1.h"
      36             : #include "fsw_compile_warnings.h"
      37             : #include "fsw_debug.h"
      38             : 
      39             : typedef struct
      40             : {
      41             :     unsigned int norm_bp1;
      42             :     unsigned int norm_bp2;
      43             :     unsigned int norm_asm;
      44             :     unsigned int burst_sbm_bp1;
      45             :     unsigned int burst_sbm_bp2;
      46             :     unsigned int burst_bp1;
      47             :     unsigned int burst_bp2;
      48             :     unsigned int sbm2_bp1;
      49             :     unsigned int sbm2_bp2;
      50             : } nb_sm_before_bp_asm_f1;
      51             : 
      52             : DISABLE_MISSING_FIELD_INITIALIZER_WARNING
      53             : nb_sm_before_bp_asm_f1 nb_sm_before_f1 = { 0 };
      54             : 
      55             : //***
      56             : // F1
      57             : ring_node_asm asm_ring_norm_f1[NB_RING_NODES_ASM_NORM_F1] = { { 0 } };
      58             : ring_node_asm asm_ring_burst_sbm_f1[NB_RING_NODES_ASM_BURST_SBM_F1] = { { 0 } };
      59             : ring_node ring_to_send_asm_f1[NB_RING_NODES_ASM_F1] = { { 0 } };
      60             : ENABLE_MISSING_FIELD_INITIALIZER_WARNING
      61             : 
      62             : int buffer_asm_f1[NB_RING_NODES_ASM_F1 * TOTAL_SIZE_SM] = { 0 };
      63             : 
      64             : float asm_f1_patched_norm[TOTAL_SIZE_SM] = { 0 };
      65             : float asm_f1_patched_burst_sbm[TOTAL_SIZE_SM] = { 0 };
      66             : float asm_f1_reorganized[TOTAL_SIZE_SM] = { 0 };
      67             : 
      68             : float compressed_sm_norm_f1[TOTAL_SIZE_COMPRESSED_ASM_NORM_F1] = { 0 };
      69             : float compressed_sm_sbm_f1[TOTAL_SIZE_COMPRESSED_ASM_SBM_F1] = { 0 };
      70             : 
      71             : 
      72             : //************
      73             : // RTEMS TASKS
      74             : 
      75           4 : LFR_NO_RETURN rtems_task avf1_task(rtems_task_argument lfrRequestedMode)
      76             : {
      77             : 
      78             :     rtems_event_set event_out;
      79             :     rtems_status_code status;
      80             :     rtems_id queue_id_prc1;
      81             :     asm_msg msgForPRC;
      82             :     ring_node* nodeForAveraging;
      83             :     ring_node* ring_node_tab[NB_SM_BEFORE_AVF0_F1];
      84             :     ring_node_asm* current_ring_node_asm_burst_sbm_f1;
      85             :     ring_node_asm* current_ring_node_asm_norm_f1;
      86             : 
      87             :     unsigned int nb_norm_bp1;
      88             :     unsigned int nb_norm_bp2;
      89             :     unsigned int nb_norm_asm;
      90             :     unsigned int nb_sbm_bp1;
      91             :     unsigned int nb_sbm_bp2;
      92             : 
      93           4 :     event_out = EVENT_SETS_NONE_PENDING;
      94           4 :     queue_id_prc1 = RTEMS_ID_NONE;
      95             : 
      96           4 :     nb_norm_bp1 = 0;
      97           4 :     nb_norm_bp2 = 0;
      98           4 :     nb_norm_asm = 0;
      99           4 :     nb_sbm_bp1 = 0;
     100           4 :     nb_sbm_bp2 = 0;
     101             : 
     102           4 :     reset_nb_sm_f1((unsigned char)lfrRequestedMode); // reset the sm counters that drive the BP and
     103             :                                                      // ASM computations / transmissions
     104           4 :     ASM_generic_init_ring(asm_ring_norm_f1, NB_RING_NODES_ASM_NORM_F1);
     105           4 :     ASM_generic_init_ring(asm_ring_burst_sbm_f1, NB_RING_NODES_ASM_BURST_SBM_F1);
     106           4 :     current_ring_node_asm_norm_f1 = asm_ring_norm_f1;
     107           4 :     current_ring_node_asm_burst_sbm_f1 = asm_ring_burst_sbm_f1;
     108             : 
     109             :     BOOT_PRINTF("in AVF1 *** lfrRequestedMode = %d\n", (int)lfrRequestedMode);
     110             : 
     111           4 :     status = get_message_queue_id_prc1(&queue_id_prc1);
     112             :     DEBUG_CHECK_STATUS(status);
     113           4 :     if (status != RTEMS_SUCCESSFUL)
     114             :     {
     115             :         LFR_PRINTF("in AVF1 *** ERR get_message_queue_id_prc1 %d\n", status);
     116             :     }
     117             : 
     118             :     while (1)
     119             :     {
     120          88 :         status = rtems_event_receive(
     121             :             RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
     122             :         DEBUG_CHECK_STATUS(status);
     123             : 
     124             :         //****************************************
     125             :         // initialize the mesage for the MATR task
     126          84 :         msgForPRC.norm = current_ring_node_asm_norm_f1;
     127          84 :         msgForPRC.burst_sbm = current_ring_node_asm_burst_sbm_f1;
     128          84 :         msgForPRC.event
     129             :             = EVENT_SETS_NONE_PENDING; // this composite event will be sent to the PRC1 task
     130             :         //
     131             :         //****************************************
     132             : 
     133          84 :         nodeForAveraging = getRingNodeForAveraging(1);
     134             :         DEBUG_CHECK_PTR(nodeForAveraging);
     135         756 :         for (int i = NB_SM_BEFORE_AVF0_F1; i > 0; i--)
     136             :         {
     137         672 :             ring_node_tab[i - 1] = nodeForAveraging;
     138         672 :             nodeForAveraging = nodeForAveraging->previous;
     139             :         }
     140             : 
     141             :         // compute the average and store it in the averaged_sm_f1 buffer
     142          84 :         SM_average(current_ring_node_asm_norm_f1->matrix,
     143             :             current_ring_node_asm_burst_sbm_f1->matrix, ring_node_tab, nb_norm_bp1, nb_sbm_bp1,
     144             :             &msgForPRC, 1, ASM_F1_INDICE_START,
     145             :             ASM_F1_KEEP_BINS); // 1 => frequency channel 1
     146             : 
     147             :         // update nb_average
     148          84 :         nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0_F1;
     149          84 :         nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0_F1;
     150          84 :         nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0_F1;
     151          84 :         nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0_F1;
     152          84 :         nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0_F1;
     153             : 
     154          84 :         if (nb_sbm_bp1 == nb_sm_before_f1.burst_sbm_bp1)
     155             :         {
     156          40 :             nb_sbm_bp1 = 0;
     157             :             // set another ring for the ASM storage
     158          40 :             current_ring_node_asm_burst_sbm_f1 = current_ring_node_asm_burst_sbm_f1->next;
     159             :             DEBUG_CHECK_PTR(current_ring_node_asm_burst_sbm_f1);
     160          40 :             if (lfrCurrentMode == LFR_MODE_BURST)
     161             :             {
     162          10 :                 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_BURST_BP1_F1;
     163             :             }
     164          30 :             else if (lfrCurrentMode == LFR_MODE_SBM2)
     165             :             {
     166          10 :                 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_SBM_BP1_F1;
     167             :             }
     168             :         }
     169             : 
     170          84 :         if (nb_sbm_bp2 == nb_sm_before_f1.burst_sbm_bp2)
     171             :         {
     172           8 :             nb_sbm_bp2 = 0;
     173           8 :             if (lfrCurrentMode == LFR_MODE_BURST)
     174             :             {
     175           2 :                 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_BURST_BP2_F1;
     176             :             }
     177           6 :             else if (lfrCurrentMode == LFR_MODE_SBM2)
     178             :             {
     179           2 :                 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_SBM_BP2_F1;
     180             :             }
     181             :         }
     182             : 
     183          84 :         if (nb_norm_bp1 == nb_sm_before_f1.norm_bp1)
     184             :         {
     185           8 :             nb_norm_bp1 = 0;
     186             :             // set another ring for the ASM storage
     187           8 :             current_ring_node_asm_norm_f1 = current_ring_node_asm_norm_f1->next;
     188             :             DEBUG_CHECK_PTR(current_ring_node_asm_norm_f1);
     189          12 :             if ((lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1)
     190          12 :                 || (lfrCurrentMode == LFR_MODE_SBM2))
     191             :             {
     192           6 :                 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_NORM_BP1_F1;
     193             :             }
     194             :         }
     195             : 
     196          84 :         if (nb_norm_bp2 == nb_sm_before_f1.norm_bp2)
     197             :         {
     198           0 :             nb_norm_bp2 = 0;
     199           0 :             if ((lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1)
     200           0 :                 || (lfrCurrentMode == LFR_MODE_SBM2))
     201             :             {
     202           0 :                 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_NORM_BP2_F1;
     203             :             }
     204             :         }
     205             : 
     206          84 :         if (nb_norm_asm == nb_sm_before_f1.norm_asm)
     207             :         {
     208           0 :             nb_norm_asm = 0;
     209           0 :             if ((lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1)
     210           0 :                 || (lfrCurrentMode == LFR_MODE_SBM2))
     211             :             {
     212           0 :                 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_NORM_ASM_F1;
     213             :             }
     214             :         }
     215             : 
     216             :         //*************************
     217             :         // send the message to PRC
     218          84 :         if (msgForPRC.event != EVENT_SETS_NONE_PENDING)
     219             :         {
     220          24 :             status = rtems_message_queue_send(queue_id_prc1, (char*)&msgForPRC, sizeof(asm_msg));
     221             :             DEBUG_CHECK_STATUS(status);
     222             :         }
     223             : 
     224          84 :         if (status != RTEMS_SUCCESSFUL)
     225             :         {
     226             :             LFR_PRINTF("in AVF1 *** Error sending message to PRC1, code %d\n", status);
     227             :         }
     228             :     }
     229             : }
     230             : 
     231           4 : LFR_NO_RETURN rtems_task prc1_task(rtems_task_argument lfrRequestedMode)
     232             : {
     233             :     char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
     234             :     size_t size; // size of the incoming TC packet
     235             :     asm_msg* incomingMsg;
     236             :     //
     237             :     rtems_id queue_id_send;
     238             :     rtems_id queue_id_q_p1;
     239             :     bp_packet_with_spare __attribute__((aligned(4))) packet_norm_bp1;
     240             :     bp_packet __attribute__((aligned(4))) packet_norm_bp2;
     241             :     bp_packet __attribute__((aligned(4))) packet_sbm_bp1;
     242             :     bp_packet __attribute__((aligned(4))) packet_sbm_bp2;
     243             :     ring_node* current_ring_node_to_send_asm_f1;
     244           4 :     float nbSMInASMNORM = 0;
     245           4 :     float nbSMInASMSBM = 0;
     246             : 
     247           4 :     size = 0;
     248           4 :     queue_id_send = RTEMS_ID_NONE;
     249           4 :     queue_id_q_p1 = RTEMS_ID_NONE;
     250           4 :     memset(&packet_norm_bp1, 0, sizeof(bp_packet_with_spare));
     251           4 :     memset(&packet_norm_bp2, 0, sizeof(bp_packet));
     252           4 :     memset(&packet_sbm_bp1, 0, sizeof(bp_packet));
     253           4 :     memset(&packet_sbm_bp2, 0, sizeof(bp_packet));
     254             : 
     255             :     // init the ring of the averaged spectral matrices which will be transmitted to the DPU
     256           4 :     init_ring(
     257             :         ring_to_send_asm_f1, NB_RING_NODES_ASM_F1, (volatile int*)buffer_asm_f1, TOTAL_SIZE_SM);
     258           4 :     current_ring_node_to_send_asm_f1 = ring_to_send_asm_f1;
     259             :     DEBUG_CHECK_PTR(current_ring_node_to_send_asm_f1);
     260             : 
     261             :     //*************
     262             :     // NORM headers
     263           4 :     BP_init_header_with_spare(&packet_norm_bp1, APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F1,
     264             :         PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1, NB_BINS_COMPRESSED_SM_F1);
     265           4 :     BP_init_header(&packet_norm_bp2, APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F1,
     266             :         PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1, NB_BINS_COMPRESSED_SM_F1);
     267             : 
     268             :     //***********************
     269             :     // BURST and SBM2 headers
     270           4 :     if (lfrRequestedMode == LFR_MODE_BURST)
     271             :     {
     272           1 :         BP_init_header(&packet_sbm_bp1, APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F1,
     273             :             PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1, NB_BINS_COMPRESSED_SM_SBM_F1);
     274           1 :         BP_init_header(&packet_sbm_bp2, APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F1,
     275             :             PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1, NB_BINS_COMPRESSED_SM_SBM_F1);
     276             :     }
     277           3 :     else if (lfrRequestedMode == LFR_MODE_SBM2)
     278             :     {
     279           1 :         BP_init_header(&packet_sbm_bp1, APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F1,
     280             :             PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1, NB_BINS_COMPRESSED_SM_SBM_F1);
     281           1 :         BP_init_header(&packet_sbm_bp2, APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F1,
     282             :             PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1, NB_BINS_COMPRESSED_SM_SBM_F1);
     283             :     }
     284             :     else
     285             :     {
     286             :         LFR_PRINTF("in PRC1 *** lfrRequestedMode is %d, several headers not initialized\n",
     287             :             (unsigned int)lfrRequestedMode);
     288             :     }
     289             : 
     290           4 :     DEBUG_CHECK_STATUS(get_message_queue_id_send(&queue_id_send));
     291           4 :     DEBUG_CHECK_STATUS(get_message_queue_id_prc1(&queue_id_q_p1));
     292             : 
     293             :     BOOT_PRINTF("in PRC1 *** lfrRequestedMode = %d\n", (int)lfrRequestedMode);
     294             : 
     295             :     while (1)
     296             :     {
     297             :         // wait for a message coming from AVF0
     298          28 :         DEBUG_CHECK_STATUS(rtems_message_queue_receive(
     299             :             queue_id_q_p1, incomingData, &size, RTEMS_WAIT, RTEMS_NO_TIMEOUT));
     300             : 
     301          24 :         incomingMsg = (asm_msg*)incomingData;
     302             :         DEBUG_CHECK_PTR(incomingMsg);
     303             : 
     304             :         //***********
     305             :         //***********
     306             :         // BURST SBM2
     307             :         //***********
     308             :         //***********
     309          24 :         if ((incomingMsg->event & RTEMS_EVENT_BURST_BP1_F1)
     310             :             || (incomingMsg->event & RTEMS_EVENT_SBM_BP1_F1))
     311             :         {
     312          20 :             SM_calibrate_and_reorder_f1(incomingMsg->burst_sbm->matrix, asm_f1_patched_burst_sbm);
     313          20 :             nbSMInASMSBM = (float)incomingMsg->numberOfSMInASMSBM;
     314             :             // 1)  compress the matrix for Basic Parameters calculation
     315          20 :             ASM_compress_divide_and_mask(asm_f1_patched_burst_sbm, compressed_sm_sbm_f1,
     316             :                 nbSMInASMSBM, NB_BINS_COMPRESSED_SM_SBM_F1, NB_BINS_TO_AVERAGE_ASM_SBM_F1,
     317             :                 ASM_F1_INDICE_START, CHANNELF1);
     318             :             // 2) compute the BP1 set
     319          20 :             compute_BP1(compressed_sm_sbm_f1, NB_BINS_COMPRESSED_SM_SBM_F1, packet_sbm_bp1.data);
     320             :             // 3) send the BP1 set
     321          20 :             set_time(packet_sbm_bp1.time, (unsigned char*)&incomingMsg->coarseTimeSBM);
     322          20 :             set_time(packet_sbm_bp1.acquisitionTime, (unsigned char*)&incomingMsg->coarseTimeSBM);
     323          20 :             packet_sbm_bp1.pa_bia_status_info = pa_bia_status_info;
     324          20 :             packet_sbm_bp1.sy_lfr_common_parameters
     325          20 :                 = parameter_dump_packet.sy_lfr_common_parameters;
     326          20 :             BP_send_s1_s2((char*)&packet_sbm_bp1, queue_id_send,
     327             :                 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 + PACKET_LENGTH_DELTA);
     328             :             // 4) compute the BP2 set if needed
     329          20 :             if ((incomingMsg->event & RTEMS_EVENT_BURST_BP2_F1)
     330             :                 || (incomingMsg->event & RTEMS_EVENT_SBM_BP2_F1))
     331             :             {
     332             :                 // 1) compute the BP2 set
     333           4 :                 compute_BP2(
     334             :                     compressed_sm_sbm_f1, NB_BINS_COMPRESSED_SM_SBM_F1, packet_sbm_bp2.data);
     335             :                 // 2) send the BP2 set
     336           4 :                 set_time(packet_sbm_bp2.time, (unsigned char*)&incomingMsg->coarseTimeSBM);
     337           4 :                 set_time(
     338           4 :                     packet_sbm_bp2.acquisitionTime, (unsigned char*)&incomingMsg->coarseTimeSBM);
     339           4 :                 packet_sbm_bp2.pa_bia_status_info = pa_bia_status_info;
     340           4 :                 packet_sbm_bp2.sy_lfr_common_parameters
     341           4 :                     = parameter_dump_packet.sy_lfr_common_parameters;
     342           4 :                 BP_send_s1_s2((char*)&packet_sbm_bp2, queue_id_send,
     343             :                     PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 + PACKET_LENGTH_DELTA);
     344             :             }
     345             :         }
     346             : 
     347             :         //*****
     348             :         //*****
     349             :         // NORM
     350             :         //*****
     351             :         //*****
     352          24 :         if ((incomingMsg->event & RTEMS_EVENT_NORM_BP1_F1)
     353             :             || (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F1))
     354             :         {
     355           6 :             SM_calibrate_and_reorder_f1(incomingMsg->norm->matrix, asm_f1_patched_norm);
     356           6 :             nbSMInASMNORM = (float)incomingMsg->numberOfSMInASMNORM;
     357             :         }
     358             : 
     359          24 :         if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F1)
     360             :         {
     361             :             // 1)  compress the matrix for Basic Parameters calculation
     362           6 :             ASM_compress_divide_and_mask(asm_f1_patched_norm, compressed_sm_norm_f1, nbSMInASMNORM,
     363             :                 NB_BINS_COMPRESSED_SM_F1, NB_BINS_TO_AVERAGE_ASM_F1, ASM_F1_INDICE_START,
     364             :                 CHANNELF1);
     365             :             // 2) compute the BP1 set
     366           6 :             compute_BP1(compressed_sm_norm_f1, NB_BINS_COMPRESSED_SM_F1, packet_norm_bp1.data);
     367             :             // 3) send the BP1 set
     368           6 :             set_time(packet_norm_bp1.time, (unsigned char*)&incomingMsg->coarseTimeNORM);
     369           6 :             set_time(packet_norm_bp1.acquisitionTime, (unsigned char*)&incomingMsg->coarseTimeNORM);
     370           6 :             packet_norm_bp1.pa_bia_status_info = pa_bia_status_info;
     371           6 :             packet_norm_bp1.sy_lfr_common_parameters
     372           6 :                 = parameter_dump_packet.sy_lfr_common_parameters;
     373           6 :             BP_send((char*)&packet_norm_bp1, queue_id_send,
     374             :                 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 + PACKET_LENGTH_DELTA);
     375           6 :             if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F1)
     376             :             {
     377             :                 // 1) compute the BP2 set
     378           0 :                 compute_BP2(compressed_sm_norm_f1, NB_BINS_COMPRESSED_SM_F1, packet_norm_bp2.data);
     379             :                 // 2) send the BP2 set
     380           0 :                 set_time(packet_norm_bp2.time, (unsigned char*)&incomingMsg->coarseTimeNORM);
     381           0 :                 set_time(
     382           0 :                     packet_norm_bp2.acquisitionTime, (unsigned char*)&incomingMsg->coarseTimeNORM);
     383           0 :                 packet_norm_bp2.pa_bia_status_info = pa_bia_status_info;
     384           0 :                 packet_norm_bp2.sy_lfr_common_parameters
     385           0 :                     = parameter_dump_packet.sy_lfr_common_parameters;
     386           0 :                 BP_send((char*)&packet_norm_bp2, queue_id_send,
     387             :                     PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 + PACKET_LENGTH_DELTA);
     388             :             }
     389             :         }
     390             : 
     391          24 :         if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F1)
     392             :         {
     393             :             // 1) reorganize the ASM and divide
     394           0 :             ASM_divide(asm_f1_patched_norm,
     395           0 :                 (float*)current_ring_node_to_send_asm_f1->buffer_address, nbSMInASMNORM,
     396             :                 ASM_F1_INDICE_START, ASM_F1_INDICE_START + ASM_F1_KEEP_BINS);
     397           0 :             current_ring_node_to_send_asm_f1->coarseTime = incomingMsg->coarseTimeNORM;
     398           0 :             current_ring_node_to_send_asm_f1->fineTime = incomingMsg->fineTimeNORM;
     399           0 :             current_ring_node_to_send_asm_f1->packet_id = SID_NORM_ASM_F1;
     400             : 
     401             :             // 3) send the spectral matrix packets
     402           0 :             DEBUG_CHECK_STATUS(rtems_message_queue_send(
     403             :                 queue_id_send, &current_ring_node_to_send_asm_f1, sizeof(ring_node*)));
     404             : 
     405             :             // change asm ring node
     406           0 :             current_ring_node_to_send_asm_f1 = current_ring_node_to_send_asm_f1->next;
     407             :         }
     408             : 
     409          24 :         update_queue_max_count(queue_id_q_p1, &hk_lfr_q_p1_fifo_size_max);
     410          24 :     }
     411             : }
     412             : 
     413             : //**********
     414             : // FUNCTIONS
     415             : 
     416           4 : void reset_nb_sm_f1(unsigned char lfrMode)
     417             : {
     418           4 :     nb_sm_before_f1.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * NB_SM_PER_S_F1;
     419           4 :     nb_sm_before_f1.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * NB_SM_PER_S_F1;
     420           8 :     nb_sm_before_f1.norm_asm = ((parameter_dump_packet.sy_lfr_n_asm_p[0] * 256)
     421           4 :                                    + parameter_dump_packet.sy_lfr_n_asm_p[1])
     422             :         * NB_SM_PER_S_F1;
     423           4 :     nb_sm_before_f1.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * NB_SM_PER_S_F1;
     424           4 :     nb_sm_before_f1.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * NB_SM_PER_S_F1;
     425           4 :     nb_sm_before_f1.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * NB_SM_PER_S_F1;
     426           4 :     nb_sm_before_f1.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * NB_SM_PER_S_F1;
     427             : 
     428           4 :     if (lfrMode == LFR_MODE_SBM2)
     429             :     {
     430           1 :         nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.sbm2_bp1;
     431           1 :         nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.sbm2_bp2;
     432             :     }
     433             :     else // if (lfrMode == LFR_MODE_BURST) Don't know why default is the same than burst
     434             :     {
     435           3 :         nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1;
     436           3 :         nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2;
     437             :     }
     438           4 : }

Generated by: LCOV version 1.14