##// END OF EJS Templates
ICD 4.1 taken into account
paul -
r283:c0251025dc7b R3_plus draft
parent child
Show More
@@ -1,2 +1,2
1 1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
2 c3197ff831df5057bdd145a4efd94ded0618661f header/lfr_common_headers
2 81c3289ebd2a13e3b3147acdf60e34678378f905 header/lfr_common_headers
@@ -116,7 +116,6 HEADERS += \
116 116 ../header/lfr_common_headers/fsw_params.h \
117 117 ../header/lfr_common_headers/fsw_params_nb_bytes.h \
118 118 ../header/lfr_common_headers/fsw_params_processing.h \
119 ../header/lfr_common_headers/TC_types.h \
120 119 ../header/lfr_common_headers/tm_byte_positions.h \
121 120 ../LFR_basic-parameters/basic_parameters.h \
122 121 ../LFR_basic-parameters/basic_parameters_params.h \
@@ -21,6 +21,15 extern rtems_id Task_id[20];
21 21 extern rtems_name timecode_timer_name;
22 22 extern rtems_id timecode_timer_id;
23 23 extern unsigned char pa_bia_status_info;
24 extern unsigned char cp_rpw_sc_rw_f_flags;
25 extern float cp_rpw_sc_rw1_f1;
26 extern float cp_rpw_sc_rw1_f2;
27 extern float cp_rpw_sc_rw2_f1;
28 extern float cp_rpw_sc_rw2_f2;
29 extern float cp_rpw_sc_rw3_f1;
30 extern float cp_rpw_sc_rw3_f2;
31 extern float cp_rpw_sc_rw4_f1;
32 extern float cp_rpw_sc_rw4_f2;
24 33
25 34 // RTEMS TASKS
26 35 rtems_task Init( rtems_task_argument argument);
@@ -35,7 +35,7 typedef struct
35 35 unsigned char time[6];
36 36 // AUXILIARY HEADER
37 37 unsigned char sid;
38 unsigned char biaStatusInfo;
38 unsigned char pa_bia_status_info;
39 39 unsigned char sy_lfr_common_parameters_spare;
40 40 unsigned char sy_lfr_common_parameters;
41 41 unsigned char acquisitionTime[6];
@@ -61,7 +61,7 typedef struct
61 61 unsigned char time[6];
62 62 // AUXILIARY HEADER
63 63 unsigned char sid;
64 unsigned char biaStatusInfo;
64 unsigned char pa_bia_status_info;
65 65 unsigned char sy_lfr_common_parameters_spare;
66 66 unsigned char sy_lfr_common_parameters;
67 67 unsigned char acquisitionTime[6];
@@ -91,6 +91,9 extern volatile int sm_f2[ ];
91 91 // parameters
92 92 extern struct param_local_str param_local;
93 93 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
94 extern unsigned char rw_fbins_mask_f0[16];
95 extern unsigned char rw_fbins_mask_f1[16];
96 extern unsigned char rw_fbins_mask_f2[16];
94 97
95 98 // registers
96 99 extern time_management_regs_t *time_management_regs;
@@ -20,6 +20,9 extern float k_coeff_intercalib_f0_sbm[
20 20 extern float k_coeff_intercalib_f1_norm[ ];
21 21 extern float k_coeff_intercalib_f1_sbm[ ];
22 22 extern float k_coeff_intercalib_f2[ ];
23 extern unsigned char rw_fbins_mask_f0[16];
24 extern unsigned char rw_fbins_mask_f1[16];
25 extern unsigned char rw_fbins_mask_f2[16];
23 26
24 27 int action_load_common_par( ccsdsTelecommandPacket_t *TC );
25 28 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
@@ -28,7 +31,7 int action_load_sbm1_par(ccsdsTelecomman
28 31 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
29 32 int action_load_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
30 33 int action_load_fbins_mask(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
31 int action_load_pas_filter_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
34 int action_load_filter_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
32 35 int action_dump_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
33 36 int action_dump_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
34 37
@@ -57,6 +60,9 int set_sy_lfr_s2_bp_p1( ccsdsTelecomman
57 60 unsigned int check_update_info_hk_lfr_mode( unsigned char mode );
58 61 unsigned int check_update_info_hk_tds_mode( unsigned char mode );
59 62 unsigned int check_update_info_hk_thr_mode( unsigned char mode );
63 void getReactionWheelsFrequencies( ccsdsTelecommandPacket_t *TC );
64 void build_rw_fbins_mask( unsigned int channel );
65 void build_rw_fbins_masks();
60 66
61 67 // FBINS_MASK
62 68 int set_sy_lfr_fbins( ccsdsTelecommandPacket_t *TC );
@@ -66,6 +66,7 unsigned int lastValidEnterModeTime;
66 66
67 67 // HK PACKETS
68 68 Packet_TM_LFR_HK_t housekeeping_packet;
69 unsigned char cp_rpw_sc_rw_f_flags;
69 70 // message queues occupancy
70 71 unsigned char hk_lfr_q_sd_fifo_size_max;
71 72 unsigned char hk_lfr_q_rv_fifo_size_max;
@@ -79,3 +80,16 unsigned short sequenceCounters_TC_EXE[S
79 80 unsigned short sequenceCounters_TM_DUMP[SEQ_CNT_NB_DEST_ID];
80 81 unsigned short sequenceCounterHK;
81 82 spw_stats grspw_stats;
83
84 // TC_LFR_UPDATE_INFO
85 float cp_rpw_sc_rw1_f1;
86 float cp_rpw_sc_rw1_f2;
87 float cp_rpw_sc_rw2_f1;
88 float cp_rpw_sc_rw2_f2;
89 float cp_rpw_sc_rw3_f1;
90 float cp_rpw_sc_rw3_f2;
91 float cp_rpw_sc_rw4_f1;
92 float cp_rpw_sc_rw4_f2;
93 unsigned char rw_fbins_mask_f0[16];
94 unsigned char rw_fbins_mask_f1[16];
95 unsigned char rw_fbins_mask_f2[16];
@@ -160,6 +160,15 rtems_task Init( rtems_task_argument ign
160 160 init_k_coefficients_prc1();
161 161 init_k_coefficients_prc2();
162 162 pa_bia_status_info = 0x00;
163 cp_rpw_sc_rw_f_flags = 0x00;
164 cp_rpw_sc_rw1_f1 = 0.0;
165 cp_rpw_sc_rw1_f2 = 0.0;
166 cp_rpw_sc_rw2_f1 = 0.0;
167 cp_rpw_sc_rw2_f2 = 0.0;
168 cp_rpw_sc_rw3_f1 = 0.0;
169 cp_rpw_sc_rw3_f2 = 0.0;
170 cp_rpw_sc_rw4_f1 = 0.0;
171 cp_rpw_sc_rw4_f2 = 0.0;
163 172 update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE );
164 173
165 174 // waveform picker initialization
@@ -317,6 +317,8 rtems_task hous_task(rtems_task_argument
317 317
318 318 hk_lfr_le_me_he_update();
319 319
320 housekeeping_packet.hk_lfr_sc_rw_f_flags = cp_rpw_sc_rw_f_flags;
321
320 322 // SEND PACKET
321 323 status = rtems_message_queue_send( queue_id, &housekeeping_packet,
322 324 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
@@ -1021,7 +1021,7 void init_header_cwf( Header_TM_LFR_SCIE
1021 1021 header->time[0] = 0x00;
1022 1022 // AUXILIARY DATA HEADER
1023 1023 header->sid = 0x00;
1024 header->hkBIA = DEFAULT_HKBIA;
1024 header->pa_bia_status_info = DEFAULT_HKBIA;
1025 1025 header->blkNr[0] = 0x00;
1026 1026 header->blkNr[1] = 0x00;
1027 1027 }
@@ -1051,7 +1051,7 void init_header_swf( Header_TM_LFR_SCIE
1051 1051 header->time[0] = 0x00;
1052 1052 // AUXILIARY DATA HEADER
1053 1053 header->sid = 0x00;
1054 header->hkBIA = DEFAULT_HKBIA;
1054 header->pa_bia_status_info = DEFAULT_HKBIA;
1055 1055 header->pktCnt = DEFAULT_PKTCNT; // PKT_CNT
1056 1056 header->pktNr = 0x00;
1057 1057 header->blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8);
@@ -1083,7 +1083,7 void init_header_asm( Header_TM_LFR_SCIE
1083 1083 header->time[0] = 0x00;
1084 1084 // AUXILIARY DATA HEADER
1085 1085 header->sid = 0x00;
1086 header->biaStatusInfo = 0x00;
1086 header->pa_bia_status_info = 0x00;
1087 1087 header->pa_lfr_pkt_cnt_asm = 0x00;
1088 1088 header->pa_lfr_pkt_nr_asm = 0x00;
1089 1089 header->pa_lfr_asm_blk_nr[0] = 0x00;
@@ -1126,7 +1126,7 int spw_send_waveform_CWF( ring_node *ri
1126 1126
1127 1127 header->packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8);
1128 1128 header->packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 );
1129 header->hkBIA = pa_bia_status_info;
1129 header->pa_bia_status_info = pa_bia_status_info;
1130 1130 header->sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
1131 1131 header->blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8);
1132 1132 header->blkNr[1] = (unsigned char) (BLK_NR_CWF );
@@ -1209,7 +1209,7 int spw_send_waveform_SWF( ring_node *ri
1209 1209 dataPtr = (int*) ring_node_to_send->buffer_address;
1210 1210 sid = ring_node_to_send->sid;
1211 1211
1212 header->hkBIA = pa_bia_status_info;
1212 header->pa_bia_status_info = pa_bia_status_info;
1213 1213 header->sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
1214 1214
1215 1215 for (i=0; i<7; i++) // send waveform
@@ -1300,7 +1300,7 int spw_send_waveform_CWF3_light( ring_n
1300 1300
1301 1301 header->packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8);
1302 1302 header->packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 );
1303 header->hkBIA = pa_bia_status_info;
1303 header->pa_bia_status_info = pa_bia_status_info;
1304 1304 header->sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
1305 1305 header->blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8);
1306 1306 header->blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 );
@@ -1361,7 +1361,7 void spw_send_asm_f0( ring_node *ring_no
1361 1361 coarseTime = ring_node_to_send->coarseTime;
1362 1362 fineTime = ring_node_to_send->fineTime;
1363 1363
1364 header->biaStatusInfo = pa_bia_status_info;
1364 header->pa_bia_status_info = pa_bia_status_info;
1365 1365 header->sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
1366 1366
1367 1367 for (i=0; i<3; i++)
@@ -1441,7 +1441,7 void spw_send_asm_f1( ring_node *ring_no
1441 1441 coarseTime = ring_node_to_send->coarseTime;
1442 1442 fineTime = ring_node_to_send->fineTime;
1443 1443
1444 header->biaStatusInfo = pa_bia_status_info;
1444 header->pa_bia_status_info = pa_bia_status_info;
1445 1445 header->sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
1446 1446
1447 1447 for (i=0; i<3; i++)
@@ -1521,7 +1521,7 void spw_send_asm_f2( ring_node *ring_no
1521 1521 coarseTime = ring_node_to_send->coarseTime;
1522 1522 fineTime = ring_node_to_send->fineTime;
1523 1523
1524 header->biaStatusInfo = pa_bia_status_info;
1524 header->pa_bia_status_info = pa_bia_status_info;
1525 1525 header->sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
1526 1526
1527 1527 for (i=0; i<3; i++)
@@ -283,7 +283,7 rtems_task prc0_task( rtems_task_argumen
283 283 // 3) send the BP1 set
284 284 set_time( packet_sbm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeSBM );
285 285 set_time( packet_sbm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
286 packet_sbm_bp1.biaStatusInfo = pa_bia_status_info;
286 packet_sbm_bp1.pa_bia_status_info = pa_bia_status_info;
287 287 packet_sbm_bp1.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
288 288 BP_send_s1_s2( (char *) &packet_sbm_bp1, queue_id,
289 289 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA,
@@ -296,7 +296,7 rtems_task prc0_task( rtems_task_argumen
296 296 // 2) send the BP2 set
297 297 set_time( packet_sbm_bp2.time, (unsigned char *) &incomingMsg->coarseTimeSBM );
298 298 set_time( packet_sbm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
299 packet_sbm_bp2.biaStatusInfo = pa_bia_status_info;
299 packet_sbm_bp2.pa_bia_status_info = pa_bia_status_info;
300 300 packet_sbm_bp2.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
301 301 BP_send_s1_s2( (char *) &packet_sbm_bp2, queue_id,
302 302 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA,
@@ -321,7 +321,7 rtems_task prc0_task( rtems_task_argumen
321 321 // 3) send the BP1 set
322 322 set_time( packet_norm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeNORM );
323 323 set_time( packet_norm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM );
324 packet_norm_bp1.biaStatusInfo = pa_bia_status_info;
324 packet_norm_bp1.pa_bia_status_info = pa_bia_status_info;
325 325 packet_norm_bp1.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
326 326 BP_send( (char *) &packet_norm_bp1, queue_id,
327 327 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA,
@@ -333,7 +333,7 rtems_task prc0_task( rtems_task_argumen
333 333 // 2) send the BP2 set
334 334 set_time( packet_norm_bp2.time, (unsigned char *) &incomingMsg->coarseTimeNORM );
335 335 set_time( packet_norm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM );
336 packet_norm_bp2.biaStatusInfo = pa_bia_status_info;
336 packet_norm_bp2.pa_bia_status_info = pa_bia_status_info;
337 337 packet_norm_bp2.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
338 338 BP_send( (char *) &packet_norm_bp2, queue_id,
339 339 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA,
@@ -278,7 +278,7 rtems_task prc1_task( rtems_task_argumen
278 278 // 3) send the BP1 set
279 279 set_time( packet_sbm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeSBM );
280 280 set_time( packet_sbm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
281 packet_sbm_bp1.biaStatusInfo = pa_bia_status_info;
281 packet_sbm_bp1.pa_bia_status_info = pa_bia_status_info;
282 282 packet_sbm_bp1.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
283 283 BP_send_s1_s2( (char *) &packet_sbm_bp1, queue_id_send,
284 284 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 + PACKET_LENGTH_DELTA,
@@ -291,7 +291,7 rtems_task prc1_task( rtems_task_argumen
291 291 // 2) send the BP2 set
292 292 set_time( packet_sbm_bp2.time, (unsigned char *) &incomingMsg->coarseTimeSBM );
293 293 set_time( packet_sbm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
294 packet_sbm_bp2.biaStatusInfo = pa_bia_status_info;
294 packet_sbm_bp2.pa_bia_status_info = pa_bia_status_info;
295 295 packet_sbm_bp2.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
296 296 BP_send_s1_s2( (char *) &packet_sbm_bp2, queue_id_send,
297 297 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 + PACKET_LENGTH_DELTA,
@@ -316,7 +316,7 rtems_task prc1_task( rtems_task_argumen
316 316 // 3) send the BP1 set
317 317 set_time( packet_norm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeNORM );
318 318 set_time( packet_norm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM );
319 packet_norm_bp1.biaStatusInfo = pa_bia_status_info;
319 packet_norm_bp1.pa_bia_status_info = pa_bia_status_info;
320 320 packet_norm_bp1.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
321 321 BP_send( (char *) &packet_norm_bp1, queue_id_send,
322 322 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 + PACKET_LENGTH_DELTA,
@@ -328,7 +328,7 rtems_task prc1_task( rtems_task_argumen
328 328 // 2) send the BP2 set
329 329 set_time( packet_norm_bp2.time, (unsigned char *) &incomingMsg->coarseTimeNORM );
330 330 set_time( packet_norm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM );
331 packet_norm_bp2.biaStatusInfo = pa_bia_status_info;
331 packet_norm_bp2.pa_bia_status_info = pa_bia_status_info;
332 332 packet_norm_bp2.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
333 333 BP_send( (char *) &packet_norm_bp2, queue_id_send,
334 334 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 + PACKET_LENGTH_DELTA,
@@ -200,7 +200,7 rtems_task prc2_task( rtems_task_argumen
200 200 // 2) send the BP1 set
201 201 set_time( packet_norm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeNORM );
202 202 set_time( packet_norm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM );
203 packet_norm_bp1.biaStatusInfo = pa_bia_status_info;
203 packet_norm_bp1.pa_bia_status_info = pa_bia_status_info;
204 204 packet_norm_bp1.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
205 205 BP_send( (char *) &packet_norm_bp1, queue_id_send,
206 206 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 + PACKET_LENGTH_DELTA,
@@ -214,7 +214,7 rtems_task prc2_task( rtems_task_argumen
214 214 // 2) send the BP2 set
215 215 set_time( packet_norm_bp2.time, (unsigned char *) &incomingMsg->coarseTimeNORM );
216 216 set_time( packet_norm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM );
217 packet_norm_bp2.biaStatusInfo = pa_bia_status_info;
217 packet_norm_bp2.pa_bia_status_info = pa_bia_status_info;
218 218 packet_norm_bp2.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
219 219 BP_send( (char *) &packet_norm_bp2, queue_id_send,
220 220 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 + PACKET_LENGTH_DELTA,
@@ -378,7 +378,7 void BP_init_header( bp_packet *packet,
378 378 packet->time[5] = 0x00;
379 379 // AUXILIARY DATA HEADER
380 380 packet->sid = sid;
381 packet->biaStatusInfo = 0x00;
381 packet->pa_bia_status_info = 0x00;
382 382 packet->sy_lfr_common_parameters_spare = 0x00;
383 383 packet->sy_lfr_common_parameters = 0x00;
384 384 packet->acquisitionTime[0] = 0x00;
@@ -412,7 +412,7 void BP_init_header_with_spare( bp_packe
412 412 packet->destinationID = TM_DESTINATION_ID_GROUND;
413 413 // AUXILIARY DATA HEADER
414 414 packet->sid = sid;
415 packet->biaStatusInfo = 0x00;
415 packet->pa_bia_status_info = 0x00;
416 416 packet->sy_lfr_common_parameters_spare = 0x00;
417 417 packet->sy_lfr_common_parameters = 0x00;
418 418 packet->time[0] = 0x00;
@@ -230,7 +230,7 int tc_check_type_subtype( unsigned char
230 230 || (packetSubType == TC_SUBTYPE_EN_CAL) || (packetSubType == TC_SUBTYPE_DIS_CAL)
231 231 || (packetSubType == TC_SUBTYPE_LOAD_K) || (packetSubType == TC_SUBTYPE_DUMP_K)
232 232 || (packetSubType == TC_SUBTYPE_LOAD_FBINS)
233 || (packetSubType == TC_SUBTYPE_LOAD_PAS_FILTER_PAR))
233 || (packetSubType == TC_SUBTYPE_LOAD_FILTER_PAR))
234 234 {
235 235 status = CCSDS_TM_VALID;
236 236 }
@@ -416,8 +416,8 int tc_check_length( unsigned char packe
416 416 status = CCSDS_TM_VALID;
417 417 }
418 418 break;
419 case TC_SUBTYPE_LOAD_PAS_FILTER_PAR:
420 if (length!=(TC_LEN_LOAD_PAS_FILTER_PAR-CCSDS_TC_TM_PACKET_OFFSET)) {
419 case TC_SUBTYPE_LOAD_FILTER_PAR:
420 if (length!=(TC_LEN_LOAD_FILTER_PAR-CCSDS_TC_TM_PACKET_OFFSET)) {
421 421 status = WRONG_LEN_PKT;
422 422 }
423 423 else {
@@ -123,8 +123,8 rtems_task actn_task( rtems_task_argumen
123 123 result = action_load_fbins_mask( &TC, queue_snd_id, time );
124 124 close_action( &TC, result, queue_snd_id );
125 125 break;
126 case TC_SUBTYPE_LOAD_PAS_FILTER_PAR:
127 result = action_load_pas_filter_par( &TC, queue_snd_id, time );
126 case TC_SUBTYPE_LOAD_FILTER_PAR:
127 result = action_load_filter_par( &TC, queue_snd_id, time );
128 128 close_action( &TC, result, queue_snd_id );
129 129 break;
130 130 case TC_SUBTYPE_UPDT_TIME:
@@ -294,6 +294,11 int action_update_info(ccsdsTelecommandP
294 294 pa_bia_status_info = pa_bia_status_info
295 295 | (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET1 ] & 0x1);
296 296
297 // REACTION_WHEELS_FREQUENCY, copy the incoming parameters in the local variable (to be copied in HK packets)
298 cp_rpw_sc_rw_f_flags = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW_F_FLAGS ];
299 getReactionWheelsFrequencies( TC );
300 build_rw_fbins_masks();
301
297 302 result = status;
298 303
299 304 return result;
@@ -310,7 +310,7 int action_load_fbins_mask(ccsdsTelecomm
310 310 return flag;
311 311 }
312 312
313 int action_load_pas_filter_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
313 int action_load_filter_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
314 314 {
315 315 /** This function updates the LFR registers with the incoming sbm2 parameters.
316 316 *
@@ -327,10 +327,21 int action_load_pas_filter_par(ccsdsTele
327 327
328 328 if (flag == LFR_SUCCESSFUL)
329 329 {
330 parameter_dump_packet.spare_sy_lfr_pas_filter_enabled = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_ENABLED ];
331 parameter_dump_packet.sy_lfr_pas_filter_modulus = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_MODULUS ];
332 parameter_dump_packet.sy_lfr_pas_filter_nstd = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_NSTD ];
333 parameter_dump_packet.sy_lfr_pas_filter_offset = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_OFFSET ];
330 parameter_dump_packet.spare_sy_lfr_pas_filter_enabled = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_ENABLED ];
331 parameter_dump_packet.sy_lfr_pas_filter_modulus = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_MODULUS ];
332 parameter_dump_packet.sy_lfr_pas_filter_tbad[0] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_TBAD + 0 ];
333 parameter_dump_packet.sy_lfr_pas_filter_tbad[1] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_TBAD + 1 ];
334 parameter_dump_packet.sy_lfr_pas_filter_tbad[2] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_TBAD + 2 ];
335 parameter_dump_packet.sy_lfr_pas_filter_tbad[3] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_TBAD + 3 ];
336 parameter_dump_packet.sy_lfr_pas_filter_offset = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_OFFSET ];
337 parameter_dump_packet.sy_lfr_pas_filter_shift[0] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_SHIFT + 0 ];
338 parameter_dump_packet.sy_lfr_pas_filter_shift[1] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_SHIFT + 1 ];
339 parameter_dump_packet.sy_lfr_pas_filter_shift[2] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_SHIFT + 2 ];
340 parameter_dump_packet.sy_lfr_pas_filter_shift[3] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_SHIFT + 3 ];
341 parameter_dump_packet.sy_lfr_sc_rw_delta_f[0] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_SC_RW_DELTA_F + 0 ];
342 parameter_dump_packet.sy_lfr_sc_rw_delta_f[1] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_SC_RW_DELTA_F + 1 ];
343 parameter_dump_packet.sy_lfr_sc_rw_delta_f[2] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_SC_RW_DELTA_F + 2 ];
344 parameter_dump_packet.sy_lfr_sc_rw_delta_f[3] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_SC_RW_DELTA_F + 3 ];
334 345 }
335 346
336 347 return flag;
@@ -790,7 +801,7 int set_sy_lfr_s1_bp_p1( ccsdsTelecomman
790 801
791 802 //*********************
792 803 // SBM2 MODE PARAMETERS
793 int set_sy_lfr_s2_bp_p0(ccsdsTelecommandPacket_t *TC)
804 int set_sy_lfr_s2_bp_p0( ccsdsTelecommandPacket_t *TC )
794 805 {
795 806 /** This function sets the time between two basic parameter sets, in s (SY_LFR_S2_BP_P0).
796 807 *
@@ -882,6 +893,149 unsigned int check_update_info_hk_thr_mo
882 893 return status;
883 894 }
884 895
896 void getReactionWheelsFrequencies( ccsdsTelecommandPacket_t *TC )
897 {
898 /** This function get the reaction wheels frequencies in the incoming TC_LFR_UPDATE_INFO and copy the values locally.
899 *
900 * @param TC points to the TeleCommand packet that is being processed
901 *
902 */
903
904 unsigned char * bytePosPtr; // pointer to the beginning of the incoming TC packet
905 unsigned char * floatPtr; // pointer to the Most Significant Byte of the considered float
906
907 bytePosPtr = (unsigned char *) &TC->packetID;
908
909 // cp_rpw_sc_rw1_f1
910 floatPtr = (unsigned char *) &cp_rpw_sc_rw1_f1;
911 floatPtr[0] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW1_F1 ];
912 floatPtr[1] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW1_F1 + 1 ];
913 floatPtr[2] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW1_F1 + 2 ];
914 floatPtr[3] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW1_F1 + 3 ];
915 // cp_rpw_sc_rw1_f2
916 floatPtr = (unsigned char *) &cp_rpw_sc_rw1_f2;
917 floatPtr[0] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW1_F2 ];
918 floatPtr[1] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW1_F2 + 1 ];
919 floatPtr[2] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW1_F2 + 2 ];
920 floatPtr[3] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW1_F2 + 3 ];
921 // cp_rpw_sc_rw2_f1
922 floatPtr = (unsigned char *) &cp_rpw_sc_rw2_f1;
923 floatPtr[0] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW2_F1 ];
924 floatPtr[1] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW2_F1 + 1 ];
925 floatPtr[2] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW2_F1 + 2 ];
926 floatPtr[3] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW2_F1 + 3 ];
927 // cp_rpw_sc_rw2_f2
928 floatPtr = (unsigned char *) &cp_rpw_sc_rw2_f2;
929 floatPtr[0] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW2_F2 ];
930 floatPtr[1] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW2_F2 + 1 ];
931 floatPtr[2] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW2_F2 + 2 ];
932 floatPtr[3] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW2_F2 + 3 ];
933 // cp_rpw_sc_rw3_f1
934 floatPtr = (unsigned char *) &cp_rpw_sc_rw3_f1;
935 floatPtr[0] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW3_F1 ];
936 floatPtr[1] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW3_F1 + 1 ];
937 floatPtr[2] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW3_F1 + 2 ];
938 floatPtr[3] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW3_F1 + 3 ];
939 // cp_rpw_sc_rw3_f2
940 floatPtr = (unsigned char *) &cp_rpw_sc_rw3_f2;
941 floatPtr[0] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW3_F2 ];
942 floatPtr[1] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW3_F2 + 1 ];
943 floatPtr[2] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW3_F2 + 2 ];
944 floatPtr[3] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW3_F2 + 3 ];
945 // cp_rpw_sc_rw4_f1
946 floatPtr = (unsigned char *) &cp_rpw_sc_rw4_f1;
947 floatPtr[0] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW4_F1 ];
948 floatPtr[1] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW4_F1 + 1 ];
949 floatPtr[2] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW4_F1 + 2 ];
950 floatPtr[3] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW4_F1 + 3 ];
951 // cp_rpw_sc_rw4_f2
952 floatPtr = (unsigned char *) &cp_rpw_sc_rw4_f2;
953 floatPtr[0] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW4_F2 ];
954 floatPtr[1] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW4_F2 + 1 ];
955 floatPtr[2] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW4_F2 + 2 ];
956 floatPtr[3] = bytePosPtr[ BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW4_F2 + 3 ];
957 }
958
959 void setFBinMask( unsigned char *fbins_mask, float freq, unsigned char deltaFreq, unsigned char flag )
960 {
961 unsigned int fBelow;
962
963 // compute the index of the frequency immediately below the reaction wheel frequency
964 fBelow = (unsigned int) ( floor( ((double) cp_rpw_sc_rw1_f1) / ((double) deltaFreq)) );
965
966 if (fBelow < 127) // if fbelow is greater than 127 or equal to 127, this means that the reaction wheel frequency is outside the frequency range
967 {
968 if (flag == 1)
969 {
970 // rw_fbins_mask[k] = (1 << fBelow) | (1 << fAbove);
971 }
972 }
973 }
974
975 void build_rw_fbins_mask( unsigned int channel )
976 {
977 unsigned char rw_fbins_mask[16];
978 unsigned char *maskPtr;
979 double deltaF;
980 unsigned k;
981
982 k = 0;
983
984 switch (channel)
985 {
986 case 0:
987 maskPtr = rw_fbins_mask_f0;
988 deltaF = 96.;
989 break;
990 case 1:
991 maskPtr = rw_fbins_mask_f1;
992 deltaF = 16.;
993 break;
994 case 2:
995 maskPtr = rw_fbins_mask_f2;
996 deltaF = 1.;
997 break;
998 default:
999 break;
1000 }
1001
1002 for (k = 0; k < 16; k++)
1003 {
1004 rw_fbins_mask[k] = 0x00;
1005 }
1006
1007 // RW1 F1
1008 // setFBinMask( rw_fbins_mask, fBelow );
1009
1010 // RW1 F2
1011
1012 // RW2 F1
1013
1014 // RW2 F2
1015
1016 // RW3 F1
1017
1018 // RW3 F2
1019
1020 // RW4 F1
1021
1022 // RW4 F2
1023
1024
1025 // update the value of the fbins related to reaction wheels frequency filtering
1026 for (k = 0; k < 16; k++)
1027 {
1028 maskPtr[k] = rw_fbins_mask[k];
1029 }
1030 }
1031
1032 void build_rw_fbins_masks()
1033 {
1034 build_rw_fbins_mask( 0 );
1035 build_rw_fbins_mask( 1 );
1036 build_rw_fbins_mask( 2 );
1037 }
1038
885 1039 //***********
886 1040 // FBINS MASK
887 1041
@@ -921,8 +1075,10 int check_sy_lfr_pas_filter_parameters(
921 1075
922 1076 unsigned char sy_lfr_pas_filter_enabled;
923 1077 unsigned char sy_lfr_pas_filter_modulus;
924 unsigned char sy_lfr_pas_filter_nstd;
1078 float sy_lfr_pas_filter_tbad;
925 1079 unsigned char sy_lfr_pas_filter_offset;
1080 float sy_lfr_pas_filtershift;
1081 float sy_lfr_sc_rw_delta_f;
926 1082
927 1083 flag = LFR_SUCCESSFUL;
928 1084
@@ -930,7 +1086,7 int check_sy_lfr_pas_filter_parameters(
930 1086 // get parameters
931 1087 sy_lfr_pas_filter_enabled = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_ENABLED ] & 0x01; // [0000 0001]
932 1088 sy_lfr_pas_filter_modulus = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_MODULUS ];
933 sy_lfr_pas_filter_nstd = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_NSTD ];
1089
934 1090 sy_lfr_pas_filter_offset = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_PAS_FILTER_OFFSET ];
935 1091
936 1092 //******************
@@ -942,15 +1098,7 int check_sy_lfr_pas_filter_parameters(
942 1098 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_PAS_FILTER_MODULUS+10, sy_lfr_pas_filter_modulus );
943 1099 flag = WRONG_APP_DATA;
944 1100 }
945 // sy_lfr_pas_filter_nstd
946 if (flag == LFR_SUCCESSFUL)
947 {
948 if ( sy_lfr_pas_filter_nstd > 8 )
949 {
950 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_PAS_FILTER_NSTD+10, sy_lfr_pas_filter_nstd );
951 flag = WRONG_APP_DATA;
952 }
953 }
1101 // sy_lfr_pas_filter_tbad
954 1102 // sy_lfr_pas_filter_offset
955 1103 if (flag == LFR_SUCCESSFUL)
956 1104 {
@@ -960,6 +1108,8 int check_sy_lfr_pas_filter_parameters(
960 1108 flag = WRONG_APP_DATA;
961 1109 }
962 1110 }
1111 // sy_lfr_pas_filtershift
1112 // sy_lfr_sc_rw_delta_f
963 1113
964 1114 return flag;
965 1115 }
General Comments 0
You need to be logged in to leave comments. Login now