GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: LFR_basic-parameters/basic_parameters.c Lines: 113 113 100.0 %
Date: 2018-11-13 15:31:29 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
1
void init_k_coefficients_f0(float *k_coefficients,
50
                            unsigned char nb_binscompressed_matrix )
51
{
52
53
    uint8_t i; // 8 bits unsigned
54
12
    for(i=0; i<nb_binscompressed_matrix; i++){
55
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K44_PE] = 1;
56
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K55_PE] = 1;
57
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K45_PE_RE] = 1;
58
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K45_PE_IM] = 1;
59
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K14_SX_RE] = 1;
60
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K14_SX_IM] = 1;
61
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K15_SX_RE] = 1;
62
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K15_SX_IM] = 1;
63
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_SX_RE] = 1;
64
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_SX_IM] = 1;
65
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_SX_RE] = 1;
66
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_SX_IM] = 1;
67
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_SX_RE] = 1;
68
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_SX_IM] = 1;
69
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_SX_RE] = 1;
70
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_SX_IM] = 1;
71
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NY_RE] = 1;
72
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NY_IM] = 1;
73
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NY_RE] = 1;
74
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NY_IM] = 1;
75
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NY_RE] = 1;
76
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NY_IM] = 1;
77
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NY_RE] = 1;
78
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NY_IM] = 1;
79
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NZ_RE] = 1;
80
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NZ_IM] = 1;
81
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NZ_RE] = 1;
82
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NZ_IM] = 1;
83
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NZ_RE] = 1;
84
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NZ_IM] = 1;
85
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_RE] = 1;
86
11
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_IM] = 1;
87
    }
88
89
1
}
90
91
92
1
void init_k_coefficients_f1(float *k_coefficients,
93
                            unsigned char nb_binscompressed_matrix )
94
{
95
96
    uint8_t i; // 8 bits unsigned
97
14
    for(i=0; i<nb_binscompressed_matrix; i++){
98
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K44_PE] = 1;
99
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K55_PE] = 1;
100
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K45_PE_RE] = 1;
101
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K45_PE_IM] = 1;
102
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K14_SX_RE] = 1;
103
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K14_SX_IM] = 1;
104
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K15_SX_RE] = 1;
105
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K15_SX_IM] = 1;
106
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_SX_RE] = 1;
107
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_SX_IM] = 1;
108
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_SX_RE] = 1;
109
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_SX_IM] = 1;
110
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_SX_RE] = 1;
111
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_SX_IM] = 1;
112
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_SX_RE] = 1;
113
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_SX_IM] = 1;
114
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NY_RE] = 1;
115
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NY_IM] = 1;
116
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NY_RE] = 1;
117
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NY_IM] = 1;
118
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NY_RE] = 1;
119
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NY_IM] = 1;
120
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NY_RE] = 1;
121
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NY_IM] = 1;
122
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NZ_RE] = 1;
123
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NZ_IM] = 1;
124
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NZ_RE] = 1;
125
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NZ_IM] = 1;
126
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NZ_RE] = 1;
127
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NZ_IM] = 1;
128
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_RE] = 1;
129
13
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_IM] = 1;
130
    }
131
132
1
}
133
134
135
1
void init_k_coefficients_f2(float *k_coefficients,
136
                            unsigned char nb_binscompressed_matrix )
137
{
138
139
    uint8_t i; // 8 bits unsigned
140
13
    for(i=0; i<nb_binscompressed_matrix; i++){
141
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K44_PE] = 1;
142
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K55_PE] = 1;
143
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K45_PE_RE] = 1;
144
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K45_PE_IM] = 1;
145
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K14_SX_RE] = 1;
146
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K14_SX_IM] = 1;
147
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K15_SX_RE] = 1;
148
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K15_SX_IM] = 1;
149
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_SX_RE] = 1;
150
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_SX_IM] = 1;
151
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_SX_RE] = 1;
152
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_SX_IM] = 1;
153
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_SX_RE] = 1;
154
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_SX_IM] = 1;
155
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_SX_RE] = 1;
156
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_SX_IM] = 1;
157
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NY_RE] = 1;
158
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NY_IM] = 1;
159
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NY_RE] = 1;
160
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NY_IM] = 1;
161
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NY_RE] = 1;
162
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NY_IM] = 1;
163
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NY_RE] = 1;
164
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NY_IM] = 1;
165
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NZ_RE] = 1;
166
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NZ_IM] = 1;
167
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NZ_RE] = 1;
168
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NZ_IM] = 1;
169
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NZ_RE] = 1;
170
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NZ_IM] = 1;
171
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_RE] = 1;
172
12
        k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_IM] = 1;
173
    }
174
175
1
}
176
177
178
3
void init_k_coefficients(float *k_coefficients,
179
                         unsigned char nb_binscompressed_matrix )
180
{
181

3
    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
1
    init_k_coefficients_f0(k_coefficients, nb_binscompressed_matrix);
188
1
    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
1
    init_k_coefficients_f1(k_coefficients, nb_binscompressed_matrix);
195
1
    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
1
    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
3
}
211