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