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) 2021, 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 : Alexis Jeandet 21 : -- Contact : Alexis Jeandet 22 : -- Mail : alexis.jeandet@lpp.polytechnique.fr 23 : ----------------------------------------------------------------------------*/ 24 : #pragma once 25 : #include "lfr_common_headers/fsw_params.h" 26 : #include <rtems.h> 27 : 28 : #ifdef __cplusplus 29 : extern "C" 30 : { 31 : #endif 32 : 33 : typedef struct ring_node_asm 34 : { 35 : struct ring_node_asm* next; 36 : float matrix[TOTAL_SIZE_SM]; 37 : unsigned int status; 38 : } ring_node_asm; 39 : 40 : typedef struct asm_msg 41 : { 42 : ring_node_asm* norm; 43 : ring_node_asm* burst_sbm; 44 : rtems_event_set event; 45 : unsigned int coarseTimeNORM; 46 : unsigned int fineTimeNORM; 47 : unsigned int coarseTimeSBM; 48 : unsigned int fineTimeSBM; 49 : unsigned int numberOfSMInASMNORM; 50 : unsigned int numberOfSMInASMSBM; 51 : } asm_msg; 52 : 53 : void Matrix_change_of_basis(_Complex float intermediary[25], const float* input_matrix, 54 : const float* mag_transition_matrix, const float* elec_transition_matrix, 55 : float* output_matrix); 56 : 57 : void SM_calibrate_and_reorder_f0(float* input_asm, float* output_asm); 58 : void SM_calibrate_and_reorder_f1(float* input_asm, float* output_asm); 59 : void SM_calibrate_and_reorder_f2(float* input_asm, float* output_asm); 60 : 61 : void SM_average(float* averaged_spec_mat_NORM, float* averaged_spec_mat_SBM, 62 : ring_node* ring_node_tab[], unsigned int nbAverageNORM, unsigned int nbAverageSBM, 63 : asm_msg* msgForMATR, unsigned char channel, unsigned int start_bin, 64 : unsigned int bins_count); 65 : 66 : void SM_average_f2(float* averaged_spec_mat_f2, ring_node* ring_node, 67 : unsigned int nbAverageNormF2, asm_msg* msgForMATR); 68 : 69 : void ASM_compress_divide_and_mask(const float* const averaged_spec_mat, 70 : float* compressed_spec_mat, const float divider, const unsigned char nbBinsCompressedMatrix, 71 : const unsigned char nbBinsToAverage, const unsigned char ASMIndexStart, 72 : const unsigned char channel); 73 : 74 : void ASM_divide(const float* averaged_spec_mat, float* averaged_spec_mat_normalized, 75 : const float divider, unsigned int start_indice, unsigned int stop_indice); 76 : 77 : static inline void extract_bin_vhdl_repr( 78 : const float* vhdl_spec_mat, float dest_matrix[25], int fbin) 79 : { 80 4440 : float* out_ptr = dest_matrix; 81 4440 : const float* in_block_ptr = vhdl_spec_mat; 82 26640 : for (unsigned int line = 0; line < 5; line++) 83 : { 84 88800 : for (unsigned int column = line; column < 5; column++) 85 : { 86 66600 : if (line != column) // imaginary part 87 : { 88 44400 : const float* in_ptr = in_block_ptr + (2 * fbin); 89 44400 : out_ptr[0] = in_ptr[0]; 90 44400 : out_ptr[1] = in_ptr[1]; 91 44400 : in_block_ptr += (2 * NB_BINS_PER_SM); 92 44400 : out_ptr += 2; 93 : } 94 : else 95 : { 96 22200 : const float* in_ptr = in_block_ptr + fbin; 97 22200 : out_ptr[0] = in_ptr[0]; 98 22200 : out_ptr++; 99 22200 : in_block_ptr += NB_BINS_PER_SM; 100 : } 101 : } 102 : } 103 : } 104 : 105 : #ifdef __cplusplus 106 : } 107 : #endif