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