##// END OF EJS Templates
BP sending filtered depending on the lastValidEnterModeTime
paul -
r243:e8fa8af1f64c R3a
parent child
Show More
@@ -1,2 +1,2
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
2 ff85ce82cd9845f180cb578272717bcb76b62cb5 header/lfr_common_headers
2 ce0c2f17257170a8529605f68687c18f23973087 header/lfr_common_headers
@@ -123,6 +123,9 void BP_init_header_with_spare(bp_packet
123 void BP_send( char *data,
123 void BP_send( char *data,
124 rtems_id queue_id ,
124 rtems_id queue_id,
125 unsigned int nbBytesToSend , unsigned int sid );
125 unsigned int nbBytesToSend , unsigned int sid );
126 void BP_send_s1_s2(char *data,
127 rtems_id queue_id,
128 unsigned int nbBytesToSend, unsigned int sid );
126
129
127 //******************
130 //******************
128 // general functions
131 // general functions
@@ -12,7 +12,8
12
12
13 #include "lfr_cpu_usage_report.h"
13 #include "lfr_cpu_usage_report.h"
14
14
15 extern unsigned int lastValidTransitionDate;
15 extern unsigned int lastValidEnterModeTime;
16 extern enum lfr_transition_type_t lfrTransitionType;
16
17
17 //****
18 //****
18 // ISR
19 // ISR
@@ -58,7 +58,8 spectral_matrix_regs_t *spectra
58 // MODE PARAMETERS
58 // MODE PARAMETERS
59 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
59 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
60 struct param_local_str param_local;
60 struct param_local_str param_local;
61 unsigned int lastValidTransitionDate;
61 unsigned int lastValidEnterModeTime;
62 enum lfr_transition_type_t lfrTransitionType;
62
63
63 // HK PACKETS
64 // HK PACKETS
64 Packet_TM_LFR_HK_t housekeeping_packet;
65 Packet_TM_LFR_HK_t housekeeping_packet;
@@ -285,7 +285,7 rtems_task prc0_task( rtems_task_argumen
285 set_time( packet_sbm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
285 set_time( packet_sbm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
286 packet_sbm_bp1.biaStatusInfo = pa_bia_status_info;
286 packet_sbm_bp1.biaStatusInfo = pa_bia_status_info;
287 packet_sbm_bp1.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
287 packet_sbm_bp1.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
288 BP_send( (char *) &packet_sbm_bp1, queue_id,
288 BP_send_s1_s2( (char *) &packet_sbm_bp1, queue_id,
289 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA,
289 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA,
290 sid);
290 sid);
291 // 4) compute the BP2 set if needed
291 // 4) compute the BP2 set if needed
@@ -298,7 +298,7 rtems_task prc0_task( rtems_task_argumen
298 set_time( packet_sbm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
298 set_time( packet_sbm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
299 packet_sbm_bp2.biaStatusInfo = pa_bia_status_info;
299 packet_sbm_bp2.biaStatusInfo = pa_bia_status_info;
300 packet_sbm_bp2.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
300 packet_sbm_bp2.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
301 BP_send( (char *) &packet_sbm_bp2, queue_id,
301 BP_send_s1_s2( (char *) &packet_sbm_bp2, queue_id,
302 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA,
302 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA,
303 sid);
303 sid);
304 }
304 }
@@ -280,7 +280,7 rtems_task prc1_task( rtems_task_argumen
280 set_time( packet_sbm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
280 set_time( packet_sbm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
281 packet_sbm_bp1.biaStatusInfo = pa_bia_status_info;
281 packet_sbm_bp1.biaStatusInfo = pa_bia_status_info;
282 packet_sbm_bp1.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
282 packet_sbm_bp1.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
283 BP_send( (char *) &packet_sbm_bp1, queue_id_send,
283 BP_send_s1_s2( (char *) &packet_sbm_bp1, queue_id_send,
284 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 + PACKET_LENGTH_DELTA,
284 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 + PACKET_LENGTH_DELTA,
285 sid );
285 sid );
286 // 4) compute the BP2 set if needed
286 // 4) compute the BP2 set if needed
@@ -293,7 +293,7 rtems_task prc1_task( rtems_task_argumen
293 set_time( packet_sbm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
293 set_time( packet_sbm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
294 packet_sbm_bp2.biaStatusInfo = pa_bia_status_info;
294 packet_sbm_bp2.biaStatusInfo = pa_bia_status_info;
295 packet_sbm_bp2.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
295 packet_sbm_bp2.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
296 BP_send( (char *) &packet_sbm_bp2, queue_id_send,
296 BP_send_s1_s2( (char *) &packet_sbm_bp2, queue_id_send,
297 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 + PACKET_LENGTH_DELTA,
297 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 + PACKET_LENGTH_DELTA,
298 sid );
298 sid );
299 }
299 }
@@ -386,6 +386,34 void BP_send(char *data, rtems_id queue_
386 }
386 }
387 }
387 }
388
388
389 void BP_send_s1_s2(char *data, rtems_id queue_id, unsigned int nbBytesToSend, unsigned int sid )
390 {
391 /** This function is used to send the BP paquets when needed.
392 *
393 * @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE
394 *
395 * @return void
396 *
397 * SBM1 and SBM2 paquets are sent depending on the type of the LFR mode transition.
398 * BURST paquets are sent everytime.
399 *
400 */
401
402 rtems_status_code status;
403
404 // SEND PACKET
405 // before lastValidTransitionDate, the data are drops even if they are ready
406 // this guarantees that no SBM packets will be received before the requestion enter mode time
407 if ( time_management_regs->coarse_time >= lastValidEnterModeTime)
408 {
409 status = rtems_message_queue_send( queue_id, data, nbBytesToSend);
410 if (status != RTEMS_SUCCESSFUL)
411 {
412 PRINTF1("ERR *** in BP_send *** ERR %d\n", (int) status)
413 }
414 }
415 }
416
389 //******************
417 //******************
390 // general functions
418 // general functions
391
419
@@ -206,7 +206,7 int action_enter_mode(ccsdsTelecommandPa
206 {
206 {
207 PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode);
207 PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode);
208
208
209
209 update_last_valid_transition_date( transitionCoarseTime );
210
210
211 switch(requestedMode)
211 switch(requestedMode)
212 {
212 {
@@ -446,7 +446,7 int check_mode_transition( unsigned char
446
446
447 void update_last_valid_transition_date(unsigned int transitionCoarseTime)
447 void update_last_valid_transition_date(unsigned int transitionCoarseTime)
448 {
448 {
449 lastValidTransitionDate = transitionCoarseTime;
449 lastValidEnterModeTime = transitionCoarseTime;
450 }
450 }
451
451
452 int check_transition_date( unsigned int transitionCoarseTime )
452 int check_transition_date( unsigned int transitionCoarseTime )
@@ -607,6 +607,7 int enter_mode_standby()
607 int status;
607 int status;
608
608
609 status = stop_current_mode(); // STOP THE CURRENT MODE
609 status = stop_current_mode(); // STOP THE CURRENT MODE
610 lfrTransitionType = TRANSITION_NOT_SPECIFIC;
610
611
611 #ifdef PRINT_TASK_STATISTICS
612 #ifdef PRINT_TASK_STATISTICS
612 rtems_cpu_usage_report();
613 rtems_cpu_usage_report();
@@ -648,6 +649,7 int enter_mode_normal( unsigned int tran
648 switch( lfrCurrentMode )
649 switch( lfrCurrentMode )
649 {
650 {
650 case LFR_MODE_STANDBY:
651 case LFR_MODE_STANDBY:
652 lfrTransitionType = TRANSITION_NOT_SPECIFIC;
651 status = restart_science_tasks( LFR_MODE_NORMAL ); // restart science tasks
653 status = restart_science_tasks( LFR_MODE_NORMAL ); // restart science tasks
652 if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
654 if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
653 {
655 {
@@ -656,6 +658,7 int enter_mode_normal( unsigned int tran
656 }
658 }
657 break;
659 break;
658 case LFR_MODE_BURST:
660 case LFR_MODE_BURST:
661 lfrTransitionType = TRANSITION_NOT_SPECIFIC;
659 status = stop_current_mode(); // stop the current mode
662 status = stop_current_mode(); // stop the current mode
660 status = restart_science_tasks( LFR_MODE_NORMAL ); // restart the science tasks
663 status = restart_science_tasks( LFR_MODE_NORMAL ); // restart the science tasks
661 if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
664 if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
@@ -665,10 +668,12 int enter_mode_normal( unsigned int tran
665 }
668 }
666 break;
669 break;
667 case LFR_MODE_SBM1:
670 case LFR_MODE_SBM1:
671 lfrTransitionType = TRANSITION_S1_TO_NORM;
668 restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters
672 restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters
669 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
673 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
670 break;
674 break;
671 case LFR_MODE_SBM2:
675 case LFR_MODE_SBM2:
676 lfrTransitionType = TRANSITION_S2_TO_NORM;
672 restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters
677 restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters
673 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
678 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
674 break;
679 break;
@@ -708,6 +713,7 int enter_mode_burst( unsigned int trans
708 rtems_cpu_usage_reset();
713 rtems_cpu_usage_reset();
709 #endif
714 #endif
710
715
716 lfrTransitionType = TRANSITION_NOT_SPECIFIC;
711 status = stop_current_mode(); // stop the current mode
717 status = stop_current_mode(); // stop the current mode
712 status = restart_science_tasks( LFR_MODE_BURST ); // restart the science tasks
718 status = restart_science_tasks( LFR_MODE_BURST ); // restart the science tasks
713 if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
719 if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
@@ -754,6 +760,7 int enter_mode_sbm1( unsigned int transi
754 switch( lfrCurrentMode )
760 switch( lfrCurrentMode )
755 {
761 {
756 case LFR_MODE_STANDBY:
762 case LFR_MODE_STANDBY:
763 lfrTransitionType = TRANSITION_NOT_SPECIFIC;
757 status = restart_science_tasks( LFR_MODE_SBM1 ); // restart science tasks
764 status = restart_science_tasks( LFR_MODE_SBM1 ); // restart science tasks
758 if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
765 if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
759 {
766 {
@@ -762,10 +769,12 int enter_mode_sbm1( unsigned int transi
762 }
769 }
763 break;
770 break;
764 case LFR_MODE_NORMAL: // lfrCurrentMode will be updated after the execution of close_action
771 case LFR_MODE_NORMAL: // lfrCurrentMode will be updated after the execution of close_action
772 lfrTransitionType = TRANSITION_NORM_TO_S1;
765 restart_asm_activities( LFR_MODE_SBM1 );
773 restart_asm_activities( LFR_MODE_SBM1 );
766 status = LFR_SUCCESSFUL;
774 status = LFR_SUCCESSFUL;
767 break;
775 break;
768 case LFR_MODE_BURST:
776 case LFR_MODE_BURST:
777 lfrTransitionType = TRANSITION_NOT_SPECIFIC;
769 status = stop_current_mode(); // stop the current mode
778 status = stop_current_mode(); // stop the current mode
770 status = restart_science_tasks( LFR_MODE_SBM1 ); // restart the science tasks
779 status = restart_science_tasks( LFR_MODE_SBM1 ); // restart the science tasks
771 if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
780 if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
@@ -775,6 +784,7 int enter_mode_sbm1( unsigned int transi
775 }
784 }
776 break;
785 break;
777 case LFR_MODE_SBM2:
786 case LFR_MODE_SBM2:
787 lfrTransitionType = TRANSITION_S2_TO_S1;
778 restart_asm_activities( LFR_MODE_SBM1 );
788 restart_asm_activities( LFR_MODE_SBM1 );
779 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
789 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
780 break;
790 break;
@@ -820,6 +830,7 int enter_mode_sbm2( unsigned int transi
820 switch( lfrCurrentMode )
830 switch( lfrCurrentMode )
821 {
831 {
822 case LFR_MODE_STANDBY:
832 case LFR_MODE_STANDBY:
833 lfrTransitionType = TRANSITION_NOT_SPECIFIC;
823 status = restart_science_tasks( LFR_MODE_SBM2 ); // restart science tasks
834 status = restart_science_tasks( LFR_MODE_SBM2 ); // restart science tasks
824 if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
835 if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
825 {
836 {
@@ -828,10 +839,12 int enter_mode_sbm2( unsigned int transi
828 }
839 }
829 break;
840 break;
830 case LFR_MODE_NORMAL:
841 case LFR_MODE_NORMAL:
842 lfrTransitionType = TRANSITION_NORM_TO_S2;
831 restart_asm_activities( LFR_MODE_SBM2 );
843 restart_asm_activities( LFR_MODE_SBM2 );
832 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
844 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
833 break;
845 break;
834 case LFR_MODE_BURST:
846 case LFR_MODE_BURST:
847 lfrTransitionType = TRANSITION_NOT_SPECIFIC;
835 status = stop_current_mode(); // stop the current mode
848 status = stop_current_mode(); // stop the current mode
836 status = restart_science_tasks( LFR_MODE_SBM2 ); // restart the science tasks
849 status = restart_science_tasks( LFR_MODE_SBM2 ); // restart the science tasks
837 if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
850 if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
@@ -841,6 +854,7 int enter_mode_sbm2( unsigned int transi
841 }
854 }
842 break;
855 break;
843 case LFR_MODE_SBM1:
856 case LFR_MODE_SBM1:
857 lfrTransitionType = TRANSITION_S1_TO_S2;
844 restart_asm_activities( LFR_MODE_SBM2 );
858 restart_asm_activities( LFR_MODE_SBM2 );
845 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
859 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
846 break;
860 break;
General Comments 0
You need to be logged in to leave comments. Login now