##// END OF EJS Templates
initialization of parameter_dump_packet updated with filtering elements
paul -
r294:3df41b40fc06 R3_plus draft
parent child
Show More
@@ -1,82 +1,83
1 #ifndef TC_LOAD_DUMP_PARAMETERS_H
1 #ifndef TC_LOAD_DUMP_PARAMETERS_H
2 #define TC_LOAD_DUMP_PARAMETERS_H
2 #define TC_LOAD_DUMP_PARAMETERS_H
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <stdio.h>
5 #include <stdio.h>
6
6
7 #include "fsw_params.h"
7 #include "fsw_params.h"
8 #include "wf_handler.h"
8 #include "wf_handler.h"
9 #include "tm_lfr_tc_exe.h"
9 #include "tm_lfr_tc_exe.h"
10 #include "fsw_misc.h"
10 #include "fsw_misc.h"
11 #include "basic_parameters_params.h"
11 #include "basic_parameters_params.h"
12 #include "avf0_prc0.h"
12 #include "avf0_prc0.h"
13
13
14 #define FLOAT_EQUAL_ZERO 0.001
14 #define FLOAT_EQUAL_ZERO 0.001
15
15
16 extern unsigned short sequenceCounterParameterDump;
16 extern unsigned short sequenceCounterParameterDump;
17 extern unsigned short sequenceCounters_TM_DUMP[];
17 extern unsigned short sequenceCounters_TM_DUMP[];
18 extern float k_coeff_intercalib_f0_norm[ ];
18 extern float k_coeff_intercalib_f0_norm[ ];
19 extern float k_coeff_intercalib_f0_sbm[ ];
19 extern float k_coeff_intercalib_f0_sbm[ ];
20 extern float k_coeff_intercalib_f1_norm[ ];
20 extern float k_coeff_intercalib_f1_norm[ ];
21 extern float k_coeff_intercalib_f1_sbm[ ];
21 extern float k_coeff_intercalib_f1_sbm[ ];
22 extern float k_coeff_intercalib_f2[ ];
22 extern float k_coeff_intercalib_f2[ ];
23 extern fbins_masks_t fbins_masks;
23 extern fbins_masks_t fbins_masks;
24
24
25 int action_load_common_par( ccsdsTelecommandPacket_t *TC );
25 int action_load_common_par( ccsdsTelecommandPacket_t *TC );
26 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
26 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
27 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
27 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
28 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
28 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
29 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
29 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
30 int action_load_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
30 int action_load_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
31 int action_load_fbins_mask(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
31 int action_load_fbins_mask(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
32 int action_load_filter_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
32 int action_load_filter_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
33 int action_dump_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
33 int action_dump_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
34 int action_dump_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
34 int action_dump_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
35
35
36 // NORMAL
36 // NORMAL
37 int check_normal_par_consistency( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
37 int check_normal_par_consistency( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
38 int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC );
38 int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC );
39 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC );
39 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC );
40 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC );
40 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC );
41 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC );
41 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC );
42 int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC );
42 int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC );
43 int set_sy_lfr_n_cwf_long_f3( ccsdsTelecommandPacket_t *TC );
43 int set_sy_lfr_n_cwf_long_f3( ccsdsTelecommandPacket_t *TC );
44
44
45 // BURST
45 // BURST
46 int set_sy_lfr_b_bp_p0( ccsdsTelecommandPacket_t *TC );
46 int set_sy_lfr_b_bp_p0( ccsdsTelecommandPacket_t *TC );
47 int set_sy_lfr_b_bp_p1( ccsdsTelecommandPacket_t *TC );
47 int set_sy_lfr_b_bp_p1( ccsdsTelecommandPacket_t *TC );
48
48
49 // SBM1
49 // SBM1
50 int set_sy_lfr_s1_bp_p0( ccsdsTelecommandPacket_t *TC );
50 int set_sy_lfr_s1_bp_p0( ccsdsTelecommandPacket_t *TC );
51 int set_sy_lfr_s1_bp_p1( ccsdsTelecommandPacket_t *TC );
51 int set_sy_lfr_s1_bp_p1( ccsdsTelecommandPacket_t *TC );
52
52
53 // SBM2
53 // SBM2
54 int set_sy_lfr_s2_bp_p0( ccsdsTelecommandPacket_t *TC );
54 int set_sy_lfr_s2_bp_p0( ccsdsTelecommandPacket_t *TC );
55 int set_sy_lfr_s2_bp_p1( ccsdsTelecommandPacket_t *TC );
55 int set_sy_lfr_s2_bp_p1( ccsdsTelecommandPacket_t *TC );
56
56
57 // TC_LFR_UPDATE_INFO
57 // TC_LFR_UPDATE_INFO
58 unsigned int check_update_info_hk_lfr_mode( unsigned char mode );
58 unsigned int check_update_info_hk_lfr_mode( unsigned char mode );
59 unsigned int check_update_info_hk_tds_mode( unsigned char mode );
59 unsigned int check_update_info_hk_tds_mode( unsigned char mode );
60 unsigned int check_update_info_hk_thr_mode( unsigned char mode );
60 unsigned int check_update_info_hk_thr_mode( unsigned char mode );
61 void getReactionWheelsFrequencies( ccsdsTelecommandPacket_t *TC );
61 void getReactionWheelsFrequencies( ccsdsTelecommandPacket_t *TC );
62 void setFBinMask(unsigned char *fbins_mask, float rw_f, unsigned char deltaFreq, unsigned char flag );
62 void setFBinMask(unsigned char *fbins_mask, float rw_f, unsigned char deltaFreq, unsigned char flag );
63 void build_sy_lfr_rw_mask( unsigned int channel );
63 void build_sy_lfr_rw_mask( unsigned int channel );
64 void build_sy_lfr_rw_masks();
64 void build_sy_lfr_rw_masks();
65 void merge_fbins_masks( void );
65 void merge_fbins_masks( void );
66
66
67 // FBINS_MASK
67 // FBINS_MASK
68 int set_sy_lfr_fbins( ccsdsTelecommandPacket_t *TC );
68 int set_sy_lfr_fbins( ccsdsTelecommandPacket_t *TC );
69
69
70 // TC_LFR_LOAD_PARS_FILTER_PAR
70 // TC_LFR_LOAD_PARS_FILTER_PAR
71 int check_sy_lfr_filter_parameters( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
71 int check_sy_lfr_filter_parameters( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
72
72
73 // KCOEFFICIENTS
73 // KCOEFFICIENTS
74 int set_sy_lfr_kcoeff(ccsdsTelecommandPacket_t *TC , rtems_id queue_id);
74 int set_sy_lfr_kcoeff(ccsdsTelecommandPacket_t *TC , rtems_id queue_id);
75 void copyFloatByChar( unsigned char *destination, unsigned char *source );
75 void copyFloatByChar( unsigned char *destination, unsigned char *source );
76 void floatToChar( float value, unsigned char* ptr);
76
77
77 void init_parameter_dump( void );
78 void init_parameter_dump( void );
78 void init_kcoefficients_dump( void );
79 void init_kcoefficients_dump( void );
79 void init_kcoefficients_dump_packet( Packet_TM_LFR_KCOEFFICIENTS_DUMP_t *kcoefficients_dump, unsigned char pkt_nr, unsigned char blk_nr );
80 void init_kcoefficients_dump_packet( Packet_TM_LFR_KCOEFFICIENTS_DUMP_t *kcoefficients_dump, unsigned char pkt_nr, unsigned char blk_nr );
80 void increment_seq_counter_destination_id_dump( unsigned char *packet_sequence_control, unsigned char destination_id );
81 void increment_seq_counter_destination_id_dump( unsigned char *packet_sequence_control, unsigned char destination_id );
81
82
82 #endif // TC_LOAD_DUMP_PARAMETERS_H
83 #endif // TC_LOAD_DUMP_PARAMETERS_H
@@ -1,1540 +1,1566
1 /** Functions to load and dump parameters in the LFR registers.
1 /** Functions to load and dump parameters in the LFR registers.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to handle TC related to parameter loading and dumping.\n
6 * A group of functions to handle TC related to parameter loading and dumping.\n
7 * TC_LFR_LOAD_COMMON_PAR\n
7 * TC_LFR_LOAD_COMMON_PAR\n
8 * TC_LFR_LOAD_NORMAL_PAR\n
8 * TC_LFR_LOAD_NORMAL_PAR\n
9 * TC_LFR_LOAD_BURST_PAR\n
9 * TC_LFR_LOAD_BURST_PAR\n
10 * TC_LFR_LOAD_SBM1_PAR\n
10 * TC_LFR_LOAD_SBM1_PAR\n
11 * TC_LFR_LOAD_SBM2_PAR\n
11 * TC_LFR_LOAD_SBM2_PAR\n
12 *
12 *
13 */
13 */
14
14
15 #include "tc_load_dump_parameters.h"
15 #include "tc_load_dump_parameters.h"
16
16
17 Packet_TM_LFR_KCOEFFICIENTS_DUMP_t kcoefficients_dump_1;
17 Packet_TM_LFR_KCOEFFICIENTS_DUMP_t kcoefficients_dump_1;
18 Packet_TM_LFR_KCOEFFICIENTS_DUMP_t kcoefficients_dump_2;
18 Packet_TM_LFR_KCOEFFICIENTS_DUMP_t kcoefficients_dump_2;
19 ring_node kcoefficient_node_1;
19 ring_node kcoefficient_node_1;
20 ring_node kcoefficient_node_2;
20 ring_node kcoefficient_node_2;
21
21
22 int action_load_common_par(ccsdsTelecommandPacket_t *TC)
22 int action_load_common_par(ccsdsTelecommandPacket_t *TC)
23 {
23 {
24 /** This function updates the LFR registers with the incoming common parameters.
24 /** This function updates the LFR registers with the incoming common parameters.
25 *
25 *
26 * @param TC points to the TeleCommand packet that is being processed
26 * @param TC points to the TeleCommand packet that is being processed
27 *
27 *
28 *
28 *
29 */
29 */
30
30
31 parameter_dump_packet.sy_lfr_common_parameters_spare = TC->dataAndCRC[0];
31 parameter_dump_packet.sy_lfr_common_parameters_spare = TC->dataAndCRC[0];
32 parameter_dump_packet.sy_lfr_common_parameters = TC->dataAndCRC[1];
32 parameter_dump_packet.sy_lfr_common_parameters = TC->dataAndCRC[1];
33 set_wfp_data_shaping( );
33 set_wfp_data_shaping( );
34 return LFR_SUCCESSFUL;
34 return LFR_SUCCESSFUL;
35 }
35 }
36
36
37 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
37 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
38 {
38 {
39 /** This function updates the LFR registers with the incoming normal parameters.
39 /** This function updates the LFR registers with the incoming normal parameters.
40 *
40 *
41 * @param TC points to the TeleCommand packet that is being processed
41 * @param TC points to the TeleCommand packet that is being processed
42 * @param queue_id is the id of the queue which handles TM related to this execution step
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 int result;
46 int result;
47 int flag;
47 int flag;
48 rtems_status_code status;
48 rtems_status_code status;
49
49
50 flag = LFR_SUCCESSFUL;
50 flag = LFR_SUCCESSFUL;
51
51
52 if ( (lfrCurrentMode == LFR_MODE_NORMAL) ||
52 if ( (lfrCurrentMode == LFR_MODE_NORMAL) ||
53 (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) {
53 (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) {
54 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
54 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
55 flag = LFR_DEFAULT;
55 flag = LFR_DEFAULT;
56 }
56 }
57
57
58 // CHECK THE PARAMETERS SET CONSISTENCY
58 // CHECK THE PARAMETERS SET CONSISTENCY
59 if (flag == LFR_SUCCESSFUL)
59 if (flag == LFR_SUCCESSFUL)
60 {
60 {
61 flag = check_normal_par_consistency( TC, queue_id );
61 flag = check_normal_par_consistency( TC, queue_id );
62 }
62 }
63
63
64 // SET THE PARAMETERS IF THEY ARE CONSISTENT
64 // SET THE PARAMETERS IF THEY ARE CONSISTENT
65 if (flag == LFR_SUCCESSFUL)
65 if (flag == LFR_SUCCESSFUL)
66 {
66 {
67 result = set_sy_lfr_n_swf_l( TC );
67 result = set_sy_lfr_n_swf_l( TC );
68 result = set_sy_lfr_n_swf_p( TC );
68 result = set_sy_lfr_n_swf_p( TC );
69 result = set_sy_lfr_n_bp_p0( TC );
69 result = set_sy_lfr_n_bp_p0( TC );
70 result = set_sy_lfr_n_bp_p1( TC );
70 result = set_sy_lfr_n_bp_p1( TC );
71 result = set_sy_lfr_n_asm_p( TC );
71 result = set_sy_lfr_n_asm_p( TC );
72 result = set_sy_lfr_n_cwf_long_f3( TC );
72 result = set_sy_lfr_n_cwf_long_f3( TC );
73 }
73 }
74
74
75 return flag;
75 return flag;
76 }
76 }
77
77
78 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
78 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
79 {
79 {
80 /** This function updates the LFR registers with the incoming burst parameters.
80 /** This function updates the LFR registers with the incoming burst parameters.
81 *
81 *
82 * @param TC points to the TeleCommand packet that is being processed
82 * @param TC points to the TeleCommand packet that is being processed
83 * @param queue_id is the id of the queue which handles TM related to this execution step
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 int flag;
87 int flag;
88 rtems_status_code status;
88 rtems_status_code status;
89 unsigned char sy_lfr_b_bp_p0;
89 unsigned char sy_lfr_b_bp_p0;
90 unsigned char sy_lfr_b_bp_p1;
90 unsigned char sy_lfr_b_bp_p1;
91 float aux;
91 float aux;
92
92
93 flag = LFR_SUCCESSFUL;
93 flag = LFR_SUCCESSFUL;
94
94
95 if ( lfrCurrentMode == LFR_MODE_BURST ) {
95 if ( lfrCurrentMode == LFR_MODE_BURST ) {
96 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
96 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
97 flag = LFR_DEFAULT;
97 flag = LFR_DEFAULT;
98 }
98 }
99
99
100 sy_lfr_b_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P0 ];
100 sy_lfr_b_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P0 ];
101 sy_lfr_b_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P1 ];
101 sy_lfr_b_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P1 ];
102
102
103 // sy_lfr_b_bp_p0 shall not be lower than its default value
103 // sy_lfr_b_bp_p0 shall not be lower than its default value
104 if (flag == LFR_SUCCESSFUL)
104 if (flag == LFR_SUCCESSFUL)
105 {
105 {
106 if (sy_lfr_b_bp_p0 < DEFAULT_SY_LFR_B_BP_P0 )
106 if (sy_lfr_b_bp_p0 < DEFAULT_SY_LFR_B_BP_P0 )
107 {
107 {
108 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_B_BP_P0+10, sy_lfr_b_bp_p0 );
108 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_B_BP_P0+10, sy_lfr_b_bp_p0 );
109 flag = WRONG_APP_DATA;
109 flag = WRONG_APP_DATA;
110 }
110 }
111 }
111 }
112 // sy_lfr_b_bp_p1 shall not be lower than its default value
112 // sy_lfr_b_bp_p1 shall not be lower than its default value
113 if (flag == LFR_SUCCESSFUL)
113 if (flag == LFR_SUCCESSFUL)
114 {
114 {
115 if (sy_lfr_b_bp_p1 < DEFAULT_SY_LFR_B_BP_P1 )
115 if (sy_lfr_b_bp_p1 < DEFAULT_SY_LFR_B_BP_P1 )
116 {
116 {
117 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_B_BP_P1+10, sy_lfr_b_bp_p1 );
117 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_B_BP_P1+10, sy_lfr_b_bp_p1 );
118 flag = WRONG_APP_DATA;
118 flag = WRONG_APP_DATA;
119 }
119 }
120 }
120 }
121 //****************************************************************
121 //****************************************************************
122 // check the consistency between sy_lfr_b_bp_p0 and sy_lfr_b_bp_p1
122 // check the consistency between sy_lfr_b_bp_p0 and sy_lfr_b_bp_p1
123 if (flag == LFR_SUCCESSFUL)
123 if (flag == LFR_SUCCESSFUL)
124 {
124 {
125 sy_lfr_b_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P0 ];
125 sy_lfr_b_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P0 ];
126 sy_lfr_b_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P1 ];
126 sy_lfr_b_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_B_BP_P1 ];
127 aux = ( (float ) sy_lfr_b_bp_p1 / sy_lfr_b_bp_p0 ) - floor(sy_lfr_b_bp_p1 / sy_lfr_b_bp_p0);
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 if (aux > FLOAT_EQUAL_ZERO)
128 if (aux > FLOAT_EQUAL_ZERO)
129 {
129 {
130 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_B_BP_P0+10, sy_lfr_b_bp_p0 );
130 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_B_BP_P0+10, sy_lfr_b_bp_p0 );
131 flag = LFR_DEFAULT;
131 flag = LFR_DEFAULT;
132 }
132 }
133 }
133 }
134
134
135 // SET THE PARAMETERS
135 // SET THE PARAMETERS
136 if (flag == LFR_SUCCESSFUL)
136 if (flag == LFR_SUCCESSFUL)
137 {
137 {
138 flag = set_sy_lfr_b_bp_p0( TC );
138 flag = set_sy_lfr_b_bp_p0( TC );
139 flag = set_sy_lfr_b_bp_p1( TC );
139 flag = set_sy_lfr_b_bp_p1( TC );
140 }
140 }
141
141
142 return flag;
142 return flag;
143 }
143 }
144
144
145 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
145 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
146 {
146 {
147 /** This function updates the LFR registers with the incoming sbm1 parameters.
147 /** This function updates the LFR registers with the incoming sbm1 parameters.
148 *
148 *
149 * @param TC points to the TeleCommand packet that is being processed
149 * @param TC points to the TeleCommand packet that is being processed
150 * @param queue_id is the id of the queue which handles TM related to this execution step
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 int flag;
154 int flag;
155 rtems_status_code status;
155 rtems_status_code status;
156 unsigned char sy_lfr_s1_bp_p0;
156 unsigned char sy_lfr_s1_bp_p0;
157 unsigned char sy_lfr_s1_bp_p1;
157 unsigned char sy_lfr_s1_bp_p1;
158 float aux;
158 float aux;
159
159
160 flag = LFR_SUCCESSFUL;
160 flag = LFR_SUCCESSFUL;
161
161
162 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
162 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
163 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
163 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
164 flag = LFR_DEFAULT;
164 flag = LFR_DEFAULT;
165 }
165 }
166
166
167 sy_lfr_s1_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P0 ];
167 sy_lfr_s1_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P0 ];
168 sy_lfr_s1_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P1 ];
168 sy_lfr_s1_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S1_BP_P1 ];
169
169
170 // sy_lfr_s1_bp_p0
170 // sy_lfr_s1_bp_p0
171 if (flag == LFR_SUCCESSFUL)
171 if (flag == LFR_SUCCESSFUL)
172 {
172 {
173 if (sy_lfr_s1_bp_p0 < DEFAULT_SY_LFR_S1_BP_P0 )
173 if (sy_lfr_s1_bp_p0 < DEFAULT_SY_LFR_S1_BP_P0 )
174 {
174 {
175 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S1_BP_P0+10, sy_lfr_s1_bp_p0 );
175 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S1_BP_P0+10, sy_lfr_s1_bp_p0 );
176 flag = WRONG_APP_DATA;
176 flag = WRONG_APP_DATA;
177 }
177 }
178 }
178 }
179 // sy_lfr_s1_bp_p1
179 // sy_lfr_s1_bp_p1
180 if (flag == LFR_SUCCESSFUL)
180 if (flag == LFR_SUCCESSFUL)
181 {
181 {
182 if (sy_lfr_s1_bp_p1 < DEFAULT_SY_LFR_S1_BP_P1 )
182 if (sy_lfr_s1_bp_p1 < DEFAULT_SY_LFR_S1_BP_P1 )
183 {
183 {
184 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S1_BP_P1+10, sy_lfr_s1_bp_p1 );
184 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S1_BP_P1+10, sy_lfr_s1_bp_p1 );
185 flag = WRONG_APP_DATA;
185 flag = WRONG_APP_DATA;
186 }
186 }
187 }
187 }
188 //******************************************************************
188 //******************************************************************
189 // check the consistency between sy_lfr_s1_bp_p0 and sy_lfr_s1_bp_p1
189 // check the consistency between sy_lfr_s1_bp_p0 and sy_lfr_s1_bp_p1
190 if (flag == LFR_SUCCESSFUL)
190 if (flag == LFR_SUCCESSFUL)
191 {
191 {
192 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));
192 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));
193 if (aux > FLOAT_EQUAL_ZERO)
193 if (aux > FLOAT_EQUAL_ZERO)
194 {
194 {
195 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S1_BP_P0+10, sy_lfr_s1_bp_p0 );
195 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S1_BP_P0+10, sy_lfr_s1_bp_p0 );
196 flag = LFR_DEFAULT;
196 flag = LFR_DEFAULT;
197 }
197 }
198 }
198 }
199
199
200 // SET THE PARAMETERS
200 // SET THE PARAMETERS
201 if (flag == LFR_SUCCESSFUL)
201 if (flag == LFR_SUCCESSFUL)
202 {
202 {
203 flag = set_sy_lfr_s1_bp_p0( TC );
203 flag = set_sy_lfr_s1_bp_p0( TC );
204 flag = set_sy_lfr_s1_bp_p1( TC );
204 flag = set_sy_lfr_s1_bp_p1( TC );
205 }
205 }
206
206
207 return flag;
207 return flag;
208 }
208 }
209
209
210 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
210 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
211 {
211 {
212 /** This function updates the LFR registers with the incoming sbm2 parameters.
212 /** This function updates the LFR registers with the incoming sbm2 parameters.
213 *
213 *
214 * @param TC points to the TeleCommand packet that is being processed
214 * @param TC points to the TeleCommand packet that is being processed
215 * @param queue_id is the id of the queue which handles TM related to this execution step
215 * @param queue_id is the id of the queue which handles TM related to this execution step
216 *
216 *
217 */
217 */
218
218
219 int flag;
219 int flag;
220 rtems_status_code status;
220 rtems_status_code status;
221 unsigned char sy_lfr_s2_bp_p0;
221 unsigned char sy_lfr_s2_bp_p0;
222 unsigned char sy_lfr_s2_bp_p1;
222 unsigned char sy_lfr_s2_bp_p1;
223 float aux;
223 float aux;
224
224
225 flag = LFR_SUCCESSFUL;
225 flag = LFR_SUCCESSFUL;
226
226
227 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
227 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
228 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
228 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
229 flag = LFR_DEFAULT;
229 flag = LFR_DEFAULT;
230 }
230 }
231
231
232 sy_lfr_s2_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P0 ];
232 sy_lfr_s2_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P0 ];
233 sy_lfr_s2_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P1 ];
233 sy_lfr_s2_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P1 ];
234
234
235 // sy_lfr_s2_bp_p0
235 // sy_lfr_s2_bp_p0
236 if (flag == LFR_SUCCESSFUL)
236 if (flag == LFR_SUCCESSFUL)
237 {
237 {
238 if (sy_lfr_s2_bp_p0 < DEFAULT_SY_LFR_S2_BP_P0 )
238 if (sy_lfr_s2_bp_p0 < DEFAULT_SY_LFR_S2_BP_P0 )
239 {
239 {
240 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S2_BP_P0+10, sy_lfr_s2_bp_p0 );
240 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S2_BP_P0+10, sy_lfr_s2_bp_p0 );
241 flag = WRONG_APP_DATA;
241 flag = WRONG_APP_DATA;
242 }
242 }
243 }
243 }
244 // sy_lfr_s2_bp_p1
244 // sy_lfr_s2_bp_p1
245 if (flag == LFR_SUCCESSFUL)
245 if (flag == LFR_SUCCESSFUL)
246 {
246 {
247 if (sy_lfr_s2_bp_p1 < DEFAULT_SY_LFR_S2_BP_P1 )
247 if (sy_lfr_s2_bp_p1 < DEFAULT_SY_LFR_S2_BP_P1 )
248 {
248 {
249 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S2_BP_P1+10, sy_lfr_s2_bp_p1 );
249 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S2_BP_P1+10, sy_lfr_s2_bp_p1 );
250 flag = WRONG_APP_DATA;
250 flag = WRONG_APP_DATA;
251 }
251 }
252 }
252 }
253 //******************************************************************
253 //******************************************************************
254 // check the consistency between sy_lfr_s2_bp_p0 and sy_lfr_s2_bp_p1
254 // check the consistency between sy_lfr_s2_bp_p0 and sy_lfr_s2_bp_p1
255 if (flag == LFR_SUCCESSFUL)
255 if (flag == LFR_SUCCESSFUL)
256 {
256 {
257 sy_lfr_s2_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P0 ];
257 sy_lfr_s2_bp_p0 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P0 ];
258 sy_lfr_s2_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P1 ];
258 sy_lfr_s2_bp_p1 = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_S2_BP_P1 ];
259 aux = ( (float ) sy_lfr_s2_bp_p1 / sy_lfr_s2_bp_p0 ) - floor(sy_lfr_s2_bp_p1 / sy_lfr_s2_bp_p0);
259 aux = ( (float ) sy_lfr_s2_bp_p1 / sy_lfr_s2_bp_p0 ) - floor(sy_lfr_s2_bp_p1 / sy_lfr_s2_bp_p0);
260 if (aux > FLOAT_EQUAL_ZERO)
260 if (aux > FLOAT_EQUAL_ZERO)
261 {
261 {
262 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S2_BP_P0+10, sy_lfr_s2_bp_p0 );
262 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, DATAFIELD_POS_SY_LFR_S2_BP_P0+10, sy_lfr_s2_bp_p0 );
263 flag = LFR_DEFAULT;
263 flag = LFR_DEFAULT;
264 }
264 }
265 }
265 }
266
266
267 // SET THE PARAMETERS
267 // SET THE PARAMETERS
268 if (flag == LFR_SUCCESSFUL)
268 if (flag == LFR_SUCCESSFUL)
269 {
269 {
270 flag = set_sy_lfr_s2_bp_p0( TC );
270 flag = set_sy_lfr_s2_bp_p0( TC );
271 flag = set_sy_lfr_s2_bp_p1( TC );
271 flag = set_sy_lfr_s2_bp_p1( TC );
272 }
272 }
273
273
274 return flag;
274 return flag;
275 }
275 }
276
276
277 int action_load_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
277 int action_load_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
278 {
278 {
279 /** This function updates the LFR registers with the incoming sbm2 parameters.
279 /** This function updates the LFR registers with the incoming sbm2 parameters.
280 *
280 *
281 * @param TC points to the TeleCommand packet that is being processed
281 * @param TC points to the TeleCommand packet that is being processed
282 * @param queue_id is the id of the queue which handles TM related to this execution step
282 * @param queue_id is the id of the queue which handles TM related to this execution step
283 *
283 *
284 */
284 */
285
285
286 int flag;
286 int flag;
287
287
288 flag = LFR_DEFAULT;
288 flag = LFR_DEFAULT;
289
289
290 flag = set_sy_lfr_kcoeff( TC, queue_id );
290 flag = set_sy_lfr_kcoeff( TC, queue_id );
291
291
292 return flag;
292 return flag;
293 }
293 }
294
294
295 int action_load_fbins_mask(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
295 int action_load_fbins_mask(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
296 {
296 {
297 /** This function updates the LFR registers with the incoming sbm2 parameters.
297 /** This function updates the LFR registers with the incoming sbm2 parameters.
298 *
298 *
299 * @param TC points to the TeleCommand packet that is being processed
299 * @param TC points to the TeleCommand packet that is being processed
300 * @param queue_id is the id of the queue which handles TM related to this execution step
300 * @param queue_id is the id of the queue which handles TM related to this execution step
301 *
301 *
302 */
302 */
303
303
304 int flag;
304 int flag;
305
305
306 flag = LFR_DEFAULT;
306 flag = LFR_DEFAULT;
307
307
308 flag = set_sy_lfr_fbins( TC );
308 flag = set_sy_lfr_fbins( TC );
309
309
310 return flag;
310 return flag;
311 }
311 }
312
312
313 int action_load_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 /** This function updates the LFR registers with the incoming sbm2 parameters.
315 /** This function updates the LFR registers with the incoming sbm2 parameters.
316 *
316 *
317 * @param TC points to the TeleCommand packet that is being processed
317 * @param TC points to the TeleCommand packet that is being processed
318 * @param queue_id is the id of the queue which handles TM related to this execution step
318 * @param queue_id is the id of the queue which handles TM related to this execution step
319 *
319 *
320 */
320 */
321
321
322 int flag;
322 int flag;
323
323
324 flag = LFR_DEFAULT;
324 flag = LFR_DEFAULT;
325
325
326 flag = check_sy_lfr_filter_parameters( TC, queue_id );
326 flag = check_sy_lfr_filter_parameters( TC, queue_id );
327
327
328 if (flag == LFR_SUCCESSFUL)
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 ];
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 ];
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 ];
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 ];
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 ];
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 ];
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 ];
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 ];
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 ];
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 ];
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 ];
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 ];
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 ];
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 ];
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 ];
344 parameter_dump_packet.sy_lfr_sc_rw_delta_f[3] = TC->dataAndCRC[ DATAFIELD_POS_SY_LFR_SC_RW_DELTA_F + 3 ];
345
345
346 //****************************
346 //****************************
347 // store PAS filter parameters
347 // store PAS filter parameters
348 // sy_lfr_pas_filter_enabled
348 // sy_lfr_pas_filter_enabled
349 filterPar.spare_sy_lfr_pas_filter_enabled = parameter_dump_packet.spare_sy_lfr_pas_filter_enabled;
349 filterPar.spare_sy_lfr_pas_filter_enabled = parameter_dump_packet.spare_sy_lfr_pas_filter_enabled;
350 // sy_lfr_pas_filter_modulus
350 // sy_lfr_pas_filter_modulus
351 filterPar.sy_lfr_pas_filter_modulus = parameter_dump_packet.sy_lfr_pas_filter_modulus;
351 filterPar.sy_lfr_pas_filter_modulus = parameter_dump_packet.sy_lfr_pas_filter_modulus;
352 // sy_lfr_pas_filter_tbad
352 // sy_lfr_pas_filter_tbad
353 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_pas_filter_tbad,
353 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_pas_filter_tbad,
354 parameter_dump_packet.sy_lfr_pas_filter_tbad );
354 parameter_dump_packet.sy_lfr_pas_filter_tbad );
355 // sy_lfr_pas_filter_offset
355 // sy_lfr_pas_filter_offset
356 filterPar.sy_lfr_pas_filter_offset = parameter_dump_packet.sy_lfr_pas_filter_offset;
356 filterPar.sy_lfr_pas_filter_offset = parameter_dump_packet.sy_lfr_pas_filter_offset;
357 // sy_lfr_pas_filter_shift
357 // sy_lfr_pas_filter_shift
358 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_pas_filter_shift,
358 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_pas_filter_shift,
359 parameter_dump_packet.sy_lfr_pas_filter_shift );
359 parameter_dump_packet.sy_lfr_pas_filter_shift );
360
360
361 //****************************************************
361 //****************************************************
362 // store the parameter sy_lfr_sc_rw_delta_f as a float
362 // store the parameter sy_lfr_sc_rw_delta_f as a float
363 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_sc_rw_delta_f,
363 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_sc_rw_delta_f,
364 parameter_dump_packet.sy_lfr_sc_rw_delta_f );
364 parameter_dump_packet.sy_lfr_sc_rw_delta_f );
365 }
365 }
366
366
367 return flag;
367 return flag;
368 }
368 }
369
369
370 int action_dump_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
370 int action_dump_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
371 {
371 {
372 /** This function updates the LFR registers with the incoming sbm2 parameters.
372 /** This function updates the LFR registers with the incoming sbm2 parameters.
373 *
373 *
374 * @param TC points to the TeleCommand packet that is being processed
374 * @param TC points to the TeleCommand packet that is being processed
375 * @param queue_id is the id of the queue which handles TM related to this execution step
375 * @param queue_id is the id of the queue which handles TM related to this execution step
376 *
376 *
377 */
377 */
378
378
379 unsigned int address;
379 unsigned int address;
380 rtems_status_code status;
380 rtems_status_code status;
381 unsigned int freq;
381 unsigned int freq;
382 unsigned int bin;
382 unsigned int bin;
383 unsigned int coeff;
383 unsigned int coeff;
384 unsigned char *kCoeffPtr;
384 unsigned char *kCoeffPtr;
385 unsigned char *kCoeffDumpPtr;
385 unsigned char *kCoeffDumpPtr;
386
386
387 // for each sy_lfr_kcoeff_frequency there is 32 kcoeff
387 // for each sy_lfr_kcoeff_frequency there is 32 kcoeff
388 // F0 => 11 bins
388 // F0 => 11 bins
389 // F1 => 13 bins
389 // F1 => 13 bins
390 // F2 => 12 bins
390 // F2 => 12 bins
391 // 36 bins to dump in two packets (30 bins max per packet)
391 // 36 bins to dump in two packets (30 bins max per packet)
392
392
393 //*********
393 //*********
394 // PACKET 1
394 // PACKET 1
395 // 11 F0 bins, 13 F1 bins and 6 F2 bins
395 // 11 F0 bins, 13 F1 bins and 6 F2 bins
396 kcoefficients_dump_1.destinationID = TC->sourceID;
396 kcoefficients_dump_1.destinationID = TC->sourceID;
397 increment_seq_counter_destination_id_dump( kcoefficients_dump_1.packetSequenceControl, TC->sourceID );
397 increment_seq_counter_destination_id_dump( kcoefficients_dump_1.packetSequenceControl, TC->sourceID );
398 for( freq=0;
398 for( freq=0;
399 freq<NB_BINS_COMPRESSED_SM_F0;
399 freq<NB_BINS_COMPRESSED_SM_F0;
400 freq++ )
400 freq++ )
401 {
401 {
402 kcoefficients_dump_1.kcoeff_blks[ freq*KCOEFF_BLK_SIZE + 1] = freq;
402 kcoefficients_dump_1.kcoeff_blks[ freq*KCOEFF_BLK_SIZE + 1] = freq;
403 bin = freq;
403 bin = freq;
404 // printKCoefficients( freq, bin, k_coeff_intercalib_f0_norm);
404 // printKCoefficients( freq, bin, k_coeff_intercalib_f0_norm);
405 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
405 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
406 {
406 {
407 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_1.kcoeff_blks[ freq*KCOEFF_BLK_SIZE + coeff*NB_BYTES_PER_FLOAT + 2 ]; // 2 for the kcoeff_frequency
407 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_1.kcoeff_blks[ freq*KCOEFF_BLK_SIZE + coeff*NB_BYTES_PER_FLOAT + 2 ]; // 2 for the kcoeff_frequency
408 kCoeffPtr = (unsigned char*) &k_coeff_intercalib_f0_norm[ (bin*NB_K_COEFF_PER_BIN) + coeff ];
408 kCoeffPtr = (unsigned char*) &k_coeff_intercalib_f0_norm[ (bin*NB_K_COEFF_PER_BIN) + coeff ];
409 copyFloatByChar( kCoeffDumpPtr, kCoeffPtr );
409 copyFloatByChar( kCoeffDumpPtr, kCoeffPtr );
410 }
410 }
411 }
411 }
412 for( freq=NB_BINS_COMPRESSED_SM_F0;
412 for( freq=NB_BINS_COMPRESSED_SM_F0;
413 freq<(NB_BINS_COMPRESSED_SM_F0+NB_BINS_COMPRESSED_SM_F1);
413 freq<(NB_BINS_COMPRESSED_SM_F0+NB_BINS_COMPRESSED_SM_F1);
414 freq++ )
414 freq++ )
415 {
415 {
416 kcoefficients_dump_1.kcoeff_blks[ freq*KCOEFF_BLK_SIZE + 1 ] = freq;
416 kcoefficients_dump_1.kcoeff_blks[ freq*KCOEFF_BLK_SIZE + 1 ] = freq;
417 bin = freq - NB_BINS_COMPRESSED_SM_F0;
417 bin = freq - NB_BINS_COMPRESSED_SM_F0;
418 // printKCoefficients( freq, bin, k_coeff_intercalib_f1_norm);
418 // printKCoefficients( freq, bin, k_coeff_intercalib_f1_norm);
419 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
419 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
420 {
420 {
421 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_1.kcoeff_blks[ freq*KCOEFF_BLK_SIZE + coeff*NB_BYTES_PER_FLOAT + 2 ]; // 2 for the kcoeff_frequency
421 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_1.kcoeff_blks[ freq*KCOEFF_BLK_SIZE + coeff*NB_BYTES_PER_FLOAT + 2 ]; // 2 for the kcoeff_frequency
422 kCoeffPtr = (unsigned char*) &k_coeff_intercalib_f1_norm[ (bin*NB_K_COEFF_PER_BIN) + coeff ];
422 kCoeffPtr = (unsigned char*) &k_coeff_intercalib_f1_norm[ (bin*NB_K_COEFF_PER_BIN) + coeff ];
423 copyFloatByChar( kCoeffDumpPtr, kCoeffPtr );
423 copyFloatByChar( kCoeffDumpPtr, kCoeffPtr );
424 }
424 }
425 }
425 }
426 for( freq=(NB_BINS_COMPRESSED_SM_F0+NB_BINS_COMPRESSED_SM_F1);
426 for( freq=(NB_BINS_COMPRESSED_SM_F0+NB_BINS_COMPRESSED_SM_F1);
427 freq<(NB_BINS_COMPRESSED_SM_F0+NB_BINS_COMPRESSED_SM_F1+6);
427 freq<(NB_BINS_COMPRESSED_SM_F0+NB_BINS_COMPRESSED_SM_F1+6);
428 freq++ )
428 freq++ )
429 {
429 {
430 kcoefficients_dump_1.kcoeff_blks[ freq*KCOEFF_BLK_SIZE + 1 ] = freq;
430 kcoefficients_dump_1.kcoeff_blks[ freq*KCOEFF_BLK_SIZE + 1 ] = freq;
431 bin = freq - (NB_BINS_COMPRESSED_SM_F0+NB_BINS_COMPRESSED_SM_F1);
431 bin = freq - (NB_BINS_COMPRESSED_SM_F0+NB_BINS_COMPRESSED_SM_F1);
432 // printKCoefficients( freq, bin, k_coeff_intercalib_f2);
432 // printKCoefficients( freq, bin, k_coeff_intercalib_f2);
433 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
433 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
434 {
434 {
435 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_1.kcoeff_blks[ freq*KCOEFF_BLK_SIZE + coeff*NB_BYTES_PER_FLOAT + 2 ]; // 2 for the kcoeff_frequency
435 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_1.kcoeff_blks[ freq*KCOEFF_BLK_SIZE + coeff*NB_BYTES_PER_FLOAT + 2 ]; // 2 for the kcoeff_frequency
436 kCoeffPtr = (unsigned char*) &k_coeff_intercalib_f2[ (bin*NB_K_COEFF_PER_BIN) + coeff ];
436 kCoeffPtr = (unsigned char*) &k_coeff_intercalib_f2[ (bin*NB_K_COEFF_PER_BIN) + coeff ];
437 copyFloatByChar( kCoeffDumpPtr, kCoeffPtr );
437 copyFloatByChar( kCoeffDumpPtr, kCoeffPtr );
438 }
438 }
439 }
439 }
440 kcoefficients_dump_1.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
440 kcoefficients_dump_1.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
441 kcoefficients_dump_1.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
441 kcoefficients_dump_1.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
442 kcoefficients_dump_1.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
442 kcoefficients_dump_1.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
443 kcoefficients_dump_1.time[3] = (unsigned char) (time_management_regs->coarse_time);
443 kcoefficients_dump_1.time[3] = (unsigned char) (time_management_regs->coarse_time);
444 kcoefficients_dump_1.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
444 kcoefficients_dump_1.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
445 kcoefficients_dump_1.time[5] = (unsigned char) (time_management_regs->fine_time);
445 kcoefficients_dump_1.time[5] = (unsigned char) (time_management_regs->fine_time);
446 // SEND DATA
446 // SEND DATA
447 kcoefficient_node_1.status = 1;
447 kcoefficient_node_1.status = 1;
448 address = (unsigned int) &kcoefficient_node_1;
448 address = (unsigned int) &kcoefficient_node_1;
449 status = rtems_message_queue_send( queue_id, &address, sizeof( ring_node* ) );
449 status = rtems_message_queue_send( queue_id, &address, sizeof( ring_node* ) );
450 if (status != RTEMS_SUCCESSFUL) {
450 if (status != RTEMS_SUCCESSFUL) {
451 PRINTF1("in action_dump_kcoefficients *** ERR sending packet 1 , code %d", status)
451 PRINTF1("in action_dump_kcoefficients *** ERR sending packet 1 , code %d", status)
452 }
452 }
453
453
454 //********
454 //********
455 // PACKET 2
455 // PACKET 2
456 // 6 F2 bins
456 // 6 F2 bins
457 kcoefficients_dump_2.destinationID = TC->sourceID;
457 kcoefficients_dump_2.destinationID = TC->sourceID;
458 increment_seq_counter_destination_id_dump( kcoefficients_dump_2.packetSequenceControl, TC->sourceID );
458 increment_seq_counter_destination_id_dump( kcoefficients_dump_2.packetSequenceControl, TC->sourceID );
459 for( freq=0; freq<6; freq++ )
459 for( freq=0; freq<6; freq++ )
460 {
460 {
461 kcoefficients_dump_2.kcoeff_blks[ freq*KCOEFF_BLK_SIZE + 1 ] = NB_BINS_COMPRESSED_SM_F0 + NB_BINS_COMPRESSED_SM_F1 + 6 + freq;
461 kcoefficients_dump_2.kcoeff_blks[ freq*KCOEFF_BLK_SIZE + 1 ] = NB_BINS_COMPRESSED_SM_F0 + NB_BINS_COMPRESSED_SM_F1 + 6 + freq;
462 bin = freq + 6;
462 bin = freq + 6;
463 // printKCoefficients( freq, bin, k_coeff_intercalib_f2);
463 // printKCoefficients( freq, bin, k_coeff_intercalib_f2);
464 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
464 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
465 {
465 {
466 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_2.kcoeff_blks[ freq*KCOEFF_BLK_SIZE + coeff*NB_BYTES_PER_FLOAT + 2 ]; // 2 for the kcoeff_frequency
466 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_2.kcoeff_blks[ freq*KCOEFF_BLK_SIZE + coeff*NB_BYTES_PER_FLOAT + 2 ]; // 2 for the kcoeff_frequency
467 kCoeffPtr = (unsigned char*) &k_coeff_intercalib_f2[ (bin*NB_K_COEFF_PER_BIN) + coeff ];
467 kCoeffPtr = (unsigned char*) &k_coeff_intercalib_f2[ (bin*NB_K_COEFF_PER_BIN) + coeff ];
468 copyFloatByChar( kCoeffDumpPtr, kCoeffPtr );
468 copyFloatByChar( kCoeffDumpPtr, kCoeffPtr );
469 }
469 }
470 }
470 }
471 kcoefficients_dump_2.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
471 kcoefficients_dump_2.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
472 kcoefficients_dump_2.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
472 kcoefficients_dump_2.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
473 kcoefficients_dump_2.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
473 kcoefficients_dump_2.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
474 kcoefficients_dump_2.time[3] = (unsigned char) (time_management_regs->coarse_time);
474 kcoefficients_dump_2.time[3] = (unsigned char) (time_management_regs->coarse_time);
475 kcoefficients_dump_2.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
475 kcoefficients_dump_2.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
476 kcoefficients_dump_2.time[5] = (unsigned char) (time_management_regs->fine_time);
476 kcoefficients_dump_2.time[5] = (unsigned char) (time_management_regs->fine_time);
477 // SEND DATA
477 // SEND DATA
478 kcoefficient_node_2.status = 1;
478 kcoefficient_node_2.status = 1;
479 address = (unsigned int) &kcoefficient_node_2;
479 address = (unsigned int) &kcoefficient_node_2;
480 status = rtems_message_queue_send( queue_id, &address, sizeof( ring_node* ) );
480 status = rtems_message_queue_send( queue_id, &address, sizeof( ring_node* ) );
481 if (status != RTEMS_SUCCESSFUL) {
481 if (status != RTEMS_SUCCESSFUL) {
482 PRINTF1("in action_dump_kcoefficients *** ERR sending packet 2, code %d", status)
482 PRINTF1("in action_dump_kcoefficients *** ERR sending packet 2, code %d", status)
483 }
483 }
484
484
485 return status;
485 return status;
486 }
486 }
487
487
488 int action_dump_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
488 int action_dump_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
489 {
489 {
490 /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue.
490 /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue.
491 *
491 *
492 * @param queue_id is the id of the queue which handles TM related to this execution step.
492 * @param queue_id is the id of the queue which handles TM related to this execution step.
493 *
493 *
494 * @return RTEMS directive status codes:
494 * @return RTEMS directive status codes:
495 * - RTEMS_SUCCESSFUL - message sent successfully
495 * - RTEMS_SUCCESSFUL - message sent successfully
496 * - RTEMS_INVALID_ID - invalid queue id
496 * - RTEMS_INVALID_ID - invalid queue id
497 * - RTEMS_INVALID_SIZE - invalid message size
497 * - RTEMS_INVALID_SIZE - invalid message size
498 * - RTEMS_INVALID_ADDRESS - buffer is NULL
498 * - RTEMS_INVALID_ADDRESS - buffer is NULL
499