GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: LFR_basic-parameters/basic_parameters.c Lines: 113 113 100.0 %
Date: 2018-11-13 11:16:07 Branches: 9 10 90.0 %

Line Branch Exec Source
1
// In the frame of RPW LFR Sofware ICD Issue1 Rev8 (05/07/2013) => R2 FSW
2
// version 1.0: 31/07/2013
3
// version 1.1: 02/04/2014
4
// version 1.2: 30/04/2014
5
// version 1.3: 02/05/2014
6
// version 1.4: 16/05/2014
7
// version 1.5: 20/05/2014
8
// version 1.6: 19/12/2014
9
// version 1.7: 15/01/2015 (modifs de Paul + correction erreurs qui se compensaient (LSB <=> MSB + indices [0,2] <=> [1,3])
10
// version 1.8: 02/02/2015 (gestion des divisions par zéro)
11
// In the frame of RPW LFR Sofware ICD Issue3 Rev6 (27/01/2015) => R3 FSW
12
// version 2.0: 19/06/2015
13
// version 2.1: 22/06/2015 (modifs de Paul)
14
// version 2.2: 23/06/2015 (modifs de l'ordre de déclaration/définition de init_k_coefficients dans basic_parameters.c ... + maintien des declarations dans le .h)
15
// version 2.3: 01/07/2015 (affectation initiale des octets 7 et 9 dans les BP1 corrigée ...)
16
// version 2.4: 05/10/2018 (added GPL headers)
17
// version 2.5: 09/10/2018 (dans main.c #include "basic_parameters_utilities.h" est changé par les déclarations extern correspondantes ...!
18
//                          + delta mise en conformité LOGISCOPE)
19
20
/*------------------------------------------------------------------------------
21
--  Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
22
--  This file is a part of the LFR FSW
23
--  Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
24
--
25
--  This program is free software; you can redistribute it and/or modify
26
--  it under the terms of the GNU General Public License as published by
27
--  the Free Software Foundation; either version 2 of the License, or
28
--  (at your option) any later version.
29
--
30
--  This program is distributed in the hope that it will be useful,
31
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
32
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
33
--  GNU General Public License for more details.
34
--
35
--  You should have received a copy of the GNU General Public License
36
--  along with this program; if not, write to the Free Software
37
--  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
38
-------------------------------------------------------------------------------*/
39
/*--                  Author : Thomas Chust
40
--                   Contact : Thomas Chust
41
--                      Mail : thomas.chust@lpp.polytechnique.fr
42
----------------------------------------------------------------------------*/
43
44
#include <stdio.h>
45
#include <stdint.h>
46
47
#include "basic_parameters_params.h"
48
49
87
void init_k_coefficients_f0(float *k_coefficients,
50
                            unsigned char nb_binscompressed_matrix )
51
{
52
53
    uint8_t i; // 8 bits unsigned
54
1044
    for(i=0; i<nb_binscompressed_matrix; i++){
55
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K44_PE] = 1;
56
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K55_PE] = 1;
57
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K45_PE_RE] = 1;
58
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K45_PE_IM] = 1;
59
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K14_SX_RE] = 1;
60
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K14_SX_IM] = 1;
61
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K15_SX_RE] = 1;
62
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K15_SX_IM] = 1;
63
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_SX_RE] = 1;
64
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_SX_IM] = 1;
65
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_SX_RE] = 1;
66
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_SX_IM] = 1;
67
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_SX_RE] = 1;
68
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_SX_IM] = 1;
69
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_SX_RE] = 1;
70
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_SX_IM] = 1;
71
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NY_RE] = 1;
72
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NY_IM] = 1;
73
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NY_RE] = 1;
74
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NY_IM] = 1;
75
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NY_RE] = 1;
76
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NY_IM] = 1;
77
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NY_RE] = 1;
78
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NY_IM] = 1;
79
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NZ_RE] = 1;
80
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NZ_IM] = 1;
81
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NZ_RE] = 1;
82
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NZ_IM] = 1;
83
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NZ_RE] = 1;
84
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NZ_IM] = 1;
85
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_RE] = 1;
86
957
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_IM] = 1;
87
    }
88
89
87
}
90
91
92
87
void init_k_coefficients_f1(float *k_coefficients,
93
                            unsigned char nb_binscompressed_matrix )
