##// END OF EJS Templates
Commit before going back to Rev 326
paul -
r330:cd97edc61709 R3++ draft
parent child
Show More
@@ -1,117 +1,118
1 1 #ifndef TC_LOAD_DUMP_PARAMETERS_H
2 2 #define TC_LOAD_DUMP_PARAMETERS_H
3 3
4 4 #include <rtems.h>
5 5 #include <stdio.h>
6 6
7 7 #include "fsw_params.h"
8 8 #include "wf_handler.h"
9 9 #include "tm_lfr_tc_exe.h"
10 10 #include "fsw_misc.h"
11 11 #include "basic_parameters_params.h"
12 12 #include "avf0_prc0.h"
13 13
14 14 #define FLOAT_EQUAL_ZERO 0.001
15 15 #define NB_BINS_TO_REMOVE 3
16 16 #define FI_INTERVAL_COEFF 0.285
17 17 #define BIN_MIN 0
18 18 #define BIN_MAX 127
19 19 #define DELTAF_F0 96.
20 20 #define DELTAF_F1 16.
21 21 #define DELTAF_F2 1.
22 #define DELTAF_DIV 2.
22 23
23 24 #define BIT_RW1_F1 0x80
24 25 #define BIT_RW1_F2 0x40
25 26 #define BIT_RW2_F1 0x20
26 27 #define BIT_RW2_F2 0x10
27 28 #define BIT_RW3_F1 0x08
28 29 #define BIT_RW3_F2 0x04
29 30 #define BIT_RW4_F1 0x02
30 31 #define BIT_RW4_F2 0x01
31 32
32 33 #define WHEEL_1 1
33 34 #define WHEEL_2 2
34 35 #define WHEEL_3 3
35 36 #define WHEEL_4 4
36 37 #define FREQ_1 1
37 38 #define FREQ_2 2
38 39 #define FREQ_3 3
39 40 #define FREQ_4 4
40 41 #define FLAG_OFFSET_WHEELS_1_3 8
41 42 #define FLAG_OFFSET_WHEELS_2_4 4
42 43
43 44 #define FLAG_NAN 0 // Not A NUMBER
44 45 #define FLAG_IAN 1 // Is A Number
45 46
46 47 #define SBM_KCOEFF_PER_NORM_KCOEFF 2
47 48
48 49 extern unsigned short sequenceCounterParameterDump;
49 50 extern unsigned short sequenceCounters_TM_DUMP[];
50 51 extern float k_coeff_intercalib_f0_norm[ ];
51 52 extern float k_coeff_intercalib_f0_sbm[ ];
52 53 extern float k_coeff_intercalib_f1_norm[ ];
53 54 extern float k_coeff_intercalib_f1_sbm[ ];
54 55 extern float k_coeff_intercalib_f2[ ];
55 56 extern fbins_masks_t fbins_masks;
56 57
57 58 int action_load_common_par( ccsdsTelecommandPacket_t *TC );
58 59 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
59 60 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
60 61 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
61 62 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
62 63 int action_load_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
63 64 int action_load_fbins_mask(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
64 65 int action_load_filter_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
65 66 int action_dump_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
66 67 int action_dump_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
67 68
68 69 // NORMAL
69 70 int check_normal_par_consistency( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
70 71 int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC );
71 72 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC );
72 73 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC );
73 74 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC );
74 75 int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC );
75 76 int set_sy_lfr_n_cwf_long_f3( ccsdsTelecommandPacket_t *TC );
76 77
77 78 // BURST
78 79 int set_sy_lfr_b_bp_p0( ccsdsTelecommandPacket_t *TC );
79 80 int set_sy_lfr_b_bp_p1( ccsdsTelecommandPacket_t *TC );
80 81
81 82 // SBM1
82 83 int set_sy_lfr_s1_bp_p0( ccsdsTelecommandPacket_t *TC );
83 84 int set_sy_lfr_s1_bp_p1( ccsdsTelecommandPacket_t *TC );
84 85
85 86 // SBM2
86 87 int set_sy_lfr_s2_bp_p0( ccsdsTelecommandPacket_t *TC );
87 88 int set_sy_lfr_s2_bp_p1( ccsdsTelecommandPacket_t *TC );
88 89
89 90 // TC_LFR_UPDATE_INFO
90 91 unsigned int check_update_info_hk_lfr_mode( unsigned char mode );
91 92 unsigned int check_update_info_hk_tds_mode( unsigned char mode );
92 93 unsigned int check_update_info_hk_thr_mode( unsigned char mode );
93 94 void set_hk_lfr_sc_rw_f_flag( unsigned char wheel, unsigned char freq, float value );
94 95 void set_hk_lfr_sc_rw_f_flags( void );
95 96 void getReactionWheelsFrequencies( ccsdsTelecommandPacket_t *TC );
96 void setFBinMask(unsigned char *fbins_mask, float rw_f, unsigned char deltaFreq, float k );
97 void setFBinMask(unsigned char *fbins_mask, float rw_f, unsigned char deltaFreq, float kcoeff );
97 98 void build_sy_lfr_rw_mask( unsigned int channel );
98 99 void build_sy_lfr_rw_masks();
99 100 void merge_fbins_masks( void );
100 101
101 102 // FBINS_MASK
102 103 int set_sy_lfr_fbins( ccsdsTelecommandPacket_t *TC );
103 104
104 105 // TC_LFR_LOAD_PARS_FILTER_PAR
105 106 int check_sy_lfr_filter_parameters( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
106 107
107 108 // KCOEFFICIENTS
108 109 int set_sy_lfr_kcoeff(ccsdsTelecommandPacket_t *TC , rtems_id queue_id);
109 110 void copyFloatByChar( unsigned char *destination, unsigned char *source );
110 111 void floatToChar( float value, unsigned char* ptr);
111 112
112 113 void init_parameter_dump( void );
113 114 void init_kcoefficients_dump( void );
114 115 void init_kcoefficients_dump_packet( Packet_TM_LFR_KCOEFFICIENTS_DUMP_t *kcoefficients_dump, unsigned char pkt_nr, unsigned char blk_nr );
115 116 void increment_seq_counter_destination_id_dump( unsigned char *packet_sequence_control, unsigned char destination_id );
116 117
117 118 #endif // TC_LOAD_DUMP_PARAMETERS_H
@@ -1,1782 +1,1780
1 1 /** Functions to load and dump parameters in the LFR registers.
2 2 *
3 3 * @file
4 4 * @author P. LEROY
5 5 *
6 6 * A group of functions to handle TC related to parameter loading and dumping.\n
7 7 * TC_LFR_LOAD_COMMON_PAR\n
8 8 * TC_LFR_LOAD_NORMAL_PAR\n
9 9 * TC_LFR_LOAD_BURST_PAR\n
10 10 * TC_LFR_LOAD_SBM1_PAR\n
11 11 * TC_LFR_LOAD_SBM2_PAR\n
12 12 *
13 13 */
14 14
15 15 #include "tc_load_dump_parameters.h"
16 16
17 17 Packet_TM_LFR_KCOEFFICIENTS_DUMP_t kcoefficients_dump_1 = {0};
18 18 Packet_TM_LFR_KCOEFFICIENTS_DUMP_t kcoefficients_dump_2 = {0};
19 19 ring_node kcoefficient_node_1 = {0};
20 20 ring_node kcoefficient_node_2 = {0};
21 21
22 22 int action_load_common_par(ccsdsTelecommandPacket_t *TC)
23 23 {
24 24 /** This function updates the LFR registers with the incoming common parameters.
25 25 *
26 26 * @param TC points to the TeleCommand packet that is being processed
27 27 *
28 28 *
29 29 */
30 30
31 31 parameter_dump_packet.sy_lfr_common_parameters_spare = TC->dataAndCRC[0];
32 32 parameter_dump_packet.sy_lfr_common_parameters = TC->dataAndCRC[1];
33 33 set_wfp_data_shaping( );
34 34 return LFR_SUCCESSFUL;
35 35 }
36 36
37 37 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
38 38 {
39 39 /** This function updates the LFR registers with the incoming normal parameters.
40 40 *
41 41 * @param TC points to the TeleCommand packet that is being processed
42 42 * @param queue_id is the id of the queue which handles TM related to this execution step
43 43 *
44 44 */
45 45
46 46 int result;
47 47 int flag;
48 48 rtems_status_code status;
49 49
50 50 flag = LFR_SUCCESSFUL;
51 51
52 52 if ( (lfrCurrentMode == LFR_MODE_NORMAL) ||
53 53 (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) {
54 54 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
55 55 flag = LFR_DEFAULT;
56 56 }
57 57
58 58 // CHECK THE PARAMETERS SET CONSISTENCY
59 59 if (flag == LFR_SUCCESSFUL)
60 60 {
61 61 flag = check_normal_par_consistency( TC, queue_id );
62 62 }
63 63
64 64 // SET THE PARAMETERS IF THEY ARE CONSISTENT
65 65 if (flag == LFR_SUCCESSFUL)
66 66 {
67 67 result = set_sy_lfr_n_swf_l( TC );
68 68 result = set_sy_lfr_n_swf_p( TC );
69 69 result = set_sy_lfr_n_bp_p0( TC );
70 70 result = set_sy_lfr_n_bp_p1( TC );
71 71 result = set_sy_lfr_n_asm_p( TC );
72 72 result = set_sy_lfr_n_cwf_long_f3( TC );
73 73 }
74 74
75 75 return flag;
76 76 }
77 77
78 78 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
79 79 {
80 80 /** This function updates the LFR registers with the incoming burst parameters.
81 81 *
82 82 * @param TC points to the TeleCommand packet that is being processed
83 83 * @param queue_id is the id of the queue which handles TM related to this execution step
84 84 *
85 85 */
86 86
87 87 int flag;
88 88 rtems_status_code status;
89 89 unsigned char sy_lfr_b_bp_p0;
90 90 unsigned char sy_lfr_b_bp_p1;
91 91 float aux;
92 92
93 93 flag = LFR_SUCCESSFUL;
94 94
95 95 if ( lfrCurrentMode == LFR_MODE_BURST ) {
96 96 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
97 97 flag = LFR_DEFAULT;
98 98 }
99 99
100 100 sy_lfr_b_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P0 ];
101 101 sy_lfr_b_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P1 ];
102 102
103 103 // sy_lfr_b_bp_p0 shall not be lower than its default value
104 104 if (flag == LFR_SUCCESSFUL)
105 105 {
106 106 if (sy_lfr_b_bp_p0 < DEFAULT_SY_LFR_B_BP_P0 )
107 107 {
108 108 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_B_BP_P0 + DATAFIELD_OFFSET, sy_lfr_b_bp_p0 );
109 109 flag = WRONG_APP_DATA;
110 110 }
111 111 }
112 112 // sy_lfr_b_bp_p1 shall not be lower than its default value
113 113 if (flag == LFR_SUCCESSFUL)
114 114 {
115 115 if (sy_lfr_b_bp_p1 < DEFAULT_SY_LFR_B_BP_P1 )
116 116 {
117 117 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_B_BP_P1 + DATAFIELD_OFFSET, sy_lfr_b_bp_p1 );
118 118 flag = WRONG_APP_DATA;
119 119 }
120 120 }
121 121 //****************************************************************
122 122 // check the consistency between sy_lfr_b_bp_p0 and sy_lfr_b_bp_p1
123 123 if (flag == LFR_SUCCESSFUL)
124 124 {
125 125 sy_lfr_b_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P0 ];
126 126 sy_lfr_b_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P1 ];
127 127 aux = ( (float ) sy_lfr_b_bp_p1 / sy_lfr_b_bp_p0 ) - floor(sy_lfr_b_bp_p1 / sy_lfr_b_bp_p0);
128 128 if (aux > FLOAT_EQUAL_ZERO)
129 129 {
130 130 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_B_BP_P0 + DATAFIELD_OFFSET, sy_lfr_b_bp_p0 );
131 131 flag = LFR_DEFAULT;
132 132 }
133 133 }
134 134
135 135 // SET THE PARAMETERS
136 136 if (flag == LFR_SUCCESSFUL)
137 137 {
138 138 flag = set_sy_lfr_b_bp_p0( TC );
139 139 flag = set_sy_lfr_b_bp_p1( TC );
140 140 }
141 141
142 142 return flag;
143 143 }
144 144
145 145 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
146 146 {
147 147 /** This function updates the LFR registers with the incoming sbm1 parameters.
148 148 *
149 149 * @param TC points to the TeleCommand packet that is being processed
150 150 * @param queue_id is the id of the queue which handles TM related to this execution step
151 151 *
152 152 */
153 153
154 154 int flag;
155 155 rtems_status_code status;
156 156 unsigned char sy_lfr_s1_bp_p0;
157 157 unsigned char sy_lfr_s1_bp_p1;
158 158 float aux;
159 159
160 160 flag = LFR_SUCCESSFUL;
161 161
162 162 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
163 163 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
164 164 flag = LFR_DEFAULT;
165 165 }
166 166
167 167 sy_lfr_s1_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P0 ];
168 168 sy_lfr_s1_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P1 ];
169 169
170 170 // sy_lfr_s1_bp_p0
171 171 if (flag == LFR_SUCCESSFUL)
172 172 {
173 173 if (sy_lfr_s1_bp_p0 < DEFAULT_SY_LFR_S1_BP_P0 )
174 174 {
175 175 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S1_BP_P0 + DATAFIELD_OFFSET, sy_lfr_s1_bp_p0 );
176 176 flag = WRONG_APP_DATA;
177 177 }
178 178 }
179 179 // sy_lfr_s1_bp_p1
180 180 if (flag == LFR_SUCCESSFUL)
181 181 {
182 182 if (sy_lfr_s1_bp_p1 < DEFAULT_SY_LFR_S1_BP_P1 )
183 183 {
184 184 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S1_BP_P1 + DATAFIELD_OFFSET, sy_lfr_s1_bp_p1 );
185 185 flag = WRONG_APP_DATA;
186 186 }
187 187 }
188 188 //******************************************************************
189 189 // check the consistency between sy_lfr_s1_bp_p0 and sy_lfr_s1_bp_p1
190 190 if (flag == LFR_SUCCESSFUL)
191 191 {
192 192 aux = ( (float ) sy_lfr_s1_bp_p1 / (sy_lfr_s1_bp_p0 * S1_BP_P0_SCALE) )
193 193 - floor(sy_lfr_s1_bp_p1 / (sy_lfr_s1_bp_p0 * S1_BP_P0_SCALE));
194 194 if (aux > FLOAT_EQUAL_ZERO)
195 195 {
196 196 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S1_BP_P0 + DATAFIELD_OFFSET, sy_lfr_s1_bp_p0 );
197 197 flag = LFR_DEFAULT;
198 198 }
199 199 }
200 200
201 201 // SET THE PARAMETERS
202 202 if (flag == LFR_SUCCESSFUL)
203 203 {
204 204 flag = set_sy_lfr_s1_bp_p0( TC );
205 205 flag = set_sy_lfr_s1_bp_p1( TC );
206 206 }
207 207
208 208 return flag;
209 209 }
210 210
211 211 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
212 212 {
213 213 /** This function updates the LFR registers with the incoming sbm2 parameters.
214 214 *
215 215 * @param TC points to the TeleCommand packet that is being processed
216 216 * @param queue_id is the id of the queue which handles TM related to this execution step
217 217 *
218 218 */
219 219
220 220 int flag;
221 221 rtems_status_code status;
222 222 unsigned char sy_lfr_s2_bp_p0;
223 223 unsigned char sy_lfr_s2_bp_p1;
224 224 float aux;
225 225
226 226 flag = LFR_SUCCESSFUL;
227 227
228 228 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
229 229 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
230 230 flag = LFR_DEFAULT;
231 231 }
232 232
233 233 sy_lfr_s2_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P0 ];
234 234 sy_lfr_s2_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P1 ];
235 235
236 236 // sy_lfr_s2_bp_p0
237 237 if (flag == LFR_SUCCESSFUL)
238 238 {
239 239 if (sy_lfr_s2_bp_p0 < DEFAULT_SY_LFR_S2_BP_P0 )
240 240 {
241 241 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S2_BP_P0 + DATAFIELD_OFFSET, sy_lfr_s2_bp_p0 );
242 242 flag = WRONG_APP_DATA;
243 243 }
244 244 }
245 245 // sy_lfr_s2_bp_p1
246 246 if (flag == LFR_SUCCESSFUL)
247 247 {
248 248 if (sy_lfr_s2_bp_p1 < DEFAULT_SY_LFR_S2_BP_P1 )
249 249 {
250 250 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S2_BP_P1 + DATAFIELD_OFFSET, sy_lfr_s2_bp_p1 );
251 251 flag = WRONG_APP_DATA;
252 252 }
253 253 }
254 254 //******************************************************************
255 255 // check the consistency between sy_lfr_s2_bp_p0 and sy_lfr_s2_bp_p1
256 256 if (flag == LFR_SUCCESSFUL)
257 257 {
258 258 sy_lfr_s2_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P0 ];
259 259 sy_lfr_s2_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P1 ];
260 260 aux = ( (float ) sy_lfr_s2_bp_p1 / sy_lfr_s2_bp_p0 ) - floor(sy_lfr_s2_bp_p1 / sy_lfr_s2_bp_p0);
261 261 if (aux > FLOAT_EQUAL_ZERO)
262 262 {
263 263 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S2_BP_P0 + DATAFIELD_OFFSET, sy_lfr_s2_bp_p0 );
264 264 flag = LFR_DEFAULT;
265 265 }
266 266 }
267 267
268 268 // SET THE PARAMETERS
269 269 if (flag == LFR_SUCCESSFUL)
270 270 {
271 271 flag = set_sy_lfr_s2_bp_p0( TC );
272 272 flag = set_sy_lfr_s2_bp_p1( TC );
273 273 }
274 274
275 275 return flag;
276 276 }
277 277
278 278 int action_load_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
279 279 {
280 280 /** This function updates the LFR registers with the incoming sbm2 parameters.
281 281 *
282 282 * @param TC points to the TeleCommand packet that is being processed
283 283 * @param queue_id is the id of the queue which handles TM related to this execution step
284 284 *
285 285 */
286 286
287 287 int flag;
288 288
289 289 flag = LFR_DEFAULT;
290 290
291 291 flag = set_sy_lfr_kcoeff( TC, queue_id );
292 292
293 293 return flag;
294 294 }
295 295
296 296 int action_load_fbins_mask(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
297 297 {
298 298 /** This function updates the LFR registers with the incoming sbm2 parameters.
299 299 *
300 300 * @param TC points to the TeleCommand packet that is being processed
301 301 * @param queue_id is the id of the queue which handles TM related to this execution step
302 302 *
303 303 */
304 304
305 305 int flag;
306 306
307 307 flag = LFR_DEFAULT;
308 308
309 309 flag = set_sy_lfr_fbins( TC );
310 310
311 311 // once the fbins masks have been stored, they have to be merged with the masks which handle the reaction wheels frequencies filtering
312 312 merge_fbins_masks();
313 313
314 314 return flag;
315 315 }
316 316
317 317 int action_load_filter_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
318 318 {
319 319 /** This function updates the LFR registers with the incoming sbm2 parameters.
320 320 *
321 321 * @param TC points to the TeleCommand packet that is being processed
322 322 * @param queue_id is the id of the queue which handles TM related to this execution step
323 323 *
324 324 */
325 325
326 326 int flag;
327 327 unsigned char k;
328 328
329 329 flag = LFR_DEFAULT;
330 330 k = INIT_CHAR;
331 331
332 332 flag = check_sy_lfr_filter_parameters( TC, queue_id );
333 333
334 334 if (flag == LFR_SUCCESSFUL)
335 335 {
336 336 parameter_dump_packet.spare_sy_lfr_pas_filter_enabled = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_ENABLED ];
337 337 parameter_dump_packet.sy_lfr_pas_filter_modulus = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_MODULUS ];
338 338 parameter_dump_packet.sy_lfr_pas_filter_tbad[BYTE_0] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_TBAD + BYTE_0 ];
339 339 parameter_dump_packet.sy_lfr_pas_filter_tbad[BYTE_1] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_TBAD + BYTE_1 ];
340 340 parameter_dump_packet.sy_lfr_pas_filter_tbad[BYTE_2] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_TBAD + BYTE_2 ];
341 341 parameter_dump_packet.sy_lfr_pas_filter_tbad[BYTE_3] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_TBAD + BYTE_3 ];
342 342 parameter_dump_packet.sy_lfr_pas_filter_offset = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_OFFSET ];
343 343 parameter_dump_packet.sy_lfr_pas_filter_shift[BYTE_0] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_SHIFT + BYTE_0 ];
344 344 parameter_dump_packet.sy_lfr_pas_filter_shift[BYTE_1] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_SHIFT + BYTE_1 ];
345 345 parameter_dump_packet.sy_lfr_pas_filter_shift[BYTE_2] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_SHIFT + BYTE_2 ];
346 346 parameter_dump_packet.sy_lfr_pas_filter_shift[BYTE_3] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_SHIFT + BYTE_3 ];
347 347 parameter_dump_packet.sy_lfr_sc_rw_delta_f[BYTE_0] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_SC_RW_DELTA_F + BYTE_0 ];
348 348 parameter_dump_packet.sy_lfr_sc_rw_delta_f[BYTE_1] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_SC_RW_DELTA_F + BYTE_1 ];
349 349 parameter_dump_packet.sy_lfr_sc_rw_delta_f[BYTE_2] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_SC_RW_DELTA_F + BYTE_2 ];
350 350 parameter_dump_packet.sy_lfr_sc_rw_delta_f[BYTE_3] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_SC_RW_DELTA_F + BYTE_3 ];
351 351
352 352 //****************************
353 353 // store PAS filter parameters
354 354 // sy_lfr_pas_filter_enabled
355 355 filterPar.spare_sy_lfr_pas_filter_enabled = parameter_dump_packet.spare_sy_lfr_pas_filter_enabled;
356 356 set_sy_lfr_pas_filter_enabled( parameter_dump_packet.spare_sy_lfr_pas_filter_enabled & BIT_PAS_FILTER_ENABLED );
357 357 // sy_lfr_pas_filter_modulus
358 358 filterPar.sy_lfr_pas_filter_modulus = parameter_dump_packet.sy_lfr_pas_filter_modulus;
359 359 // sy_lfr_pas_filter_tbad
360 360 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_pas_filter_tbad,
361 361 parameter_dump_packet.sy_lfr_pas_filter_tbad );
362 362 // sy_lfr_pas_filter_offset
363 363 filterPar.sy_lfr_pas_filter_offset = parameter_dump_packet.sy_lfr_pas_filter_offset;
364 364 // sy_lfr_pas_filter_shift
365 365 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_pas_filter_shift,
366 366 parameter_dump_packet.sy_lfr_pas_filter_shift );
367 367
368 368 //****************************************************
369 369 // store the parameter sy_lfr_sc_rw_delta_f as a float
370 370 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_sc_rw_delta_f,
371 371 parameter_dump_packet.sy_lfr_sc_rw_delta_f );
372 372
373 373 // copy rw.._k.. from the incoming TC to the local parameter_dump_packet
374 374 for (k = 0; k < NB_RW_K_COEFFS * NB_BYTES_PER_RW_K_COEFF; k++)
375 375 {
376 376 parameter_dump_packet.sy_lfr_rw1_k1[k] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_RW1_K1 + k ];
377 377 }
378 378
379 379 //***********************************************
380 380 // store the parameter sy_lfr_rw.._k.. as a float
381 381 // rw1_k
382 382 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_rw1_k1, parameter_dump_packet.sy_lfr_rw1_k1 );
383 383 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_rw1_k2, parameter_dump_packet.sy_lfr_rw1_k2 );
384 384 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_rw1_k3, parameter_dump_packet.sy_lfr_rw1_k3 );
385 385 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_rw1_k4, parameter_dump_packet.sy_lfr_rw1_k4 );
386 386 // rw2_k
387 387 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_rw2_k1, parameter_dump_packet.sy_lfr_rw2_k1 );
388 388 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_rw2_k2, parameter_dump_packet.sy_lfr_rw2_k2 );
389 389 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_rw2_k3, parameter_dump_packet.sy_lfr_rw2_k3 );
390 390 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_rw2_k4, parameter_dump_packet.sy_lfr_rw2_k4 );
391 391 // rw3_k
392 392 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_rw3_k1, parameter_dump_packet.sy_lfr_rw3_k1 );
393 393 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_rw3_k2, parameter_dump_packet.sy_lfr_rw3_k2 );
394 394 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_rw3_k3, parameter_dump_packet.sy_lfr_rw3_k3 );
395 395 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_rw3_k4, parameter_dump_packet.sy_lfr_rw3_k4 );
396 396 // rw4_k
397 397 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_rw4_k1, parameter_dump_packet.sy_lfr_rw4_k1 );
398 398 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_rw4_k2, parameter_dump_packet.sy_lfr_rw4_k2 );
399 399 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_rw4_k3, parameter_dump_packet.sy_lfr_rw4_k3 );
400 400 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_rw4_k4, parameter_dump_packet.sy_lfr_rw4_k4 );
401 401
402 402 }
403 403
404 404 return flag;
405 405 }
406 406
407 407 int action_dump_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
408 408 {
409 409 /** This function updates the LFR registers with the incoming sbm2 parameters.
410 410 *
411 411 * @param TC points to the TeleCommand packet that is being processed
412 412 * @param queue_id is the id of the queue which handles TM related to this execution step
413 413 *
414 414 */
415 415
416 416 unsigned int address;
417 417 rtems_status_code status;
418 418 unsigned int freq;
419 419 unsigned int bin;
420 420 unsigned int coeff;
421 421 unsigned char *kCoeffPtr;
422 422 unsigned char *kCoeffDumpPtr;
423 423
424 424 // for each sy_lfr_kcoeff_frequency there is 32 kcoeff
425 425 // F0 => 11 bins
426 426 // F1 => 13 bins
427 427 // F2 => 12 bins
428 428 // 36 bins to dump in two packets (30 bins max per packet)
429 429
430 430 //*********
431 431 // PACKET 1
432 432 // 11 F0 bins, 13 F1 bins and 6 F2 bins
433 433 kcoefficients_dump_1.destinationID = TC->sourceID;
434 434 increment_seq_counter_destination_id_dump( kcoefficients_dump_1.packetSequenceControl, TC->sourceID );
435 435 for( freq = 0;
436 436 freq < NB_BINS_COMPRESSED_SM_F0;
437 437 freq++ )
438 438 {
439 439 kcoefficients_dump_1.kcoeff_blks[ (freq*KCOEFF_BLK_SIZE) + 1] = freq;
440 440 bin = freq;
441 441 // printKCoefficients( freq, bin, k_coeff_intercalib_f0_norm);
442 442 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
443 443 {
444 444 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_1.kcoeff_blks[
445 445 (freq*KCOEFF_BLK_SIZE) + (coeff*NB_BYTES_PER_FLOAT) + KCOEFF_FREQ
446 446 ]; // 2 for the kcoeff_frequency
447 447 kCoeffPtr = (unsigned char*) &k_coeff_intercalib_f0_norm[ (bin*NB_K_COEFF_PER_BIN) + coeff ];
448 448 copyFloatByChar( kCoeffDumpPtr, kCoeffPtr );
449 449 }
450 450 }
451 451 for( freq = NB_BINS_COMPRESSED_SM_F0;
452 452 freq < ( NB_BINS_COMPRESSED_SM_F0 + NB_BINS_COMPRESSED_SM_F1 );
453 453 freq++ )
454 454 {
455 455 kcoefficients_dump_1.kcoeff_blks[ (freq*KCOEFF_BLK_SIZE) + 1 ] = freq;
456 456 bin = freq - NB_BINS_COMPRESSED_SM_F0;
457 457 // printKCoefficients( freq, bin, k_coeff_intercalib_f1_norm);
458 458 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
459 459 {
460 460 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_1.kcoeff_blks[
461 461 (freq*KCOEFF_BLK_SIZE) + (coeff*NB_BYTES_PER_FLOAT) + KCOEFF_FREQ
462 462 ]; // 2 for the kcoeff_frequency
463 463 kCoeffPtr = (unsigned char*) &k_coeff_intercalib_f1_norm[ (bin*NB_K_COEFF_PER_BIN) + coeff ];
464 464 copyFloatByChar( kCoeffDumpPtr, kCoeffPtr );
465 465 }
466 466 }
467 467 for( freq = ( NB_BINS_COMPRESSED_SM_F0 + NB_BINS_COMPRESSED_SM_F1 );
468 468 freq < KCOEFF_BLK_NR_PKT1 ;
469 469 freq++ )
470 470 {
471 471 kcoefficients_dump_1.kcoeff_blks[ (freq * KCOEFF_BLK_SIZE) + 1 ] = freq;
472 472 bin = freq - (NB_BINS_COMPRESSED_SM_F0 + NB_BINS_COMPRESSED_SM_F1);
473 473 // printKCoefficients( freq, bin, k_coeff_intercalib_f2);
474 474 for ( coeff = 0; coeff <NB_K_COEFF_PER_BIN; coeff++ )
475 475 {
476 476 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_1.kcoeff_blks[
477 477 (freq * KCOEFF_BLK_SIZE) + (coeff * NB_BYTES_PER_FLOAT) + KCOEFF_FREQ
478 478 ]; // 2 for the kcoeff_frequency
479 479 kCoeffPtr = (unsigned char*) &k_coeff_intercalib_f2[ (bin*NB_K_COEFF_PER_BIN) + coeff ];
480 480 copyFloatByChar( kCoeffDumpPtr, kCoeffPtr );
481 481 }
482 482 }
483 483 kcoefficients_dump_1.time[BYTE_0] = (unsigned char) (time_management_regs->coarse_time >> SHIFT_3_BYTES);
484 484 kcoefficients_dump_1.time[BYTE_1] = (unsigned char) (time_management_regs->coarse_time >> SHIFT_2_BYTES);
485 485 kcoefficients_dump_1.time[BYTE_2] = (unsigned char) (time_management_regs->coarse_time >> SHIFT_1_BYTE);
486 486 kcoefficients_dump_1.time[BYTE_3] = (unsigned char) (time_management_regs->coarse_time);
487 487 kcoefficients_dump_1.time[BYTE_4] = (unsigned char) (time_management_regs->fine_time >> SHIFT_1_BYTE);
488 488 kcoefficients_dump_1.time[BYTE_5] = (unsigned char) (time_management_regs->fine_time);
489 489 // SEND DATA
490 490 kcoefficient_node_1.status = 1;
491 491 address = (unsigned int) &kcoefficient_node_1;
492 492 status = rtems_message_queue_send( queue_id, &address, sizeof( ring_node* ) );
493 493 if (status != RTEMS_SUCCESSFUL) {
494 494 PRINTF1("in action_dump_kcoefficients *** ERR sending packet 1 , code %d", status)
495 495 }
496 496
497 497 //********
498 498 // PACKET 2
499 499 // 6 F2 bins
500 500 kcoefficients_dump_2.destinationID = TC->sourceID;
501 501 increment_seq_counter_destination_id_dump( kcoefficients_dump_2.packetSequenceControl, TC->sourceID );
502 502 for( freq = 0;
503 503 freq < KCOEFF_BLK_NR_PKT2;
504 504 freq++ )
505 505 {
506 506 kcoefficients_dump_2.kcoeff_blks[ (freq*KCOEFF_BLK_SIZE) + 1 ] = KCOEFF_BLK_NR_PKT1 + freq;
507 507 bin = freq + KCOEFF_BLK_NR_PKT2;
508 508 // printKCoefficients( freq, bin, k_coeff_intercalib_f2);
509 509 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
510 510 {
511 511 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_2.kcoeff_blks[
512 512 (freq*KCOEFF_BLK_SIZE) + (coeff*NB_BYTES_PER_FLOAT) + KCOEFF_FREQ ]; // 2 for the kcoeff_frequency
513 513 kCoeffPtr = (unsigned char*) &k_coeff_intercalib_f2[ (bin*NB_K_COEFF_PER_BIN) + coeff ];
514 514 copyFloatByChar( kCoeffDumpPtr, kCoeffPtr );
515 515 }
516 516 }
517 517 kcoefficients_dump_2.time[BYTE_0] = (unsigned char) (time_management_regs->coarse_time >> SHIFT_3_BYTES);
518 518 kcoefficients_dump_2.time[BYTE_1] = (unsigned char) (time_management_regs->coarse_time >> SHIFT_2_BYTES);
519 519 kcoefficients_dump_2.time[BYTE_2] = (unsigned char) (time_management_regs->coarse_time >> SHIFT_1_BYTE);
520 520 kcoefficients_dump_2.time[BYTE_3] = (unsigned char) (time_management_regs->coarse_time);
521 521 kcoefficients_dump_2.time[BYTE_4] = (unsigned char) (time_management_regs->fine_time >> SHIFT_1_BYTE);
522 522 kcoefficients_dump_2.time[BYTE_5] = (unsigned char) (time_management_regs->fine_time);
523 523 // SEND DATA
524 524 kcoefficient_node_2.status = 1;
525 525 address = (unsigned int) &kcoefficient_node_2;
526 526 status = rtems_message_queue_send( queue_id, &address, sizeof( ring_node* ) );
527 527 if (status != RTEMS_SUCCESSFUL) {
528 528 PRINTF1("in action_dump_kcoefficients *** ERR sending packet 2, code %d", status)
529 529 }
530 530
531 531 return status;
532 532 }
533 533
534 534 int action_dump_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
535 535 {
536 536 /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue.
537 537 *
538 538 * @param queue_id is the id of the queue which handles TM related to this execution step.
539 539 *
540 540 * @return RTEMS directive status codes:
541 541 * - RTEMS_SUCCESSFUL - message sent successfully
542 542 * - RTEMS_INVALID_ID - invalid queue id
543 543 * - RTEMS_INVALID_SIZE - invalid message size
544 544 * - RTEMS_INVALID_ADDRESS - buffer is NULL
545 545 * - RTEMS_UNSATISFIED - out of message buffers
546 546 * - RTEMS_TOO_MANY - queue s limit has been reached
547 547 *
548 548 */
549 549
550 550 int status;
551 551
552 552 increment_seq_counter_destination_id_dump( parameter_dump_packet.packetSequenceControl, TC->sourceID );
553 553 parameter_dump_packet.destinationID = TC->sourceID;
554 554
555 555 // UPDATE TIME
556 556 parameter_dump_packet.time[BYTE_0] = (unsigned char) (time_management_regs->coarse_time >> SHIFT_3_BYTES);
557 557 parameter_dump_packet.time[BYTE_1] = (unsigned char) (time_management_regs->coarse_time >> SHIFT_2_BYTES);
558 558 parameter_dump_packet.time[BYTE_2] = (unsigned char) (time_management_regs->coarse_time >> SHIFT_1_BYTE);
559 559 parameter_dump_packet.time[BYTE_3] = (unsigned char) (time_management_regs->coarse_time);
560 560 parameter_dump_packet.time[BYTE_4] = (unsigned char) (time_management_regs->fine_time >> SHIFT_1_BYTE);
561 561 parameter_dump_packet.time[BYTE_5] = (unsigned char) (time_management_regs->fine_time);
562 562 // SEND DATA
563 563 status = rtems_message_queue_send( queue_id, &parameter_dump_packet,
564 564 PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
565 565 if (status != RTEMS_SUCCESSFUL) {
566 566 PRINTF1("in action_dump *** ERR sending packet, code %d", status)
567 567 }
568 568
569 569 return status;
570 570 }
571 571
572 572 //***********************
573 573 // NORMAL MODE PARAMETERS
574 574
575 575 int check_normal_par_consistency( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
576 576 {
577 577 unsigned char msb;
578 578 unsigned char lsb;
579 579 int flag;
580 580 float aux;
581 581 rtems_status_code status;
582 582
583 583 unsigned int sy_lfr_n_swf_l;
584 584 unsigned int sy_lfr_n_swf_p;
585 585 unsigned int sy_lfr_n_asm_p;
586 586 unsigned char sy_lfr_n_bp_p0;
587 587 unsigned char sy_lfr_n_bp_p1;
588 588 unsigned char sy_lfr_n_cwf_long_f3;
589 589
590 590 flag = LFR_SUCCESSFUL;
591 591
592 592 //***************
593 593 // get parameters
594 594 msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L ];
595 595 lsb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L+1 ];
596 596 sy_lfr_n_swf_l = (msb * CONST_256) + lsb;
597 597
598 598 msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P ];
599 599 lsb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P+1 ];
600 600 sy_lfr_n_swf_p = (msb * CONST_256) + lsb;
601 601
602 602 msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P ];
603 603 lsb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P+1 ];
604 604 sy_lfr_n_asm_p = (msb * CONST_256) + lsb;
605 605
606 606 sy_lfr_n_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P0 ];
607 607
608 608 sy_lfr_n_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P1 ];
609 609
610 610 sy_lfr_n_cwf_long_f3 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_CWF_LONG_F3 ];
611 611
612 612 //******************
613 613 // check consistency
614 614 // sy_lfr_n_swf_l
615 615 if (sy_lfr_n_swf_l != DFLT_SY_LFR_N_SWF_L)
616 616 {
617 617 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_SWF_L + DATAFIELD_OFFSET, sy_lfr_n_swf_l );
618 618 flag = WRONG_APP_DATA;
619 619 }
620 620 // sy_lfr_n_swf_p
621 621 if (flag == LFR_SUCCESSFUL)
622 622 {
623 623 if ( sy_lfr_n_swf_p < MIN_SY_LFR_N_SWF_P )
624 624 {
625 625 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_SWF_P + DATAFIELD_OFFSET, sy_lfr_n_swf_p );
626 626 flag = WRONG_APP_DATA;
627 627 }
628 628 }
629 629 // sy_lfr_n_bp_p0
630 630 if (flag == LFR_SUCCESSFUL)
631 631 {
632 632 if (sy_lfr_n_bp_p0 < DFLT_SY_LFR_N_BP_P0)
633 633 {
634 634 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_BP_P0 + DATAFIELD_OFFSET, sy_lfr_n_bp_p0 );
635 635 flag = WRONG_APP_DATA;
636 636 }
637 637 }
638 638 // sy_lfr_n_asm_p
639 639 if (flag == LFR_SUCCESSFUL)
640 640 {
641 641 if (sy_lfr_n_asm_p == 0)
642 642 {
643 643 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_ASM_P + DATAFIELD_OFFSET, sy_lfr_n_asm_p );
644 644 flag = WRONG_APP_DATA;
645 645 }
646 646 }
647 647 // sy_lfr_n_asm_p shall be a whole multiple of sy_lfr_n_bp_p0
648 648 if (flag == LFR_SUCCESSFUL)
649 649 {
650 650 aux = ( (float ) sy_lfr_n_asm_p / sy_lfr_n_bp_p0 ) - floor(sy_lfr_n_asm_p / sy_lfr_n_bp_p0);
651 651 if (aux > FLOAT_EQUAL_ZERO)
652 652 {
653 653 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_ASM_P + DATAFIELD_OFFSET, sy_lfr_n_asm_p );
654 654 flag = WRONG_APP_DATA;
655 655 }
656 656 }
657 657 // sy_lfr_n_bp_p1
658 658 if (flag == LFR_SUCCESSFUL)
659 659 {
660 660 if (sy_lfr_n_bp_p1 < DFLT_SY_LFR_N_BP_P1)
661 661 {
662 662 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_BP_P1 + DATAFIELD_OFFSET, sy_lfr_n_bp_p1 );
663 663 flag = WRONG_APP_DATA;
664 664 }
665 665 }
666 666 // sy_lfr_n_bp_p1 shall be a whole multiple of sy_lfr_n_bp_p0
667 667 if (flag == LFR_SUCCESSFUL)
668 668 {
669 669 aux = ( (float ) sy_lfr_n_bp_p1 / sy_lfr_n_bp_p0 ) - floor(sy_lfr_n_bp_p1 / sy_lfr_n_bp_p0);
670 670 if (aux > FLOAT_EQUAL_ZERO)
671 671 {
672 672 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_BP_P1 + DATAFIELD_OFFSET, sy_lfr_n_bp_p1 );
673 673 flag = LFR_DEFAULT;
674 674 }
675 675 }
676 676 // sy_lfr_n_cwf_long_f3
677 677
678 678 return flag;
679 679 }
680 680
681 681 int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC )
682 682 {
683 683 /** This function sets the number of points of a snapshot (sy_lfr_n_swf_l).
684 684 *
685 685 * @param TC points to the TeleCommand packet that is being processed
686 686 * @param queue_id is the id of the queue which handles TM related to this execution step
687 687 *
688 688 */
689 689
690 690 int result;
691 691
692 692 result = LFR_SUCCESSFUL;
693 693
694 694 parameter_dump_packet.sy_lfr_n_swf_l[0] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L ];
695 695 parameter_dump_packet.sy_lfr_n_swf_l[1] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L+1 ];
696 696
697 697 return result;
698 698 }
699 699
700 700 int set_sy_lfr_n_swf_p(ccsdsTelecommandPacket_t *TC )
701 701 {
702 702 /** This function sets the time between two snapshots, in s (sy_lfr_n_swf_p).
703 703 *
704 704 * @param TC points to the TeleCommand packet that is being processed
705 705 * @param queue_id is the id of the queue which handles TM related to this execution step
706 706 *
707 707 */
708 708
709 709 int result;
710 710
711 711 result = LFR_SUCCESSFUL;
712 712
713 713 parameter_dump_packet.sy_lfr_n_swf_p[0] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P ];
714 714 parameter_dump_packet.sy_lfr_n_swf_p[1] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P+1 ];
715 715
716 716 return result;
717 717 }
718 718
719 719 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC )
720 720 {
721 721 /** This function sets the time between two full spectral matrices transmission, in s (SY_LFR_N_ASM_P).
722 722 *
723 723 * @param TC points to the TeleCommand packet that is being processed
724 724 * @param queue_id is the id of the queue which handles TM related to this execution step
725 725 *
726 726 */
727 727
728 728 int result;
729 729
730 730 result = LFR_SUCCESSFUL;
731 731
732 732 parameter_dump_packet.sy_lfr_n_asm_p[0] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P ];
733 733 parameter_dump_packet.sy_lfr_n_asm_p[1] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P+1 ];
734 734
735 735 return result;
736 736 }
737 737
738 738 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC )
739 739 {
740 740 /** This function sets the time between two basic parameter sets, in s (DFLT_SY_LFR_N_BP_P0).
741 741 *
742 742 * @param TC points to the TeleCommand packet that is being processed
743 743 * @param queue_id is the id of the queue which handles TM related to this execution step
744 744 *
745 745 */
746 746
747 747 int status;
748 748
749 749 status = LFR_SUCCESSFUL;
750 750
751 751 parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P0 ];
752 752
753 753 return status;
754 754 }
755 755
756 756 int set_sy_lfr_n_bp_p1(ccsdsTelecommandPacket_t *TC )
757 757 {
758 758 /** This function sets the time between two basic parameter sets (autocorrelation + crosscorrelation), in s (sy_lfr_n_bp_p1).
759 759 *
760 760 * @param TC points to the TeleCommand packet that is being processed
761 761 * @param queue_id is the id of the queue which handles TM related to this execution step
762 762 *
763 763 */
764 764
765 765 int status;
766 766
767 767 status = LFR_SUCCESSFUL;
768 768
769 769 parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P1 ];
770