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