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