##// END OF EJS Templates
BP sending filtered depending on the lastValidEnterModeTime
paul -
r243:e8fa8af1f64c R3a
parent child
Show More
@@ -1,2 +1,2
1 1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
2 ff85ce82cd9845f180cb578272717bcb76b62cb5 header/lfr_common_headers
2 ce0c2f17257170a8529605f68687c18f23973087 header/lfr_common_headers
@@ -115,14 +115,17 void ASM_generic_init_ring(ring_node_asm
115 115
116 116 void BP_reset_current_ring_nodes( void );
117 117 void BP_init_header(bp_packet *packet,
118 unsigned int apid, unsigned char sid,
119 unsigned int packetLength , unsigned char blkNr);
118 unsigned int apid, unsigned char sid,
119 unsigned int packetLength , unsigned char blkNr);
120 120 void BP_init_header_with_spare(bp_packet_with_spare *packet,
121 unsigned int apid, unsigned char sid,
122 unsigned int packetLength, unsigned char blkNr );
121 unsigned int apid, unsigned char sid,
122 unsigned int packetLength, unsigned char blkNr );
123 123 void BP_send( char *data,
124 rtems_id queue_id ,
124 rtems_id queue_id,
125 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 131 // general functions
@@ -143,20 +146,20 static inline void SM_average(float *ave
143 146 asm_msg *msgForMATR );
144 147
145 148 static inline void SM_average_debug(float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
146 ring_node *ring_node_tab[],
147 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
148 asm_msg *msgForMATR );
149 ring_node *ring_node_tab[],
150 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
151 asm_msg *msgForMATR );
149 152
150 153 void ASM_patch( float *inputASM, float *outputASM );
151 154
152 155 void extractReImVectors(float *inputASM, float *outputASM, unsigned int asmComponent );
153 156
154 157 static inline void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized,
155 float divider );
158 float divider );
156 159
157 160 static inline void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat,
158 float divider,
159 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart);
161 float divider,
162 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart);
160 163
161 164 static inline void ASM_convert(volatile float *input_matrix, char *output_matrix);
162 165
@@ -206,15 +209,15 void SM_average( float *averaged_spec_ma
206 209 averaged_spec_mat_SBM[ i ] = ( averaged_spec_mat_SBM[ i ] + sum );
207 210 msgForMATR->coarseTimeNORM = ring_node_tab[0]->coarseTime;
208 211 msgForMATR->fineTimeNORM = ring_node_tab[0]->fineTime;
209 // PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNORM, nbAverageSBM)
212 // PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNORM, nbAverageSBM)
210 213 }
211 214 }
212 215 }
213 216
214 217 void SM_average_debug( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
215 ring_node *ring_node_tab[],
216 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
217 asm_msg *msgForMATR )
218 ring_node *ring_node_tab[],
219 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
220 asm_msg *msgForMATR )
218 221 {
219 222 float sum;
220 223 unsigned int i;
@@ -256,7 +259,7 void ASM_reorganize_and_divide( float *a
256 259 }
257 260
258 261 void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider,
259 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart )
262 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart )
260 263 {
261 264 int frequencyBin;
262 265 int asmComponent;
@@ -281,7 +284,7 void ASM_compress_reorganize_and_divide(
281 284 {
282 285 compressed_spec_mat[offsetCompressed ] =
283 286 ( compressed_spec_mat[ offsetCompressed ]
284 + averaged_spec_mat[ offsetASM + k ] );
287 + averaged_spec_mat[ offsetASM + k ] );
285 288 }
286 289 compressed_spec_mat[ offsetCompressed ] =
287 290 compressed_spec_mat[ offsetCompressed ] / (divider * nbBinsToAverage);
@@ -317,8 +320,8 void ASM_convert( volatile float *input_
317 320 }
318 321
319 322 void ASM_compress_reorganize_and_divide_mask(float *averaged_spec_mat, float *compressed_spec_mat,
320 float divider,
321 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart, unsigned char channel);
323 float divider,
324 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart, unsigned char channel);
322 325
323 326 int getFBinMask(int k, unsigned char channel);
324 327
@@ -12,7 +12,8
12 12
13 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 19 // ISR
@@ -58,7 +58,8 spectral_matrix_regs_t *spectra
58 58 // MODE PARAMETERS
59 59 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
60 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 64 // HK PACKETS
64 65 Packet_TM_LFR_HK_t housekeeping_packet;
@@ -285,7 +285,7 rtems_task prc0_task( rtems_task_argumen
285 285 set_time( packet_sbm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
286 286 packet_sbm_bp1.biaStatusInfo = pa_bia_status_info;
287 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 289 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA,
290 290 sid);
291 291 // 4) compute the BP2 set if needed
@@ -298,7 +298,7 rtems_task prc0_task( rtems_task_argumen
298 298 set_time( packet_sbm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
299 299 packet_sbm_bp2.biaStatusInfo = pa_bia_status_info;
300 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 302 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA,
303 303 sid);
304 304 }
@@ -280,7 +280,7 rtems_task prc1_task( rtems_task_argumen
280 280 set_time( packet_sbm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
281 281 packet_sbm_bp1.biaStatusInfo = pa_bia_status_info;
282 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 284 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 + PACKET_LENGTH_DELTA,
285 285 sid );
286 286 // 4) compute the BP2 set if needed
@@ -293,7 +293,7 rtems_task prc1_task( rtems_task_argumen
293 293 set_time( packet_sbm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
294 294 packet_sbm_bp2.biaStatusInfo = pa_bia_status_info;
295 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 297 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 + PACKET_LENGTH_DELTA,
298 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 418 // general functions
391 419
@@ -206,7 +206,7 int action_enter_mode(ccsdsTelecommandPa
206 206 {
207 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 211 switch(requestedMode)
212 212 {
@@ -446,7 +446,7 int check_mode_transition( unsigned char
446 446
447 447 void update_last_valid_transition_date(unsigned int transitionCoarseTime)
448 448 {
449 lastValidTransitionDate = transitionCoarseTime;
449 lastValidEnterModeTime = transitionCoarseTime;
450 450 }
451 451
452 452 int check_transition_date( unsigned int transitionCoarseTime )
@@ -607,6 +607,7 int enter_mode_standby()
607 607 int status;
608 608
609 609 status = stop_current_mode(); // STOP THE CURRENT MODE
610 lfrTransitionType = TRANSITION_NOT_SPECIFIC;
610 611
611 612 #ifdef PRINT_TASK_STATISTICS
612 613 rtems_cpu_usage_report();
@@ -648,6 +649,7 int enter_mode_normal( unsigned int tran
648 649 switch( lfrCurrentMode )
649 650 {
650 651 case LFR_MODE_STANDBY:
652 lfrTransitionType = TRANSITION_NOT_SPECIFIC;
651 653 status = restart_science_tasks( LFR_MODE_NORMAL ); // restart science tasks
652 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 659 break;
658 660 case LFR_MODE_BURST:
661 lfrTransitionType = TRANSITION_NOT_SPECIFIC;
659 662 status = stop_current_mode(); // stop the current mode
660 663 status = restart_science_tasks( LFR_MODE_NORMAL ); // restart the science tasks
661 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 669 break;
667 670 case LFR_MODE_SBM1:
671 lfrTransitionType = TRANSITION_S1_TO_NORM;
668 672 restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters
669 673 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
670 674 break;
671 675 case LFR_MODE_SBM2:
676 lfrTransitionType = TRANSITION_S2_TO_NORM;
672 677 restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters
673 678 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
674 679 break;
@@ -708,6 +713,7 int enter_mode_burst( unsigned int trans
708 713 rtems_cpu_usage_reset();
709 714 #endif
710 715
716 lfrTransitionType = TRANSITION_NOT_SPECIFIC;
711 717 status = stop_current_mode(); // stop the current mode
712 718 status = restart_science_tasks( LFR_MODE_BURST ); // restart the science tasks
713 719 if (status == RTEMS_SUCCESSFUL) // relaunch spectral_matrix and waveform_picker modules
@@ -754,6 +760,7 int enter_mode_sbm1( unsigned int transi
754 760 switch( lfrCurrentMode )
755 761 {
756 762 case LFR_MODE_STANDBY:
763 lfrTransitionType = TRANSITION_NOT_SPECIFIC;
757 764 status = restart_science_tasks( LFR_MODE_SBM1 ); // restart science tasks
758 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 770 break;
764 771 case LFR_MODE_NORMAL: // lfrCurrentMode will be updated after the execution of close_action
772 lfrTransitionType = TRANSITION_NORM_TO_S1;
765 773 restart_asm_activities( LFR_MODE_SBM1 );
766 774 status = LFR_SUCCESSFUL;
767 775 break;
768 776 case LFR_MODE_BURST:
777 lfrTransitionType = TRANSITION_NOT_SPECIFIC;
769 778 status = stop_current_mode(); // stop the current mode
770 779 status = restart_science_tasks( LFR_MODE_SBM1 ); // restart the science tasks
771 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 785 break;
777 786 case LFR_MODE_SBM2:
787 lfrTransitionType = TRANSITION_S2_TO_S1;
778 788 restart_asm_activities( LFR_MODE_SBM1 );
779 789 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
780 790 break;
@@ -820,6 +830,7 int enter_mode_sbm2( unsigned int transi
820 830 switch( lfrCurrentMode )
821 831 {
822 832 case LFR_MODE_STANDBY:
833 lfrTransitionType = TRANSITION_NOT_SPECIFIC;
823 834 status = restart_science_tasks( LFR_MODE_SBM2 ); // restart science tasks
824 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 840 break;
830 841 case LFR_MODE_NORMAL:
842 lfrTransitionType = TRANSITION_NORM_TO_S2;
831 843 restart_asm_activities( LFR_MODE_SBM2 );
832 844 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
833 845 break;
834 846 case LFR_MODE_BURST:
847 lfrTransitionType = TRANSITION_NOT_SPECIFIC;
835 848 status = stop_current_mode(); // stop the current mode
836 849 status = restart_science_tasks( LFR_MODE_SBM2 ); // restart the science tasks
837 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 855 break;
843 856 case LFR_MODE_SBM1:
857 lfrTransitionType = TRANSITION_S1_TO_S2;
844 858 restart_asm_activities( LFR_MODE_SBM2 );
845 859 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
846 860 break;
General Comments 0
You need to be logged in to leave comments. Login now