##// END OF EJS Templates
sync
paul -
r193:eb9f1afc986d R3
parent child
Show More
@@ -1,2 +1,2
1 1 a586fe639ac179e95bdc150ebdbab0312f31dc30 LFR_basic-parameters
2 d700fe1774be46689e78de1efae2ed50655b0f1c header/lfr_common_headers
2 ddd0a6fe16cc1861ad679bf646663e070189e037 header/lfr_common_headers
@@ -1,826 +1,852
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 int action_load_common_par(ccsdsTelecommandPacket_t *TC)
18 18 {
19 19 /** This function updates the LFR registers with the incoming common parameters.
20 20 *
21 21 * @param TC points to the TeleCommand packet that is being processed
22 22 *
23 23 *
24 24 */
25 25
26 26 parameter_dump_packet.unused0 = TC->dataAndCRC[0];
27 27 parameter_dump_packet.sy_lfr_common_parameters = TC->dataAndCRC[1];
28 28 set_wfp_data_shaping( );
29 29 return LFR_SUCCESSFUL;
30 30 }
31 31
32 32 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
33 33 {
34 34 /** This function updates the LFR registers with the incoming normal parameters.
35 35 *
36 36 * @param TC points to the TeleCommand packet that is being processed
37 37 * @param queue_id is the id of the queue which handles TM related to this execution step
38 38 *
39 39 */
40 40
41 41 int result;
42 42 int flag;
43 43 rtems_status_code status;
44 44
45 45 flag = LFR_SUCCESSFUL;
46 46
47 47 if ( (lfrCurrentMode == LFR_MODE_NORMAL) ||
48 48 (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) {
49 49 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
50 50 flag = LFR_DEFAULT;
51 51 }
52 52
53 53 // CHECK THE PARAMETERS SET CONSISTENCY
54 54 if (flag == LFR_SUCCESSFUL)
55 55 {
56 56 flag = check_common_par_consistency( TC, queue_id );
57 57 }
58 58
59 59 // SET THE PARAMETERS IF THEY ARE CONSISTENT
60 60 if (flag == LFR_SUCCESSFUL)
61 61 {
62 62 result = set_sy_lfr_n_swf_l( TC );
63 63 result = set_sy_lfr_n_swf_p( TC );
64 64 result = set_sy_lfr_n_bp_p0( TC );
65 65 result = set_sy_lfr_n_bp_p1( TC );
66 66 result = set_sy_lfr_n_asm_p( TC );
67 67 result = set_sy_lfr_n_cwf_long_f3( TC );
68 68 }
69 69
70 70 return flag;
71 71 }
72 72
73 73 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
74 74 {
75 75 /** This function updates the LFR registers with the incoming burst parameters.
76 76 *
77 77 * @param TC points to the TeleCommand packet that is being processed
78 78 * @param queue_id is the id of the queue which handles TM related to this execution step
79 79 *
80 80 */
81 81
82 82 int flag;
83 83 rtems_status_code status;
84 84 unsigned char sy_lfr_b_bp_p0;
85 85 unsigned char sy_lfr_b_bp_p1;
86 86 float aux;
87 87
88 88 flag = LFR_SUCCESSFUL;
89 89
90 90 if ( lfrCurrentMode == LFR_MODE_BURST ) {
91 91 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
92 92 flag = LFR_DEFAULT;
93 93 }
94 94
95 95 sy_lfr_b_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P0 ];
96 96 sy_lfr_b_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P1 ];
97 97
98 98 // sy_lfr_b_bp_p0
99 99 if (flag == LFR_SUCCESSFUL)
100 100 {
101 101 if (sy_lfr_b_bp_p0 < DEFAULT_SY_LFR_B_BP_P0 )
102 102 {
103 103 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_B_BP_P0+10, sy_lfr_b_bp_p0 );
104 104 flag = WRONG_APP_DATA;
105 105 }
106 106 }
107 107 // sy_lfr_b_bp_p1
108 108 if (flag == LFR_SUCCESSFUL)
109 109 {
110 110 if (sy_lfr_b_bp_p1 < DEFAULT_SY_LFR_B_BP_P1 )
111 111 {
112 112 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_B_BP_P1+10, sy_lfr_b_bp_p1 );
113 113 flag = WRONG_APP_DATA;
114 114 }
115 115 }
116 116 //****************************************************************
117 117 // check the consistency between sy_lfr_b_bp_p0 and sy_lfr_b_bp_p1
118 118 if (flag == LFR_SUCCESSFUL)
119 119 {
120 120 sy_lfr_b_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P0 ];
121 121 sy_lfr_b_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P1 ];
122 122 aux = ( (float ) sy_lfr_b_bp_p1 / sy_lfr_b_bp_p0 ) - floor(sy_lfr_b_bp_p1 / sy_lfr_b_bp_p0);
123 123 if (aux > FLOAT_EQUAL_ZERO)
124 124 {
125 125 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_B_BP_P0+10, sy_lfr_b_bp_p0 );
126 126 flag = LFR_DEFAULT;
127 127 }
128 128 }
129 129
130 130 // SET HTE PARAMETERS
131 131 if (flag == LFR_SUCCESSFUL)
132 132 {
133 133 flag = set_sy_lfr_b_bp_p0( TC );
134 134 flag = set_sy_lfr_b_bp_p1( TC );
135 135 }
136 136
137 137 return flag;
138 138 }
139 139
140 140 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
141 141 {
142 142 /** This function updates the LFR registers with the incoming sbm1 parameters.
143 143 *
144 144 * @param TC points to the TeleCommand packet that is being processed
145 145 * @param queue_id is the id of the queue which handles TM related to this execution step
146 146 *
147 147 */
148 148
149 149 int flag;
150 150 rtems_status_code status;
151 151 unsigned char sy_lfr_s1_bp_p0;
152 152 unsigned char sy_lfr_s1_bp_p1;
153 153 float aux;
154 154
155 155 flag = LFR_SUCCESSFUL;
156 156
157 157 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
158 158 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
159 159 flag = LFR_DEFAULT;
160 160 }
161 161
162 162 sy_lfr_s1_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P0 ];
163 163 sy_lfr_s1_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P1 ];
164 164
165 165 // sy_lfr_s1_bp_p0
166 166 if (flag == LFR_SUCCESSFUL)
167 167 {
168 168 if (sy_lfr_s1_bp_p0 < DEFAULT_SY_LFR_S1_BP_P0 )
169 169 {
170 170 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S1_BP_P0+10, sy_lfr_s1_bp_p0 );
171 171 flag = WRONG_APP_DATA;
172 172 }
173 173 }
174 174 // sy_lfr_s1_bp_p1
175 175 if (flag == LFR_SUCCESSFUL)
176 176 {
177 177 if (sy_lfr_s1_bp_p1 < DEFAULT_SY_LFR_S1_BP_P1 )
178 178 {
179 179 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S1_BP_P1+10, sy_lfr_s1_bp_p1 );
180 180 flag = WRONG_APP_DATA;
181 181 }
182 182 }
183 183 //******************************************************************
184 184 // check the consistency between sy_lfr_s1_bp_p0 and sy_lfr_s1_bp_p1
185 185 if (flag == LFR_SUCCESSFUL)
186 186 {
187 187 aux = ( (float ) sy_lfr_s1_bp_p1 / (sy_lfr_s1_bp_p0*0.25) ) - floor(sy_lfr_s1_bp_p1 / (sy_lfr_s1_bp_p0*0.25));
188 188 if (aux > FLOAT_EQUAL_ZERO)
189 189 {
190 190 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S1_BP_P0+10, sy_lfr_s1_bp_p0 );
191 191 flag = LFR_DEFAULT;
192 192 }
193 193 }
194 194
195 195 // SET THE PARAMETERS
196 196 if (flag == LFR_SUCCESSFUL)
197 197 {
198 198 flag = set_sy_lfr_s1_bp_p0( TC );
199 199 flag = set_sy_lfr_s1_bp_p1( TC );
200 200 }
201 201
202 202 return flag;
203 203 }
204 204
205 205 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
206 206 {
207 207 /** This function updates the LFR registers with the incoming sbm2 parameters.
208 208 *
209 209 * @param TC points to the TeleCommand packet that is being processed
210 210 * @param queue_id is the id of the queue which handles TM related to this execution step
211 211 *
212 212 */
213 213
214 214 int flag;
215 215 rtems_status_code status;
216 216 unsigned char sy_lfr_s2_bp_p0;
217 217 unsigned char sy_lfr_s2_bp_p1;
218 218 float aux;
219 219
220 220 flag = LFR_SUCCESSFUL;
221 221
222 222 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
223 223 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
224 224 flag = LFR_DEFAULT;
225 225 }
226 226
227 227 sy_lfr_s2_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P0 ];
228 228 sy_lfr_s2_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P1 ];
229 229
230 230 // sy_lfr_s2_bp_p0
231 231 if (flag == LFR_SUCCESSFUL)
232 232 {
233 233 if (sy_lfr_s2_bp_p0 < DEFAULT_SY_LFR_S2_BP_P0 )
234 234 {
235 235 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S2_BP_P0+10, sy_lfr_s2_bp_p0 );
236 236 flag = WRONG_APP_DATA;
237 237 }
238 238 }
239 239 // sy_lfr_s2_bp_p1
240 240 if (flag == LFR_SUCCESSFUL)
241 241 {
242 242 if (sy_lfr_s2_bp_p1 < DEFAULT_SY_LFR_S2_BP_P1 )
243 243 {
244 244 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S2_BP_P1+10, sy_lfr_s2_bp_p1 );
245 245 flag = WRONG_APP_DATA;
246 246 }
247 247 }
248 248 //******************************************************************
249 249 // check the consistency between sy_lfr_s2_bp_p0 and sy_lfr_s2_bp_p1
250 250 if (flag == LFR_SUCCESSFUL)
251 251 {
252 252 sy_lfr_s2_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P0 ];
253 253 sy_lfr_s2_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P1 ];
254 254 aux = ( (float ) sy_lfr_s2_bp_p1 / sy_lfr_s2_bp_p0 ) - floor(sy_lfr_s2_bp_p1 / sy_lfr_s2_bp_p0);
255 255 if (aux > FLOAT_EQUAL_ZERO)
256 256 {
257 257 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S2_BP_P0+10, sy_lfr_s2_bp_p0 );
258 258 flag = LFR_DEFAULT;
259 259 }
260 260 }
261 261
262 262 // SET THE PARAMETERS
263 263 if (flag == LFR_SUCCESSFUL)
264 264 {
265 265 flag = set_sy_lfr_s2_bp_p0( TC );
266 266 flag = set_sy_lfr_s2_bp_p1( TC );
267 267 }
268 268
269 269 return flag;
270 270 }
271 271
272 272 int action_load_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
273 273 {
274 274 /** This function updates the LFR registers with the incoming sbm2 parameters.
275 275 *
276 276 * @param TC points to the TeleCommand packet that is being processed
277 277 * @param queue_id is the id of the queue which handles TM related to this execution step
278 278 *
279 279 */
280 280
281 281 int flag;
282 282
283 283 flag = LFR_DEFAULT;
284 284
285 // NB_BINS_COMPRESSED_SM_F0;
286 // NB_BINS_COMPRESSED_SM_F1;
287 // NB_BINS_COMPRESSED_SM_F2;
288
285 289 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
286 290
287 291 return flag;
288 292 }
289 293
290 294 int action_load_fbins_mask(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
291 295 {
292 296 /** This function updates the LFR registers with the incoming sbm2 parameters.
293 297 *
294 298 * @param TC points to the TeleCommand packet that is being processed
295 299 * @param queue_id is the id of the queue which handles TM related to this execution step
296 300 *
297 301 */
298 302
299 303 int flag;
300 304
301 305 flag = LFR_DEFAULT;
302 306
303 307 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
304 308
305 309 return flag;
306 310 }
307 311
308 312 int action_dump_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
309 313 {
310 314 /** This function updates the LFR registers with the incoming sbm2 parameters.
311 315 *
312 316 * @param TC points to the TeleCommand packet that is being processed
313 317 * @param queue_id is the id of the queue which handles TM related to this execution step
314 318 *
315 319 */
316 320
317 321 int flag;
318 322
319 323 flag = LFR_DEFAULT;
320 324
321 325 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
322 326
323 327 return flag;
324 328 }
325 329
326 330 int action_dump_par( rtems_id queue_id )
327 331 {
328 332 /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue.
329 333 *
330 334 * @param queue_id is the id of the queue which handles TM related to this execution step.
331 335 *
332 336 * @return RTEMS directive status codes:
333 337 * - RTEMS_SUCCESSFUL - message sent successfully
334 338 * - RTEMS_INVALID_ID - invalid queue id
335 339 * - RTEMS_INVALID_SIZE - invalid message size
336 340 * - RTEMS_INVALID_ADDRESS - buffer is NULL
337 341 * - RTEMS_UNSATISFIED - out of message buffers
338 342 * - RTEMS_TOO_MANY - queue s limit has been reached
339 343 *
340 344 */
341 345
342 346 int status;
343 347
344 348 // UPDATE TIME
345 349 parameter_dump_packet.packetSequenceControl[0] = (unsigned char) (sequenceCounterParameterDump >> 8);
346 350 parameter_dump_packet.packetSequenceControl[1] = (unsigned char) (sequenceCounterParameterDump );
347 351 increment_seq_counter( &sequenceCounterParameterDump );
348 352
349 353 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
350 354 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
351 355 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
352 356 parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
353 357 parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
354 358 parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
355 359 // SEND DATA
356 360 status = rtems_message_queue_send( queue_id, &parameter_dump_packet,
357 361 PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
358 362 if (status != RTEMS_SUCCESSFUL) {
359 363 PRINTF1("in action_dump *** ERR sending packet, code %d", status)
360 364 }
361 365
362 366 return status;
363 367 }
364 368
365 369 //***********************
366 370 // NORMAL MODE PARAMETERS
367 371
368 372 int check_common_par_consistency( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
369 373 {
370 374 unsigned char msb;
371 375 unsigned char lsb;
372 376 int flag;
373 377 float aux;
374 378 rtems_status_code status;
375 379
376 380 unsigned int sy_lfr_n_swf_l;
377 381 unsigned int sy_lfr_n_swf_p;
378 382 unsigned int sy_lfr_n_asm_p;
379 383 unsigned char sy_lfr_n_bp_p0;
380 384 unsigned char sy_lfr_n_bp_p1;
381 385 unsigned char sy_lfr_n_cwf_long_f3;
382 386
383 387 flag = LFR_SUCCESSFUL;
384 388
385 389 //***************
386 390 // get parameters
387 391 msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L ];
388 392 lsb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L+1 ];
389 393 sy_lfr_n_swf_l = msb * 256 + lsb;
390 394
391 395 msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P ];
392 396 lsb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P+1 ];
393 397 sy_lfr_n_swf_p = msb * 256 + lsb;
394 398
395 399 msb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P ];
396 400 lsb = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P+1 ];
397 401 sy_lfr_n_asm_p = msb * 256 + lsb;
398 402
399 403 sy_lfr_n_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P0 ];
400 404
401 405 sy_lfr_n_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P1 ];
402 406
403 407 sy_lfr_n_cwf_long_f3 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_CWF_LONG_F3 ];
404 408
405 409 //******************
406 410 // check consistency
407 411 // sy_lfr_n_swf_l
408 412 if (sy_lfr_n_swf_l != 2048)
409 413 {
410 414 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_SWF_L+10, sy_lfr_n_swf_l );
411 415 flag = WRONG_APP_DATA;
412 416 }
413 417 // sy_lfr_n_swf_p
414 418 if (flag == LFR_SUCCESSFUL)
415 419 {
416 420 if ( sy_lfr_n_swf_p < 16 )
417 421 {
418 422 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_SWF_P+10, sy_lfr_n_swf_p );
419 423 flag = WRONG_APP_DATA;
420 424 }
421 425 }
422 426 // sy_lfr_n_bp_p0
423 427 if (flag == LFR_SUCCESSFUL)
424 428 {
425 429 if (sy_lfr_n_bp_p0 < DFLT_SY_LFR_N_BP_P0)
426 430 {
427 431 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_BP_P0+10, sy_lfr_n_bp_p0 );
428 432 flag = WRONG_APP_DATA;
429 433 }
430 434 }
431 435 // sy_lfr_n_asm_p
432 436 if (flag == LFR_SUCCESSFUL)
433 437 {
434 438 if (sy_lfr_n_asm_p == 0)
435 439 {
436 440 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_ASM_P+10, sy_lfr_n_asm_p );
437 441 flag = WRONG_APP_DATA;
438 442 }
439 443 }
440 444 // sy_lfr_n_asm_p shall be a whole multiple of sy_lfr_n_bp_p0
441 445 if (flag == LFR_SUCCESSFUL)
442 446 {
443 447 aux = ( (float ) sy_lfr_n_asm_p / sy_lfr_n_bp_p0 ) - floor(sy_lfr_n_asm_p / sy_lfr_n_bp_p0);
444 448 if (aux > FLOAT_EQUAL_ZERO)
445 449 {
446 450 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_ASM_P+10, sy_lfr_n_asm_p );
447 451 flag = WRONG_APP_DATA;
448 452 }
449 453 }
450 454 // sy_lfr_n_bp_p1
451 455 if (flag == LFR_SUCCESSFUL)
452 456 {
453 457 if (sy_lfr_n_bp_p1 < DFLT_SY_LFR_N_BP_P1)
454 458 {
455 459 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_BP_P1+10, sy_lfr_n_bp_p1 );
456 460 flag = WRONG_APP_DATA;
457 461 }
458 462 }
459 463 // sy_lfr_n_bp_p1 shall be a whole multiple of sy_lfr_n_bp_p0
460 464 if (flag == LFR_SUCCESSFUL)
461 465 {
462 466 aux = ( (float ) sy_lfr_n_bp_p1 / sy_lfr_n_bp_p0 ) - floor(sy_lfr_n_bp_p1 / sy_lfr_n_bp_p0);
463 467 if (aux > FLOAT_EQUAL_ZERO)
464 468 {
465 469 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_N_BP_P1+10, sy_lfr_n_bp_p1 );
466 470 flag = LFR_DEFAULT;
467 471 }
468 472 }
469 473 // sy_lfr_n_cwf_long_f3
470 474
471 475 return flag;
472 476 }
473 477
474 478 int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC )
475 479 {
476 480 /** This function sets the number of points of a snapshot (sy_lfr_n_swf_l).
477 481 *
478 482 * @param TC points to the TeleCommand packet that is being processed
479 483 * @param queue_id is the id of the queue which handles TM related to this execution step
480 484 *
481 485 */
482 486
483 487 int result;
484 488
485 489 result = LFR_SUCCESSFUL;
486 490
487 491 parameter_dump_packet.sy_lfr_n_swf_l[0] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L ];
488 492 parameter_dump_packet.sy_lfr_n_swf_l[1] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_L+1 ];
489 493
490 494 return result;
491 495 }
492 496
493 497 int set_sy_lfr_n_swf_p(ccsdsTelecommandPacket_t *TC )
494 498 {
495 499 /** This function sets the time between two snapshots, in s (sy_lfr_n_swf_p).
496 500 *
497 501 * @param TC points to the TeleCommand packet that is being processed
498 502 * @param queue_id is the id of the queue which handles TM related to this execution step
499 503 *
500 504 */
501 505
502 506 int result;
503 507
504 508 result = LFR_SUCCESSFUL;
505 509
506 510 parameter_dump_packet.sy_lfr_n_swf_p[0] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P ];
507 511 parameter_dump_packet.sy_lfr_n_swf_p[1] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_SWF_P+1 ];
508 512
509 513 return result;
510 514 }
511 515
512 516 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC )
513 517 {
514 518 /** This function sets the time between two full spectral matrices transmission, in s (SY_LFR_N_ASM_P).
515 519 *
516 520 * @param TC points to the TeleCommand packet that is being processed
517 521 * @param queue_id is the id of the queue which handles TM related to this execution step
518 522 *
519 523 */
520 524
521 525 int result;
522 526
523 527 result = LFR_SUCCESSFUL;
524 528
525 529 parameter_dump_packet.sy_lfr_n_asm_p[0] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P ];
526 530 parameter_dump_packet.sy_lfr_n_asm_p[1] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_ASM_P+1 ];
527 531
528 532 return result;
529 533 }
530 534
531 535 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC )
532 536 {
533 537 /** This function sets the time between two basic parameter sets, in s (DFLT_SY_LFR_N_BP_P0).
534 538 *
535 539 * @param TC points to the TeleCommand packet that is being processed
536 540 * @param queue_id is the id of the queue which handles TM related to this execution step
537 541 *
538 542 */
539 543
540 544 int status;
541 545
542 546 status = LFR_SUCCESSFUL;
543 547
544 548 parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P0 ];
545 549
546 550 return status;
547 551 }
548 552
549 553 int set_sy_lfr_n_bp_p1(ccsdsTelecommandPacket_t *TC )
550 554 {
551 555 /** This function sets the time between two basic parameter sets (autocorrelation + crosscorrelation), in s (sy_lfr_n_bp_p1).
552 556 *
553 557 * @param TC points to the TeleCommand packet that is being processed
554 558 * @param queue_id is the id of the queue which handles TM related to this execution step
555 559 *
556 560 */
557 561
558 562 int status;
559 563
560 564 status = LFR_SUCCESSFUL;
561 565
562 566 parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_BP_P1 ];
563 567
564 568 return status;
565 569 }
566 570
567 571 int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC )
568 572 {
569 573 /** This function allows to switch from CWF_F3 packets to CWF_LONG_F3 packets.
570 574 *
571 575 * @param TC points to the TeleCommand packet that is being processed
572 576 * @param queue_id is the id of the queue which handles TM related to this execution step
573 577 *
574 578 */
575 579
576 580 int status;
577 581
578 582 status = LFR_SUCCESSFUL;
579 583
580 584 parameter_dump_packet.sy_lfr_n_cwf_long_f3 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_N_CWF_LONG_F3 ];
581 585
582 586 return status;
583 587 }
584 588
585 589 //**********************
586 590 // BURST MODE PARAMETERS
587 591 int set_sy_lfr_b_bp_p0(ccsdsTelecommandPacket_t *TC)
588 592 {
589 593 /** This function sets the time between two basic parameter sets, in s (SY_LFR_B_BP_P0).
590 594 *
591 595 * @param TC points to the TeleCommand packet that is being processed
592 596 * @param queue_id is the id of the queue which handles TM related to this execution step
593 597 *
594 598 */
595 599
596 600 int status;
597 601
598 602 status = LFR_SUCCESSFUL;
599 603
600 604 parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P0 ];
601 605
602 606 return status;
603 607 }
604 608
605 609 int set_sy_lfr_b_bp_p1( ccsdsTelecommandPacket_t *TC )
606 610 {
607 611 /** This function sets the time between two basic parameter sets, in s (SY_LFR_B_BP_P1).
608 612 *
609 613 * @param TC points to the TeleCommand packet that is being processed
610 614 * @param queue_id is the id of the queue which handles TM related to this execution step
611 615 *
612 616 */
613 617
614 618 int status;
615 619
616 620 status = LFR_SUCCESSFUL;
617 621
618 622 parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P1 ];
619 623
620 624 return status;
621 625 }
622 626
623 627 //*********************
624 628 // SBM1 MODE PARAMETERS
625 629 int set_sy_lfr_s1_bp_p0( ccsdsTelecommandPacket_t *TC )
626 630 {
627 631 /** This function sets the time between two basic parameter sets, in s (SY_LFR_S1_BP_P0).
628 632 *
629 633 * @param TC points to the TeleCommand packet that is being processed
630 634 * @param queue_id is the id of the queue which handles TM related to this execution step
631 635 *
632 636 */
633 637
634 638 int status;
635 639
636 640 status = LFR_SUCCESSFUL;
637 641
638 642 parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P0 ];
639 643
640 644 return status;
641 645 }
642 646
643 647 int set_sy_lfr_s1_bp_p1( ccsdsTelecommandPacket_t *TC )
644 648 {
645 649 /** This function sets the time between two basic parameter sets, in s (SY_LFR_S1_BP_P1).
646 650 *
647 651 * @param TC points to the TeleCommand packet that is being processed
648 652 * @param queue_id is the id of the queue which handles TM related to this execution step
649 653 *
650 654 */
651 655
652 656 int status;
653 657
654 658 status = LFR_SUCCESSFUL;
655 659
656 660 parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P1 ];
657 661
658 662 return status;
659 663 }
660 664
661 665 //*********************
662 666 // SBM2 MODE PARAMETERS
663 667 int set_sy_lfr_s2_bp_p0(ccsdsTelecommandPacket_t *TC)
664 668 {
665 669 /** This function sets the time between two basic parameter sets, in s (SY_LFR_S2_BP_P0).
666 670 *
667 671 * @param TC points to the TeleCommand packet that is being processed
668 672 * @param queue_id is the id of the queue which handles TM related to this execution step
669 673 *
670 674 */
671 675
672 676 int status;
673 677
674 678 status = LFR_SUCCESSFUL;
675 679
676 680 parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P0 ];
677 681
678 682 return status;
679 683 }
680 684
681 685 int set_sy_lfr_s2_bp_p1( ccsdsTelecommandPacket_t *TC )
682 686 {
683 687 /** This function sets the time between two basic parameter sets, in s (SY_LFR_S2_BP_P1).
684 688 *
685 689 * @param TC points to the TeleCommand packet that is being processed
686 690 * @param queue_id is the id of the queue which handles TM related to this execution step
687 691 *
688 692 */
689 693
690 694 int status;
691 695
692 696 status = LFR_SUCCESSFUL;
693 697
694 698 parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P1 ];
695 699
696 700 return status;
697 701 }
698 702
699
700 703 //*******************
701 704 // TC_LFR_UPDATE_INFO
702 705 unsigned int check_update_info_hk_lfr_mode( unsigned char mode )
703 706 {
704 707 unsigned int status;
705 708
706 709 if ( (mode == LFR_MODE_STANDBY) || (mode == LFR_MODE_NORMAL)
707 710 || (mode == LFR_MODE_BURST)
708 711 || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2))
709 712 {
710 713 status = LFR_SUCCESSFUL;
711 714 }
712 715 else
713 716 {
714 717 status = LFR_DEFAULT;
715 718 }
716 719
717 720 return status;
718 721 }
719 722
720 723 unsigned int check_update_info_hk_tds_mode( unsigned char mode )
721 724 {
722 725 unsigned int status;
723 726
724 727 if ( (mode == TDS_MODE_STANDBY) || (mode == TDS_MODE_NORMAL)
725 728 || (mode == TDS_MODE_BURST)
726 729 || (mode == TDS_MODE_SBM1) || (mode == TDS_MODE_SBM2)
727 730 || (mode == TDS_MODE_LFM))
728 731 {
729 732 status = LFR_SUCCESSFUL;
730 733 }
731 734 else
732 735 {
733 736 status = LFR_DEFAULT;
734 737 }
735 738
736 739 return status;
737 740 }
738 741
739 742 unsigned int check_update_info_hk_thr_mode( unsigned char mode )
740 743 {
741 744 unsigned int status;
742 745
743 746 if ( (mode == THR_MODE_STANDBY) || (mode == THR_MODE_NORMAL)
744 747 || (mode == THR_MODE_BURST))
745 748 {
746 749 status = LFR_SUCCESSFUL;
747 750 }
748 751 else
749 752 {
750 753 status = LFR_DEFAULT;
751 754 }
752 755
753 756 return status;
754 757 }
755 758
759 //**************
760 // KCOEFFICIENTS
761 int set_sy_lfr_kcoeff( ccsdsTelecommandPacket_t *TC )
762 {
763 unsigned short sy_lfr_kcoeff_frequency;
764 unsigned short *freqPtr;
765 int status;
766
767 status = LFR_SUCCESSFUL;
768
769 freqPtr = (unsigned short *) &TC->dataAndCRC[0];
770 sy_lfr_kcoeff_frequency = *freqPtr;
771
772 PRINTF1("sy_lfr_kcoeff_frequency = %d\n", sy_lfr_kcoeff_frequency)
773
774 if (sy_lfr_kcoeff_frequency >= NB_BINS_COMPRESSED_SM)
775 {
776 PRINTF1("ERR *** in set_sy_lfr_kcoeff_frequency *** sy_lfr_kcoeff_frequency = %d\n", sy_lfr_kcoeff_frequency)
777 }
778
779 return status;
780 }
781
756 782 //**********
757 783 // init dump
758 784
759 785 void init_parameter_dump( void )
760 786 {
761 787 /** This function initialize the parameter_dump_packet global variable with default values.
762 788 *
763 789 */
764 790
765 791 parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
766 792 parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
767 793 parameter_dump_packet.reserved = CCSDS_RESERVED;
768 794 parameter_dump_packet.userApplication = CCSDS_USER_APP;
769 795 parameter_dump_packet.packetID[0] = (unsigned char) (APID_TM_PARAMETER_DUMP >> 8);
770 796 parameter_dump_packet.packetID[1] = (unsigned char) APID_TM_PARAMETER_DUMP;
771 797 parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
772 798 parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
773 799 parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8);
774 800 parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP;
775 801 // DATA FIELD HEADER
776 802 parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2;
777 803 parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP;
778 804 parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP;
779 805 parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND;
780 806 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
781 807 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
782 808 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
783 809 parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
784 810 parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
785 811 parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
786 812 parameter_dump_packet.sid = SID_PARAMETER_DUMP;
787 813
788 814 //******************
789 815 // COMMON PARAMETERS
790 816 parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0;
791 817 parameter_dump_packet.sy_lfr_common_parameters = DEFAULT_SY_LFR_COMMON1;
792 818
793 819 //******************
794 820 // NORMAL PARAMETERS
795 821 parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (DFLT_SY_LFR_N_SWF_L >> 8);
796 822 parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (DFLT_SY_LFR_N_SWF_L );
797 823 parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (DFLT_SY_LFR_N_SWF_P >> 8);
798 824 parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (DFLT_SY_LFR_N_SWF_P );
799 825 parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (DFLT_SY_LFR_N_ASM_P >> 8);
800 826 parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (DFLT_SY_LFR_N_ASM_P );
801 827 parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) DFLT_SY_LFR_N_BP_P0;
802 828 parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) DFLT_SY_LFR_N_BP_P1;
803 829 parameter_dump_packet.sy_lfr_n_cwf_long_f3 = (unsigned char) DFLT_SY_LFR_N_CWF_LONG_F3;
804 830
805 831 //*****************
806 832 // BURST PARAMETERS
807 833 parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0;
808 834 parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1;
809 835
810 836 //****************
811 837 // SBM1 PARAMETERS
812 838 parameter_dump_packet.sy_lfr_s1_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P0; // min value is 0.25 s for the period
813 839 parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1;
814 840
815 841 //****************
816 842 // SBM2 PARAMETERS
817 843 parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0;
818 844 parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1;
819 845 }
820 846
821 847
822 848
823 849
824 850
825 851
826 852
General Comments 0
You need to be logged in to leave comments. Login now