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 : #include "mitigations/reaction_wheel_filtering.h" 25 : #include "lfr_common_headers/fsw_params.h" 26 : 27 : #include "fsw_globals.h" 28 : #include "fsw_debug.h" 29 : 30 9352 : int getFBinMask(int index, unsigned char channel) 31 : { 32 : unsigned int indexInChar; 33 : unsigned int indexInTheChar; 34 : int fbin; 35 : const unsigned char* sy_lfr_fbins_fx_word1; 36 : 37 9352 : sy_lfr_fbins_fx_word1 = parameter_dump_packet.sy_lfr_fbins_f0_word1; 38 : 39 9352 : switch (channel) 40 : { 41 : case CHANNELF0: 42 6072 : sy_lfr_fbins_fx_word1 = fbins_masks.merged_fbins_mask_f0; 43 6072 : break; 44 : case CHANNELF1: 45 2704 : sy_lfr_fbins_fx_word1 = fbins_masks.merged_fbins_mask_f1; 46 2704 : break; 47 : case CHANNELF2: 48 576 : sy_lfr_fbins_fx_word1 = fbins_masks.merged_fbins_mask_f2; 49 576 : break; 50 : default: 51 : LFR_PRINTF("ERR *** in getFBinMask, wrong frequency channel"); 52 : } 53 : 54 9352 : indexInChar = index >> SHIFT_3_BITS; 55 9352 : indexInTheChar = index - (indexInChar * BITS_PER_BYTE); 56 : 57 9352 : fbin = (int)((sy_lfr_fbins_fx_word1[BYTES_PER_MASK - 1 - indexInChar] >> indexInTheChar) & 1); 58 : 59 9352 : return fbin; 60 : }