94
{
95
96
    uint8_t i; // 8 bits unsigned
97
1218
    for(i=0; i<nb_binscompressed_matrix; i++){
98
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K44_PE] = 1;
99
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K55_PE] = 1;
100
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K45_PE_RE] = 1;
101
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K45_PE_IM] = 1;
102
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K14_SX_RE] = 1;
103
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K14_SX_IM] = 1;
104
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K15_SX_RE] = 1;
105
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K15_SX_IM] = 1;
106
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_SX_RE] = 1;
107
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_SX_IM] = 1;
108
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_SX_RE] = 1;
109
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_SX_IM] = 1;
110
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_SX_RE] = 1;
111
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_SX_IM] = 1;
112
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_SX_RE] = 1;
113
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_SX_IM] = 1;
114
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NY_RE] = 1;
115
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NY_IM] = 1;
116
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NY_RE] = 1;
117
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NY_IM] = 1;
118
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NY_RE] = 1;
119
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NY_IM] = 1;
120
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NY_RE] = 1;
121
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NY_IM] = 1;
122
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NZ_RE] = 1;
123
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NZ_IM] = 1;
124
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NZ_RE] = 1;
125
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NZ_IM] = 1;
126
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NZ_RE] = 1;
127
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NZ_IM] = 1;
128
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_RE] = 1;
129
1131
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_IM] = 1;
130
    }
131
132
87
}
133
134
135
87
void init_k_coefficients_f2(float *k_coefficients,
136
                            unsigned char nb_binscompressed_matrix )
137
{
138
139
    uint8_t i; // 8 bits unsigned
140
1131
    for(i=0; i<nb_binscompressed_matrix; i++){
141
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K44_PE] = 1;
142
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K55_PE] = 1;
143
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K45_PE_RE] = 1;
144
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K45_PE_IM] = 1;
145
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K14_SX_RE] = 1;
146
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K14_SX_IM] = 1;
147
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K15_SX_RE] = 1;
148
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K15_SX_IM] = 1;
149
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_SX_RE] = 1;
150
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_SX_IM] = 1;
151
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_SX_RE] = 1;
152
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_SX_IM] = 1;
153
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_SX_RE] = 1;
154
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_SX_IM] = 1;
155
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_SX_RE] = 1;
156
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_SX_IM] = 1;
157
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NY_RE] = 1;
158
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NY_IM] = 1;
159
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NY_RE] = 1;
160
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NY_IM] = 1;
161
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NY_RE] = 1;
162
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NY_IM] = 1;
163
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NY_RE] = 1;
164
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NY_IM] = 1;
165
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NZ_RE] = 1;
166
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NZ_IM] = 1;
167
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NZ_RE] = 1;
168
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NZ_IM] = 1;
169
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NZ_RE] = 1;
170
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NZ_IM] = 1;
171
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_RE] = 1;
172
1044
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_IM] = 1;
173
    }
174
175
87
}
176
177
178
261
void init_k_coefficients(float *k_coefficients,
179
                         unsigned char nb_binscompressed_matrix )
180
{
181

261
    switch (nb_binscompressed_matrix)
182
    {
183
    case NB_BINS_COMPRESSED_MATRIX_f0:
184
#ifdef DEBUG_TCH
185
    printf("F0 data: initialization of the intercalibration k-coefficients\n");
186
#endif
187
87
    init_k_coefficients_f0(k_coefficients, nb_binscompressed_matrix);
188
87
    break;
189
190
    case NB_BINS_COMPRESSED_MATRIX_f1:
191
#ifdef DEBUG_TCH
192
    printf("F1 data: initialization of the intercalibration k-coefficients\n");
193
#endif
194
87
    init_k_coefficients_f1(k_coefficients, nb_binscompressed_matrix);
195
87
    break;
196
197
    case NB_BINS_COMPRESSED_MATRIX_f2:
198
#ifdef DEBUG_TCH
199
    printf("F2 data: initialization of the intercalibration k-coefficients\n");
200
#endif
201
87
    init_k_coefficients_f2(k_coefficients, nb_binscompressed_matrix);
202
    break;
203
204
    default:
205
#ifdef DEBUG_TCH
206
    printf("there is a problème !!?\n");
207
#endif
208
    break;
209
    }
210
261
}
211