##// END OF EJS Templates
avf2 prc2 tasks added...
paul -
r124:9657f56b7e43 VHDLib206
parent child
Show More
@@ -0,0 +1,358
1 /** Functions related to data processing.
2 *
3 * @file
4 * @author P. LEROY
5 *
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
7 *
8 */
9
10 #include "avf0_prc0.h"
11
12 ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_NORM_F0 ];
13 ring_node_asm asm_ring_burst_sbm_f0[ NB_RING_NODES_ASM_BURST_SBM_F0 ];
14 ring_node_asm *current_ring_node_asm_burst_sbm_f0;
15 ring_node_asm *current_ring_node_asm_norm_f0;
16
17 float asm_f0_reorganized [ TOTAL_SIZE_SM ];
18 char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
19 float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F0];
20 float compressed_sm_sbm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 ];
21
22 nb_sm_before_bp_asm_f0 nb_sm_before_f0;
23
24 void reset_nb_sm_f0( unsigned char lfrMode )
25 {
26 nb_sm_before_f0.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96;
27 nb_sm_before_f0.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96;
28 nb_sm_before_f0.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 96;
29 nb_sm_before_f0.sbm1_bp1 = parameter_dump_packet.sy_lfr_s1_bp_p0 * 24;
30 nb_sm_before_f0.sbm1_bp2 = parameter_dump_packet.sy_lfr_s1_bp_p1 * 96;
31 nb_sm_before_f0.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 96;
32 nb_sm_before_f0.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 96;
33 nb_sm_before_f0.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 96;
34 nb_sm_before_f0.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 96;
35
36 if (lfrMode == LFR_MODE_SBM1)
37 {
38 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm1_bp1;
39 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm1_bp2;
40 }
41 else if (lfrMode == LFR_MODE_SBM2)
42 {
43 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm2_bp1;
44 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm2_bp2;
45 }
46 else if (lfrMode == LFR_MODE_BURST)
47 {
48 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1;
49 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2;
50 }
51 else
52 {
53 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1;
54 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2;
55 }
56 }
57
58 //************
59 // RTEMS TASKS
60
61 rtems_task avf0_task( rtems_task_argument lfrRequestedMode )
62 {
63 int i;
64
65 rtems_event_set event_out;
66 rtems_status_code status;
67 rtems_id queue_id_prc0;
68 asm_msg msgForMATR;
69 ring_node_sm *ring_node_tab[8];
70
71 unsigned int nb_norm_bp1;
72 unsigned int nb_norm_bp2;
73 unsigned int nb_norm_asm;
74 unsigned int nb_sbm_bp1;
75 unsigned int nb_sbm_bp2;
76
77 nb_norm_bp1 = 0;
78 nb_norm_bp2 = 0;
79 nb_norm_asm = 0;
80 nb_sbm_bp1 = 0;
81 nb_sbm_bp2 = 0;
82
83 reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions
84 ASM_generic_init_ring( asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0 );
85 ASM_generic_init_ring( asm_ring_burst_sbm_f0, NB_RING_NODES_ASM_BURST_SBM_F0 );
86 current_ring_node_asm_norm_f0 = asm_ring_norm_f0;
87 current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0;
88
89 BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
90
91 status = get_message_queue_id_prc0( &queue_id_prc0 );
92 if (status != RTEMS_SUCCESSFUL)
93 {
94 PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status)
95 }
96
97 while(1){
98 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
99 ring_node_tab[NB_SM_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0;
100 for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ )
101 {
102 ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous;
103 ring_node_tab[NB_SM_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0;
104 }
105
106 // compute the average and store it in the averaged_sm_f1 buffer
107 SM_average( current_ring_node_asm_norm_f0->matrix,
108 current_ring_node_asm_burst_sbm_f0->matrix,
109 ring_node_tab,
110 nb_norm_bp1, nb_sbm_bp1 );
111
112 // update nb_average
113 nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0;
114 nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0;
115 nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0;
116 nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0;
117 nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0;
118
119 //****************************************
120 // initialize the mesage for the MATR task
121 msgForMATR.event = 0x00; // this composite event will be sent to the MATR task
122 msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f0;
123 msgForMATR.norm = current_ring_node_asm_norm_f0;
124 // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0];
125 // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1];
126 msgForMATR.coarseTime = time_management_regs->coarse_time;
127 msgForMATR.fineTime = time_management_regs->fine_time;
128
129 if (nb_sbm_bp1 == nb_sm_before_f0.burst_sbm_bp1)
130 {
131 nb_sbm_bp1 = 0;
132 // set another ring for the ASM storage
133 current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next;
134 if ( (lfrCurrentMode == LFR_MODE_BURST)
135 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
136 {
137 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F0;
138 }
139 }
140
141 if (nb_sbm_bp2 == nb_sm_before_f0.burst_sbm_bp2)
142 {
143 nb_sbm_bp2 = 0;
144 if ( (lfrCurrentMode == LFR_MODE_BURST)
145 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
146 {
147 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F0;
148 }
149 }
150
151 if (nb_norm_bp1 == nb_sm_before_f0.norm_bp1)
152 {
153 nb_norm_bp1 = 0;
154 // set another ring for the ASM storage
155 current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next;
156 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
157 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
158 {
159 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F0;
160 }
161 }
162
163 if (nb_norm_bp2 == nb_sm_before_f0.norm_bp2)
164 {
165 nb_norm_bp2 = 0;
166 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
167 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
168 {
169 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F0;
170 }
171 }
172
173 if (nb_norm_asm == nb_sm_before_f0.norm_asm)
174 {
175 nb_norm_asm = 0;
176 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
177 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
178 {
179 // PRINTF1("%lld\n", localTime)
180 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F0;
181 }
182 }
183
184 //*************************
185 // send the message to MATR
186 if (msgForMATR.event != 0x00)
187 {
188 status = rtems_message_queue_send( queue_id_prc0, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0);
189 }
190
191 if (status != RTEMS_SUCCESSFUL) {
192 printf("in AVF0 *** Error sending message to MATR, code %d\n", status);
193 }
194 }
195 }
196
197 rtems_task prc0_task( rtems_task_argument lfrRequestedMode )
198 {
199 char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
200 size_t size; // size of the incoming TC packet
201 asm_msg *incomingMsg;
202 //
203 spw_ioctl_pkt_send spw_ioctl_send_ASM;
204 rtems_status_code status;
205 rtems_id queue_id;
206 rtems_id queue_id_q_p0;
207 Header_TM_LFR_SCIENCE_ASM_t headerASM;
208 bp_packet_with_spare packet_norm_bp1_f0;
209 bp_packet packet_norm_bp2_f0;
210 bp_packet packet_sbm_bp1_f0;
211 bp_packet packet_sbm_bp2_f0;
212
213 unsigned long long int localTime;
214
215 ASM_init_header( &headerASM );
216
217 //*************
218 // NORM headers
219 BP_init_header_with_spare( &packet_norm_bp1_f0.header,
220 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0,
221 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 );
222 BP_init_header( &packet_norm_bp2_f0.header,
223 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0,
224 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0);
225
226 //****************************
227 // BURST SBM1 and SBM2 headers
228 if ( lfrRequestedMode == LFR_MODE_BURST )
229 {
230 BP_init_header( &packet_sbm_bp1_f0.header,
231 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0,
232 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
233 BP_init_header( &packet_sbm_bp2_f0.header,
234 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0,
235 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
236 }
237 else if ( lfrRequestedMode == LFR_MODE_SBM1 )
238 {
239 BP_init_header( &packet_sbm_bp1_f0.header,
240 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0,
241 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
242 BP_init_header( &packet_sbm_bp2_f0.header,
243 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0,
244 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
245 }
246 else if ( lfrRequestedMode == LFR_MODE_SBM2 )
247 {
248 BP_init_header( &packet_sbm_bp1_f0.header,
249 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0,
250 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
251 BP_init_header( &packet_sbm_bp2_f0.header,
252 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0,
253 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
254 }
255 else
256 {
257 PRINTF1("in PRC0 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode)
258 }
259
260 status = get_message_queue_id_send( &queue_id );
261 if (status != RTEMS_SUCCESSFUL)
262 {
263 PRINTF1("in PRC0 *** ERR get_message_queue_id_send %d\n", status)
264 }
265 status = get_message_queue_id_prc0( &queue_id_q_p0);
266 if (status != RTEMS_SUCCESSFUL)
267 {
268 PRINTF1("in PRC0 *** ERR get_message_queue_id_prc0 %d\n", status)
269 }
270
271 BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
272
273 while(1){
274 status = rtems_message_queue_receive( queue_id_q_p0, incomingData, &size, //************************************
275 RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0
276
277 incomingMsg = (asm_msg*) incomingData;
278
279 localTime = getTimeAsUnsignedLongLongInt( );
280 //****************
281 //****************
282 // BURST SBM1 SBM2
283 //****************
284 //****************
285 if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F0 )
286 {
287 // 1) compress the matrix for Basic Parameters calculation
288 ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm_f0,
289 nb_sm_before_f0.burst_sbm_bp1,
290 NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0,
291 ASM_F0_INDICE_START);
292 // 2) compute the BP1 set
293
294 // 3) send the BP1 set
295 set_time( packet_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
296 set_time( packet_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
297 BP_send( (char *) &packet_sbm_bp1_f0.header, queue_id,
298 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA);
299 // 4) compute the BP2 set if needed
300 if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F0 )
301 {
302 // 1) compute the BP2 set
303
304 // 2) send the BP2 set
305 set_time( packet_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
306 set_time( packet_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
307 BP_send( (char *) &packet_sbm_bp2_f0.header, queue_id,
308 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA);
309 }
310 }
311
312 //*****
313 //*****
314 // NORM
315 //*****
316 //*****
317 if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0)
318 {
319 // 1) compress the matrix for Basic Parameters calculation
320 ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0,
321 nb_sm_before_f0.norm_bp1,
322 NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
323 ASM_F0_INDICE_START );
324 // 2) compute the BP1 set
325
326 // 3) send the BP1 set
327 set_time( packet_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
328 set_time( packet_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
329 BP_send( (char *) &packet_norm_bp1_f0.header, queue_id,
330 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA);
331 if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0)
332 {
333 // 1) compute the BP2 set using the same ASM as the one used for BP1
334
335 // 2) send the BP2 set
336 set_time( packet_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
337 set_time( packet_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
338 BP_send( (char *) &packet_norm_bp2_f0.header, queue_id,
339 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA);
340 }
341 }
342
343 if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0)
344 {
345 // 1) reorganize the ASM and divide
346 ASM_reorganize_and_divide( incomingMsg->norm->matrix,
347 asm_f0_reorganized,
348 nb_sm_before_f0.norm_bp1 );
349 // 2) convert the float array in a char array
350 ASM_convert( asm_f0_reorganized, asm_f0_char);
351 // 3) send the spectral matrix packets
352 set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime );
353 set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
354 ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
355 }
356
357 }
358 }
@@ -0,0 +1,30
1 #ifndef AVF0_PRC0_H
2 #define AVF0_PRC0_H
3
4 #include "fsw_processing.h"
5
6 typedef struct {
7 unsigned int norm_bp1;
8 unsigned int norm_bp2;
9 unsigned int norm_asm;
10 unsigned int burst_sbm_bp1;
11 unsigned int burst_sbm_bp2;
12 unsigned int burst_bp1;
13 unsigned int burst_bp2;
14 unsigned int sbm1_bp1;
15 unsigned int sbm1_bp2;
16 unsigned int sbm2_bp1;
17 unsigned int sbm2_bp2;
18 } nb_sm_before_bp_asm_f0;
19
20 extern struct ring_node_sm *current_ring_node_sm_f0;
21 extern struct ring_node_sm *ring_node_for_averaging_sm_f0;
22
23 extern rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id );
24
25 void reset_nb_sm_f0( unsigned char lfrMode );
26
27 rtems_task avf0_task( rtems_task_argument lfrRequestedMode );
28 rtems_task prc0_task( rtems_task_argument lfrRequestedMode );
29
30 #endif // AVF0_PRC0_H
@@ -0,0 +1,339
1 /** Functions related to data processing.
2 *
3 * @file
4 * @author P. LEROY
5 *
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
7 *
8 */
9
10 #include "avf1_prc1.h"
11
12 ring_node_asm asm_ring_norm_f1 [ NB_RING_NODES_ASM_NORM_F1 ];
13 ring_node_asm asm_ring_burst_sbm_f1[ NB_RING_NODES_ASM_BURST_SBM_F1 ];
14 ring_node_asm *current_ring_node_asm_burst_sbm_f1;
15 ring_node_asm *current_ring_node_asm_norm_f1;
16
17 float asm_f1_reorganized [ TOTAL_SIZE_SM ];
18 char asm_f1_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
19 float compressed_sm_norm_f1[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F1];
20 float compressed_sm_sbm_f1 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 ];
21
22 nb_sm_before_bp_asm_f1 nb_sm_before_f1;
23
24 void reset_nb_sm_f1( unsigned char lfrMode )
25 {
26 nb_sm_before_f1.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 16;
27 nb_sm_before_f1.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 16;
28 nb_sm_before_f1.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 16;
29 nb_sm_before_f1.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 16;
30 nb_sm_before_f1.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 16;
31 nb_sm_before_f1.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 16;
32 nb_sm_before_f1.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 16;
33
34 if (lfrMode == LFR_MODE_SBM2)
35 {
36 nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.sbm2_bp1;
37 nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.sbm2_bp2;
38 }
39 else if (lfrMode == LFR_MODE_BURST)
40 {
41 nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1;
42 nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2;
43 }
44 else
45 {
46 nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1;
47 nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2;
48 }
49 }
50
51 //************
52 // RTEMS TASKS
53
54 rtems_task avf1_task( rtems_task_argument lfrRequestedMode )
55 {
56 int i;
57
58 rtems_event_set event_out;
59 rtems_status_code status;
60 rtems_id queue_id_prc1;
61 asm_msg msgForMATR;
62 ring_node_sm *ring_node_tab[8];
63
64 unsigned int nb_norm_bp1;
65 unsigned int nb_norm_bp2;
66 unsigned int nb_norm_asm;
67 unsigned int nb_sbm_bp1;
68 unsigned int nb_sbm_bp2;
69
70 nb_norm_bp1 = 0;
71 nb_norm_bp2 = 0;
72 nb_norm_asm = 0;
73 nb_sbm_bp1 = 0;
74 nb_sbm_bp2 = 0;
75
76 reset_nb_sm_f1( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions
77 ASM_generic_init_ring( asm_ring_norm_f1, NB_RING_NODES_ASM_NORM_F1 );
78 ASM_generic_init_ring( asm_ring_burst_sbm_f1, NB_RING_NODES_ASM_BURST_SBM_F1 );
79 current_ring_node_asm_norm_f1 = asm_ring_norm_f1;
80 current_ring_node_asm_burst_sbm_f1 = asm_ring_burst_sbm_f1;
81
82 BOOT_PRINTF1("in AVF1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
83
84 status = get_message_queue_id_prc1( &queue_id_prc1 );
85 if (status != RTEMS_SUCCESSFUL)
86 {
87 PRINTF1("in AVF1 *** ERR get_message_queue_id_prc1 %d\n", status)
88 }
89
90 while(1){
91 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
92 ring_node_tab[NB_SM_BEFORE_AVF1-1] = ring_node_for_averaging_sm_f1;
93 for ( i = 2; i < (NB_SM_BEFORE_AVF1+1); i++ )
94 {
95 ring_node_for_averaging_sm_f1 = ring_node_for_averaging_sm_f1->previous;
96 ring_node_tab[NB_SM_BEFORE_AVF1-i] = ring_node_for_averaging_sm_f1;
97 }
98
99 // compute the average and store it in the averaged_sm_f1 buffer
100 SM_average( current_ring_node_asm_norm_f1->matrix,
101 current_ring_node_asm_burst_sbm_f1->matrix,
102 ring_node_tab,
103 nb_norm_bp1, nb_sbm_bp1 );
104
105 // update nb_average
106 nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF1;
107 nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF1;
108 nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF1;
109 nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF1;
110 nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF1;
111
112 //****************************************
113 // initialize the mesage for the MATR task
114 msgForMATR.event = 0x00; // this composite event will be sent to the PRC1 task
115 msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f1;
116 msgForMATR.norm = current_ring_node_asm_norm_f1;
117 // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0];
118 // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1];
119 msgForMATR.coarseTime = time_management_regs->coarse_time;
120 msgForMATR.fineTime = time_management_regs->fine_time;
121
122 if (nb_sbm_bp1 == nb_sm_before_f1.burst_sbm_bp1)
123 {
124 nb_sbm_bp1 = 0;
125 // set another ring for the ASM storage
126 current_ring_node_asm_burst_sbm_f1 = current_ring_node_asm_burst_sbm_f1->next;
127 if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) )
128 {
129 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F1;
130 }
131 }
132
133 if (nb_sbm_bp2 == nb_sm_before_f1.burst_sbm_bp2)
134 {
135 nb_sbm_bp2 = 0;
136 if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) )
137 {
138 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F1;
139 }
140 }
141
142 if (nb_norm_bp1 == nb_sm_before_f1.norm_bp1)
143 {
144 nb_norm_bp1 = 0;
145 // set another ring for the ASM storage
146 current_ring_node_asm_norm_f1 = current_ring_node_asm_norm_f1->next;
147 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
148 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
149 {
150 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F1;
151 }
152 }
153
154 if (nb_norm_bp2 == nb_sm_before_f1.norm_bp2)
155 {
156 nb_norm_bp2 = 0;
157 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
158 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
159 {
160 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F1;
161 }
162 }
163
164 if (nb_norm_asm == nb_sm_before_f1.norm_asm)
165 {
166 nb_norm_asm = 0;
167 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
168 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
169 {
170 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F1;
171 }
172 }
173
174 //*************************
175 // send the message to MATR
176 if (msgForMATR.event != 0x00)
177 {
178 status = rtems_message_queue_send( queue_id_prc1, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC1);
179 }
180
181 if (status != RTEMS_SUCCESSFUL) {
182 printf("in AVF1 *** Error sending message to PRC1, code %d\n", status);
183 }
184 }
185 }
186
187 rtems_task prc1_task( rtems_task_argument lfrRequestedMode )
188 {
189 char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
190 size_t size; // size of the incoming TC packet
191 asm_msg *incomingMsg;
192 //
193 spw_ioctl_pkt_send spw_ioctl_send_ASM;
194 rtems_status_code status;
195 rtems_id queue_id_send;
196 rtems_id queue_id_q_p1;
197 Header_TM_LFR_SCIENCE_ASM_t headerASM;
198 bp_packet_with_spare packet_norm_bp1;
199 bp_packet packet_norm_bp2;
200 bp_packet packet_sbm_bp1;
201 bp_packet packet_sbm_bp2;
202
203 unsigned long long int localTime;
204
205 ASM_init_header( &headerASM );
206
207 //*************
208 // NORM headers
209 BP_init_header_with_spare( &packet_norm_bp1.header,
210 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F1,
211 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1, NB_BINS_COMPRESSED_SM_F1 );
212 BP_init_header( &packet_norm_bp2.header,
213 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F1,
214 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1, NB_BINS_COMPRESSED_SM_F1);
215
216 //***********************
217 // BURST and SBM2 headers
218 if ( lfrRequestedMode == LFR_MODE_BURST )
219 {
220 BP_init_header( &packet_sbm_bp1.header,
221 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F1,
222 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F1);
223 BP_init_header( &packet_sbm_bp2.header,
224 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F1,
225 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F1);
226 }
227 else if ( lfrRequestedMode == LFR_MODE_SBM2 )
228 {
229 BP_init_header( &packet_sbm_bp1.header,
230 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F1,
231 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1, NB_BINS_COMPRESSED_SM_SBM_F1);
232 BP_init_header( &packet_sbm_bp2.header,
233 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F1,
234 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1, NB_BINS_COMPRESSED_SM_SBM_F1);
235 }
236 else
237 {
238 PRINTF1("in PRC1 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode)
239 }
240
241 status = get_message_queue_id_send( &queue_id_send );
242 if (status != RTEMS_SUCCESSFUL)
243 {
244 PRINTF1("in PRC1 *** ERR get_message_queue_id_send %d\n", status)
245 }
246 status = get_message_queue_id_prc1( &queue_id_q_p1);
247 if (status != RTEMS_SUCCESSFUL)
248 {
249 PRINTF1("in PRC1 *** ERR get_message_queue_id_prc1 %d\n", status)
250 }
251
252 BOOT_PRINTF1("in PRC1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
253
254 while(1){
255 status = rtems_message_queue_receive( queue_id_q_p1, incomingData, &size, //************************************
256 RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0
257
258 incomingMsg = (asm_msg*) incomingData;
259
260 localTime = getTimeAsUnsignedLongLongInt( );
261 //***********
262 //***********
263 // BURST SBM2
264 //***********
265 //***********
266 if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F1 )
267 {
268 // 1) compress the matrix for Basic Parameters calculation
269 ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm_f1,
270 nb_sm_before_f1.burst_sbm_bp1,
271 NB_BINS_COMPRESSED_SM_SBM_F1, NB_BINS_TO_AVERAGE_ASM_SBM_F1,
272 ASM_F1_INDICE_START);
273 // 2) compute the BP1 set
274
275 // 3) send the BP1 set
276 set_time( packet_sbm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime );
277 set_time( packet_sbm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
278 BP_send( (char *) &packet_sbm_bp1.header, queue_id_send,
279 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 + PACKET_LENGTH_DELTA);
280 // 4) compute the BP2 set if needed
281 if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F1 )
282 {
283 // 1) compute the BP2 set
284
285 // 2) send the BP2 set
286 set_time( packet_sbm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime );
287 set_time( packet_sbm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
288 BP_send( (char *) &packet_sbm_bp2.header, queue_id_send,
289 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 + PACKET_LENGTH_DELTA);
290 }
291 }
292
293 //*****
294 //*****
295 // NORM
296 //*****
297 //*****
298 if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F1)
299 {
300 // 1) compress the matrix for Basic Parameters calculation
301 ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f1,
302 nb_sm_before_f1.norm_bp1,
303 NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
304 ASM_F0_INDICE_START );
305 // 2) compute the BP1 set
306
307 // 3) send the BP1 set
308 set_time( packet_norm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime );
309 set_time( packet_norm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
310 BP_send( (char *) &packet_norm_bp1.header, queue_id_send,
311 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 + PACKET_LENGTH_DELTA);
312 if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F1)
313 {
314 // 1) compute the BP2 set
315
316 // 2) send the BP2 set
317 set_time( packet_norm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime );
318 set_time( packet_norm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
319 BP_send( (char *) &packet_norm_bp2.header, queue_id_send,
320 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 + PACKET_LENGTH_DELTA);
321 }
322 }
323
324 if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F1)
325 {
326 // 1) reorganize the ASM and divide
327 ASM_reorganize_and_divide( incomingMsg->norm->matrix,
328 asm_f1_reorganized,
329 nb_sm_before_f1.norm_bp1 );
330 // 2) convert the float array in a char array
331 ASM_convert( asm_f1_reorganized, asm_f1_char);
332 // 3) send the spectral matrix packets
333 set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime );
334 set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
335 ASM_send( &headerASM, asm_f1_char, SID_NORM_ASM_F1, &spw_ioctl_send_ASM, queue_id_send);
336 }
337
338 }
339 }
@@ -0,0 +1,28
1 #ifndef AVF1_PRC1_H
2 #define AVF1_PRC1_H
3
4 #include "fsw_processing.h"
5
6 typedef struct {
7 unsigned int norm_bp1;
8 unsigned int norm_bp2;
9 unsigned int norm_asm;
10 unsigned int burst_sbm_bp1;
11 unsigned int burst_sbm_bp2;
12 unsigned int burst_bp1;
13 unsigned int burst_bp2;
14 unsigned int sbm2_bp1;
15 unsigned int sbm2_bp2;
16 } nb_sm_before_bp_asm_f1;
17
18 extern struct ring_node_sm *current_ring_node_sm_f1;
19 extern struct ring_node_sm *ring_node_for_averaging_sm_f1;
20
21 extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
22
23 void reset_nb_sm_f1( unsigned char lfrMode );
24
25 rtems_task avf1_task( rtems_task_argument lfrRequestedMode );
26 rtems_task prc1_task( rtems_task_argument lfrRequestedMode );
27
28 #endif // AVF1_PRC1_H
@@ -0,0 +1,240
1 /** Functions related to data processing.
2 *
3 * @file
4 * @author P. LEROY
5 *
6 * These function are related to data processing at f2 = 256 Hz, i.e. spectral matrices averaging and basic parameters computation.
7 *
8 */
9
10 #include "avf2_prc2.h"
11
12 ring_node_asm asm_ring_norm_f2 [ NB_RING_NODES_ASM_NORM_F2 ];
13 ring_node_asm asm_ring_burst_sbm_f2[ NB_RING_NODES_ASM_BURST_SBM_F2 ];
14 ring_node_asm *current_ring_node_asm_burst_sbm_f2;
15 ring_node_asm *current_ring_node_asm_norm_f2;
16
17 float asm_f2_reorganized [ TOTAL_SIZE_SM ];
18 char asm_f2_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
19 float compressed_sm_norm_f2[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F2];
20 float compressed_sm_sbm_f2 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F2 ];
21
22 nb_sm_before_bp_asm_f2 nb_sm_before_f2;
23
24 void reset_nb_sm_f2( void )
25 {
26 nb_sm_before_f2.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0;
27 nb_sm_before_f2.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1;
28 nb_sm_before_f2.norm_asm = parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1];
29 }
30
31 void SM_average_f2( float *averaged_spec_mat_f2,
32 ring_node_sm *ring_node,
33 unsigned int nbAverageNormF2 )
34 {
35 float sum;
36 unsigned int i;
37
38 for(i=0; i<TOTAL_SIZE_SM; i++)
39 {
40 sum = ( (int *) (ring_node->buffer_address) ) [ i ];
41 if ( (nbAverageNormF2 == 0) )
42 {
43 averaged_spec_mat_f2[ i ] = sum;
44 }
45 else
46 {
47 averaged_spec_mat_f2[ i ] = ( averaged_spec_mat_f2[ i ] + sum );
48 }
49 }
50 }
51
52 //************
53 // RTEMS TASKS
54
55 rtems_task avf2_task( rtems_task_argument lfrRequestedMode )
56 {
57 rtems_event_set event_out;
58 rtems_status_code status;
59 rtems_id queue_id_prc2;
60 asm_msg msgForMATR;
61
62 unsigned int nb_norm_bp1;
63 unsigned int nb_norm_bp2;
64 unsigned int nb_norm_asm;
65
66 nb_norm_bp1 = 0;
67 nb_norm_bp2 = 0;
68 nb_norm_asm = 0;
69
70 reset_nb_sm_f2( ); // reset the sm counters that drive the BP and ASM computations / transmissions
71
72 BOOT_PRINTF1("in AVF2 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
73
74 status = get_message_queue_id_prc2( &queue_id_prc2 );
75 if (status != RTEMS_SUCCESSFUL)
76 {
77 PRINTF1("in AVF2 *** ERR get_message_queue_id_prc2 %d\n", status)
78 }
79
80 while(1){
81 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
82
83 // compute the average and store it in the averaged_sm_f2 buffer
84 SM_average_f2( current_ring_node_asm_norm_f2->matrix,
85 ring_node_for_averaging_sm_f2,
86 nb_norm_bp1 );
87
88 // update nb_average
89 nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF2;
90 nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF2;
91 nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF2;
92
93 //****************************************
94 // initialize the mesage for the MATR task
95 msgForMATR.event = 0x00; // this composite event will be sent to the MATR task
96 msgForMATR.burst_sbm = NULL;
97 msgForMATR.norm = current_ring_node_asm_norm_f2;
98 // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0];
99 // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1];
100 msgForMATR.coarseTime = time_management_regs->coarse_time;
101 msgForMATR.fineTime = time_management_regs->fine_time;
102
103 if (nb_norm_bp1 == nb_sm_before_f2.norm_bp1)
104 {
105 nb_norm_bp1 = 0;
106 // set another ring for the ASM storage
107 current_ring_node_asm_norm_f2 = current_ring_node_asm_norm_f2->next;
108 if ( lfrCurrentMode == LFR_MODE_NORMAL )
109 {
110 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F0;
111 }
112 }
113
114 if (nb_norm_bp2 == nb_sm_before_f2.norm_bp2)
115 {
116 nb_norm_bp2 = 0;
117 if ( lfrCurrentMode == LFR_MODE_NORMAL )
118 {
119 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F2;
120 }
121 }
122
123 if (nb_norm_asm == nb_sm_before_f2.norm_asm)
124 {
125 nb_norm_asm = 0;
126 if ( lfrCurrentMode == LFR_MODE_NORMAL )
127 {
128 // PRINTF1("%lld\n", localTime)
129 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F2;
130 }
131 }
132
133 //*************************
134 // send the message to MATR
135 if (msgForMATR.event != 0x00)
136 {
137 status = rtems_message_queue_send( queue_id_prc2, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0);
138 }
139
140 if (status != RTEMS_SUCCESSFUL) {
141 printf("in AVF2 *** Error sending message to MATR, code %d\n", status);
142 }
143 }
144 }
145
146 rtems_task prc2_task( rtems_task_argument argument )
147 {
148 char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
149 size_t size; // size of the incoming TC packet
150 asm_msg *incomingMsg;
151 //
152 spw_ioctl_pkt_send spw_ioctl_send_ASM;
153 rtems_status_code status;
154 rtems_id queue_id;
155 rtems_id queue_id_q_p2;
156 Header_TM_LFR_SCIENCE_ASM_t headerASM;
157 bp_packet packet_norm_bp1_f2;
158 bp_packet packet_norm_bp2_f2;
159
160 unsigned long long int localTime;
161
162 ASM_init_header( &headerASM );
163
164 //*************
165 // NORM headers
166 BP_init_header( &packet_norm_bp1_f2.header,
167 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F2,
168 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2, NB_BINS_COMPRESSED_SM_F2 );
169 BP_init_header( &packet_norm_bp2_f2.header,
170 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F2,
171 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2, NB_BINS_COMPRESSED_SM_F2 );
172
173 status = get_message_queue_id_send( &queue_id );
174 if (status != RTEMS_SUCCESSFUL)
175 {
176 PRINTF1("in PRC2 *** ERR get_message_queue_id_send %d\n", status)
177 }
178 status = get_message_queue_id_prc2( &queue_id_q_p2);
179 if (status != RTEMS_SUCCESSFUL)
180 {
181 PRINTF1("in PRC2 *** ERR get_message_queue_id_prc2 %d\n", status)
182 }
183
184 BOOT_PRINTF("in PRC2 ***\n")
185
186 while(1){
187 status = rtems_message_queue_receive( queue_id_q_p2, incomingData, &size, //************************************
188 RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0
189
190 incomingMsg = (asm_msg*) incomingData;
191
192 localTime = getTimeAsUnsignedLongLongInt( );
193
194 //*****
195 //*****
196 // NORM
197 //*****
198 //*****
199 if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F2)
200 {
201 // 1) compress the matrix for Basic Parameters calculation
202 ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f2,
203 nb_sm_before_f2.norm_bp1,
204 NB_BINS_COMPRESSED_SM_F2, NB_BINS_TO_AVERAGE_ASM_F2,
205 ASM_F2_INDICE_START );
206 // 2) compute the BP1 set
207
208 // 3) send the BP1 set
209 set_time( packet_norm_bp1_f2.header.time, (unsigned char *) &incomingMsg->coarseTime );
210 set_time( packet_norm_bp1_f2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
211 BP_send( (char *) &packet_norm_bp1_f2.header, queue_id,
212 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 + PACKET_LENGTH_DELTA);
213 if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F2)
214 {
215 // 1) compute the BP2 set using the same ASM as the one used for BP1
216
217 // 2) send the BP2 set
218 set_time( packet_norm_bp2_f2.header.time, (unsigned char *) &incomingMsg->coarseTime );
219 set_time( packet_norm_bp2_f2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
220 BP_send( (char *) &packet_norm_bp2_f2.header, queue_id,
221 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 + PACKET_LENGTH_DELTA);
222 }
223 }
224
225 if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F2)
226 {
227 // 1) reorganize the ASM and divide
228 ASM_reorganize_and_divide( incomingMsg->norm->matrix,
229 asm_f2_reorganized,
230 nb_sm_before_f2.norm_bp1 );
231 // 2) convert the float array in a char array
232 ASM_convert( asm_f2_reorganized, asm_f2_char);
233 // 3) send the spectral matrix packets
234 set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime );
235 set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
236 ASM_send( &headerASM, asm_f2_char, SID_NORM_ASM_F2, &spw_ioctl_send_ASM, queue_id);
237 }
238
239 }
240 }
@@ -0,0 +1,24
1 #ifndef AVF2_PRC2_H
2 #define AVF2_PRC2_H
3
4 #include "fsw_processing.h"
5
6 typedef struct {
7 unsigned int norm_bp1;
8 unsigned int norm_bp2;
9 unsigned int norm_asm;
10 } nb_sm_before_bp_asm_f2;
11
12 extern struct ring_node_sm *current_ring_node_sm_f2;
13 extern struct ring_node_sm *ring_node_for_averaging_sm_f2;
14
15 extern rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
16
17 void reset_nb_sm_f2(void );
18 void SM_average_f2( float *averaged_spec_mat_f2, ring_node_sm *ring_node, unsigned int nbAverageNormF2 );
19
20 // RTEMS TASKS
21 rtems_task avf2_task( rtems_task_argument lfrRequestedMode );
22 rtems_task prc2_task(rtems_task_argument argument );
23
24 #endif // AVF2_PRC2_H
This diff has been collapsed as it changes many lines, (570 lines changed) Show them Hide them
@@ -0,0 +1,570
1 /** Functions related to data processing.
2 *
3 * @file
4 * @author P. LEROY
5 *
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
7 *
8 */
9
10 #include "fsw_processing.h"
11 #include "fsw_processing_globals.c"
12
13 unsigned int nb_sm_f0;
14 unsigned int nb_sm_f0_aux_f1;
15 unsigned int nb_sm_f1;
16 unsigned int nb_sm_f0_aux_f2;
17
18 //************************
19 // spectral matrices rings
20 ring_node_sm sm_ring_f0[ NB_RING_NODES_SM_F0 ];
21 ring_node_sm sm_ring_f1[ NB_RING_NODES_SM_F1 ];
22 ring_node_sm sm_ring_f2[ NB_RING_NODES_SM_F2 ];
23 ring_node_sm *current_ring_node_sm_f0;
24 ring_node_sm *current_ring_node_sm_f1;
25 ring_node_sm *current_ring_node_sm_f2;
26 ring_node_sm *ring_node_for_averaging_sm_f0;
27 ring_node_sm *ring_node_for_averaging_sm_f1;
28 ring_node_sm *ring_node_for_averaging_sm_f2;
29
30 //***********************************************************
31 // Interrupt Service Routine for spectral matrices processing
32
33 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
34 {
35 ring_node_sm *previous_ring_node_sm_f0;
36
37 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
38
39 previous_ring_node_sm_f0 = current_ring_node_sm_f0;
40
41 if ( (spectral_matrix_regs->status & 0x2) == 0x02) // check ready matrix bit f0_1
42 {
43 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
44 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
45 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101
46 nb_sm_f0 = nb_sm_f0 + 1;
47 }
48
49 //************************
50 // reset status error bits
51 if ( (spectral_matrix_regs->status & 0x30) != 0x00)
52 {
53 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
54 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111
55 }
56
57 //**************************************
58 // reset ready matrix bits for f0_0, f1 and f2
59 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff2; // 0010
60
61 if (nb_sm_f0 == NB_SM_BEFORE_AVF0)
62 {
63 ring_node_for_averaging_sm_f0 = previous_ring_node_sm_f0;
64 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
65 {
66 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
67 }
68 nb_sm_f0 = 0;
69 }
70
71 }
72
73 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
74 {
75 //***
76 // F0
77 nb_sm_f0 = nb_sm_f0 + 1;
78 if (nb_sm_f0 == NB_SM_BEFORE_AVF0 )
79 {
80 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
81 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
82 {
83 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
84 }
85 nb_sm_f0 = 0;
86 }
87
88 //***
89 // F1
90 nb_sm_f0_aux_f1 = nb_sm_f0_aux_f1 + 1;
91 if (nb_sm_f0_aux_f1 == 6)
92 {
93 nb_sm_f0_aux_f1 = 0;
94 nb_sm_f1 = nb_sm_f1 + 1;
95 }
96 if (nb_sm_f1 == NB_SM_BEFORE_AVF1 )
97 {
98 ring_node_for_averaging_sm_f1 = current_ring_node_sm_f1;
99 if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
100 {
101 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
102 }
103 nb_sm_f1 = 0;
104 }
105
106 //***
107 // F2
108 nb_sm_f0_aux_f2 = nb_sm_f0_aux_f2 + 1;
109 if (nb_sm_f0_aux_f2 == 96)
110 {
111 nb_sm_f0_aux_f2 = 0;
112 ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2;
113 if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
114 {
115 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
116 }
117 }
118 }
119
120 //******************
121 // Spectral Matrices
122
123 void reset_nb_sm( void )
124 {
125 nb_sm_f0 = 0;
126 nb_sm_f0_aux_f1 = 0;
127 nb_sm_f0_aux_f2 = 0;
128
129 nb_sm_f1 = 0;
130 }
131
132 void SM_init_rings( void )
133 {
134 unsigned char i;
135
136 // F0 RING
137 sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1];
138 sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-1];
139 sm_ring_f0[0].buffer_address =
140 (int) &sm_f0[ 0 ];
141
142 sm_ring_f0[NB_RING_NODES_SM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0];
143 sm_ring_f0[NB_RING_NODES_SM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-2];
144 sm_ring_f0[NB_RING_NODES_SM_F0-1].buffer_address =
145 (int) &sm_f0[ (NB_RING_NODES_SM_F0-1) * TOTAL_SIZE_SM ];
146
147 for(i=1; i<NB_RING_NODES_SM_F0-1; i++)
148 {
149 sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1];
150 sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1];
151 sm_ring_f0[i].buffer_address =
152 (int) &sm_f0[ i * TOTAL_SIZE_SM ];
153 }
154
155 // F1 RING
156 sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1];
157 sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-1];
158 sm_ring_f1[0].buffer_address =
159 (int) &sm_f1[ 0 ];
160
161 sm_ring_f1[NB_RING_NODES_SM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0];
162 sm_ring_f1[NB_RING_NODES_SM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-2];
163 sm_ring_f1[NB_RING_NODES_SM_F1-1].buffer_address =
164 (int) &sm_f1[ (NB_RING_NODES_SM_F1-1) * TOTAL_SIZE_SM ];
165
166 for(i=1; i<NB_RING_NODES_SM_F1-1; i++)
167 {
168 sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1];
169 sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1];
170 sm_ring_f1[i].buffer_address =
171 (int) &sm_f1[ i * TOTAL_SIZE_SM ];
172 }
173
174 // F2 RING
175 sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1];
176 sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-1];
177 sm_ring_f2[0].buffer_address =
178 (int) &sm_f2[ 0 ];
179
180 sm_ring_f2[NB_RING_NODES_SM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0];
181 sm_ring_f2[NB_RING_NODES_SM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-2];
182 sm_ring_f2[NB_RING_NODES_SM_F2-1].buffer_address =
183 (int) &sm_f2[ (NB_RING_NODES_SM_F2-1) * TOTAL_SIZE_SM ];
184
185 for(i=1; i<NB_RING_NODES_SM_F2-1; i++)
186 {
187 sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1];
188 sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1];
189 sm_ring_f2[i].buffer_address =
190 (int) &sm_f2[ i * TOTAL_SIZE_SM ];
191 }
192
193 DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0)
194 DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1)
195 DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2)
196
197 spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address;
198 DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0)
199 }
200
201 void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes )
202 {
203 unsigned char i;
204
205 ring[ nbNodes - 1 ].next
206 = (ring_node_asm*) &ring[ 0 ];
207
208 for(i=0; i<nbNodes-1; i++)
209 {
210 ring[ i ].next = (ring_node_asm*) &ring[ i + 1 ];
211 }
212 }
213
214 void SM_reset_current_ring_nodes( void )
215 {
216 current_ring_node_sm_f0 = sm_ring_f0;
217 current_ring_node_sm_f1 = sm_ring_f1;
218 current_ring_node_sm_f2 = sm_ring_f2;
219
220 ring_node_for_averaging_sm_f0 = sm_ring_f0;
221 }
222
223 void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header)
224 {
225 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
226 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
227 header->reserved = 0x00;
228 header->userApplication = CCSDS_USER_APP;
229 header->packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
230 header->packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
231 header->packetSequenceControl[0] = 0xc0;
232 header->packetSequenceControl[1] = 0x00;
233 header->packetLength[0] = 0x00;
234 header->packetLength[1] = 0x00;
235 // DATA FIELD HEADER
236 header->spare1_pusVersion_spare2 = 0x10;
237 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
238 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
239 header->destinationID = TM_DESTINATION_ID_GROUND;
240 // AUXILIARY DATA HEADER
241 header->sid = 0x00;
242 header->biaStatusInfo = 0x00;
243 header->pa_lfr_pkt_cnt_asm = 0x00;
244 header->pa_lfr_pkt_nr_asm = 0x00;
245 header->time[0] = 0x00;
246 header->time[0] = 0x00;
247 header->time[0] = 0x00;
248 header->time[0] = 0x00;
249 header->time[0] = 0x00;
250 header->time[0] = 0x00;
251 header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB
252 header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB
253 }
254
255 void SM_average( float *averaged_spec_mat_f0, float *averaged_spec_mat_f1,
256 ring_node_sm *ring_node_tab[],
257 unsigned int nbAverageNormF0, unsigned int nbAverageSBM1F0 )
258 {
259 float sum;
260 unsigned int i;
261
262 for(i=0; i<TOTAL_SIZE_SM; i++)
263 {
264 sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ]
265 + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ]
266 + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ]
267 + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ]
268 + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ]
269 + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ]
270 + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ]
271 + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ];
272
273 if ( (nbAverageNormF0 == 0) && (nbAverageSBM1F0 == 0) )
274 {
275 averaged_spec_mat_f0[ i ] = sum;
276 averaged_spec_mat_f1[ i ] = sum;
277 }
278 else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 != 0) )
279 {
280 averaged_spec_mat_f0[ i ] = ( averaged_spec_mat_f0[ i ] + sum );
281 averaged_spec_mat_f1[ i ] = ( averaged_spec_mat_f1[ i ] + sum );
282 }
283 else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 == 0) )
284 {
285 averaged_spec_mat_f0[ i ] = ( averaged_spec_mat_f0[ i ] + sum );
286 averaged_spec_mat_f1[ i ] = sum;
287 }
288 else
289 {
290 PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNormF0, nbAverageSBM1F0)
291 }
292 }
293 }
294
295 void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider )
296 {
297 int frequencyBin;
298 int asmComponent;
299 unsigned int offsetAveragedSpecMatReorganized;
300 unsigned int offsetAveragedSpecMat;
301
302 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
303 {
304 for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ )
305 {
306 offsetAveragedSpecMatReorganized =
307 frequencyBin * NB_VALUES_PER_SM
308 + asmComponent;
309 offsetAveragedSpecMat =
310 asmComponent * NB_BINS_PER_SM
311 + frequencyBin;
312 averaged_spec_mat_reorganized[offsetAveragedSpecMatReorganized ] =
313 averaged_spec_mat[ offsetAveragedSpecMat ] / divider;
314 }
315 }
316 }
317
318 void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider,
319 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart )
320 {
321 int frequencyBin;
322 int asmComponent;
323 int offsetASM;
324 int offsetCompressed;
325 int k;
326
327 // build data
328 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
329 {
330 for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ )
331 {
332 offsetCompressed = // NO TIME OFFSET
333 frequencyBin * NB_VALUES_PER_SM
334 + asmComponent;
335 offsetASM = // NO TIME OFFSET
336 asmComponent * NB_BINS_PER_SM
337 + ASMIndexStart
338 + frequencyBin * nbBinsToAverage;
339 compressed_spec_mat[ offsetCompressed ] = 0;
340 for ( k = 0; k < nbBinsToAverage; k++ )
341 {
342 compressed_spec_mat[offsetCompressed ] =
343 ( compressed_spec_mat[ offsetCompressed ]
344 + averaged_spec_mat[ offsetASM + k ] ) / (divider * nbBinsToAverage);
345 }
346 }
347 }
348 }
349
350 void ASM_convert( volatile float *input_matrix, char *output_matrix)
351 {
352 unsigned int frequencyBin;
353 unsigned int asmComponent;
354 char * pt_char_input;
355 char * pt_char_output;
356 unsigned int offsetInput;
357 unsigned int offsetOutput;
358
359 pt_char_input = (char*) &input_matrix;
360 pt_char_output = (char*) &output_matrix;
361
362 // convert all other data
363 for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++)
364 {
365 for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++)
366 {
367 offsetInput = (frequencyBin*NB_VALUES_PER_SM) + asmComponent ;
368 offsetOutput = 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) ;
369 pt_char_input = (char*) &input_matrix [ offsetInput ];
370 pt_char_output = (char*) &output_matrix[ offsetOutput ];
371 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
372 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
373 }
374 }
375 }
376
377 void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
378 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id)
379 {
380 unsigned int i;
381 unsigned int length = 0;
382 rtems_status_code status;
383
384 for (i=0; i<2; i++)
385 {
386 // (1) BUILD THE DATA
387 switch(sid)
388 {
389 case SID_NORM_ASM_F0:
390 spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; // 2 packets will be sent
391 spw_ioctl_send->data = &spectral_matrix[
392 ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2
393 ];
394 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0;
395 header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB
396 header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB
397 break;
398 case SID_NORM_ASM_F1:
399 spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F1_IN_BYTES / 2; // 2 packets will be sent
400 spw_ioctl_send->data = &spectral_matrix[
401 ( (ASM_F1_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F1) ) * NB_VALUES_PER_SM ) * 2
402 ];
403 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1;
404 header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F1) >> 8 ); // BLK_NR MSB
405 header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F1); // BLK_NR LSB
406 break;
407 case SID_NORM_ASM_F2:
408 break;
409 default:
410 PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid)
411 break;
412 }
413 spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES;
414 spw_ioctl_send->hdr = (char *) header;
415 spw_ioctl_send->options = 0;
416
417 // (2) BUILD THE HEADER
418 header->packetLength[0] = (unsigned char) (length>>8);
419 header->packetLength[1] = (unsigned char) (length);
420 header->sid = (unsigned char) sid; // SID
421 header->pa_lfr_pkt_cnt_asm = 2;
422 header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1);
423
424 // (3) SET PACKET TIME
425 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
426 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
427 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
428 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
429 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
430 header->time[5] = (unsigned char) (time_management_regs->fine_time);
431 //
432 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
433 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
434 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
435 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
436 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
437 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
438
439 // (4) SEND PACKET
440 status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
441 if (status != RTEMS_SUCCESSFUL) {
442 printf("in ASM_send *** ERR %d\n", (int) status);
443 }
444 }
445 }
446
447 //*****************
448 // Basic Parameters
449
450 void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header,
451 unsigned int apid, unsigned char sid,
452 unsigned int packetLength, unsigned char blkNr )
453 {
454 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
455 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
456 header->reserved = 0x00;
457 header->userApplication = CCSDS_USER_APP;
458 header->packetID[0] = (unsigned char) (apid >> 8);
459 header->packetID[1] = (unsigned char) (apid);
460 header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
461 header->packetSequenceControl[1] = 0x00;
462 header->packetLength[0] = (unsigned char) (packetLength >> 8);
463 header->packetLength[1] = (unsigned char) (packetLength);
464 // DATA FIELD HEADER
465 header->spare1_pusVersion_spare2 = 0x10;
466 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
467 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
468 header->destinationID = TM_DESTINATION_ID_GROUND;
469 // AUXILIARY DATA HEADER
470 header->sid = sid;
471 header->biaStatusInfo = 0x00;
472 header->time[0] = 0x00;
473 header->time[0] = 0x00;
474 header->time[0] = 0x00;
475 header->time[0] = 0x00;
476 header->time[0] = 0x00;
477 header->time[0] = 0x00;
478 header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB
479 header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB
480 }
481
482 void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header,
483 unsigned int apid, unsigned char sid,
484 unsigned int packetLength , unsigned char blkNr)
485 {
486 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
487 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
488 header->reserved = 0x00;
489 header->userApplication = CCSDS_USER_APP;
490 header->packetID[0] = (unsigned char) (apid >> 8);
491 header->packetID[1] = (unsigned char) (apid);
492 header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
493 header->packetSequenceControl[1] = 0x00;
494 header->packetLength[0] = (unsigned char) (packetLength >> 8);
495 header->packetLength[1] = (unsigned char) (packetLength);
496 // DATA FIELD HEADER
497 header->spare1_pusVersion_spare2 = 0x10;
498 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
499 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
500 header->destinationID = TM_DESTINATION_ID_GROUND;
501 // AUXILIARY DATA HEADER
502 header->sid = sid;
503 header->biaStatusInfo = 0x00;
504 header->time[0] = 0x00;
505 header->time[0] = 0x00;
506 header->time[0] = 0x00;
507 header->time[0] = 0x00;
508 header->time[0] = 0x00;
509 header->time[0] = 0x00;
510 header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB
511 header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB
512 }
513
514 void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend )
515 {
516 rtems_status_code status;
517
518 // SEND PACKET
519 status = rtems_message_queue_send( queue_id, data, nbBytesToSend);
520 if (status != RTEMS_SUCCESSFUL)
521 {
522 printf("ERR *** in BP_send *** ERR %d\n", (int) status);
523 }
524 }
525
526 //******************
527 // general functions
528
529 void reset_spectral_matrix_regs( void )
530 {
531 /** This function resets the spectral matrices module registers.
532 *
533 * The registers affected by this function are located at the following offset addresses:
534 *
535 * - 0x00 config
536 * - 0x04 status
537 * - 0x08 matrixF0_Address0
538 * - 0x10 matrixFO_Address1
539 * - 0x14 matrixF1_Address
540 * - 0x18 matrixF2_Address
541 *
542 */
543
544 spectral_matrix_regs->config = 0x00;
545 spectral_matrix_regs->status = 0x00;
546
547 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
548 spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address;
549 spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address;
550 spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address;
551 }
552
553 void set_time( unsigned char *time, unsigned char * timeInBuffer )
554 {
555 // time[0] = timeInBuffer[2];
556 // time[1] = timeInBuffer[3];
557 // time[2] = timeInBuffer[0];
558 // time[3] = timeInBuffer[1];
559 // time[4] = timeInBuffer[6];
560 // time[5] = timeInBuffer[7];
561
562 time[0] = timeInBuffer[0];
563 time[1] = timeInBuffer[1];
564 time[2] = timeInBuffer[2];
565 time[3] = timeInBuffer[3];
566 time[4] = timeInBuffer[6];
567 time[5] = timeInBuffer[7];
568 }
569
570
@@ -0,0 +1,108
1 #ifndef FSW_PROCESSING_H_INCLUDED
2 #define FSW_PROCESSING_H_INCLUDED
3
4 #include <rtems.h>
5 #include <grspw.h>
6 #include <math.h>
7 #include <stdlib.h> // abs() is in the stdlib
8 #include <stdio.h> // printf()
9 #include <math.h>
10
11 #include "fsw_params.h"
12 #include "fsw_spacewire.h"
13
14 typedef struct ring_node_sm
15 {
16 struct ring_node_sm *previous;
17 struct ring_node_sm *next;
18 int buffer_address;
19 unsigned int status;
20 unsigned int coarseTime;
21 unsigned int fineTime;
22 } ring_node_sm;
23
24 typedef struct ring_node_asm
25 {
26 struct ring_node_asm *next;
27 float matrix[ TOTAL_SIZE_SM ];
28 unsigned int status;
29 } ring_node_asm;
30
31 typedef struct bp_packet
32 {
33 Header_TM_LFR_SCIENCE_BP_t header;
34 unsigned char data[ 30 * 22 ]; // MAX size is 22 * 30 [TM_LFR_SCIENCE_BURST_BP2_F1]
35 } bp_packet;
36
37 typedef struct bp_packet_with_spare
38 {
39 Header_TM_LFR_SCIENCE_BP_with_spare_t header;
40 unsigned char data[ 9 * 13 ]; // only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1
41 } bp_packet_with_spare;
42
43 typedef struct asm_msg
44 {
45 ring_node_asm *norm;
46 ring_node_asm *burst_sbm;
47 rtems_event_set event;
48 unsigned int coarseTime;
49 unsigned int fineTime;
50 } asm_msg;
51
52 extern volatile int sm_f0[ ];
53 extern volatile int sm_f1[ ];
54 extern volatile int sm_f2[ ];
55
56 // parameters
57 extern struct param_local_str param_local;
58
59 // registers
60 extern time_management_regs_t *time_management_regs;
61 extern spectral_matrix_regs_t *spectral_matrix_regs;
62
63 extern rtems_name misc_name[5];
64 extern rtems_id Task_id[20]; /* array of task ids */
65
66 // ISR
67 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
68 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
69
70 //******************
71 // Spectral Matrices
72 void reset_nb_sm( void );
73 void SM_init_rings( void );
74 void ASM_generic_init_ring(ring_node_asm *ring, unsigned char nbNodes );
75 void SM_reset_current_ring_nodes( void );
76 void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header);
77 void SM_average(float *averaged_spec_mat_f0, float *averaged_spec_mat_f1,
78 ring_node_sm *ring_node_tab[],
79 unsigned int firstTimeF0, unsigned int firstTimeF1 );
80 void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized,
81 float divider );
82 void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat,
83 float divider,
84 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart);
85 void ASM_convert(volatile float *input_matrix, char *output_matrix);
86 void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
87 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id);
88
89 //*****************
90 // Basic Parameters
91
92 void BP_reset_current_ring_nodes( void );
93 void BP_init_header(Header_TM_LFR_SCIENCE_BP_t *header,
94 unsigned int apid, unsigned char sid,
95 unsigned int packetLength , unsigned char blkNr);
96 void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header,
97 unsigned int apid, unsigned char sid,
98 unsigned int packetLength, unsigned char blkNr );
99 void BP_send(char *data,
100 rtems_id queue_id ,
101 unsigned int nbBytesToSend );
102
103 //******************
104 // general functions
105 void reset_spectral_matrix_regs( void );
106 void set_time(unsigned char *time, unsigned char *timeInBuffer );
107
108 #endif // FSW_PROCESSING_H_INCLUDED
@@ -1,253 +1,271
1 #############################################################################
1 #############################################################################
2 # Makefile for building: bin/fsw
2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Apr 24 22:14:00 2014
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Sun Apr 27 14:59:58 2014
4 # Project: fsw-qt.pro
4 # Project: fsw-qt.pro
5 # Template: app
5 # Template: app
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
7 #############################################################################
7 #############################################################################
8
8
9 ####### Compiler, tools and options
9 ####### Compiler, tools and options
10
10
11 CC = sparc-rtems-gcc
11 CC = sparc-rtems-gcc
12 CXX = sparc-rtems-g++
12 CXX = sparc-rtems-g++
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=6 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS -DBOOT_MESSAGES
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=6 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS -DBOOT_MESSAGES
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../src/basic_parameters
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../src/basic_parameters -I../src/avf_prc
17 LINK = sparc-rtems-g++
17 LINK = sparc-rtems-g++
18 LFLAGS =
18 LFLAGS =
19 LIBS = $(SUBLIBS)
19 LIBS = $(SUBLIBS)
20 AR = sparc-rtems-ar rcs
20 AR = sparc-rtems-ar rcs
21 RANLIB =
21 RANLIB =
22 QMAKE = /usr/bin/qmake-qt4
22 QMAKE = /usr/bin/qmake-qt4
23 TAR = tar -cf
23 TAR = tar -cf
24 COMPRESS = gzip -9f
24 COMPRESS = gzip -9f
25 COPY = cp -f
25 COPY = cp -f
26 SED = sed
26 SED = sed
27 COPY_FILE = $(COPY)
27 COPY_FILE = $(COPY)
28 COPY_DIR = $(COPY) -r
28 COPY_DIR = $(COPY) -r
29 STRIP = sparc-rtems-strip
29 STRIP = sparc-rtems-strip
30 INSTALL_FILE = install -m 644 -p
30 INSTALL_FILE = install -m 644 -p
31 INSTALL_DIR = $(COPY_DIR)
31 INSTALL_DIR = $(COPY_DIR)
32 INSTALL_PROGRAM = install -m 755 -p
32 INSTALL_PROGRAM = install -m 755 -p
33 DEL_FILE = rm -f
33 DEL_FILE = rm -f
34 SYMLINK = ln -f -s
34 SYMLINK = ln -f -s
35 DEL_DIR = rmdir
35 DEL_DIR = rmdir
36 MOVE = mv -f
36 MOVE = mv -f
37 CHK_DIR_EXISTS= test -d
37 CHK_DIR_EXISTS= test -d
38 MKDIR = mkdir -p
38 MKDIR = mkdir -p
39
39
40 ####### Output directory
40 ####### Output directory
41
41
42 OBJECTS_DIR = obj/
42 OBJECTS_DIR = obj/
43
43
44 ####### Files
44 ####### Files
45
45
46 SOURCES = ../src/wf_handler.c \
46 SOURCES = ../src/wf_handler.c \
47 ../src/tc_handler.c \
47 ../src/tc_handler.c \
48 ../src/fsw_processing.c \
49 ../src/fsw_misc.c \
48 ../src/fsw_misc.c \
50 ../src/fsw_init.c \
49 ../src/fsw_init.c \
51 ../src/fsw_globals.c \
50 ../src/fsw_globals.c \
52 ../src/fsw_spacewire.c \
51 ../src/fsw_spacewire.c \
53 ../src/tc_load_dump_parameters.c \
52 ../src/tc_load_dump_parameters.c \
54 ../src/tm_lfr_tc_exe.c \
53 ../src/tm_lfr_tc_exe.c \
55 ../src/tc_acceptance.c \
54 ../src/tc_acceptance.c \
56 ../src/basic_parameters/basic_parameters.c
55 ../src/basic_parameters/basic_parameters.c \
56 ../src/avf_prc/fsw_processing.c \
57 ../src/avf_prc/avf0_prc0.c \
58 ../src/avf_prc/avf1_prc1.c \
59 ../src/avf_prc/avf2_prc2.c
57 OBJECTS = obj/wf_handler.o \
60 OBJECTS = obj/wf_handler.o \
58 obj/tc_handler.o \
61 obj/tc_handler.o \
59 obj/fsw_processing.o \
60 obj/fsw_misc.o \
62 obj/fsw_misc.o \
61 obj/fsw_init.o \
63 obj/fsw_init.o \
62 obj/fsw_globals.o \
64 obj/fsw_globals.o \
63 obj/fsw_spacewire.o \
65 obj/fsw_spacewire.o \
64 obj/tc_load_dump_parameters.o \
66 obj/tc_load_dump_parameters.o \
65 obj/tm_lfr_tc_exe.o \
67 obj/tm_lfr_tc_exe.o \
66 obj/tc_acceptance.o \
68 obj/tc_acceptance.o \
67 obj/basic_parameters.o
69 obj/basic_parameters.o \
70 obj/fsw_processing.o \
71 obj/avf0_prc0.o \
72 obj/avf1_prc1.o \
73 obj/avf2_prc2.o
68 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
74 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
69 /usr/lib64/qt4/mkspecs/common/linux.conf \
75 /usr/lib64/qt4/mkspecs/common/linux.conf \
70 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
76 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
71 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
77 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
72 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
78 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
73 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
79 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
74 /usr/lib64/qt4/mkspecs/qconfig.pri \
80 /usr/lib64/qt4/mkspecs/qconfig.pri \
75 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
81 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
76 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
82 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
77 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
83 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
78 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
84 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
79 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
85 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
80 sparc.pri \
86 sparc.pri \
81 /usr/lib64/qt4/mkspecs/features/release.prf \
87 /usr/lib64/qt4/mkspecs/features/release.prf \
82 /usr/lib64/qt4/mkspecs/features/default_post.prf \
88 /usr/lib64/qt4/mkspecs/features/default_post.prf \
83 /usr/lib64/qt4/mkspecs/features/shared.prf \
89 /usr/lib64/qt4/mkspecs/features/shared.prf \
84 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
90 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
85 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
91 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
86 /usr/lib64/qt4/mkspecs/features/resources.prf \
92 /usr/lib64/qt4/mkspecs/features/resources.prf \
87 /usr/lib64/qt4/mkspecs/features/uic.prf \
93 /usr/lib64/qt4/mkspecs/features/uic.prf \
88 /usr/lib64/qt4/mkspecs/features/yacc.prf \
94 /usr/lib64/qt4/mkspecs/features/yacc.prf \
89 /usr/lib64/qt4/mkspecs/features/lex.prf \
95 /usr/lib64/qt4/mkspecs/features/lex.prf \
90 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
96 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
91 fsw-qt.pro
97 fsw-qt.pro
92 QMAKE_TARGET = fsw
98 QMAKE_TARGET = fsw
93 DESTDIR = bin/
99 DESTDIR = bin/
94 TARGET = bin/fsw
100 TARGET = bin/fsw
95
101
96 first: all
102 first: all
97 ####### Implicit rules
103 ####### Implicit rules
98
104
99 .SUFFIXES: .o .c .cpp .cc .cxx .C
105 .SUFFIXES: .o .c .cpp .cc .cxx .C
100
106
101 .cpp.o:
107 .cpp.o:
102 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
108 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
103
109
104 .cc.o:
110 .cc.o:
105 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
111 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
106
112
107 .cxx.o:
113 .cxx.o:
108 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
114 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
109
115
110 .C.o:
116 .C.o:
111 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
117 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
112
118
113 .c.o:
119 .c.o:
114 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
120 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
115
121
116 ####### Build rules
122 ####### Build rules
117
123
118 all: Makefile $(TARGET)
124 all: Makefile $(TARGET)
119
125
120 $(TARGET): $(OBJECTS)
126 $(TARGET): $(OBJECTS)
121 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
127 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
122 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
128 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
123
129
124 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
130 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
125 /usr/lib64/qt4/mkspecs/common/linux.conf \
131 /usr/lib64/qt4/mkspecs/common/linux.conf \
126 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
132 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
127 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
133 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
128 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
134 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
129 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
135 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
130 /usr/lib64/qt4/mkspecs/qconfig.pri \
136 /usr/lib64/qt4/mkspecs/qconfig.pri \
131 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
137 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
132 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
138 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
133 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
139 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
134 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
140 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
135 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
141 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
136 sparc.pri \
142 sparc.pri \
137 /usr/lib64/qt4/mkspecs/features/release.prf \
143 /usr/lib64/qt4/mkspecs/features/release.prf \
138 /usr/lib64/qt4/mkspecs/features/default_post.prf \
144 /usr/lib64/qt4/mkspecs/features/default_post.prf \
139 /usr/lib64/qt4/mkspecs/features/shared.prf \
145 /usr/lib64/qt4/mkspecs/features/shared.prf \
140 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
146 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
141 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
147 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
142 /usr/lib64/qt4/mkspecs/features/resources.prf \
148 /usr/lib64/qt4/mkspecs/features/resources.prf \
143 /usr/lib64/qt4/mkspecs/features/uic.prf \
149 /usr/lib64/qt4/mkspecs/features/uic.prf \
144 /usr/lib64/qt4/mkspecs/features/yacc.prf \
150 /usr/lib64/qt4/mkspecs/features/yacc.prf \
145 /usr/lib64/qt4/mkspecs/features/lex.prf \
151 /usr/lib64/qt4/mkspecs/features/lex.prf \
146 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
152 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
147 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
153 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
148 /usr/lib64/qt4/mkspecs/common/unix.conf:
154 /usr/lib64/qt4/mkspecs/common/unix.conf:
149 /usr/lib64/qt4/mkspecs/common/linux.conf:
155 /usr/lib64/qt4/mkspecs/common/linux.conf:
150 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
156 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
151 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
157 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
152 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
158 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
153 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
159 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
154 /usr/lib64/qt4/mkspecs/qconfig.pri:
160 /usr/lib64/qt4/mkspecs/qconfig.pri:
155 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
161 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
156 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
162 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
157 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
163 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
158 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
164 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
159 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
165 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
160 sparc.pri:
166 sparc.pri:
161 /usr/lib64/qt4/mkspecs/features/release.prf:
167 /usr/lib64/qt4/mkspecs/features/release.prf:
162 /usr/lib64/qt4/mkspecs/features/default_post.prf:
168 /usr/lib64/qt4/mkspecs/features/default_post.prf:
163 /usr/lib64/qt4/mkspecs/features/shared.prf:
169 /usr/lib64/qt4/mkspecs/features/shared.prf:
164 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
170 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
165 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
171 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
166 /usr/lib64/qt4/mkspecs/features/resources.prf:
172 /usr/lib64/qt4/mkspecs/features/resources.prf:
167 /usr/lib64/qt4/mkspecs/features/uic.prf:
173 /usr/lib64/qt4/mkspecs/features/uic.prf:
168 /usr/lib64/qt4/mkspecs/features/yacc.prf:
174 /usr/lib64/qt4/mkspecs/features/yacc.prf:
169 /usr/lib64/qt4/mkspecs/features/lex.prf:
175 /usr/lib64/qt4/mkspecs/features/lex.prf:
170 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
176 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
171 qmake: FORCE
177 qmake: FORCE
172 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
178 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
173
179
174 dist:
180 dist:
175 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
181 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
176 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0
182 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0
177
183
178
184
179 clean:compiler_clean
185 clean:compiler_clean
180 -$(DEL_FILE) $(OBJECTS)
186 -$(DEL_FILE) $(OBJECTS)
181 -$(DEL_FILE) *~ core *.core
187 -$(DEL_FILE) *~ core *.core
182
188
183
189
184 ####### Sub-libraries
190 ####### Sub-libraries
185
191
186 distclean: clean
192 distclean: clean
187 -$(DEL_FILE) $(TARGET)
193 -$(DEL_FILE) $(TARGET)
188 -$(DEL_FILE) Makefile
194 -$(DEL_FILE) Makefile
189
195
190
196
191 grmon:
197 grmon:
192 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
198 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
193
199
194 check: first
200 check: first
195
201
196 compiler_rcc_make_all:
202 compiler_rcc_make_all:
197 compiler_rcc_clean:
203 compiler_rcc_clean:
198 compiler_uic_make_all:
204 compiler_uic_make_all:
199 compiler_uic_clean:
205 compiler_uic_clean:
200 compiler_image_collection_make_all: qmake_image_collection.cpp
206 compiler_image_collection_make_all: qmake_image_collection.cpp
201 compiler_image_collection_clean:
207 compiler_image_collection_clean:
202 -$(DEL_FILE) qmake_image_collection.cpp
208 -$(DEL_FILE) qmake_image_collection.cpp
203 compiler_yacc_decl_make_all:
209 compiler_yacc_decl_make_all:
204 compiler_yacc_decl_clean:
210 compiler_yacc_decl_clean:
205 compiler_yacc_impl_make_all:
211 compiler_yacc_impl_make_all:
206 compiler_yacc_impl_clean:
212 compiler_yacc_impl_clean:
207 compiler_lex_make_all:
213 compiler_lex_make_all:
208 compiler_lex_clean:
214 compiler_lex_clean:
209 compiler_clean:
215 compiler_clean:
210
216
211 ####### Compile
217 ####### Compile
212
218
213 obj/wf_handler.o: ../src/wf_handler.c
219 obj/wf_handler.o: ../src/wf_handler.c
214 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
220 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
215
221
216 obj/tc_handler.o: ../src/tc_handler.c
222 obj/tc_handler.o: ../src/tc_handler.c
217 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
223 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
218
224
219 obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c
220 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c
221
222 obj/fsw_misc.o: ../src/fsw_misc.c
225 obj/fsw_misc.o: ../src/fsw_misc.c
223 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
226 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
224
227
225 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
228 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
226 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
229 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
227
230
228 obj/fsw_globals.o: ../src/fsw_globals.c
231 obj/fsw_globals.o: ../src/fsw_globals.c
229 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
232 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
230
233
231 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
234 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
232 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
235 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
233
236
234 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
237 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
235 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
238 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
236
239
237 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
240 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
238 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
241 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
239
242
240 obj/tc_acceptance.o: ../src/tc_acceptance.c
243 obj/tc_acceptance.o: ../src/tc_acceptance.c
241 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
244 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
242
245
243 obj/basic_parameters.o: ../src/basic_parameters/basic_parameters.c ../src/basic_parameters/basic_parameters.h
246 obj/basic_parameters.o: ../src/basic_parameters/basic_parameters.c ../src/basic_parameters/basic_parameters.h
244 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/basic_parameters/basic_parameters.c
247 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/basic_parameters/basic_parameters.c
245
248
249 obj/fsw_processing.o: ../src/avf_prc/fsw_processing.c ../src/avf_prc/fsw_processing.h
250 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/avf_prc/fsw_processing.c
251
252 obj/avf0_prc0.o: ../src/avf_prc/avf0_prc0.c ../src/avf_prc/avf0_prc0.h \
253 ../src/avf_prc/fsw_processing.h
254 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/avf_prc/avf0_prc0.c
255
256 obj/avf1_prc1.o: ../src/avf_prc/avf1_prc1.c ../src/avf_prc/avf1_prc1.h \
257 ../src/avf_prc/fsw_processing.h
258 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/avf_prc/avf1_prc1.c
259
260 obj/avf2_prc2.o: ../src/avf_prc/avf2_prc2.c ../src/avf_prc/avf2_prc2.h \
261 ../src/avf_prc/fsw_processing.h
262 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/avf_prc/avf2_prc2.c
263
246 ####### Install
264 ####### Install
247
265
248 install: FORCE
266 install: FORCE
249
267
250 uninstall: FORCE
268 uninstall: FORCE
251
269
252 FORCE:
270 FORCE:
253
271
@@ -1,85 +1,92
1 TEMPLATE = app
1 TEMPLATE = app
2 # CONFIG += console v8 sim
2 # CONFIG += console v8 sim
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
4 CONFIG += console verbose cpu_usage_report boot_messages
4 CONFIG += console verbose cpu_usage_report boot_messages
5 CONFIG -= qt
5 CONFIG -= qt
6
6
7 include(./sparc.pri)
7 include(./sparc.pri)
8
8
9 # flight software version
9 # flight software version
10 SWVERSION=-1-0
10 SWVERSION=-1-0
11 DEFINES += SW_VERSION_N1=1 # major
11 DEFINES += SW_VERSION_N1=1 # major
12 DEFINES += SW_VERSION_N2=0 # minor
12 DEFINES += SW_VERSION_N2=0 # minor
13 DEFINES += SW_VERSION_N3=0 # patch
13 DEFINES += SW_VERSION_N3=0 # patch
14 DEFINES += SW_VERSION_N4=6 # internal
14 DEFINES += SW_VERSION_N4=6 # internal
15
15
16 contains( CONFIG, debug_tch ) {
16 contains( CONFIG, debug_tch ) {
17 DEFINES += DEBUG_TCH
17 DEFINES += DEBUG_TCH
18 }
18 }
19
19
20 contains( CONFIG, vhdl_dev ) {
20 contains( CONFIG, vhdl_dev ) {
21 DEFINES += VHDL_DEV
21 DEFINES += VHDL_DEV
22 }
22 }
23
23
24 contains( CONFIG, verbose ) {
24 contains( CONFIG, verbose ) {
25 DEFINES += PRINT_MESSAGES_ON_CONSOLE
25 DEFINES += PRINT_MESSAGES_ON_CONSOLE
26 }
26 }
27
27
28 contains( CONFIG, debug_messages ) {
28 contains( CONFIG, debug_messages ) {
29 DEFINES += DEBUG_MESSAGES
29 DEFINES += DEBUG_MESSAGES
30 }
30 }
31
31
32 contains( CONFIG, cpu_usage_report ) {
32 contains( CONFIG, cpu_usage_report ) {
33 DEFINES += PRINT_TASK_STATISTICS
33 DEFINES += PRINT_TASK_STATISTICS
34 }
34 }
35
35
36 contains( CONFIG, stack_report ) {
36 contains( CONFIG, stack_report ) {
37 DEFINES += PRINT_STACK_REPORT
37 DEFINES += PRINT_STACK_REPORT
38 }
38 }
39
39
40 contains( CONFIG, boot_messages ) {
40 contains( CONFIG, boot_messages ) {
41 DEFINES += BOOT_MESSAGES
41 DEFINES += BOOT_MESSAGES
42 }
42 }
43
43
44 #doxygen.target = doxygen
44 #doxygen.target = doxygen
45 #doxygen.commands = doxygen ../doc/Doxyfile
45 #doxygen.commands = doxygen ../doc/Doxyfile
46 #QMAKE_EXTRA_TARGETS += doxygen
46 #QMAKE_EXTRA_TARGETS += doxygen
47
47
48 TARGET = fsw
48 TARGET = fsw
49
49
50 INCLUDEPATH += \
50 INCLUDEPATH += \
51 ../src \
51 ../src \
52 ../header \
52 ../header \
53 ../src/basic_parameters
53 ../src/basic_parameters \
54 ../src/avf_prc
54
55
55 SOURCES += \
56 SOURCES += \
56 ../src/wf_handler.c \
57 ../src/wf_handler.c \
57 ../src/tc_handler.c \
58 ../src/tc_handler.c \
58 ../src/fsw_processing.c \
59 ../src/fsw_misc.c \
59 ../src/fsw_misc.c \
60 ../src/fsw_init.c \
60 ../src/fsw_init.c \
61 ../src/fsw_globals.c \
61 ../src/fsw_globals.c \
62 ../src/fsw_spacewire.c \
62 ../src/fsw_spacewire.c \
63 ../src/tc_load_dump_parameters.c \
63 ../src/tc_load_dump_parameters.c \
64 ../src/tm_lfr_tc_exe.c \
64 ../src/tm_lfr_tc_exe.c \
65 ../src/tc_acceptance.c \
65 ../src/tc_acceptance.c \
66 ../src/basic_parameters/basic_parameters.c
66 ../src/basic_parameters/basic_parameters.c \
67 ../src/avf_prc/fsw_processing.c \
68 ../src/avf_prc/avf0_prc0.c \
69 ../src/avf_prc/avf1_prc1.c \
70 ../src/avf_prc/avf2_prc2.c
67
71
68
72
69 HEADERS += \
73 HEADERS += \
70 ../header/wf_handler.h \
74 ../header/wf_handler.h \
71 ../header/tc_handler.h \
75 ../header/tc_handler.h \
72 ../header/grlib_regs.h \
76 ../header/grlib_regs.h \
73 ../header/fsw_processing.h \
74 ../header/fsw_params.h \
77 ../header/fsw_params.h \
75 ../header/fsw_misc.h \
78 ../header/fsw_misc.h \
76 ../header/fsw_init.h \
79 ../header/fsw_init.h \
77 ../header/ccsds_types.h \
80 ../header/ccsds_types.h \
78 ../header/fsw_params_processing.h \
81 ../header/fsw_params_processing.h \
79 ../header/fsw_spacewire.h \
82 ../header/fsw_spacewire.h \
80 ../header/tc_load_dump_parameters.h \
83 ../header/tc_load_dump_parameters.h \
81 ../header/tm_lfr_tc_exe.h \
84 ../header/tm_lfr_tc_exe.h \
82 ../header/tc_acceptance.h \
85 ../header/tc_acceptance.h \
83 ../header/fsw_params_nb_bytes.h \
86 ../header/fsw_params_nb_bytes.h \
84 ../src/basic_parameters/basic_parameters.h
87 ../src/basic_parameters/basic_parameters.h \
88 ../src/avf_prc/fsw_processing.h \
89 ../src/avf_prc/avf0_prc0.h \
90 ../src/avf_prc/avf1_prc1.h \
91 ../src/avf_prc/avf2_prc2.h
85
92
@@ -1,201 +1,201
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 3.0.1, 2014-04-24T22:30:22. -->
3 <!-- Written by QtCreator 3.0.1, 2014-04-27T15:09:47. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
7 <value type="int">0</value>
7 <value type="int">0</value>
8 </data>
8 </data>
9 <data>
9 <data>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
11 <valuemap type="QVariantMap">
11 <valuemap type="QVariantMap">
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
16 <value type="QString" key="language">Cpp</value>
16 <value type="QString" key="language">Cpp</value>
17 <valuemap type="QVariantMap" key="value">
17 <valuemap type="QVariantMap" key="value">
18 <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
18 <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
19 </valuemap>
19 </valuemap>
20 </valuemap>
20 </valuemap>
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22 <value type="QString" key="language">QmlJS</value>
22 <value type="QString" key="language">QmlJS</value>
23 <valuemap type="QVariantMap" key="value">
23 <valuemap type="QVariantMap" key="value">
24 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
24 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
25 </valuemap>
25 </valuemap>
26 </valuemap>
26 </valuemap>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
28 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
28 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
38 <value type="int" key="EditorConfiguration.TabSize">8</value>
38 <value type="int" key="EditorConfiguration.TabSize">8</value>
39 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
39 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
40 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
40 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
41 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
41 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
42 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
42 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
43 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
43 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
44 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
44 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
45 </valuemap>
45 </valuemap>
46 </data>
46 </data>
47 <data>
47 <data>
48 <variable>ProjectExplorer.Project.PluginSettings</variable>
48 <variable>ProjectExplorer.Project.PluginSettings</variable>
49 <valuemap type="QVariantMap"/>
49 <valuemap type="QVariantMap"/>
50 </data>
50 </data>
51 <data>
51 <data>
52 <variable>ProjectExplorer.Project.Target.0</variable>
52 <variable>ProjectExplorer.Project.Target.0</variable>
53 <valuemap type="QVariantMap">
53 <valuemap type="QVariantMap">
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.3 in PATH (System)</value>
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.3 in PATH (System)</value>
55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.3 in PATH (System)</value>
55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.3 in PATH (System)</value>
56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{be73cf6a-f9d8-4d5a-8adf-adc2d83e2e44}</value>
56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{be73cf6a-f9d8-4d5a-8adf-adc2d83e2e44}</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
61 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value>
61 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value>
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
63 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
63 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
64 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
64 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
67 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
67 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
69 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
69 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
70 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
70 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
71 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
71 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
72 </valuemap>
72 </valuemap>
73 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
73 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
74 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
74 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
77 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
77 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
78 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
78 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
79 <value type="QString">-w</value>
79 <value type="QString">-w</value>
80 <value type="QString">-r</value>
80 <value type="QString">-r</value>
81 </valuelist>
81 </valuelist>
82 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
82 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
84 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
84 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
85 </valuemap>
85 </valuemap>
86 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
86 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
89 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
89 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
90 </valuemap>
90 </valuemap>
91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
92 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
92 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
93 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
93 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
96 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
96 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
97 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
97 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
98 <value type="QString">-w</value>
98 <value type="QString">-w</value>
99 <value type="QString">-r</value>
99 <value type="QString">-r</value>
100 </valuelist>
100 </valuelist>
101 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
101 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
103 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
103 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
104 </valuemap>
104 </valuemap>
105 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
105 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
108 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
108 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
109 </valuemap>
109 </valuemap>
110 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
110 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
111 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
111 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
112 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
112 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
116 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
116 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
118 </valuemap>
118 </valuemap>
119 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
119 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
120 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
120 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
122 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
122 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
126 </valuemap>
126 </valuemap>
127 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
127 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
128 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
128 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
129 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
129 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
131 </valuemap>
131 </valuemap>
132 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
132 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
133 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
133 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
134 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
134 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
135 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
135 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
136 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
136 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
137 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
137 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
138 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
138 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
139 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
139 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
140 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
140 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
141 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
141 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
142 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
142 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
143 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
143 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
144 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
144 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
145 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
145 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
146 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
146 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
147 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
147 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
148 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
148 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
149 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
149 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
150 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
150 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
151 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
151 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
152 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
152 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
153 <value type="int">0</value>
153 <value type="int">0</value>
154 <value type="int">1</value>
154 <value type="int">1</value>
155 <value type="int">2</value>
155 <value type="int">2</value>
156 <value type="int">3</value>
156 <value type="int">3</value>
157 <value type="int">4</value>
157 <value type="int">4</value>
158 <value type="int">5</value>
158 <value type="int">5</value>
159 <value type="int">6</value>
159 <value type="int">6</value>
160 <value type="int">7</value>
160 <value type="int">7</value>
161 <value type="int">8</value>
161 <value type="int">8</value>
162 <value type="int">9</value>
162 <value type="int">9</value>
163 <value type="int">10</value>
163 <value type="int">10</value>
164 <value type="int">11</value>
164 <value type="int">11</value>
165 <value type="int">12</value>
165 <value type="int">12</value>
166 <value type="int">13</value>
166 <value type="int">13</value>
167 <value type="int">14</value>
167 <value type="int">14</value>
168 </valuelist>
168 </valuelist>
169 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
169 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
170 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
170 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
174 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
174 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
175 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
175 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
176 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
176 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
177 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
177 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
178 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
178 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
179 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
179 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
180 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
180 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
181 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
181 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
182 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
182 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
183 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
183 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
184 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
184 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
185 </valuemap>
185 </valuemap>
186 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
186 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
187 </valuemap>
187 </valuemap>
188 </data>
188 </data>
189 <data>
189 <data>
190 <variable>ProjectExplorer.Project.TargetCount</variable>
190 <variable>ProjectExplorer.Project.TargetCount</variable>
191 <value type="int">1</value>
191 <value type="int">1</value>
192 </data>
192 </data>
193 <data>
193 <data>
194 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
194 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
195 <value type="QByteArray">{cdbf9cdc-1e84-406e-889b-c4feef49e75c}</value>
195 <value type="QByteArray">{cdbf9cdc-1e84-406e-889b-c4feef49e75c}</value>
196 </data>
196 </data>
197 <data>
197 <data>
198 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
198 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
199 <value type="int">15</value>
199 <value type="int">15</value>
200 </data>
200 </data>
201 </qtcreator>
201 </qtcreator>
@@ -1,663 +1,665
1 #ifndef CCSDS_TYPES_H_INCLUDED
1 #ifndef CCSDS_TYPES_H_INCLUDED
2 #define CCSDS_TYPES_H_INCLUDED
2 #define CCSDS_TYPES_H_INCLUDED
3
3
4 #include "fsw_params_processing.h"
4 #include "fsw_params_processing.h"
5
5
6 #define CCSDS_PROTOCOLE_EXTRA_BYTES 4
6 #define CCSDS_PROTOCOLE_EXTRA_BYTES 4
7 #define CCSDS_TC_TM_PACKET_OFFSET 7
7 #define CCSDS_TC_TM_PACKET_OFFSET 7
8 #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4
8 #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4
9 #define CCSDS_TM_PKT_MAX_SIZE 4412
9 #define CCSDS_TM_PKT_MAX_SIZE 4412
10 #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4
10 #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4
11 #define CCSDS_TC_PKT_MAX_SIZE 256
11 #define CCSDS_TC_PKT_MAX_SIZE 256
12 #define CCSDS_TC_PKT_MIN_SIZE 16
12 #define CCSDS_TC_PKT_MIN_SIZE 16
13 #define CCSDS_PROCESS_ID 76
13 #define CCSDS_PROCESS_ID 76
14 #define CCSDS_PACKET_CATEGORY 12
14 #define CCSDS_PACKET_CATEGORY 12
15 #define CCSDS_NODE_ADDRESS 0xfe
15 #define CCSDS_NODE_ADDRESS 0xfe
16 #define CCSDS_USER_APP 0x00
16 #define CCSDS_USER_APP 0x00
17
17
18 #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10
18 #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10
19 #define DEFAULT_RESERVED 0x00
19 #define DEFAULT_RESERVED 0x00
20 #define DEFAULT_HKBIA 0x1e // 0001 1110
20 #define DEFAULT_HKBIA 0x1e // 0001 1110
21
21
22 // PACKET ID
22 // PACKET ID
23 #define APID_TM_TC_EXE 0x0cc1 // PID 76 CAT 1
23 #define APID_TM_TC_EXE 0x0cc1 // PID 76 CAT 1
24 #define APID_TM_HK 0x0cc4 // PID 76 CAT 4
24 #define APID_TM_HK 0x0cc4 // PID 76 CAT 4
25 #define APID_TM_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9
25 #define APID_TM_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9
26 #define APID_TM_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12
26 #define APID_TM_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12
27 #define APID_TM_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12
27 #define APID_TM_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12
28 #define TM_PACKET_PID_DEFAULT 76
28 #define TM_PACKET_PID_DEFAULT 76
29 #define TM_PACKET_PID_BURST_SBM1_SBM2 79
29 #define TM_PACKET_PID_BURST_SBM1_SBM2 79
30 #define TM_PACKET_CAT_TC_EXE 1
30 #define TM_PACKET_CAT_TC_EXE 1
31 #define TM_PACKET_CAT_HK 4
31 #define TM_PACKET_CAT_HK 4
32 #define TM_PACKET_CAT_PARAMETER_DUMP 9
32 #define TM_PACKET_CAT_PARAMETER_DUMP 9
33 #define TM_PACKET_CAT_SCIENCE 12
33 #define TM_PACKET_CAT_SCIENCE 12
34 #define TC_PACKET_CAT 12
34 #define TC_PACKET_CAT 12
35
35
36 // PACKET SEQUENCE CONTROL
36 // PACKET SEQUENCE CONTROL
37 #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000]
37 #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000]
38 #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000]
38 #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000]
39 #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000]
39 #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000]
40 #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000]
40 #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000]
41 #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000]
41 #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000]
42
42
43 // DESTINATION ID
43 // DESTINATION ID
44 #define TM_DESTINATION_ID_GROUND 0
44 #define TM_DESTINATION_ID_GROUND 0
45 #define TM_DESTINATION_ID_MISSION_TIMELINE 110
45 #define TM_DESTINATION_ID_MISSION_TIMELINE 110
46 #define TM_DESTINATION_ID_TC_SEQUENCES 111
46 #define TM_DESTINATION_ID_TC_SEQUENCES 111
47 #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112
47 #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112
48 #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113
48 #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113
49 #define TM_DESTINATION_ID_DIRECT_CMD 120
49 #define TM_DESTINATION_ID_DIRECT_CMD 120
50 #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121
50 #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121
51 #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122
51 #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122
52 #define TM_DESTINATION_ID_OBCP 15
52 #define TM_DESTINATION_ID_OBCP 15
53 #define TM_DESTINATION_ID_SYSTEM_CONTROL 14
53 #define TM_DESTINATION_ID_SYSTEM_CONTROL 14
54 #define TM_DESTINATION_ID_AOCS 11
54 #define TM_DESTINATION_ID_AOCS 11
55
55
56 #define CCSDS_DESTINATION_ID 0x01
56 #define CCSDS_DESTINATION_ID 0x01
57 #define CCSDS_PROTOCOLE_ID 0x02
57 #define CCSDS_PROTOCOLE_ID 0x02
58 #define CCSDS_RESERVED 0x00
58 #define CCSDS_RESERVED 0x00
59 #define CCSDS_USER_APP 0x00
59 #define CCSDS_USER_APP 0x00
60
60
61 #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24
61 #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24
62 #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32
62 #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32
63 #define SIZE_HK_PARAMETERS 112
63 #define SIZE_HK_PARAMETERS 112
64
64
65 // TC TYPES
65 // TC TYPES
66 #define TC_TYPE_GEN 181
66 #define TC_TYPE_GEN 181
67 #define TC_TYPE_TIME 9
67 #define TC_TYPE_TIME 9
68
68
69 // TC SUBTYPES
69 // TC SUBTYPES
70 #define TC_SUBTYPE_RESET 1
70 #define TC_SUBTYPE_RESET 1
71 #define TC_SUBTYPE_LOAD_COMM 11
71 #define TC_SUBTYPE_LOAD_COMM 11
72 #define TC_SUBTYPE_LOAD_NORM 13
72 #define TC_SUBTYPE_LOAD_NORM 13
73 #define TC_SUBTYPE_LOAD_BURST 19
73 #define TC_SUBTYPE_LOAD_BURST 19
74 #define TC_SUBTYPE_LOAD_SBM1 25
74 #define TC_SUBTYPE_LOAD_SBM1 25
75 #define TC_SUBTYPE_LOAD_SBM2 27
75 #define TC_SUBTYPE_LOAD_SBM2 27
76 #define TC_SUBTYPE_DUMP 31
76 #define TC_SUBTYPE_DUMP 31
77 #define TC_SUBTYPE_ENTER 41
77 #define TC_SUBTYPE_ENTER 41
78 #define TC_SUBTYPE_UPDT_INFO 51
78 #define TC_SUBTYPE_UPDT_INFO 51
79 #define TC_SUBTYPE_EN_CAL 61
79 #define TC_SUBTYPE_EN_CAL 61
80 #define TC_SUBTYPE_DIS_CAL 63
80 #define TC_SUBTYPE_DIS_CAL 63
81 #define TC_SUBTYPE_UPDT_TIME 129
81 #define TC_SUBTYPE_UPDT_TIME 129
82
82
83 // TC LEN
83 // TC LEN
84 #define TC_LEN_RESET 12
84 #define TC_LEN_RESET 12
85 #define TC_LEN_LOAD_COMM 14
85 #define TC_LEN_LOAD_COMM 14
86 #define TC_LEN_LOAD_NORM 22
86 #define TC_LEN_LOAD_NORM 22
87 #define TC_LEN_LOAD_BURST 14
87 #define TC_LEN_LOAD_BURST 14
88 #define TC_LEN_LOAD_SBM1 14
88 #define TC_LEN_LOAD_SBM1 14
89 #define TC_LEN_LOAD_SBM2 14
89 #define TC_LEN_LOAD_SBM2 14
90 #define TC_LEN_DUMP 12
90 #define TC_LEN_DUMP 12
91 #define TC_LEN_ENTER 20
91 #define TC_LEN_ENTER 20
92 #define TC_LEN_UPDT_INFO 46
92 #define TC_LEN_UPDT_INFO 46
93 #define TC_LEN_EN_CAL 12
93 #define TC_LEN_EN_CAL 12
94 #define TC_LEN_DIS_CAL 12
94 #define TC_LEN_DIS_CAL 12
95 #define TC_LEN_UPDT_TIME 18
95 #define TC_LEN_UPDT_TIME 18
96
96
97 // TM TYPES
97 // TM TYPES
98 #define TM_TYPE_TC_EXE 1
98 #define TM_TYPE_TC_EXE 1
99 #define TM_TYPE_HK 3
99 #define TM_TYPE_HK 3
100 #define TM_TYPE_PARAMETER_DUMP 3
100 #define TM_TYPE_PARAMETER_DUMP 3
101 #define TM_TYPE_LFR_SCIENCE 21
101 #define TM_TYPE_LFR_SCIENCE 21
102
102
103 // TM SUBTYPES
103 // TM SUBTYPES
104 #define TM_SUBTYPE_EXE_OK 7
104 #define TM_SUBTYPE_EXE_OK 7
105 #define TM_SUBTYPE_EXE_NOK 8
105 #define TM_SUBTYPE_EXE_NOK 8
106 #define TM_SUBTYPE_HK 25
106 #define TM_SUBTYPE_HK 25
107 #define TM_SUBTYPE_PARAMETER_DUMP 25
107 #define TM_SUBTYPE_PARAMETER_DUMP 25
108 #define TM_SUBTYPE_SCIENCE 3
108 #define TM_SUBTYPE_SCIENCE 3
109 #define TM_SUBTYPE_LFR_SCIENCE 3
109 #define TM_SUBTYPE_LFR_SCIENCE 3
110
110
111 // FAILURE CODES
111 // FAILURE CODES
112 #define ILLEGAL_APID 0
112 #define ILLEGAL_APID 0
113 #define WRONG_LEN_PKT 1
113 #define WRONG_LEN_PKT 1
114 #define INCOR_CHECKSUM 2
114 #define INCOR_CHECKSUM 2
115 #define ILL_TYPE 3
115 #define ILL_TYPE 3
116 #define ILL_SUBTYPE 4
116 #define ILL_SUBTYPE 4
117 #define WRONG_APP_DATA 5 // 0x00 0x05
117 #define WRONG_APP_DATA 5 // 0x00 0x05
118 #define TC_NOT_EXE 42000 // 0xa4 0x10
118 #define TC_NOT_EXE 42000 // 0xa4 0x10
119 #define WRONG_SRC_ID 42001 // 0xa4 0x11
119 #define WRONG_SRC_ID 42001 // 0xa4 0x11
120 #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12
120 #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12
121 #define FAIL_DETECTED 42003 // 0xa4 0x13
121 #define FAIL_DETECTED 42003 // 0xa4 0x13
122 #define NOT_ALLOWED 42004 // 0xa4 0x14
122 #define NOT_ALLOWED 42004 // 0xa4 0x14
123 #define CORRUPTED 42005 // 0xa4 0x15
123 #define CORRUPTED 42005 // 0xa4 0x15
124 #define CCSDS_TM_VALID 7
124 #define CCSDS_TM_VALID 7
125
125
126 // TC SID
126 // TC SID
127 #define SID_TC_GROUND 0
127 #define SID_TC_GROUND 0
128 #define SID_TC_MISSION_TIMELINE 110
128 #define SID_TC_MISSION_TIMELINE 110
129 #define SID_TC_TC_SEQUENCES 111
129 #define SID_TC_TC_SEQUENCES 111
130 #define SID_TC_RECOVERY_ACTION_CMD 112
130 #define SID_TC_RECOVERY_ACTION_CMD 112
131 #define SID_TC_BACKUP_MISSION_TIMELINE 113
131 #define SID_TC_BACKUP_MISSION_TIMELINE 113
132 #define SID_TC_DIRECT_CMD 120
132 #define SID_TC_DIRECT_CMD 120
133 #define SID_TC_SPARE_GRD_SRC1 121
133 #define SID_TC_SPARE_GRD_SRC1 121
134 #define SID_TC_SPARE_GRD_SRC2 122
134 #define SID_TC_SPARE_GRD_SRC2 122
135 #define SID_TC_OBCP 15
135 #define SID_TC_OBCP 15
136 #define SID_TC_SYSTEM_CONTROL 14
136 #define SID_TC_SYSTEM_CONTROL 14
137 #define SID_TC_AOCS 11
137 #define SID_TC_AOCS 11
138 #define SID_TC_RPW_INTERNAL 254
138 #define SID_TC_RPW_INTERNAL 254
139
139
140 enum apid_destid{
140 enum apid_destid{
141 GROUND,
141 GROUND,
142 MISSION_TIMELINE,
142 MISSION_TIMELINE,
143 TC_SEQUENCES,
143 TC_SEQUENCES,
144 RECOVERY_ACTION_CMD,
144 RECOVERY_ACTION_CMD,
145 BACKUP_MISSION_TIMELINE,
145 BACKUP_MISSION_TIMELINE,
146 DIRECT_CMD,
146 DIRECT_CMD,
147 SPARE_GRD_SRC1,
147 SPARE_GRD_SRC1,
148 SPARE_GRD_SRC2,
148 SPARE_GRD_SRC2,
149 OBCP,
149 OBCP,
150 SYSTEM_CONTROL,
150 SYSTEM_CONTROL,
151 AOCS,
151 AOCS,
152 RPW_INTERNAL
152 RPW_INTERNAL
153 };
153 };
154 // SEQUENCE COUNTERS
154 // SEQUENCE COUNTERS
155 #define SEQ_CNT_MAX 16383
155 #define SEQ_CNT_MAX 16383
156 #define SEQ_CNT_NB_DEST_ID 12
156 #define SEQ_CNT_NB_DEST_ID 12
157
157
158 // TM SID
158 // TM SID
159 #define SID_HK 1
159 #define SID_HK 1
160 #define SID_PARAMETER_DUMP 10
160 #define SID_PARAMETER_DUMP 10
161
161
162 #define SID_NORM_SWF_F0 3
162 #define SID_NORM_SWF_F0 3
163 #define SID_NORM_SWF_F1 4
163 #define SID_NORM_SWF_F1 4
164 #define SID_NORM_SWF_F2 5
164 #define SID_NORM_SWF_F2 5
165 #define SID_NORM_CWF_F3 1
165 #define SID_NORM_CWF_F3 1
166 #define SID_BURST_CWF_F2 2
166 #define SID_BURST_CWF_F2 2
167 #define SID_SBM1_CWF_F1 24
167 #define SID_SBM1_CWF_F1 24
168 #define SID_SBM2_CWF_F2 25
168 #define SID_SBM2_CWF_F2 25
169 #define SID_NORM_ASM_F0 11
169 #define SID_NORM_ASM_F0 11
170 #define SID_NORM_ASM_F1 12
170 #define SID_NORM_ASM_F1 12
171 #define SID_NORM_ASM_F2 13
171 #define SID_NORM_ASM_F2 13
172 #define SID_NORM_BP1_F0 14
172 #define SID_NORM_BP1_F0 14
173 #define SID_NORM_BP1_F1 15
173 #define SID_NORM_BP1_F1 15
174 #define SID_NORM_BP1_F2 16
174 #define SID_NORM_BP1_F2 16
175 #define SID_NORM_BP2_F0 19
175 #define SID_NORM_BP2_F0 19
176 #define SID_NORM_BP2_F1 20
176 #define SID_NORM_BP2_F1 20
177 #define SID_NORM_BP2_F2 21
177 #define SID_NORM_BP2_F2 21
178 #define SID_BURST_BP1_F0 17
178 #define SID_BURST_BP1_F0 17
179 #define SID_BURST_BP2_F0 22
179 #define SID_BURST_BP2_F0 22
180 #define SID_BURST_BP1_F1 18
180 #define SID_BURST_BP1_F1 18
181 #define SID_BURST_BP2_F1 23
181 #define SID_BURST_BP2_F1 23
182 #define SID_SBM1_BP1_F0 28
182 #define SID_SBM1_BP1_F0 28
183 #define SID_SBM1_BP2_F0 31
183 #define SID_SBM1_BP2_F0 31
184 #define SID_SBM2_BP1_F0 29
184 #define SID_SBM2_BP1_F0 29
185 #define SID_SBM2_BP2_F0 32
185 #define SID_SBM2_BP2_F0 32
186 #define SID_SBM2_BP1_F1 30
186 #define SID_SBM2_BP1_F1 30
187 #define SID_SBM2_BP2_F1 33
187 #define SID_SBM2_BP2_F1 33
188 #define SID_NORM_CWF_LONG_F3 34
188 #define SID_NORM_CWF_LONG_F3 34
189
189
190 // LENGTH (BYTES)
190 // LENGTH (BYTES)
191 #define LENGTH_TM_LFR_TC_EXE_MAX 32
191 #define LENGTH_TM_LFR_TC_EXE_MAX 32
192 #define LENGTH_TM_LFR_HK 126
192 #define LENGTH_TM_LFR_HK 126
193
193
194 // HEADER_LENGTH
194 // HEADER_LENGTH
195 #define TM_HEADER_LEN 16
195 #define TM_HEADER_LEN 16
196 #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28
196 #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28
197 // PACKET_LENGTH
197 // PACKET_LENGTH
198 #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET)
198 #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET)
199 #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET)
199 #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET)
200 #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET)
200 #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET)
201 #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET)
201 #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET)
202 #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET)
202 #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET)
203 #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET)
203 #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET)
204 #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET)
204 #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET)
205 #define PACKET_LENGTH_PARAMETER_DUMP (36 - CCSDS_TC_TM_PACKET_OFFSET)
205 #define PACKET_LENGTH_PARAMETER_DUMP (36 - CCSDS_TC_TM_PACKET_OFFSET)
206 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 (2228 - CCSDS_TC_TM_PACKET_OFFSET) // 44 * 25 * 2 + 28
206 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 (2228 - CCSDS_TC_TM_PACKET_OFFSET) // 44 * 25 * 2 + 28
207 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 (2628 - CCSDS_TC_TM_PACKET_OFFSET) // 52 * 25 * 2 + 28
207 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 (2628 - CCSDS_TC_TM_PACKET_OFFSET) // 52 * 25 * 2 + 28
208 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 (2428 - CCSDS_TC_TM_PACKET_OFFSET) // 48 * 25 * 2 + 28
208 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 (2428 - CCSDS_TC_TM_PACKET_OFFSET) // 48 * 25 * 2 + 28
209 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 (126 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 9 + 27
209 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 (126 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 9 + 27
210 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 (356 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 30 + 26
210 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 (356 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 30 + 26
211 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 (144 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 9 + 27
211 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 (144 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 9 + 27
212 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 (416 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 30 + 26
212 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 (416 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 30 + 26
213 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 (134 - CCSDS_TC_TM_PACKET_OFFSET) // 12 * 9 + 26
214 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 (386 - CCSDS_TC_TM_PACKET_OFFSET) // 12 * 30 + 26
213 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 (224 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 9 + 26
215 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 (224 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 9 + 26
214 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 (686 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 30 + 26
216 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 (686 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 30 + 26
215 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 (260 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 9 + 26
217 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 (260 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 9 + 26
216 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 (806 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 30 + 26
218 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 (806 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 30 + 26
217
219
218 #define PACKET_LENGTH_DELTA 11 // 7 + 4
220 #define PACKET_LENGTH_DELTA 11 // 7 + 4
219
221
220 #define SPARE1_PUSVERSION_SPARE2 0x10
222 #define SPARE1_PUSVERSION_SPARE2 0x10
221
223
222 // R1
224 // R1
223 #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1
225 #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1
224 #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1
226 #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1
225 #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1
227 #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1
226 #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1
228 #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1
227 #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1
229 #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1
228 #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1
230 #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1
229 // R2
231 // R2
230 #define TM_LEN_SCI_SWF_304 3669 // 304 * 12 + 10 + 12 - 1
232 #define TM_LEN_SCI_SWF_304 3669 // 304 * 12 + 10 + 12 - 1
231 #define TM_LEN_SCI_SWF_224 2709 // 224 * 12 + 10 + 12 - 1
233 #define TM_LEN_SCI_SWF_224 2709 // 224 * 12 + 10 + 12 - 1
232 #define TM_LEN_SCI_CWF_336 4051 // 336 * 12 + 10 + 10 - 1
234 #define TM_LEN_SCI_CWF_336 4051 // 336 * 12 + 10 + 10 - 1
233 #define TM_LEN_SCI_CWF_672 4051 // 672 * 6 + 10 + 10 - 1
235 #define TM_LEN_SCI_CWF_672 4051 // 672 * 6 + 10 + 10 - 1
234 //
236 //
235 #define DEFAULT_PKTCNT 0x07
237 #define DEFAULT_PKTCNT 0x07
236 #define BLK_NR_304 0x0130
238 #define BLK_NR_304 0x0130
237 #define BLK_NR_224 0x00e0
239 #define BLK_NR_224 0x00e0
238 #define BLK_NR_CWF 0x0150 // 336
240 #define BLK_NR_CWF 0x0150 // 336
239 #define BLK_NR_CWF_SHORT_F3 0x02a0 // 672
241 #define BLK_NR_CWF_SHORT_F3 0x02a0 // 672
240
242
241 enum TM_TYPE{
243 enum TM_TYPE{
242 TM_LFR_TC_EXE_OK,
244 TM_LFR_TC_EXE_OK,
243 TM_LFR_TC_EXE_ERR,
245 TM_LFR_TC_EXE_ERR,
244 TM_LFR_HK,
246 TM_LFR_HK,
245 TM_LFR_SCI,
247 TM_LFR_SCI,
246 TM_LFR_SCI_SBM,
248 TM_LFR_SCI_SBM,
247 TM_LFR_PAR_DUMP
249 TM_LFR_PAR_DUMP
248 };
250 };
249
251
250 typedef struct {
252 typedef struct {
251 unsigned char targetLogicalAddress;
253 unsigned char targetLogicalAddress;
252 unsigned char protocolIdentifier;
254 unsigned char protocolIdentifier;
253 unsigned char reserved;
255 unsigned char reserved;
254 unsigned char userApplication;
256 unsigned char userApplication;
255 // PACKET HEADER
257 // PACKET HEADER
256 unsigned char packetID[2];
258 unsigned char packetID[2];
257 unsigned char packetSequenceControl[2];
259 unsigned char packetSequenceControl[2];
258 unsigned char packetLength[2];
260 unsigned char packetLength[2];
259 // DATA FIELD HEADER
261 // DATA FIELD HEADER
260 unsigned char spare1_pusVersion_spare2;
262 unsigned char spare1_pusVersion_spare2;
261 unsigned char serviceType;
263 unsigned char serviceType;
262 unsigned char serviceSubType;
264 unsigned char serviceSubType;
263 unsigned char destinationID;
265 unsigned char destinationID;
264 unsigned char time[6];
266 unsigned char time[6];
265 //
267 //
266 unsigned char telecommand_pkt_id[2];
268 unsigned char telecommand_pkt_id[2];
267 unsigned char pkt_seq_control[2];
269 unsigned char pkt_seq_control[2];
268 } Packet_TM_LFR_TC_EXE_SUCCESS_t;
270 } Packet_TM_LFR_TC_EXE_SUCCESS_t;
269
271
270 typedef struct {
272 typedef struct {
271 unsigned char targetLogicalAddress;
273 unsigned char targetLogicalAddress;
272 unsigned char protocolIdentifier;
274 unsigned char protocolIdentifier;
273 unsigned char reserved;
275 unsigned char reserved;
274 unsigned char userApplication;
276 unsigned char userApplication;
275 // PACKET HEADER
277 // PACKET HEADER
276 unsigned char packetID[2];
278 unsigned char packetID[2];
277 unsigned char packetSequenceControl[2];
279 unsigned char packetSequenceControl[2];
278 unsigned char packetLength[2];
280 unsigned char packetLength[2];
279 // DATA FIELD HEADER
281 // DATA FIELD HEADER
280 unsigned char spare1_pusVersion_spare2;
282 unsigned char spare1_pusVersion_spare2;
281 unsigned char serviceType;
283 unsigned char serviceType;
282 unsigned char serviceSubType;
284 unsigned char serviceSubType;
283 unsigned char destinationID;
285 unsigned char destinationID;
284 unsigned char time[6];
286 unsigned char time[6];
285 //
287 //
286 unsigned char tc_failure_code[2];
288 unsigned char tc_failure_code[2];
287 unsigned char telecommand_pkt_id[2];
289 unsigned char telecommand_pkt_id[2];
288 unsigned char pkt_seq_control[2];
290 unsigned char pkt_seq_control[2];
289 unsigned char tc_service;
291 unsigned char tc_service;
290 unsigned char tc_subtype;
292 unsigned char tc_subtype;
291 unsigned char byte_position;
293 unsigned char byte_position;
292 unsigned char rcv_value;
294 unsigned char rcv_value;
293 } Packet_TM_LFR_TC_EXE_INCONSISTENT_t;
295 } Packet_TM_LFR_TC_EXE_INCONSISTENT_t;
294
296
295 typedef struct {
297 typedef struct {
296 unsigned char targetLogicalAddress;
298 unsigned char targetLogicalAddress;
297 unsigned char protocolIdentifier;
299 unsigned char protocolIdentifier;
298 unsigned char reserved;
300 unsigned char reserved;
299 unsigned char userApplication;
301 unsigned char userApplication;
300 // PACKET HEADER
302 // PACKET HEADER
301 unsigned char packetID[2];
303 unsigned char packetID[2];
302 unsigned char packetSequenceControl[2];
304 unsigned char packetSequenceControl[2];
303 unsigned char packetLength[2];
305 unsigned char packetLength[2];
304 // DATA FIELD HEADER
306 // DATA FIELD HEADER
305 unsigned char spare1_pusVersion_spare2;
307 unsigned char spare1_pusVersion_spare2;
306 unsigned char serviceType;
308 unsigned char serviceType;
307 unsigned char serviceSubType;
309 unsigned char serviceSubType;
308 unsigned char destinationID;
310 unsigned char destinationID;
309 unsigned char time[6];
311 unsigned char time[6];
310 //
312 //
311 unsigned char tc_failure_code[2];
313 unsigned char tc_failure_code[2];
312 unsigned char telecommand_pkt_id[2];
314 unsigned char telecommand_pkt_id[2];
313 unsigned char pkt_seq_control[2];
315 unsigned char pkt_seq_control[2];
314 unsigned char tc_service;
316 unsigned char tc_service;
315 unsigned char tc_subtype;
317 unsigned char tc_subtype;
316 unsigned char lfr_status_word[2];
318 unsigned char lfr_status_word[2];
317 } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t;
319 } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t;
318
320
319 typedef struct {
321 typedef struct {
320 unsigned char targetLogicalAddress;
322 unsigned char targetLogicalAddress;
321 unsigned char protocolIdentifier;
323 unsigned char protocolIdentifier;
322 unsigned char reserved;
324 unsigned char reserved;
323 unsigned char userApplication;
325 unsigned char userApplication;
324 // PACKET HEADER
326 // PACKET HEADER
325 unsigned char packetID[2];
327 unsigned char packetID[2];
326 unsigned char packetSequenceControl[2];
328 unsigned char packetSequenceControl[2];
327 unsigned char packetLength[2];
329 unsigned char packetLength[2];
328 // DATA FIELD HEADER
330 // DATA FIELD HEADER
329 unsigned char spare1_pusVersion_spare2;
331 unsigned char spare1_pusVersion_spare2;
330 unsigned char serviceType;
332 unsigned char serviceType;
331 unsigned char serviceSubType;
333 unsigned char serviceSubType;
332 unsigned char destinationID;
334 unsigned char destinationID;
333 unsigned char time[6];
335 unsigned char time[6];
334 //
336 //
335 unsigned char tc_failure_code[2];
337 unsigned char tc_failure_code[2];
336 unsigned char telecommand_pkt_id[2];
338 unsigned char telecommand_pkt_id[2];
337 unsigned char pkt_seq_control[2];
339 unsigned char pkt_seq_control[2];
338 unsigned char tc_service;
340 unsigned char tc_service;
339 unsigned char tc_subtype;
341 unsigned char tc_subtype;
340 } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t;
342 } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t;
341
343
342 typedef struct {
344 typedef struct {
343 unsigned char targetLogicalAddress;
345 unsigned char targetLogicalAddress;
344 unsigned char protocolIdentifier;
346 unsigned char protocolIdentifier;
345 unsigned char reserved;
347 unsigned char reserved;
346 unsigned char userApplication;
348 unsigned char userApplication;
347 // PACKET HEADER
349 // PACKET HEADER
348 unsigned char packetID[2];
350 unsigned char packetID[2];
349 unsigned char packetSequenceControl[2];
351 unsigned char packetSequenceControl[2];
350 unsigned char packetLength[2];
352 unsigned char packetLength[2];
351 // DATA FIELD HEADER
353 // DATA FIELD HEADER
352 unsigned char spare1_pusVersion_spare2;
354 unsigned char spare1_pusVersion_spare2;
353 unsigned char serviceType;
355 unsigned char serviceType;
354 unsigned char serviceSubType;
356 unsigned char serviceSubType;
355 unsigned char destinationID;
357 unsigned char destinationID;
356 unsigned char time[6];
358 unsigned char time[6];
357 //
359 //
358 unsigned char tc_failure_code[2];
360 unsigned char tc_failure_code[2];
359 unsigned char telecommand_pkt_id[2];
361 unsigned char telecommand_pkt_id[2];
360 unsigned char pkt_seq_control[2];
362 unsigned char pkt_seq_control[2];
361 unsigned char tc_service;
363 unsigned char tc_service;
362 unsigned char tc_subtype;
364 unsigned char tc_subtype;
363 } Packet_TM_LFR_TC_EXE_ERROR_t;
365 } Packet_TM_LFR_TC_EXE_ERROR_t;
364
366
365 typedef struct {
367 typedef struct {
366 unsigned char targetLogicalAddress;
368 unsigned char targetLogicalAddress;
367 unsigned char protocolIdentifier;
369 unsigned char protocolIdentifier;
368 unsigned char reserved;
370 unsigned char reserved;
369 unsigned char userApplication;
371 unsigned char userApplication;
370 // PACKET HEADER
372 // PACKET HEADER
371 unsigned char packetID[2];
373 unsigned char packetID[2];
372 unsigned char packetSequenceControl[2];
374 unsigned char packetSequenceControl[2];
373 unsigned char packetLength[2];
375 unsigned char packetLength[2];
374 // DATA FIELD HEADER
376 // DATA FIELD HEADER
375 unsigned char spare1_pusVersion_spare2;
377 unsigned char spare1_pusVersion_spare2;
376 unsigned char serviceType;
378 unsigned char serviceType;
377 unsigned char serviceSubType;
379 unsigned char serviceSubType;
378 unsigned char destinationID;
380 unsigned char destinationID;
379 unsigned char time[6];
381 unsigned char time[6];
380 //
382 //
381 unsigned char tc_failure_code[2];
383 unsigned char tc_failure_code[2];
382 unsigned char telecommand_pkt_id[2];
384 unsigned char telecommand_pkt_id[2];
383 unsigned char pkt_seq_control[2];
385 unsigned char pkt_seq_control[2];
384 unsigned char tc_service;
386 unsigned char tc_service;
385 unsigned char tc_subtype;
387 unsigned char tc_subtype;
386 unsigned char pkt_len_rcv_value[2];
388 unsigned char pkt_len_rcv_value[2];
387 unsigned char pkt_datafieldsize_cnt[2];
389 unsigned char pkt_datafieldsize_cnt[2];
388 unsigned char rcv_crc[2];
390 unsigned char rcv_crc[2];
389 unsigned char computed_crc[2];
391 unsigned char computed_crc[2];
390 } Packet_TM_LFR_TC_EXE_CORRUPTED_t;
392 } Packet_TM_LFR_TC_EXE_CORRUPTED_t;
391
393
392 typedef struct {
394 typedef struct {
393 unsigned char targetLogicalAddress;
395 unsigned char targetLogicalAddress;
394 unsigned char protocolIdentifier;
396 unsigned char protocolIdentifier;
395 unsigned char reserved;
397 unsigned char reserved;
396 unsigned char userApplication;
398 unsigned char userApplication;
397 unsigned char packetID[2];
399 unsigned char packetID[2];
398 unsigned char packetSequenceControl[2];
400 unsigned char packetSequenceControl[2];
399 unsigned char packetLength[2];
401 unsigned char packetLength[2];
400 // DATA FIELD HEADER
402 // DATA FIELD HEADER
401 unsigned char spare1_pusVersion_spare2;
403 unsigned char spare1_pusVersion_spare2;
402 unsigned char serviceType;
404 unsigned char serviceType;
403 unsigned char serviceSubType;
405 unsigned char serviceSubType;
404 unsigned char destinationID;
406 unsigned char destinationID;
405 unsigned char time[6];
407 unsigned char time[6];
406 // AUXILIARY HEADER
408 // AUXILIARY HEADER
407 unsigned char sid;
409 unsigned char sid;
408 unsigned char hkBIA;
410 unsigned char hkBIA;
409 unsigned char pktCnt;
411 unsigned char pktCnt;
410 unsigned char pktNr;
412 unsigned char pktNr;
411 unsigned char acquisitionTime[6];
413 unsigned char acquisitionTime[6];
412 unsigned char blkNr[2];
414 unsigned char blkNr[2];
413 } Header_TM_LFR_SCIENCE_SWF_t;
415 } Header_TM_LFR_SCIENCE_SWF_t;
414
416
415 typedef struct {
417 typedef struct {
416 unsigned char targetLogicalAddress;
418 unsigned char targetLogicalAddress;
417 unsigned char protocolIdentifier;
419 unsigned char protocolIdentifier;
418 unsigned char reserved;
420 unsigned char reserved;
419 unsigned char userApplication;
421 unsigned char userApplication;
420 unsigned char packetID[2];
422 unsigned char packetID[2];
421 unsigned char packetSequenceControl[2];
423 unsigned char packetSequenceControl[2];
422 unsigned char packetLength[2];
424 unsigned char packetLength[2];
423 // DATA FIELD HEADER
425 // DATA FIELD HEADER
424 unsigned char spare1_pusVersion_spare2;
426 unsigned char spare1_pusVersion_spare2;
425 unsigned char serviceType;
427 unsigned char serviceType;
426 unsigned char serviceSubType;
428 unsigned char serviceSubType;
427 unsigned char destinationID;
429 unsigned char destinationID;
428 unsigned char time[6];
430 unsigned char time[6];
429 // AUXILIARY DATA HEADER
431 // AUXILIARY DATA HEADER
430 unsigned char sid;
432 unsigned char sid;
431 unsigned char hkBIA;
433 unsigned char hkBIA;
432 unsigned char acquisitionTime[6];
434 unsigned char acquisitionTime[6];
433 unsigned char blkNr[2];
435 unsigned char blkNr[2];
434 } Header_TM_LFR_SCIENCE_CWF_t;
436 } Header_TM_LFR_SCIENCE_CWF_t;
435
437
436 typedef struct {
438 typedef struct {
437 unsigned char targetLogicalAddress;
439 unsigned char targetLogicalAddress;
438 unsigned char protocolIdentifier;
440 unsigned char protocolIdentifier;
439 unsigned char reserved;
441 unsigned char reserved;
440 unsigned char userApplication;
442 unsigned char userApplication;
441 unsigned char packetID[2];
443 unsigned char packetID[2];
442 unsigned char packetSequenceControl[2];
444 unsigned char packetSequenceControl[2];
443 unsigned char packetLength[2];
445 unsigned char packetLength[2];
444 // DATA FIELD HEADER
446 // DATA FIELD HEADER
445 unsigned char spare1_pusVersion_spare2;
447 unsigned char spare1_pusVersion_spare2;
446 unsigned char serviceType;
448 unsigned char serviceType;
447 unsigned char serviceSubType;
449 unsigned char serviceSubType;
448 unsigned char destinationID;
450 unsigned char destinationID;
449 unsigned char time[6];
451 unsigned char time[6];
450 // AUXILIARY HEADER
452 // AUXILIARY HEADER
451 unsigned char sid;
453 unsigned char sid;
452 unsigned char biaStatusInfo;
454 unsigned char biaStatusInfo;
453 unsigned char pa_lfr_pkt_cnt_asm;
455 unsigned char pa_lfr_pkt_cnt_asm;
454 unsigned char pa_lfr_pkt_nr_asm;
456 unsigned char pa_lfr_pkt_nr_asm;
455 unsigned char acquisitionTime[6];
457 unsigned char acquisitionTime[6];
456 unsigned char pa_lfr_asm_blk_nr[2];
458 unsigned char pa_lfr_asm_blk_nr[2];
457 } Header_TM_LFR_SCIENCE_ASM_t;
459 } Header_TM_LFR_SCIENCE_ASM_t;
458
460
459 typedef struct {
461 typedef struct {
460 unsigned char targetLogicalAddress;
462 unsigned char targetLogicalAddress;
461 unsigned char protocolIdentifier;
463 unsigned char protocolIdentifier;
462 unsigned char reserved;
464 unsigned char reserved;
463 unsigned char userApplication;
465 unsigned char userApplication;
464 unsigned char packetID[2];
466 unsigned char packetID[2];
465 unsigned char packetSequenceControl[2];
467 unsigned char packetSequenceControl[2];
466 unsigned char packetLength[2];
468 unsigned char packetLength[2];
467 // DATA FIELD HEADER
469 // DATA FIELD HEADER
468 unsigned char spare1_pusVersion_spare2;
470 unsigned char spare1_pusVersion_spare2;
469 unsigned char serviceType;
471 unsigned char serviceType;
470 unsigned char serviceSubType;
472 unsigned char serviceSubType;
471 unsigned char destinationID;
473 unsigned char destinationID;
472 unsigned char time[6];
474 unsigned char time[6];
473 // AUXILIARY HEADER
475 // AUXILIARY HEADER
474 unsigned char sid;
476 unsigned char sid;
475 unsigned char biaStatusInfo;
477 unsigned char biaStatusInfo;
476 unsigned char acquisitionTime[6];
478 unsigned char acquisitionTime[6];
477 unsigned char source_data_spare[2];
479 unsigned char source_data_spare[2];
478 unsigned char pa_lfr_bp_blk_nr[2];
480 unsigned char pa_lfr_bp_blk_nr[2];
479 } Header_TM_LFR_SCIENCE_BP_with_spare_t;
481 } Header_TM_LFR_SCIENCE_BP_with_spare_t;
480
482
481 typedef struct {
483 typedef struct {
482 unsigned char targetLogicalAddress;
484 unsigned char targetLogicalAddress;
483 unsigned char protocolIdentifier;
485 unsigned char protocolIdentifier;
484 unsigned char reserved;
486 unsigned char reserved;
485 unsigned char userApplication;
487 unsigned char userApplication;
486 unsigned char packetID[2];
488 unsigned char packetID[2];
487 unsigned char packetSequenceControl[2];
489 unsigned char packetSequenceControl[2];
488 unsigned char packetLength[2];
490 unsigned char packetLength[2];
489 // DATA FIELD HEADER
491 // DATA FIELD HEADER
490 unsigned char spare1_pusVersion_spare2;
492 unsigned char spare1_pusVersion_spare2;
491 unsigned char serviceType;
493 unsigned char serviceType;
492 unsigned char serviceSubType;
494 unsigned char serviceSubType;
493 unsigned char destinationID;
495 unsigned char destinationID;
494 unsigned char time[6];
496 unsigned char time[6];
495 // AUXILIARY HEADER
497 // AUXILIARY HEADER
496 unsigned char sid;
498 unsigned char sid;
497 unsigned char biaStatusInfo;
499 unsigned char biaStatusInfo;
498 unsigned char acquisitionTime[6];
500 unsigned char acquisitionTime[6];
499 unsigned char pa_lfr_bp_blk_nr[2];
501 unsigned char pa_lfr_bp_blk_nr[2];
500 } Header_TM_LFR_SCIENCE_BP_t;
502 } Header_TM_LFR_SCIENCE_BP_t;
501
503
502 typedef struct {
504 typedef struct {
503 //targetLogicalAddress is removed by the grspw module
505 //targetLogicalAddress is removed by the grspw module
504 unsigned char protocolIdentifier;
506 unsigned char protocolIdentifier;
505 unsigned char reserved;
507 unsigned char reserved;
506 unsigned char userApplication;
508 unsigned char userApplication;
507 unsigned char packetID[2];
509 unsigned char packetID[2];
508 unsigned char packetSequenceControl[2];
510 unsigned char packetSequenceControl[2];
509 unsigned char packetLength[2];
511 unsigned char packetLength[2];
510 // DATA FIELD HEADER
512 // DATA FIELD HEADER
511 unsigned char headerFlag_pusVersion_Ack;
513 unsigned char headerFlag_pusVersion_Ack;
512 unsigned char serviceType;
514 unsigned char serviceType;
513 unsigned char serviceSubType;
515 unsigned char serviceSubType;
514 unsigned char sourceID;
516 unsigned char sourceID;
515 unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10];
517 unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10];
516 } ccsdsTelecommandPacket_t;
518 } ccsdsTelecommandPacket_t;
517
519
518 typedef struct {
520 typedef struct {
519 unsigned char targetLogicalAddress;
521 unsigned char targetLogicalAddress;
520 unsigned char protocolIdentifier;
522 unsigned char protocolIdentifier;
521 unsigned char reserved;
523 unsigned char reserved;
522 unsigned char userApplication;
524 unsigned char userApplication;
523 unsigned char packetID[2];
525 unsigned char packetID[2];
524 unsigned char packetSequenceControl[2];
526 unsigned char packetSequenceControl[2];
525 unsigned char packetLength[2];
527 unsigned char packetLength[2];
526 unsigned char spare1_pusVersion_spare2;
528 unsigned char spare1_pusVersion_spare2;
527 unsigned char serviceType;
529 unsigned char serviceType;
528 unsigned char serviceSubType;
530 unsigned char serviceSubType;
529 unsigned char destinationID;
531 unsigned char destinationID;
530 unsigned char time[6];
532 unsigned char time[6];
531 unsigned char sid;
533 unsigned char sid;
532
534
533 //**************
535 //**************
534 // HK PARAMETERS
536 // HK PARAMETERS
535 unsigned char lfr_status_word[2];
537 unsigned char lfr_status_word[2];
536 unsigned char lfr_sw_version[4];
538 unsigned char lfr_sw_version[4];
537 unsigned char lfr_fpga_version[3];
539 unsigned char lfr_fpga_version[3];
538 // ressource statistics
540 // ressource statistics
539 unsigned char hk_lfr_cpu_load;
541 unsigned char hk_lfr_cpu_load;
540 unsigned char hk_lfr_load_max;
542 unsigned char hk_lfr_load_max;
541 unsigned char hk_lfr_load_aver;
543 unsigned char hk_lfr_load_aver;
542 // tc statistics
544 // tc statistics
543 unsigned char hk_lfr_update_info_tc_cnt[2];
545 unsigned char hk_lfr_update_info_tc_cnt[2];
544 unsigned char hk_lfr_update_time_tc_cnt[2];
546 unsigned char hk_lfr_update_time_tc_cnt[2];
545 unsigned char hk_lfr_exe_tc_cnt[2];
547 unsigned char hk_lfr_exe_tc_cnt[2];
546 unsigned char hk_lfr_rej_tc_cnt[2];
548 unsigned char hk_lfr_rej_tc_cnt[2];
547 unsigned char hk_lfr_last_exe_tc_id[2];
549 unsigned char hk_lfr_last_exe_tc_id[2];
548 unsigned char hk_lfr_last_exe_tc_type[2];
550 unsigned char hk_lfr_last_exe_tc_type[2];
549 unsigned char hk_lfr_last_exe_tc_subtype[2];
551 unsigned char hk_lfr_last_exe_tc_subtype[2];
550 unsigned char hk_lfr_last_exe_tc_time[6];
552 unsigned char hk_lfr_last_exe_tc_time[6];
551 unsigned char hk_lfr_last_rej_tc_id[2];
553 unsigned char hk_lfr_last_rej_tc_id[2];
552 unsigned char hk_lfr_last_rej_tc_type[2];
554 unsigned char hk_lfr_last_rej_tc_type[2];
553 unsigned char hk_lfr_last_rej_tc_subtype[2];
555 unsigned char hk_lfr_last_rej_tc_subtype[2];
554 unsigned char hk_lfr_last_rej_tc_time[6];
556 unsigned char hk_lfr_last_rej_tc_time[6];
555 // anomaly statistics
557 // anomaly statistics
556 unsigned char hk_lfr_le_cnt[2];
558 unsigned char hk_lfr_le_cnt[2];
557 unsigned char hk_lfr_me_cnt[2];
559 unsigned char hk_lfr_me_cnt[2];
558 unsigned char hk_lfr_he_cnt[2];
560 unsigned char hk_lfr_he_cnt[2];
559 unsigned char hk_lfr_last_er_rid[2];
561 unsigned char hk_lfr_last_er_rid[2];
560 unsigned char hk_lfr_last_er_code;
562 unsigned char hk_lfr_last_er_code;
561 unsigned char hk_lfr_last_er_time[6];
563 unsigned char hk_lfr_last_er_time[6];
562 // vhdl_blk_status
564 // vhdl_blk_status
563 unsigned char hk_lfr_vhdl_aa_sm;
565 unsigned char hk_lfr_vhdl_aa_sm;
564 unsigned char hk_lfr_vhdl_fft_sr;
566 unsigned char hk_lfr_vhdl_fft_sr;
565 unsigned char hk_lfr_vhdl_cic_hk;
567 unsigned char hk_lfr_vhdl_cic_hk;
566 unsigned char hk_lfr_vhdl_iir_cal;
568 unsigned char hk_lfr_vhdl_iir_cal;
567 // spacewire_if_statistics
569 // spacewire_if_statistics
568 unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2];
570 unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2];
569 unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2];
571 unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2];
570 unsigned char hk_lfr_dpu_spw_tick_out_cnt;
572 unsigned char hk_lfr_dpu_spw_tick_out_cnt;
571 unsigned char hk_lfr_dpu_spw_last_timc;
573 unsigned char hk_lfr_dpu_spw_last_timc;
572 // ahb error statistics
574 // ahb error statistics
573 unsigned int hk_lfr_last_fail_addr;
575 unsigned int hk_lfr_last_fail_addr;
574 // temperatures
576 // temperatures
575 unsigned char hk_lfr_temp_scm[2];
577 unsigned char hk_lfr_temp_scm[2];
576 unsigned char hk_lfr_temp_pcb[2];
578 unsigned char hk_lfr_temp_pcb[2];
577 unsigned char hk_lfr_temp_fpga[2];
579 unsigned char hk_lfr_temp_fpga[2];
578 // spacecraft potential
580 // spacecraft potential
579 unsigned char hk_lfr_sc_v_f3[2];
581 unsigned char hk_lfr_sc_v_f3[2];
580 unsigned char hk_lfr_sc_e1_f3[2];
582 unsigned char hk_lfr_sc_e1_f3[2];
581 unsigned char hk_lfr_sc_e2_f3[2];
583 unsigned char hk_lfr_sc_e2_f3[2];
582 // error counters
584 // error counters
583 unsigned char hk_lfr_dpu_spw_parity;
585 unsigned char hk_lfr_dpu_spw_parity;
584 unsigned char hk_lfr_dpu_spw_disconnect;
586 unsigned char hk_lfr_dpu_spw_disconnect;
585 unsigned char hk_lfr_dpu_spw_escape;
587 unsigned char hk_lfr_dpu_spw_escape;
586 unsigned char hk_lfr_dpu_spw_credit;
588 unsigned char hk_lfr_dpu_spw_credit;
587 unsigned char hk_lfr_dpu_spw_write_sync;
589 unsigned char hk_lfr_dpu_spw_write_sync;
588 unsigned char hk_lfr_dpu_spw_rx_ahb;
590 unsigned char hk_lfr_dpu_spw_rx_ahb;
589 unsigned char hk_lfr_dpu_spw_tx_ahb;
591 unsigned char hk_lfr_dpu_spw_tx_ahb;
590 unsigned char hk_lfr_dpu_spw_early_eop;
592 unsigned char hk_lfr_dpu_spw_early_eop;
591 unsigned char hk_lfr_dpu_spw_invalid_addr;
593 unsigned char hk_lfr_dpu_spw_invalid_addr;
592 unsigned char hk_lfr_dpu_spw_eep;
594 unsigned char hk_lfr_dpu_spw_eep;
593 unsigned char hk_lfr_dpu_spw_rx_too_big;
595 unsigned char hk_lfr_dpu_spw_rx_too_big;
594 // timecode
596 // timecode
595 unsigned char hk_lfr_timecode_erroneous;
597 unsigned char hk_lfr_timecode_erroneous;
596 unsigned char hk_lfr_timecode_missing;
598 unsigned char hk_lfr_timecode_missing;
597 unsigned char hk_lfr_timecode_invalid;
599 unsigned char hk_lfr_timecode_invalid;
598 // time
600 // time
599 unsigned char hk_lfr_time_timecode_it;
601 unsigned char hk_lfr_time_timecode_it;
600 unsigned char hk_lfr_time_not_synchro;
602 unsigned char hk_lfr_time_not_synchro;
601 unsigned char hk_lfr_time_timecode_ctr;
603 unsigned char hk_lfr_time_timecode_ctr;
602 // hk_lfr_buffer_dpu_
604 // hk_lfr_buffer_dpu_
603 unsigned char hk_lfr_buffer_dpu_tc_fifo;
605 unsigned char hk_lfr_buffer_dpu_tc_fifo;
604 unsigned char hk_lfr_buffer_dpu_tm_fifo;
606 unsigned char hk_lfr_buffer_dpu_tm_fifo;
605 // hk_lfr_ahb_
607 // hk_lfr_ahb_
606 unsigned char hk_lfr_ahb_correctable;
608 unsigned char hk_lfr_ahb_correctable;
607 unsigned char hk_lfr_ahb_uncorrectable;
609 unsigned char hk_lfr_ahb_uncorrectable;
608 // spare
610 // spare
609 unsigned char parameters_spare;
611 unsigned char parameters_spare;
610 } Packet_TM_LFR_HK_t;
612 } Packet_TM_LFR_HK_t;
611
613
612 typedef struct {
614 typedef struct {
613 unsigned char targetLogicalAddress;
615 unsigned char targetLogicalAddress;
614 unsigned char protocolIdentifier;
616 unsigned char protocolIdentifier;
615 unsigned char reserved;
617 unsigned char reserved;
616 unsigned char userApplication;
618 unsigned char userApplication;
617 unsigned char packetID[2];
619 unsigned char packetID[2];
618 unsigned char packetSequenceControl[2];
620 unsigned char packetSequenceControl[2];
619 unsigned char packetLength[2];
621 unsigned char packetLength[2];
620 // DATA FIELD HEADER
622 // DATA FIELD HEADER
621 unsigned char spare1_pusVersion_spare2;
623 unsigned char spare1_pusVersion_spare2;
622 unsigned char serviceType;
624 unsigned char serviceType;
623 unsigned char serviceSubType;
625 unsigned char serviceSubType;
624 unsigned char destinationID;
626 unsigned char destinationID;
625 unsigned char time[6];
627 unsigned char time[6];
626 unsigned char sid;
628 unsigned char sid;
627
629
628 //******************
630 //******************
629 // COMMON PARAMETERS
631 // COMMON PARAMETERS
630 unsigned char unused0;
632 unsigned char unused0;
631 unsigned char bw_sp0_sp1_r0_r1;
633 unsigned char bw_sp0_sp1_r0_r1;
632
634
633 //******************
635 //******************
634 // NORMAL PARAMETERS
636 // NORMAL PARAMETERS
635 unsigned char sy_lfr_n_swf_l[2];
637 unsigned char sy_lfr_n_swf_l[2];
636 unsigned char sy_lfr_n_swf_p[2];
638 unsigned char sy_lfr_n_swf_p[2];
637 unsigned char sy_lfr_n_asm_p[2];
639 unsigned char sy_lfr_n_asm_p[2];
638 unsigned char sy_lfr_n_bp_p0;
640 unsigned char sy_lfr_n_bp_p0;
639 unsigned char sy_lfr_n_bp_p1;
641 unsigned char sy_lfr_n_bp_p1;
640 unsigned char sy_lfr_n_cwf_long_f3;
642 unsigned char sy_lfr_n_cwf_long_f3;
641 unsigned char lfr_normal_parameters_spare;
643 unsigned char lfr_normal_parameters_spare;
642
644
643 //*****************
645 //*****************
644 // BURST PARAMETERS
646 // BURST PARAMETERS
645 unsigned char sy_lfr_b_bp_p0;
647 unsigned char sy_lfr_b_bp_p0;
646 unsigned char sy_lfr_b_bp_p1;
648 unsigned char sy_lfr_b_bp_p1;
647
649
648 //****************
650 //****************
649 // SBM1 PARAMETERS
651 // SBM1 PARAMETERS
650 unsigned char sy_lfr_s1_bp_p0;
652 unsigned char sy_lfr_s1_bp_p0;
651 unsigned char sy_lfr_s1_bp_p1;
653 unsigned char sy_lfr_s1_bp_p1;
652
654
653 //****************
655 //****************
654 // SBM2 PARAMETERS
656 // SBM2 PARAMETERS
655 unsigned char sy_lfr_s2_bp_p0;
657 unsigned char sy_lfr_s2_bp_p0;
656 unsigned char sy_lfr_s2_bp_p1;
658 unsigned char sy_lfr_s2_bp_p1;
657
659
658 // SPARE
660 // SPARE
659 unsigned char source_data_spare;
661 unsigned char source_data_spare;
660 } Packet_TM_LFR_PARAMETER_DUMP_t;
662 } Packet_TM_LFR_PARAMETER_DUMP_t;
661
663
662
664
663 #endif // CCSDS_TYPES_H_INCLUDED
665 #endif // CCSDS_TYPES_H_INCLUDED
@@ -1,43 +1,47
1 #ifndef FSW_INIT_H_INCLUDED
1 #ifndef FSW_INIT_H_INCLUDED
2 #define FSW_INIT_H_INCLUDED
2 #define FSW_INIT_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <leon.h>
5 #include <leon.h>
6
6
7 #include "fsw_params.h"
7 #include "fsw_params.h"
8 #include "fsw_misc.h"
8 #include "fsw_misc.h"
9 #include "fsw_processing.h"
9 #include "fsw_processing.h"
10 #include "avf0_prc0.h"
11 #include "avf1_prc1.h"
12 #include "avf2_prc2.h"
13
10 #include "tc_handler.h"
14 #include "tc_handler.h"
11 #include "wf_handler.h"
15 #include "wf_handler.h"
12
13 #include "fsw_spacewire.h"
16 #include "fsw_spacewire.h"
14
17
15 extern rtems_name Task_name[20]; /* array of task names */
18 extern rtems_name Task_name[20]; /* array of task names */
16 extern rtems_id Task_id[20]; /* array of task ids */
19 extern rtems_id Task_id[20]; /* array of task ids */
17
20
18 // RTEMS TASKS
21 // RTEMS TASKS
19 rtems_task Init( rtems_task_argument argument);
22 rtems_task Init( rtems_task_argument argument);
20
23
21 // OTHER functions
24 // OTHER functions
22 void create_names( void );
25 void create_names( void );
23 int create_all_tasks( void );
26 int create_all_tasks( void );
24 int start_all_tasks( void );
27 int start_all_tasks( void );
25 //
28 //
26 rtems_status_code create_message_queues( void );
29 rtems_status_code create_message_queues( void );
27 rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
30 rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
28 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id );
31 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id );
29 rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id );
32 rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id );
30 rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
33 rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
34 rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
31 //
35 //
32 int start_recv_send_tasks( void );
36 int start_recv_send_tasks( void );
33 //
37 //
34 void init_local_mode_parameters( void );
38 void init_local_mode_parameters( void );
35 void reset_local_time( void );
39 void reset_local_time( void );
36
40
37 extern int rtems_cpu_usage_report( void );
41 extern int rtems_cpu_usage_report( void );
38 extern int rtems_cpu_usage_reset( void );
42 extern int rtems_cpu_usage_reset( void );
39 extern void rtems_stack_checker_report_usage( void );
43 extern void rtems_stack_checker_report_usage( void );
40
44
41 extern int sched_yield( void );
45 extern int sched_yield( void );
42
46
43 #endif // FSW_INIT_H_INCLUDED
47 #endif // FSW_INIT_H_INCLUDED
@@ -1,283 +1,250
1 #ifndef FSW_PARAMS_H_INCLUDED
1 #ifndef FSW_PARAMS_H_INCLUDED
2 #define FSW_PARAMS_H_INCLUDED
2 #define FSW_PARAMS_H_INCLUDED
3
3
4 #include "grlib_regs.h"
4 #include "grlib_regs.h"
5 #include "fsw_params_processing.h"
5 #include "fsw_params_processing.h"
6 #include "fsw_params_nb_bytes.h"
6 #include "fsw_params_nb_bytes.h"
7 #include "tm_byte_positions.h"
7 #include "tm_byte_positions.h"
8 #include "ccsds_types.h"
8 #include "ccsds_types.h"
9
9
10 #define GRSPW_DEVICE_NAME "/dev/grspw0"
10 #define GRSPW_DEVICE_NAME "/dev/grspw0"
11 #define UART_DEVICE_NAME "/dev/console"
11 #define UART_DEVICE_NAME "/dev/console"
12
12
13 typedef struct ring_node
13 typedef struct ring_node
14 {
14 {
15 struct ring_node *previous;
15 struct ring_node *previous;
16 int buffer_address;
16 int buffer_address;
17 struct ring_node *next;
17 struct ring_node *next;
18 unsigned int status;
18 unsigned int status;
19 } ring_node;
19 } ring_node;
20
20
21 typedef struct {
22 unsigned int norm_bp1;
23 unsigned int norm_bp2;
24 unsigned int norm_asm;
25 unsigned int burst_sbm_bp1;
26 unsigned int burst_sbm_bp2;
27 unsigned int burst_bp1;
28 unsigned int burst_bp2;
29 unsigned int sbm1_bp1;
30 unsigned int sbm1_bp2;
31 unsigned int sbm2_bp1;
32 unsigned int sbm2_bp2;
33 } nb_sm_before_bp_asm_f0;
34
35 typedef struct {
36 unsigned int norm_bp1;
37 unsigned int norm_bp2;
38 unsigned int norm_asm;
39 unsigned int burst_sbm_bp1;
40 unsigned int burst_sbm_bp2;
41 unsigned int burst_bp1;
42 unsigned int burst_bp2;
43 unsigned int sbm2_bp1;
44 unsigned int sbm2_bp2;
45 } nb_sm_before_bp_asm_f1;
46
47 typedef struct {
48 unsigned int norm_bp1_f2;
49 unsigned int norm_bp2_f2;
50 unsigned int norm_asm_f2;
51 unsigned int burst_sbm_bp1_f2;
52 unsigned int burst_sbm_bp2_f2;
53 unsigned int burst_bp1_f2;
54 unsigned int burst_bp2_f2;
55 unsigned int sbm2_bp1_f2;
56 unsigned int sbm2_bp2_f2;
57 } nb_sm_before_bp_asm_f2;
58
59 //************************
21 //************************
60 // flight software version
22 // flight software version
61 // this parameters is handled by the Qt project options
23 // this parameters is handled by the Qt project options
62
24
63 #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk
25 #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk
64 #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk
26 #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk
65 #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688
27 #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688
66 #define TIME_OFFSET 2
28 #define TIME_OFFSET 2
67 #define TIME_OFFSET_IN_BYTES 8
29 #define TIME_OFFSET_IN_BYTES 8
68 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
30 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
69 #define NB_BYTES_SWF_BLK (2 * 6)
31 #define NB_BYTES_SWF_BLK (2 * 6)
70 #define NB_WORDS_SWF_BLK 3
32 #define NB_WORDS_SWF_BLK 3
71 #define NB_BYTES_CWF3_LIGHT_BLK 6
33 #define NB_BYTES_CWF3_LIGHT_BLK 6
72 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
34 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
73 #define NB_RING_NODES_F0 3 // AT LEAST 3
35 #define NB_RING_NODES_F0 3 // AT LEAST 3
74 #define NB_RING_NODES_F1 5 // AT LEAST 3
36 #define NB_RING_NODES_F1 5 // AT LEAST 3
75 #define NB_RING_NODES_F2 5 // AT LEAST 3
37 #define NB_RING_NODES_F2 5 // AT LEAST 3
76
38
77 //**********
39 //**********
78 // LFR MODES
40 // LFR MODES
79 #define LFR_MODE_STANDBY 0
41 #define LFR_MODE_STANDBY 0
80 #define LFR_MODE_NORMAL 1
42 #define LFR_MODE_NORMAL 1
81 #define LFR_MODE_BURST 2
43 #define LFR_MODE_BURST 2
82 #define LFR_MODE_SBM1 3
44 #define LFR_MODE_SBM1 3
83 #define LFR_MODE_SBM2 4
45 #define LFR_MODE_SBM2 4
84
46
85 #define TDS_MODE_LFM 5
47 #define TDS_MODE_LFM 5
86 #define TDS_MODE_STANDBY 0
48 #define TDS_MODE_STANDBY 0
87 #define TDS_MODE_NORMAL 1
49 #define TDS_MODE_NORMAL 1
88 #define TDS_MODE_BURST 2
50 #define TDS_MODE_BURST 2
89 #define TDS_MODE_SBM1 3
51 #define TDS_MODE_SBM1 3
90 #define TDS_MODE_SBM2 4
52 #define TDS_MODE_SBM2 4
91
53
92 #define THR_MODE_STANDBY 0
54 #define THR_MODE_STANDBY 0
93 #define THR_MODE_NORMAL 1
55 #define THR_MODE_NORMAL 1
94 #define THR_MODE_BURST 2
56 #define THR_MODE_BURST 2
95
57
96 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
58 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
97 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
59 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
98 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
60 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
99 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
61 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
100 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
62 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
101 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
63 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
102 #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6
64 #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6
103 #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7
65 #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7
104 #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8
66 #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 // ASM only in NORM mode
105 #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9
67 #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9
106 #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10
68 #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10
107 #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11
69 #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 // ASM only in NORM mode
108 #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12
70 #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12
109 #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13
71 #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13
110 #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14
72 #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 // ASM only in NORM mode
111 #define RTEMS_EVENT_BURST_SBM_BP1_F0 RTEMS_EVENT_15
73 #define RTEMS_EVENT_BURST_SBM_BP1_F0 RTEMS_EVENT_15
112 #define RTEMS_EVENT_BURST_SBM_BP2_F0 RTEMS_EVENT_16
74 #define RTEMS_EVENT_BURST_SBM_BP2_F0 RTEMS_EVENT_16
113 #define RTEMS_EVENT_BURST_SBM_BP1_F1 RTEMS_EVENT_17
75 #define RTEMS_EVENT_BURST_SBM_BP1_F1 RTEMS_EVENT_17
114 #define RTEMS_EVENT_BURST_SBM_BP2_F1 RTEMS_EVENT_18
76 #define RTEMS_EVENT_BURST_SBM_BP2_F1 RTEMS_EVENT_18
115 #define RTEMS_EVENT_BURST_SBM_BP1_F2 RTEMS_EVENT_19
116 #define RTEMS_EVENT_BURST_SBM_BP2_F2 RTEMS_EVENT_20
117
77
118 //****************************
78 //****************************
119 // LFR DEFAULT MODE PARAMETERS
79 // LFR DEFAULT MODE PARAMETERS
120 // COMMON
80 // COMMON
121 #define DEFAULT_SY_LFR_COMMON0 0x00
81 #define DEFAULT_SY_LFR_COMMON0 0x00
122 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
82 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
123 // NORM
83 // NORM
124 #define SY_LFR_N_SWF_L 2048 // nb sample
84 #define SY_LFR_N_SWF_L 2048 // nb sample
125 #define SY_LFR_N_SWF_P 300 // sec
85 #define SY_LFR_N_SWF_P 300 // sec
126 #define SY_LFR_N_ASM_P 3600 // sec
86 #define SY_LFR_N_ASM_P 3600 // sec
127 #define SY_LFR_N_BP_P0 4 // sec
87 #define SY_LFR_N_BP_P0 4 // sec
128 #define SY_LFR_N_BP_P1 20 // sec
88 #define SY_LFR_N_BP_P1 20 // sec
129 #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3
89 #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3
130 #define MIN_DELTA_SNAPSHOT 16 // sec
90 #define MIN_DELTA_SNAPSHOT 16 // sec
131 // BURST
91 // BURST
132 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
92 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
133 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
93 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
134 // SBM1
94 // SBM1
135 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
95 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
136 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
96 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
137 // SBM2
97 // SBM2
138 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
98 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
139 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
99 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
140 // ADDITIONAL PARAMETERS
100 // ADDITIONAL PARAMETERS
141 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
101 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
142 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
102 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
143 // STATUS WORD
103 // STATUS WORD
144 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
104 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
145 #define DEFAULT_STATUS_WORD_BYTE1 0x00
105 #define DEFAULT_STATUS_WORD_BYTE1 0x00
146 //
106 //
147 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
107 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
148 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
108 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
149 //****************************
109 //****************************
150
110
151 //*****************************
111 //*****************************
152 // APB REGISTERS BASE ADDRESSES
112 // APB REGISTERS BASE ADDRESSES
153 #define REGS_ADDR_APBUART 0x80000100
113 #define REGS_ADDR_APBUART 0x80000100
154 #define REGS_ADDR_GPTIMER 0x80000300
114 #define REGS_ADDR_GPTIMER 0x80000300
155 #define REGS_ADDR_GRSPW 0x80000500
115 #define REGS_ADDR_GRSPW 0x80000500
156 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
116 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
157 #define REGS_ADDR_GRGPIO 0x80000b00
117 #define REGS_ADDR_GRGPIO 0x80000b00
158
118
159 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
119 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
160 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f40
120 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f40
161
121
162 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
122 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
163 #define APBUART_CTRL_REG_MASK_TE 0x00000002
123 #define APBUART_CTRL_REG_MASK_TE 0x00000002
164 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
124 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
165
125
166 //**********
126 //**********
167 // IRQ LINES
127 // IRQ LINES
168 #define IRQ_SM_SIMULATOR 9
128 #define IRQ_SM_SIMULATOR 9
169 #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels
129 #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels
170 #define IRQ_WAVEFORM_PICKER 14
130 #define IRQ_WAVEFORM_PICKER 14
171 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
131 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
172 #define IRQ_SPECTRAL_MATRIX 6
132 #define IRQ_SPECTRAL_MATRIX 6
173 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
133 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
174
134
175 //*****
135 //*****
176 // TIME
136 // TIME
177 #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416
137 #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416
178 #define TIMER_SM_SIMULATOR 1
138 #define TIMER_SM_SIMULATOR 1
179 #define HK_PERIOD 100 // 100 * 10ms => 1s
139 #define HK_PERIOD 100 // 100 * 10ms => 1s
180 #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000
140 #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000
181 #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s
141 #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s
182
142
183 //**********
143 //**********
184 // LPP CODES
144 // LPP CODES
185 #define LFR_SUCCESSFUL 0
145 #define LFR_SUCCESSFUL 0
186 #define LFR_DEFAULT 1
146 #define LFR_DEFAULT 1
187 #define LFR_EXE_ERROR 2
147 #define LFR_EXE_ERROR 2
188
148
189 //******
149 //******
190 // RTEMS
150 // RTEMS
191 #define TASKID_RECV 1
151 #define TASKID_RECV 1
192 #define TASKID_ACTN 2
152 #define TASKID_ACTN 2
193 #define TASKID_SPIQ 3
153 #define TASKID_SPIQ 3
194 #define TASKID_STAT 4
154 #define TASKID_STAT 4
195 #define TASKID_AVF0 5
155 #define TASKID_AVF0 5
196 #define TASKID_SWBD 6
156 #define TASKID_SWBD 6
197 #define TASKID_WFRM 7
157 #define TASKID_WFRM 7
198 #define TASKID_DUMB 8
158 #define TASKID_DUMB 8
199 #define TASKID_HOUS 9
159 #define TASKID_HOUS 9
200 #define TASKID_PRC0 10
160 #define TASKID_PRC0 10
201 #define TASKID_CWF3 11
161 #define TASKID_CWF3 11
202 #define TASKID_CWF2 12
162 #define TASKID_CWF2 12
203 #define TASKID_CWF1 13
163 #define TASKID_CWF1 13
204 #define TASKID_SEND 14
164 #define TASKID_SEND 14
205 #define TASKID_WTDG 15
165 #define TASKID_WTDG 15
206 #define TASKID_AVF1 16
166 #define TASKID_AVF1 16
207 #define TASKID_PRC1 17
167 #define TASKID_PRC1 17
168 #define TASKID_AVF2 18
169 #define TASKID_PRC2 19
208
170
209 #define TASK_PRIORITY_SPIQ 5
171 #define TASK_PRIORITY_SPIQ 5
210 #define TASK_PRIORITY_WTDG 20
172 #define TASK_PRIORITY_WTDG 20
211 #define TASK_PRIORITY_HOUS 30
173 #define TASK_PRIORITY_HOUS 30
212 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
174 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
213 #define TASK_PRIORITY_CWF2 35 //
175 #define TASK_PRIORITY_CWF2 35 //
214 #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it
176 #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it
215 #define TASK_PRIORITY_WFRM 40
177 #define TASK_PRIORITY_WFRM 40
216 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
178 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
217 #define TASK_PRIORITY_SEND 45
179 #define TASK_PRIORITY_SEND 45
218 #define TASK_PRIORITY_RECV 50
180 #define TASK_PRIORITY_RECV 50
219 #define TASK_PRIORITY_ACTN 50
181 #define TASK_PRIORITY_ACTN 50
220 #define TASK_PRIORITY_AVF0 60
182 #define TASK_PRIORITY_AVF0 60
221 #define TASK_PRIORITY_AVF1 70
183 #define TASK_PRIORITY_AVF1 70
222 #define TASK_PRIORITY_PRC0 100
184 #define TASK_PRIORITY_PRC0 100
223 #define TASK_PRIORITY_PRC1 100
185 #define TASK_PRIORITY_PRC1 100
186 #define TASK_PRIORITY_AVF2 110
187 #define TASK_PRIORITY_PRC2 110
224 #define TASK_PRIORITY_STAT 200
188 #define TASK_PRIORITY_STAT 200
225 #define TASK_PRIORITY_DUMB 200
189 #define TASK_PRIORITY_DUMB 200
226
190
227 #define MSG_QUEUE_COUNT_RECV 10
191 #define MSG_QUEUE_COUNT_RECV 10
228 #define MSG_QUEUE_COUNT_SEND 50
192 #define MSG_QUEUE_COUNT_SEND 50
229 #define MSG_QUEUE_COUNT_PRC0 10
193 #define MSG_QUEUE_COUNT_PRC0 10
230 #define MSG_QUEUE_COUNT_PRC1 10
194 #define MSG_QUEUE_COUNT_PRC1 10
195 #define MSG_QUEUE_COUNT_PRC2 5
231 #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1
196 #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1
232 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
197 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
233 #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers
198 #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers
234 #define MSG_QUEUE_SIZE_PRC1 20 // two pointers and one rtems_event + 2 integers
199 #define MSG_QUEUE_SIZE_PRC1 20 // two pointers and one rtems_event + 2 integers
200 #define MSG_QUEUE_SIZE_PRC2 20 // two pointers and one rtems_event + 2 integers
235
201
236 #define QUEUE_RECV 0
202 #define QUEUE_RECV 0
237 #define QUEUE_SEND 1
203 #define QUEUE_SEND 1
238 #define QUEUE_PRC0 2
204 #define QUEUE_PRC0 2
239 #define QUEUE_PRC1 3
205 #define QUEUE_PRC1 3
206 #define QUEUE_PRC2 4
240
207
241 //*******
208 //*******
242 // MACROS
209 // MACROS
243 #ifdef PRINT_MESSAGES_ON_CONSOLE
210 #ifdef PRINT_MESSAGES_ON_CONSOLE
244 #define PRINTF(x) printf(x);
211 #define PRINTF(x) printf(x);
245 #define PRINTF1(x,y) printf(x,y);
212 #define PRINTF1(x,y) printf(x,y);
246 #define PRINTF2(x,y,z) printf(x,y,z);
213 #define PRINTF2(x,y,z) printf(x,y,z);
247 #else
214 #else
248 #define PRINTF(x) ;
215 #define PRINTF(x) ;
249 #define PRINTF1(x,y) ;
216 #define PRINTF1(x,y) ;
250 #define PRINTF2(x,y,z) ;
217 #define PRINTF2(x,y,z) ;
251 #endif
218 #endif
252
219
253 #ifdef BOOT_MESSAGES
220 #ifdef BOOT_MESSAGES
254 #define BOOT_PRINTF(x) printf(x);
221 #define BOOT_PRINTF(x) printf(x);
255 #define BOOT_PRINTF1(x,y) printf(x,y);
222 #define BOOT_PRINTF1(x,y) printf(x,y);
256 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
223 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
257 #else
224 #else
258 #define BOOT_PRINTF(x) ;
225 #define BOOT_PRINTF(x) ;
259 #define BOOT_PRINTF1(x,y) ;
226 #define BOOT_PRINTF1(x,y) ;
260 #define BOOT_PRINTF2(x,y,z) ;
227 #define BOOT_PRINTF2(x,y,z) ;
261 #endif
228 #endif
262
229
263 #ifdef DEBUG_MESSAGES
230 #ifdef DEBUG_MESSAGES
264 #define DEBUG_PRINTF(x) printf(x);
231 #define DEBUG_PRINTF(x) printf(x);
265 #define DEBUG_PRINTF1(x,y) printf(x,y);
232 #define DEBUG_PRINTF1(x,y) printf(x,y);
266 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
233 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
267 #else
234 #else
268 #define DEBUG_PRINTF(x) ;
235 #define DEBUG_PRINTF(x) ;
269 #define DEBUG_PRINTF1(x,y) ;
236 #define DEBUG_PRINTF1(x,y) ;
270 #define DEBUG_PRINTF2(x,y,z) ;
237 #define DEBUG_PRINTF2(x,y,z) ;
271 #endif
238 #endif
272
239
273 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
240 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
274
241
275 struct param_local_str{
242 struct param_local_str{
276 unsigned int local_sbm1_nb_cwf_sent;
243 unsigned int local_sbm1_nb_cwf_sent;
277 unsigned int local_sbm1_nb_cwf_max;
244 unsigned int local_sbm1_nb_cwf_max;
278 unsigned int local_sbm2_nb_cwf_sent;
245 unsigned int local_sbm2_nb_cwf_sent;
279 unsigned int local_sbm2_nb_cwf_max;
246 unsigned int local_sbm2_nb_cwf_max;
280 unsigned int local_nb_interrupt_f0_MAX;
247 unsigned int local_nb_interrupt_f0_MAX;
281 };
248 };
282
249
283 #endif // FSW_PARAMS_H_INCLUDED
250 #endif // FSW_PARAMS_H_INCLUDED
@@ -1,63 +1,65
1 #ifndef FSW_PARAMS_PROCESSING_H
1 #ifndef FSW_PARAMS_PROCESSING_H
2 #define FSW_PARAMS_PROCESSING_H
2 #define FSW_PARAMS_PROCESSING_H
3
3
4 #define NB_BINS_PER_SM 128
4 #define NB_BINS_PER_SM 128
5 #define NB_VALUES_PER_SM 25
5 #define NB_VALUES_PER_SM 25
6 #define TOTAL_SIZE_SM 3200 // 25 * 128
6 #define TOTAL_SIZE_SM 3200 // 25 * 128
7 #define TOTAL_SIZE_NORM_BP1_F0 99 // 11 * 9 = 99
7 #define TOTAL_SIZE_NORM_BP1_F0 99 // 11 * 9 = 99
8 #define TOTAL_SIZE_NORM_BP1_F1 117 // 13 * 9 = 117
8 #define TOTAL_SIZE_NORM_BP1_F1 117 // 13 * 9 = 117
9 #define TOTAL_SIZE_NORM_BP1_F2 108 // 12 * 9 = 108
9 #define TOTAL_SIZE_NORM_BP1_F2 108 // 12 * 9 = 108
10 #define TOTAL_SIZE_SBM1_BP1_F0 198 // 22 * 9 = 198
10 #define TOTAL_SIZE_SBM1_BP1_F0 198 // 22 * 9 = 198
11 //
11 //
12 #define NB_RING_NODES_SM_F0 12 // AT LEAST 3
12 #define NB_RING_NODES_SM_F0 12 // AT LEAST 3
13 #define NB_RING_NODES_ASM_BURST_SBM_F0 10 // AT LEAST 3
13 #define NB_RING_NODES_ASM_BURST_SBM_F0 10 // AT LEAST 3
14 #define NB_RING_NODES_ASM_NORM_F0 10 // AT LEAST 3
14 #define NB_RING_NODES_ASM_NORM_F0 10 // AT LEAST 3
15 #define NB_RING_NODES_SM_F1 3 // AT LEAST 3
15 #define NB_RING_NODES_SM_F1 3 // AT LEAST 3
16 #define NB_RING_NODES_ASM_BURST_SBM_F1 5 // AT LEAST 3
16 #define NB_RING_NODES_ASM_BURST_SBM_F1 5 // AT LEAST 3
17 #define NB_RING_NODES_ASM_NORM_F1 5 // AT LEAST 3
17 #define NB_RING_NODES_ASM_NORM_F1 5 // AT LEAST 3
18 #define NB_RING_NODES_SM_F2 3 // AT LEAST 3
18 #define NB_RING_NODES_SM_F2 3 // AT LEAST 3
19 #define NB_RING_NODES_ASM_BURST_SBM_F2 3 // AT LEAST 3
20 #define NB_RING_NODES_ASM_NORM_F2 3 // AT LEAST 3
19 //
21 //
20 #define NB_BINS_PER_ASM_F0 88
22 #define NB_BINS_PER_ASM_F0 88
21 #define NB_BINS_PER_PKT_ASM_F0 44
23 #define NB_BINS_PER_PKT_ASM_F0 44
22 #define TOTAL_SIZE_ASM_F0_IN_BYTES 4400 // 25 * 88 * 2
24 #define TOTAL_SIZE_ASM_F0_IN_BYTES 4400 // 25 * 88 * 2
23 #define ASM_F0_INDICE_START 17 // 88 bins
25 #define ASM_F0_INDICE_START 17 // 88 bins
24 #define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins
26 #define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins
25 //
27 //
26 #define NB_BINS_PER_ASM_F1 104
28 #define NB_BINS_PER_ASM_F1 104
27 #define NB_BINS_PER_PKT_ASM_F1 52
29 #define NB_BINS_PER_PKT_ASM_F1 52
28 #define TOTAL_SIZE_ASM_F1_IN_BYTES 5200 // 25 * 104 * 2
30 #define TOTAL_SIZE_ASM_F1_IN_BYTES 5200 // 25 * 104 * 2
29 #define ASM_F1_INDICE_START 6 // 104 bins
31 #define ASM_F1_INDICE_START 6 // 104 bins
30 #define ASM_F1_INDICE_STOP 109 // 2 packets of 52 bins
32 #define ASM_F1_INDICE_STOP 109 // 2 packets of 52 bins
31 //
33 //
32 #define NB_BINS_PER_ASM_F2 96
34 #define NB_BINS_PER_ASM_F2 96
33 #define NB_BINS_PER_PKT_ASM_F2 48
35 #define NB_BINS_PER_PKT_ASM_F2 48
34 #define TOTAL_SIZE_ASM_F2_IN_BYTES 4800 // 25 * 96 * 2
36 #define TOTAL_SIZE_ASM_F2_IN_BYTES 4800 // 25 * 96 * 2
35 #define ASM_F2_INDICE_START 7 // 96 bins
37 #define ASM_F2_INDICE_START 7 // 96 bins
36 #define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins
38 #define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins
37 //
39 //
38 #define NB_BINS_COMPRESSED_SM_F0 11
40 #define NB_BINS_COMPRESSED_SM_F0 11
39 #define NB_BINS_COMPRESSED_SM_F1 13
41 #define NB_BINS_COMPRESSED_SM_F1 13
40 #define NB_BINS_COMPRESSED_SM_F2 12
42 #define NB_BINS_COMPRESSED_SM_F2 12
41 #define NB_BINS_COMPRESSED_SM_SBM_F0 22
43 #define NB_BINS_COMPRESSED_SM_SBM_F0 22
42 #define NB_BINS_COMPRESSED_SM_SBM_F1 26
44 #define NB_BINS_COMPRESSED_SM_SBM_F1 26
43 #define NB_BINS_COMPRESSED_SM_SBM_F2 24
45 #define NB_BINS_COMPRESSED_SM_SBM_F2 24
44 //
46 //
45 #define NB_BINS_TO_AVERAGE_ASM_F0 8
47 #define NB_BINS_TO_AVERAGE_ASM_F0 8
46 #define NB_BINS_TO_AVERAGE_ASM_F1 8
48 #define NB_BINS_TO_AVERAGE_ASM_F1 8
47 #define NB_BINS_TO_AVERAGE_ASM_F2 8
49 #define NB_BINS_TO_AVERAGE_ASM_F2 8
48 #define NB_BINS_TO_AVERAGE_ASM_SBM_F0 4
50 #define NB_BINS_TO_AVERAGE_ASM_SBM_F0 4
49 #define NB_BINS_TO_AVERAGE_ASM_SBM_F1 4
51 #define NB_BINS_TO_AVERAGE_ASM_SBM_F1 4
50 #define NB_BINS_TO_AVERAGE_ASM_SBM_F2 4
52 #define NB_BINS_TO_AVERAGE_ASM_SBM_F2 4
51 //
53 //
52 #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F0 275 // 11 * 25 WORDS
54 #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F0 275 // 11 * 25 WORDS
53 #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F1 325 // 13 * 25 WORDS
55 #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F1 325 // 13 * 25 WORDS
54 #define TOTAL_SIZE_COMPRESSED_ASM_F2 300 // 12 * 25 WORDS
56 #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F2 300 // 12 * 25 WORDS
55 #define TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 550 // 22 * 25 WORDS
57 #define TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 550 // 22 * 25 WORDS
56 #define TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 650 // 26 * 25 WORDS
58 #define TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 650 // 26 * 25 WORDS
57 // NORM
59 #define TOTAL_SIZE_COMPRESSED_ASM_SBM_F2 600 // 24 * 25 WORDS
58 #define NB_SM_BEFORE_NORM_BP1_F0 384 // 96 * 4
59 // GENERAL
60 // GENERAL
60 #define NB_SM_BEFORE_AVF0 8
61 #define NB_SM_BEFORE_AVF0 8 // must be 8 due to the SM_average() function
61 #define NB_SM_BEFORE_AVF1 8
62 #define NB_SM_BEFORE_AVF1 8 // must be 8 due to the SM_average() function
63 #define NB_SM_BEFORE_AVF2 1 // must be 1 due to the SM_average_f2() function
62
64
63 #endif // FSW_PARAMS_PROCESSING_H
65 #endif // FSW_PARAMS_PROCESSING_H
@@ -1,50 +1,46
1 #ifndef TC_LOAD_DUMP_PARAMETERS_H
1 #ifndef TC_LOAD_DUMP_PARAMETERS_H
2 #define TC_LOAD_DUMP_PARAMETERS_H
2 #define TC_LOAD_DUMP_PARAMETERS_H
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <stdio.h>
5 #include <stdio.h>
6
6
7 #include "fsw_params.h"
7 #include "fsw_params.h"
8 #include "wf_handler.h"
8 #include "wf_handler.h"
9 #include "tm_lfr_tc_exe.h"
9 #include "tm_lfr_tc_exe.h"
10 #include "fsw_misc.h"
10 #include "fsw_misc.h"
11
11
12 extern nb_sm_before_bp_asm_f0 nb_sm_before_f0;
13 extern nb_sm_before_bp_asm_f1 nb_sm_before_f1;
14 extern nb_sm_before_bp_asm_f2 nb_sm_before_f2;
15
16 int action_load_common_par( ccsdsTelecommandPacket_t *TC );
12 int action_load_common_par( ccsdsTelecommandPacket_t *TC );
17 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
13 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
18 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
14 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
19 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
15 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
20 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
16 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
21 int action_dump_par(rtems_id queue_id );
17 int action_dump_par(rtems_id queue_id );
22
18
23 // NORMAL
19 // NORMAL
24 int set_sy_lfr_n_swf_l(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
20 int set_sy_lfr_n_swf_l(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
25 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
21 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
26 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
22 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
27 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
23 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
28 int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
24 int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
29 int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
25 int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
30
26
31 // BURST
27 // BURST
32 int set_sy_lfr_b_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
28 int set_sy_lfr_b_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
33 int set_sy_lfr_b_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
29 int set_sy_lfr_b_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
34
30
35 // SBM1
31 // SBM1
36 int set_sy_lfr_s1_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
32 int set_sy_lfr_s1_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
37 int set_sy_lfr_s1_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
33 int set_sy_lfr_s1_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
38
34
39 // SBM2
35 // SBM2
40 int set_sy_lfr_s2_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
36 int set_sy_lfr_s2_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
41 int set_sy_lfr_s2_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
37 int set_sy_lfr_s2_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
42
38
43 // TC_LFR_UPDATE_INFO
39 // TC_LFR_UPDATE_INFO
44 unsigned int check_update_info_hk_lfr_mode( unsigned char mode );
40 unsigned int check_update_info_hk_lfr_mode( unsigned char mode );
45 unsigned int check_update_info_hk_tds_mode( unsigned char mode );
41 unsigned int check_update_info_hk_tds_mode( unsigned char mode );
46 unsigned int check_update_info_hk_thr_mode( unsigned char mode );
42 unsigned int check_update_info_hk_thr_mode( unsigned char mode );
47
43
48 void init_parameter_dump( void );
44 void init_parameter_dump( void );
49
45
50 #endif // TC_LOAD_DUMP_PARAMETERS_H
46 #endif // TC_LOAD_DUMP_PARAMETERS_H
@@ -1,79 +1,75
1 /** Global variables of the LFR flight software.
1 /** Global variables of the LFR flight software.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * Among global variables, there are:
6 * Among global variables, there are:
7 * - RTEMS names and id.
7 * - RTEMS names and id.
8 * - APB configuration registers.
8 * - APB configuration registers.
9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
10 * - spectral matrices buffesr, used by the hardware module to store data.
10 * - spectral matrices buffesr, used by the hardware module to store data.
11 * - variable related to LFR modes parameters.
11 * - variable related to LFR modes parameters.
12 * - the global HK packet buffer.
12 * - the global HK packet buffer.
13 * - the global dump parameter buffer.
13 * - the global dump parameter buffer.
14 *
14 *
15 */
15 */
16
16
17 #include <rtems.h>
17 #include <rtems.h>
18 #include <grspw.h>
18 #include <grspw.h>
19
19
20 #include "ccsds_types.h"
20 #include "ccsds_types.h"
21 #include "grlib_regs.h"
21 #include "grlib_regs.h"
22 #include "fsw_params.h"
22 #include "fsw_params.h"
23
23
24 // RTEMS GLOBAL VARIABLES
24 // RTEMS GLOBAL VARIABLES
25 rtems_name misc_name[5];
25 rtems_name misc_name[5];
26 rtems_id misc_id[5];
26 rtems_id misc_id[5];
27 rtems_name Task_name[20]; /* array of task names */
27 rtems_name Task_name[20]; /* array of task names */
28 rtems_id Task_id[20]; /* array of task ids */
28 rtems_id Task_id[20]; /* array of task ids */
29 unsigned int maxCount;
29 unsigned int maxCount;
30 int fdSPW = 0;
30 int fdSPW = 0;
31 int fdUART = 0;
31 int fdUART = 0;
32 unsigned char lfrCurrentMode;
32 unsigned char lfrCurrentMode;
33
33
34 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584
34 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584
35 // 97 * 256 = 24832 => delta = 248 bytes = 62 words
35 // 97 * 256 = 24832 => delta = 248 bytes = 62 words
36 // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264
36 // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264
37 // 127 * 256 = 32512 => delta = 248 bytes = 62 words
37 // 127 * 256 = 32512 => delta = 248 bytes = 62 words
38 // F0
38 // F0
39 volatile int wf_snap_f0[ NB_RING_NODES_F0 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100)));
39 volatile int wf_snap_f0[ NB_RING_NODES_F0 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100)));
40 // F1 F2
40 // F1 F2
41 volatile int wf_snap_f1[ NB_RING_NODES_F1 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100)));
41 volatile int wf_snap_f1[ NB_RING_NODES_F1 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100)));
42 volatile int wf_snap_f2[ NB_RING_NODES_F2 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100)));
42 volatile int wf_snap_f2[ NB_RING_NODES_F2 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100)));
43 // F3
43 // F3
44 volatile int wf_cont_f3_a [ (NB_SAMPLES_PER_SNAPSHOT) * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
44 volatile int wf_cont_f3_a [ (NB_SAMPLES_PER_SNAPSHOT) * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
45 volatile int wf_cont_f3_b [ (NB_SAMPLES_PER_SNAPSHOT) * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
45 volatile int wf_cont_f3_b [ (NB_SAMPLES_PER_SNAPSHOT) * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
46 char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK + TIME_OFFSET_IN_BYTES ] __attribute__((aligned(0x100)));
46 char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK + TIME_OFFSET_IN_BYTES ] __attribute__((aligned(0x100)));
47
47
48 //***********************************
48 //***********************************
49 // SPECTRAL MATRICES GLOBAL VARIABLES
49 // SPECTRAL MATRICES GLOBAL VARIABLES
50
50
51 nb_sm_before_bp_asm_f0 nb_sm_before_f0;
52 nb_sm_before_bp_asm_f1 nb_sm_before_f1;
53 nb_sm_before_bp_asm_f2 nb_sm_before_f2;
54
55 // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00
51 // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00
56 volatile int sm_f0[ NB_RING_NODES_SM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
52 volatile int sm_f0[ NB_RING_NODES_SM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
57 volatile int sm_f1[ NB_RING_NODES_SM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
53 volatile int sm_f1[ NB_RING_NODES_SM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
58 volatile int sm_f2[ NB_RING_NODES_SM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
54 volatile int sm_f2[ NB_RING_NODES_SM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100)));
59
55
60 // APB CONFIGURATION REGISTERS
56 // APB CONFIGURATION REGISTERS
61 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
57 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
62 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
58 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
63 waveform_picker_regs_new_t *waveform_picker_regs = (waveform_picker_regs_new_t*) REGS_ADDR_WAVEFORM_PICKER;
59 waveform_picker_regs_new_t *waveform_picker_regs = (waveform_picker_regs_new_t*) REGS_ADDR_WAVEFORM_PICKER;
64 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
60 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
65
61
66 // MODE PARAMETERS
62 // MODE PARAMETERS
67 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
63 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
68 struct param_local_str param_local;
64 struct param_local_str param_local;
69
65
70 // HK PACKETS
66 // HK PACKETS
71 Packet_TM_LFR_HK_t housekeeping_packet;
67 Packet_TM_LFR_HK_t housekeeping_packet;
72 // sequence counters are incremented by APID (PID + CAT) and destination ID
68 // sequence counters are incremented by APID (PID + CAT) and destination ID
73 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
69 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
74 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
70 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
75 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
71 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
76 spw_stats spacewire_stats;
72 spw_stats spacewire_stats;
77 spw_stats spacewire_stats_backup;
73 spw_stats spacewire_stats_backup;
78
74
79
75
@@ -1,709 +1,767
1 /** This is the RTEMS initialization module.
1 /** This is the RTEMS initialization module.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * This module contains two very different information:
6 * This module contains two very different information:
7 * - specific instructions to configure the compilation of the RTEMS executive
7 * - specific instructions to configure the compilation of the RTEMS executive
8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
9 *
9 *
10 */
10 */
11
11
12 //*************************
12 //*************************
13 // GPL reminder to be added
13 // GPL reminder to be added
14 //*************************
14 //*************************
15
15
16 #include <rtems.h>
16 #include <rtems.h>
17
17
18 /* configuration information */
18 /* configuration information */
19
19
20 #define CONFIGURE_INIT
20 #define CONFIGURE_INIT
21
21
22 #include <bsp.h> /* for device driver prototypes */
22 #include <bsp.h> /* for device driver prototypes */
23
23
24 /* configuration information */
24 /* configuration information */
25
25
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
28
28
29 #define CONFIGURE_MAXIMUM_TASKS 20
29 #define CONFIGURE_MAXIMUM_TASKS 20
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
35 #define CONFIGURE_MAXIMUM_DRIVERS 16
35 #define CONFIGURE_MAXIMUM_DRIVERS 16
36 #define CONFIGURE_MAXIMUM_PERIODS 5
36 #define CONFIGURE_MAXIMUM_PERIODS 5
37 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
37 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
38 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 4
38 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 5
39 #ifdef PRINT_STACK_REPORT
39 #ifdef PRINT_STACK_REPORT
40 #define CONFIGURE_STACK_CHECKER_ENABLED
40 #define CONFIGURE_STACK_CHECKER_ENABLED
41 #endif
41 #endif
42
42
43 #include <rtems/confdefs.h>
43 #include <rtems/confdefs.h>
44
44
45 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
45 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
46 #ifdef RTEMS_DRVMGR_STARTUP
46 #ifdef RTEMS_DRVMGR_STARTUP
47 #ifdef LEON3
47 #ifdef LEON3
48 /* Add Timer and UART Driver */
48 /* Add Timer and UART Driver */
49 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
49 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
50 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
50 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
51 #endif
51 #endif
52 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
52 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
53 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
53 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
54 #endif
54 #endif
55 #endif
55 #endif
56 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
56 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
57 #include <drvmgr/drvmgr_confdefs.h>
57 #include <drvmgr/drvmgr_confdefs.h>
58 #endif
58 #endif
59
59
60 #include "fsw_init.h"
60 #include "fsw_init.h"
61 #include "fsw_config.c"
61 #include "fsw_config.c"
62
62
63 rtems_task Init( rtems_task_argument ignored )
63 rtems_task Init( rtems_task_argument ignored )
64 {
64 {
65 /** This is the RTEMS INIT taks, it the first task launched by the system.
65 /** This is the RTEMS INIT taks, it the first task launched by the system.
66 *
66 *
67 * @param unused is the starting argument of the RTEMS task
67 * @param unused is the starting argument of the RTEMS task
68 *
68 *
69 * The INIT task create and run all other RTEMS tasks.
69 * The INIT task create and run all other RTEMS tasks.
70 *
70 *
71 */
71 */
72
72
73 reset_local_time();
73 reset_local_time();
74
74
75 rtems_status_code status;
75 rtems_status_code status;
76 rtems_status_code status_spw;
76 rtems_status_code status_spw;
77 rtems_isr_entry old_isr_handler;
77 rtems_isr_entry old_isr_handler;
78
78
79 // UART settings
79 // UART settings
80 send_console_outputs_on_apbuart_port();
80 send_console_outputs_on_apbuart_port();
81 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
81 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
82 enable_apbuart_transmitter();
82 enable_apbuart_transmitter();
83 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
83 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
84
84
85 PRINTF("\n\n\n\n\n")
85 PRINTF("\n\n\n\n\n")
86 PRINTF("*************************\n")
86 PRINTF("*************************\n")
87 PRINTF("** LFR Flight Software **\n")
87 PRINTF("** LFR Flight Software **\n")
88 PRINTF1("** %d.", SW_VERSION_N1)
88 PRINTF1("** %d.", SW_VERSION_N1)
89 PRINTF1("%d." , SW_VERSION_N2)
89 PRINTF1("%d." , SW_VERSION_N2)
90 PRINTF1("%d." , SW_VERSION_N3)
90 PRINTF1("%d." , SW_VERSION_N3)
91 PRINTF1("%d **\n", SW_VERSION_N4)
91 PRINTF1("%d **\n", SW_VERSION_N4)
92 PRINTF("*************************\n")
92 PRINTF("*************************\n")
93 PRINTF("\n\n")
93 PRINTF("\n\n")
94
94
95 init_parameter_dump();
95 init_parameter_dump();
96 init_local_mode_parameters();
96 init_local_mode_parameters();
97 init_housekeeping_parameters();
97 init_housekeeping_parameters();
98
98
99 init_waveform_rings(); // initialize the waveform rings
99 init_waveform_rings(); // initialize the waveform rings
100 SM_init_rings(); // initialize spectral matrices rings
100 SM_init_rings(); // initialize spectral matrices rings
101 ASM_init_rings(); // initialize the average spectral matrix ring (just for burst, sbm1 and sbm2 asm @ f0 storage)
102
101
103 reset_wfp_burst_enable();
102 reset_wfp_burst_enable();
104 reset_wfp_status();
103 reset_wfp_status();
105 set_wfp_data_shaping();
104 set_wfp_data_shaping();
106
105
107 updateLFRCurrentMode();
106 updateLFRCurrentMode();
108
107
109 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
108 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
110
109
111 create_names(); // create all names
110 create_names(); // create all names
112
111
113 status = create_message_queues(); // create message queues
112 status = create_message_queues(); // create message queues
114 if (status != RTEMS_SUCCESSFUL)
113 if (status != RTEMS_SUCCESSFUL)
115 {
114 {
116 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
115 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
117 }
116 }
118
117
119 status = create_all_tasks(); // create all tasks
118 status = create_all_tasks(); // create all tasks
120 if (status != RTEMS_SUCCESSFUL)
119 if (status != RTEMS_SUCCESSFUL)
121 {
120 {
122 PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status)
121 PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status)
123 }
122 }
124
123
125 // **************************
124 // **************************
126 // <SPACEWIRE INITIALIZATION>
125 // <SPACEWIRE INITIALIZATION>
127 grspw_timecode_callback = &timecode_irq_handler;
126 grspw_timecode_callback = &timecode_irq_handler;
128
127
129 status_spw = spacewire_open_link(); // (1) open the link
128 status_spw = spacewire_open_link(); // (1) open the link
130 if ( status_spw != RTEMS_SUCCESSFUL )
129 if ( status_spw != RTEMS_SUCCESSFUL )
131 {
130 {
132 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
131 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
133 }
132 }
134
133
135 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
134 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
136 {
135 {
137 status_spw = spacewire_configure_link( fdSPW );
136 status_spw = spacewire_configure_link( fdSPW );
138 if ( status_spw != RTEMS_SUCCESSFUL )
137 if ( status_spw != RTEMS_SUCCESSFUL )
139 {
138 {
140 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
139 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
141 }
140 }
142 }
141 }
143
142
144 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
143 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
145 {
144 {
146 status_spw = spacewire_start_link( fdSPW );
145 status_spw = spacewire_start_link( fdSPW );
147 if ( status_spw != RTEMS_SUCCESSFUL )
146 if ( status_spw != RTEMS_SUCCESSFUL )
148 {
147 {
149 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
148 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
150 }
149 }
151 }
150 }
152 // </SPACEWIRE INITIALIZATION>
151 // </SPACEWIRE INITIALIZATION>
153 // ***************************
152 // ***************************
154
153
155 status = start_all_tasks(); // start all tasks
154 status = start_all_tasks(); // start all tasks
156 if (status != RTEMS_SUCCESSFUL)
155 if (status != RTEMS_SUCCESSFUL)
157 {
156 {
158 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
157 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
159 }
158 }
160
159
161 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
160 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
162 status = start_recv_send_tasks();
161 status = start_recv_send_tasks();
163 if ( status != RTEMS_SUCCESSFUL )
162 if ( status != RTEMS_SUCCESSFUL )
164 {
163 {
165 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
164 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
166 }
165 }
167
166
168 // suspend science tasks, they will be restarted later depending on the mode
167 // suspend science tasks, they will be restarted later depending on the mode
169 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
168 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
170 if (status != RTEMS_SUCCESSFUL)
169 if (status != RTEMS_SUCCESSFUL)
171 {
170 {
172 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
171 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
173 }
172 }
174
173
175 //******************************
174 //******************************
176 // <SPECTRAL MATRICES SIMULATOR>
175 // <SPECTRAL MATRICES SIMULATOR>
177 LEON_Mask_interrupt( IRQ_SM_SIMULATOR );
176 LEON_Mask_interrupt( IRQ_SM_SIMULATOR );
178 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
177 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
179 IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu );
178 IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu );
180 // </SPECTRAL MATRICES SIMULATOR>
179 // </SPECTRAL MATRICES SIMULATOR>
181 //*******************************
180 //*******************************
182
181
183 // configure IRQ handling for the waveform picker unit
182 // configure IRQ handling for the waveform picker unit
184 status = rtems_interrupt_catch( waveforms_isr,
183 status = rtems_interrupt_catch( waveforms_isr,
185 IRQ_SPARC_WAVEFORM_PICKER,
184 IRQ_SPARC_WAVEFORM_PICKER,
186 &old_isr_handler) ;
185 &old_isr_handler) ;
187 // configure IRQ handling for the spectral matrices unit
186 // configure IRQ handling for the spectral matrices unit
188 status = rtems_interrupt_catch( spectral_matrices_isr,
187 status = rtems_interrupt_catch( spectral_matrices_isr,
189 IRQ_SPARC_SPECTRAL_MATRIX,
188 IRQ_SPARC_SPECTRAL_MATRIX,
190 &old_isr_handler) ;
189 &old_isr_handler) ;
191
190
192 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
191 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
193 if ( status_spw != RTEMS_SUCCESSFUL )
192 if ( status_spw != RTEMS_SUCCESSFUL )
194 {
193 {
195 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
194 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
196 if ( status != RTEMS_SUCCESSFUL ) {
195 if ( status != RTEMS_SUCCESSFUL ) {
197 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
196 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
198 }
197 }
199 }
198 }
200
199
201 BOOT_PRINTF("delete INIT\n")
200 BOOT_PRINTF("delete INIT\n")
202
201
203 send_dumb_hk();
202 send_dumb_hk();
204
203
205 status = rtems_task_delete(RTEMS_SELF);
204 status = rtems_task_delete(RTEMS_SELF);
206
205
207 }
206 }
208
207
209 void init_local_mode_parameters( void )
208 void init_local_mode_parameters( void )
210 {
209 {
211 /** This function initialize the param_local global variable with default values.
210 /** This function initialize the param_local global variable with default values.
212 *
211 *
213 */
212 */
214
213
215 unsigned int i;
214 unsigned int i;
216
215
217 // LOCAL PARAMETERS
216 // LOCAL PARAMETERS
218 set_local_nb_interrupt_f0_MAX();
217 set_local_nb_interrupt_f0_MAX();
219
218
220 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
219 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
221 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
220 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
222 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
221 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
223
222
224 // init sequence counters
223 // init sequence counters
225
224
226 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
225 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
227 {
226 {
228 sequenceCounters_TC_EXE[i] = 0x00;
227 sequenceCounters_TC_EXE[i] = 0x00;
229 }
228 }
230 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
229 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
231 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
230 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
232 }
231 }
233
232
234 void reset_local_time( void )
233 void reset_local_time( void )
235 {
234 {
236 time_management_regs->ctrl = 0x02; // software reset, coarse time = 0x80000000
235 time_management_regs->ctrl = 0x02; // software reset, coarse time = 0x80000000
237 }
236 }
238
237
239 void create_names( void ) // create all names for tasks and queues
238 void create_names( void ) // create all names for tasks and queues
240 {
239 {
241 /** This function creates all RTEMS names used in the software for tasks and queues.
240 /** This function creates all RTEMS names used in the software for tasks and queues.
242 *
241 *
243 * @return RTEMS directive status codes:
242 * @return RTEMS directive status codes:
244 * - RTEMS_SUCCESSFUL - successful completion
243 * - RTEMS_SUCCESSFUL - successful completion
245 *
244 *
246 */
245 */
247
246
248 // task names
247 // task names
249 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
248 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
250 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
249 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
251 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
250 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
252 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
251 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
253 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
252 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
254 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
253 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
255 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
254 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
256 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
255 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
257 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
256 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
258 Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' );
257 Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' );
259 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
258 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
260 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
259 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
261 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
260 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
262 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
261 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
263 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
262 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
264 Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' );
263 Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' );
265 Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' );
264 Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' );
265 Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' );
266 Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' );
266
267
267 // rate monotonic period names
268 // rate monotonic period names
268 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
269 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
269
270
270 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
271 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
271 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
272 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
272 misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' );
273 misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' );
273 misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' );
274 misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' );
275 misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' );
274 }
276 }
275
277
276 int create_all_tasks( void ) // create all tasks which run in the software
278 int create_all_tasks( void ) // create all tasks which run in the software
277 {
279 {
278 /** This function creates all RTEMS tasks used in the software.
280 /** This function creates all RTEMS tasks used in the software.
279 *
281 *
280 * @return RTEMS directive status codes:
282 * @return RTEMS directive status codes:
281 * - RTEMS_SUCCESSFUL - task created successfully
283 * - RTEMS_SUCCESSFUL - task created successfully
282 * - RTEMS_INVALID_ADDRESS - id is NULL
284 * - RTEMS_INVALID_ADDRESS - id is NULL
283 * - RTEMS_INVALID_NAME - invalid task name
285 * - RTEMS_INVALID_NAME - invalid task name
284 * - RTEMS_INVALID_PRIORITY - invalid task priority
286 * - RTEMS_INVALID_PRIORITY - invalid task priority
285 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
287 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
286 * - RTEMS_TOO_MANY - too many tasks created
288 * - RTEMS_TOO_MANY - too many tasks created
287 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
289 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
288 * - RTEMS_TOO_MANY - too many global objects
290 * - RTEMS_TOO_MANY - too many global objects
289 *
291 *
290 */
292 */
291
293
292 rtems_status_code status;
294 rtems_status_code status;
293
295
294 //**********
296 //**********
295 // SPACEWIRE
297 // SPACEWIRE
296 // RECV
298 // RECV
297 status = rtems_task_create(
299 status = rtems_task_create(
298 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
300 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
299 RTEMS_DEFAULT_MODES,
301 RTEMS_DEFAULT_MODES,
300 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
302 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
301 );
303 );
302 if (status == RTEMS_SUCCESSFUL) // SEND
304 if (status == RTEMS_SUCCESSFUL) // SEND
303 {
305 {
304 status = rtems_task_create(
306 status = rtems_task_create(
305 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
307 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
306 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
308 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
307 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
309 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
308 );
310 );
309 }
311 }
310 if (status == RTEMS_SUCCESSFUL) // WTDG
312 if (status == RTEMS_SUCCESSFUL) // WTDG
311 {
313 {
312 status = rtems_task_create(
314 status = rtems_task_create(
313 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
315 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
314 RTEMS_DEFAULT_MODES,
316 RTEMS_DEFAULT_MODES,
315 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
317 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
316 );
318 );
317 }
319 }
318 if (status == RTEMS_SUCCESSFUL) // ACTN
320 if (status == RTEMS_SUCCESSFUL) // ACTN
319 {
321 {
320 status = rtems_task_create(
322 status = rtems_task_create(
321 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
323 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
322 RTEMS_DEFAULT_MODES,
324 RTEMS_DEFAULT_MODES,
323 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
325 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
324 );
326 );
325 }
327 }
326 if (status == RTEMS_SUCCESSFUL) // SPIQ
328 if (status == RTEMS_SUCCESSFUL) // SPIQ
327 {
329 {
328 status = rtems_task_create(
330 status = rtems_task_create(
329 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
331 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
330 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
332 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
331 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
333 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
332 );
334 );
333 }
335 }
334
336
335 //******************
337 //******************
336 // SPECTRAL MATRICES
338 // SPECTRAL MATRICES
337 if (status == RTEMS_SUCCESSFUL) // AVF0
339 if (status == RTEMS_SUCCESSFUL) // AVF0
338 {
340 {
339 status = rtems_task_create(
341 status = rtems_task_create(
340 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
342 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
341 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
343 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
342 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
344 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
343 );
345 );
344 }
346 }
345 if (status == RTEMS_SUCCESSFUL) // PRC0
347 if (status == RTEMS_SUCCESSFUL) // PRC0
346 {
348 {
347 status = rtems_task_create(
349 status = rtems_task_create(
348 Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2,
350 Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2,
349 RTEMS_DEFAULT_MODES,
351 RTEMS_DEFAULT_MODES,
350 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0]
352 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0]
351 );
353 );
352 }
354 }
353 if (status == RTEMS_SUCCESSFUL) // AVF1
355 if (status == RTEMS_SUCCESSFUL) // AVF1
354 {
356 {
355 status = rtems_task_create(
357 status = rtems_task_create(
356 Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE,
358 Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE,
357 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
359 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
358 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1]
360 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1]
359 );
361 );
360 }
362 }
361 if (status == RTEMS_SUCCESSFUL) // PRC1
363 if (status == RTEMS_SUCCESSFUL) // PRC1
362 {
364 {
363 status = rtems_task_create(
365 status = rtems_task_create(
364 Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2,
366 Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2,
365 RTEMS_DEFAULT_MODES,
367 RTEMS_DEFAULT_MODES,
366 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1]
368 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1]
367 );
369 );
368 }
370 }
371 if (status == RTEMS_SUCCESSFUL) // AVF2
372 {
373 status = rtems_task_create(
374 Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE,
375 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
376 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF2]
377 );
378 }
379 if (status == RTEMS_SUCCESSFUL) // PRC2
380 {
381 status = rtems_task_create(
382 Task_name[TASKID_PRC2], TASK_PRIORITY_PRC2, RTEMS_MINIMUM_STACK_SIZE * 2,
383 RTEMS_DEFAULT_MODES,
384 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC2]
385 );
386 }
369
387
370 //****************
388 //****************
371 // WAVEFORM PICKER
389 // WAVEFORM PICKER
372 if (status == RTEMS_SUCCESSFUL) // WFRM
390 if (status == RTEMS_SUCCESSFUL) // WFRM
373 {
391 {
374 status = rtems_task_create(
392 status = rtems_task_create(
375 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
393 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
376 RTEMS_DEFAULT_MODES,
394 RTEMS_DEFAULT_MODES,
377 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
395 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
378 );
396 );
379 }
397 }
380 if (status == RTEMS_SUCCESSFUL) // CWF3
398 if (status == RTEMS_SUCCESSFUL) // CWF3
381 {
399 {
382 status = rtems_task_create(
400 status = rtems_task_create(
383 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
401 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
384 RTEMS_DEFAULT_MODES,
402 RTEMS_DEFAULT_MODES,
385 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3]
403 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3]
386 );
404 );
387 }
405 }
388 if (status == RTEMS_SUCCESSFUL) // CWF2
406 if (status == RTEMS_SUCCESSFUL) // CWF2
389 {
407 {
390 status = rtems_task_create(
408 status = rtems_task_create(
391 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
409 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
392 RTEMS_DEFAULT_MODES,
410 RTEMS_DEFAULT_MODES,
393 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2]
411 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2]
394 );
412 );
395 }
413 }
396 if (status == RTEMS_SUCCESSFUL) // CWF1
414 if (status == RTEMS_SUCCESSFUL) // CWF1
397 {
415 {
398 status = rtems_task_create(
416 status = rtems_task_create(
399 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
417 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
400 RTEMS_DEFAULT_MODES,
418 RTEMS_DEFAULT_MODES,
401 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1]
419 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1]
402 );
420 );
403 }
421 }
404 if (status == RTEMS_SUCCESSFUL) // SWBD
422 if (status == RTEMS_SUCCESSFUL) // SWBD
405 {
423 {
406 status = rtems_task_create(
424 status = rtems_task_create(
407 Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE,
425 Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE,
408 RTEMS_DEFAULT_MODES,
426 RTEMS_DEFAULT_MODES,
409 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD]
427 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD]
410 );
428 );
411 }
429 }
412
430
413 //*****
431 //*****
414 // MISC
432 // MISC
415 if (status == RTEMS_SUCCESSFUL) // STAT
433 if (status == RTEMS_SUCCESSFUL) // STAT
416 {
434 {
417 status = rtems_task_create(
435 status = rtems_task_create(
418 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
436 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
419 RTEMS_DEFAULT_MODES,
437 RTEMS_DEFAULT_MODES,
420 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
438 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
421 );
439 );
422 }
440 }
423 if (status == RTEMS_SUCCESSFUL) // DUMB
441 if (status == RTEMS_SUCCESSFUL) // DUMB
424 {
442 {
425 status = rtems_task_create(
443 status = rtems_task_create(
426 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
444 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
427 RTEMS_DEFAULT_MODES,
445 RTEMS_DEFAULT_MODES,
428 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
446 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
429 );
447 );
430 }
448 }
431 if (status == RTEMS_SUCCESSFUL) // HOUS
449 if (status == RTEMS_SUCCESSFUL) // HOUS
432 {
450 {
433 status = rtems_task_create(
451 status = rtems_task_create(
434 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
452 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
435 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
453 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
436 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
454 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
437 );
455 );
438 }
456 }
439
457
440 return status;
458 return status;
441 }
459 }
442
460
443 int start_recv_send_tasks( void )
461 int start_recv_send_tasks( void )
444 {
462 {
445 rtems_status_code status;
463 rtems_status_code status;
446
464
447 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
465 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
448 if (status!=RTEMS_SUCCESSFUL) {
466 if (status!=RTEMS_SUCCESSFUL) {
449 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
467 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
450 }
468 }
451
469
452 if (status == RTEMS_SUCCESSFUL) // SEND
470 if (status == RTEMS_SUCCESSFUL) // SEND
453 {
471 {
454 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
472 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
455 if (status!=RTEMS_SUCCESSFUL) {
473 if (status!=RTEMS_SUCCESSFUL) {
456 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
474 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
457 }
475 }
458 }
476 }
459
477
460 return status;
478 return status;
461 }
479 }
462
480
463 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
481 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
464 {
482 {
465 /** This function starts all RTEMS tasks used in the software.
483 /** This function starts all RTEMS tasks used in the software.
466 *
484 *
467 * @return RTEMS directive status codes:
485 * @return RTEMS directive status codes:
468 * - RTEMS_SUCCESSFUL - ask started successfully
486 * - RTEMS_SUCCESSFUL - ask started successfully
469 * - RTEMS_INVALID_ADDRESS - invalid task entry point
487 * - RTEMS_INVALID_ADDRESS - invalid task entry point
470 * - RTEMS_INVALID_ID - invalid task id
488 * - RTEMS_INVALID_ID - invalid task id
471 * - RTEMS_INCORRECT_STATE - task not in the dormant state
489 * - RTEMS_INCORRECT_STATE - task not in the dormant state
472 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
490 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
473 *
491 *
474 */
492 */
475 // starts all the tasks fot eh flight software
493 // starts all the tasks fot eh flight software
476
494
477 rtems_status_code status;
495 rtems_status_code status;
478
496
479 //**********
497 //**********
480 // SPACEWIRE
498 // SPACEWIRE
481 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
499 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
482 if (status!=RTEMS_SUCCESSFUL) {
500 if (status!=RTEMS_SUCCESSFUL) {
483 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
501 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
484 }
502 }
485
503
486 if (status == RTEMS_SUCCESSFUL) // WTDG
504 if (status == RTEMS_SUCCESSFUL) // WTDG
487 {
505 {
488 status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 );
506 status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 );
489 if (status!=RTEMS_SUCCESSFUL) {
507 if (status!=RTEMS_SUCCESSFUL) {
490 BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n")
508 BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n")
491 }
509 }
492 }
510 }
493
511
494 if (status == RTEMS_SUCCESSFUL) // ACTN
512 if (status == RTEMS_SUCCESSFUL) // ACTN
495 {
513 {
496 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
514 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
497 if (status!=RTEMS_SUCCESSFUL) {
515 if (status!=RTEMS_SUCCESSFUL) {
498 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
516 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
499 }
517 }
500 }
518 }
501
519
502 //******************
520 //******************
503 // SPECTRAL MATRICES
521 // SPECTRAL MATRICES
504 if (status == RTEMS_SUCCESSFUL) // AVF0
522 if (status == RTEMS_SUCCESSFUL) // AVF0
505 {
523 {
506 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, LFR_MODE_STANDBY );
524 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, LFR_MODE_STANDBY );
507 if (status!=RTEMS_SUCCESSFUL) {
525 if (status!=RTEMS_SUCCESSFUL) {
508 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
526 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
509 }
527 }
510 }
528 }
511 if (status == RTEMS_SUCCESSFUL) // PRC0
529 if (status == RTEMS_SUCCESSFUL) // PRC0
512 {
530 {
513 status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, LFR_MODE_STANDBY );
531 status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, LFR_MODE_STANDBY );
514 if (status!=RTEMS_SUCCESSFUL) {
532 if (status!=RTEMS_SUCCESSFUL) {
515 BOOT_PRINTF("in INIT *** Error starting TASK_PRC0\n")
533 BOOT_PRINTF("in INIT *** Error starting TASK_PRC0\n")
516 }
534 }
517 }
535 }
518 if (status == RTEMS_SUCCESSFUL) // AVF1
536 if (status == RTEMS_SUCCESSFUL) // AVF1
519 {
537 {
520 status = rtems_task_start( Task_id[TASKID_AVF1], avf1_task, LFR_MODE_STANDBY );
538 status = rtems_task_start( Task_id[TASKID_AVF1], avf1_task, LFR_MODE_STANDBY );
521 if (status!=RTEMS_SUCCESSFUL) {
539 if (status!=RTEMS_SUCCESSFUL) {
522 BOOT_PRINTF("in INIT *** Error starting TASK_AVF1\n")
540 BOOT_PRINTF("in INIT *** Error starting TASK_AVF1\n")
523 }
541 }
524 }
542 }
525 if (status == RTEMS_SUCCESSFUL) // PRC1
543 if (status == RTEMS_SUCCESSFUL) // PRC1
526 {
544 {
527 status = rtems_task_start( Task_id[TASKID_PRC1], prc1_task, LFR_MODE_STANDBY );
545 status = rtems_task_start( Task_id[TASKID_PRC1], prc1_task, LFR_MODE_STANDBY );
528 if (status!=RTEMS_SUCCESSFUL) {
546 if (status!=RTEMS_SUCCESSFUL) {
529 BOOT_PRINTF("in INIT *** Error starting TASK_PRC1\n")
547 BOOT_PRINTF("in INIT *** Error starting TASK_PRC1\n")
530 }
548 }
531 }
549 }
550 if (status == RTEMS_SUCCESSFUL) // AVF2
551 {
552 status = rtems_task_start( Task_id[TASKID_AVF2], avf2_task, 1 );
553 if (status!=RTEMS_SUCCESSFUL) {
554 BOOT_PRINTF("in INIT *** Error starting TASK_AVF2\n")
555 }
556 }
557 if (status == RTEMS_SUCCESSFUL) // PRC2
558 {
559 status = rtems_task_start( Task_id[TASKID_PRC2], prc2_task, 1 );
560 if (status!=RTEMS_SUCCESSFUL) {
561 BOOT_PRINTF("in INIT *** Error starting TASK_PRC2\n")
562 }
563 }
532
564
533 //****************
565 //****************
534 // WAVEFORM PICKER
566 // WAVEFORM PICKER
535 if (status == RTEMS_SUCCESSFUL) // WFRM
567 if (status == RTEMS_SUCCESSFUL) // WFRM
536 {
568 {
537 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
569 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
538 if (status!=RTEMS_SUCCESSFUL) {
570 if (status!=RTEMS_SUCCESSFUL) {
539 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
571 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
540 }
572 }
541 }
573 }
542 if (status == RTEMS_SUCCESSFUL) // CWF3
574 if (status == RTEMS_SUCCESSFUL) // CWF3
543 {
575 {
544 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
576 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
545 if (status!=RTEMS_SUCCESSFUL) {
577 if (status!=RTEMS_SUCCESSFUL) {
546 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
578 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
547 }
579 }
548 }
580 }
549 if (status == RTEMS_SUCCESSFUL) // CWF2
581 if (status == RTEMS_SUCCESSFUL) // CWF2
550 {
582 {
551 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
583 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
552 if (status!=RTEMS_SUCCESSFUL) {
584 if (status!=RTEMS_SUCCESSFUL) {
553 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
585 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
554 }
586 }
555 }
587 }
556 if (status == RTEMS_SUCCESSFUL) // CWF1
588 if (status == RTEMS_SUCCESSFUL) // CWF1
557 {
589 {
558 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
590 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
559 if (status!=RTEMS_SUCCESSFUL) {
591 if (status!=RTEMS_SUCCESSFUL) {
560 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
592 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
561 }
593 }
562 }
594 }
563 if (status == RTEMS_SUCCESSFUL) // SWBD
595 if (status == RTEMS_SUCCESSFUL) // SWBD
564 {
596 {
565 status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 );
597 status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 );
566 if (status!=RTEMS_SUCCESSFUL) {
598 if (status!=RTEMS_SUCCESSFUL) {
567 BOOT_PRINTF("in INIT *** Error starting TASK_SWBD\n")
599 BOOT_PRINTF("in INIT *** Error starting TASK_SWBD\n")
568 }
600 }
569 }
601 }
570
602
571 //*****
603 //*****
572 // MISC
604 // MISC
573 if (status == RTEMS_SUCCESSFUL) // HOUS
605 if (status == RTEMS_SUCCESSFUL) // HOUS
574 {
606 {
575 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
607 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
576 if (status!=RTEMS_SUCCESSFUL) {
608 if (status!=RTEMS_SUCCESSFUL) {
577 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
609 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
578 }
610 }
579 }
611 }
580 if (status == RTEMS_SUCCESSFUL) // DUMB
612 if (status == RTEMS_SUCCESSFUL) // DUMB
581 {
613 {
582 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
614 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
583 if (status!=RTEMS_SUCCESSFUL) {
615 if (status!=RTEMS_SUCCESSFUL) {
584 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
616 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
585 }
617 }
586 }
618 }
587 if (status == RTEMS_SUCCESSFUL) // STAT
619 if (status == RTEMS_SUCCESSFUL) // STAT
588 {
620 {
589 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
621 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
590 if (status!=RTEMS_SUCCESSFUL) {
622 if (status!=RTEMS_SUCCESSFUL) {
591 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
623 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
592 }
624 }
593 }
625 }
594
626
595 return status;
627 return status;
596 }
628 }
597
629
598 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
630 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
599 {
631 {
600 rtems_status_code status_recv;
632 rtems_status_code status_recv;
601 rtems_status_code status_send;
633 rtems_status_code status_send;
602 rtems_status_code status_q_p0;
634 rtems_status_code status_q_p0;
603 rtems_status_code status_q_p1;
635 rtems_status_code status_q_p1;
636 rtems_status_code status_q_p2;
604 rtems_status_code ret;
637 rtems_status_code ret;
605 rtems_id queue_id;
638 rtems_id queue_id;
606
639
607 //****************************************
640 //****************************************
608 // create the queue for handling valid TCs
641 // create the queue for handling valid TCs
609 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
642 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
610 MSG_QUEUE_COUNT_RECV, CCSDS_TC_PKT_MAX_SIZE,
643 MSG_QUEUE_COUNT_RECV, CCSDS_TC_PKT_MAX_SIZE,
611 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
644 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
612 if ( status_recv != RTEMS_SUCCESSFUL ) {
645 if ( status_recv != RTEMS_SUCCESSFUL ) {
613 PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv)
646 PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv)
614 }
647 }
615
648
616 //************************************************
649 //************************************************
617 // create the queue for handling TM packet sending
650 // create the queue for handling TM packet sending
618 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
651 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
619 MSG_QUEUE_COUNT_SEND, MSG_QUEUE_SIZE_SEND,
652 MSG_QUEUE_COUNT_SEND, MSG_QUEUE_SIZE_SEND,
620 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
653 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
621 if ( status_send != RTEMS_SUCCESSFUL ) {
654 if ( status_send != RTEMS_SUCCESSFUL ) {
622 PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send)
655 PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send)
623 }
656 }
624
657
625 //*****************************************************************************
658 //*****************************************************************************
626 // create the queue for handling averaged spectral matrices for processing @ f0
659 // create the queue for handling averaged spectral matrices for processing @ f0
627 status_q_p0 = rtems_message_queue_create( misc_name[QUEUE_PRC0],
660 status_q_p0 = rtems_message_queue_create( misc_name[QUEUE_PRC0],
628 MSG_QUEUE_COUNT_PRC0, MSG_QUEUE_SIZE_PRC0,
661 MSG_QUEUE_COUNT_PRC0, MSG_QUEUE_SIZE_PRC0,
629 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
662 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
630 if ( status_q_p0 != RTEMS_SUCCESSFUL ) {
663 if ( status_q_p0 != RTEMS_SUCCESSFUL ) {
631 PRINTF1("in create_message_queues *** ERR creating Q_P0 queue, %d\n", status_q_p0)
664 PRINTF1("in create_message_queues *** ERR creating Q_P0 queue, %d\n", status_q_p0)
632 }
665 }
633
666
634 //*****************************************************************************
667 //*****************************************************************************
635 // create the queue for handling averaged spectral matrices for processing @ f1
668 // create the queue for handling averaged spectral matrices for processing @ f1
636 status_q_p1 = rtems_message_queue_create( misc_name[QUEUE_PRC1],
669 status_q_p1 = rtems_message_queue_create( misc_name[QUEUE_PRC1],
637 MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1,
670 MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1,
638 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
671 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
639 if ( status_q_p1 != RTEMS_SUCCESSFUL ) {
672 if ( status_q_p1 != RTEMS_SUCCESSFUL ) {
640 PRINTF1("in create_message_queues *** ERR creating Q_P1 queue, %d\n", status_q_p1)
673 PRINTF1("in create_message_queues *** ERR creating Q_P1 queue, %d\n", status_q_p1)
641 }
674 }
642
675
676 //*****************************************************************************
677 // create the queue for handling averaged spectral matrices for processing @ f2
678 status_q_p2 = rtems_message_queue_create( misc_name[QUEUE_PRC2],
679 MSG_QUEUE_COUNT_PRC2, MSG_QUEUE_SIZE_PRC2,
680 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
681 if ( status_q_p2 != RTEMS_SUCCESSFUL ) {
682 PRINTF1("in create_message_queues *** ERR creating Q_P2 queue, %d\n", status_q_p2)
683 }
684
643 if ( status_recv != RTEMS_SUCCESSFUL )
685 if ( status_recv != RTEMS_SUCCESSFUL )
644 {
686 {
645 ret = status_recv;
687 ret = status_recv;
646 }
688 }
647 else if( status_send != RTEMS_SUCCESSFUL )
689 else if( status_send != RTEMS_SUCCESSFUL )
648 {
690 {
649 ret = status_send;
691 ret = status_send;
650 }
692 }
651 else if( status_q_p0 != RTEMS_SUCCESSFUL )
693 else if( status_q_p0 != RTEMS_SUCCESSFUL )
652 {
694 {
653 ret = status_q_p0;
695 ret = status_q_p0;
654 }
696 }
697 else if( status_q_p1 != RTEMS_SUCCESSFUL )
698 {
699 ret = status_q_p1;
700 }
655 else
701 else
656 {
702 {
657 ret = status_q_p1;
703 ret = status_q_p2;
658 }
704 }
659
705
660 return ret;
706 return ret;
661 }
707 }
662
708
663 rtems_status_code get_message_queue_id_send( rtems_id *queue_id )
709 rtems_status_code get_message_queue_id_send( rtems_id *queue_id )
664 {
710 {
665 rtems_status_code status;
711 rtems_status_code status;
666 rtems_name queue_name;
712 rtems_name queue_name;
667
713
668 queue_name = rtems_build_name( 'Q', '_', 'S', 'D' );
714 queue_name = rtems_build_name( 'Q', '_', 'S', 'D' );
669
715
670 status = rtems_message_queue_ident( queue_name, 0, queue_id );
716 status = rtems_message_queue_ident( queue_name, 0, queue_id );
671
717
672 return status;
718 return status;
673 }
719 }
674
720
675 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id )
721 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id )
676 {
722 {
677 rtems_status_code status;
723 rtems_status_code status;
678 rtems_name queue_name;
724 rtems_name queue_name;
679
725
680 queue_name = rtems_build_name( 'Q', '_', 'R', 'V' );
726 queue_name = rtems_build_name( 'Q', '_', 'R', 'V' );
681
727
682 status = rtems_message_queue_ident( queue_name, 0, queue_id );
728 status = rtems_message_queue_ident( queue_name, 0, queue_id );
683
729
684 return status;
730 return status;
685 }
731 }
686
732
687 rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id )
733 rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id )
688 {
734 {
689 rtems_status_code status;
735 rtems_status_code status;
690 rtems_name queue_name;
736 rtems_name queue_name;
691
737
692 queue_name = rtems_build_name( 'Q', '_', 'P', '0' );
738 queue_name = rtems_build_name( 'Q', '_', 'P', '0' );
693
739
694 status = rtems_message_queue_ident( queue_name, 0, queue_id );
740 status = rtems_message_queue_ident( queue_name, 0, queue_id );
695
741
696 return status;
742 return status;
697 }
743 }
698
744
699 rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id )
745 rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id )
700 {
746 {
701 rtems_status_code status;
747 rtems_status_code status;
702 rtems_name queue_name;
748 rtems_name queue_name;
703
749
704 queue_name = rtems_build_name( 'Q', '_', 'P', '1' );
750 queue_name = rtems_build_name( 'Q', '_', 'P', '1' );
705
751
706 status = rtems_message_queue_ident( queue_name, 0, queue_id );
752 status = rtems_message_queue_ident( queue_name, 0, queue_id );
707
753
708 return status;
754 return status;
709 }
755 }
756
757 rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id )
758 {
759 rtems_status_code status;
760 rtems_name queue_name;
761
762 queue_name = rtems_build_name( 'Q', '_', 'P', '2' );
763
764 status = rtems_message_queue_ident( queue_name, 0, queue_id );
765
766 return status;
767 }
@@ -1,921 +1,950
1 /** Functions and tasks related to TeleCommand handling.
1 /** Functions and tasks related to TeleCommand handling.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to handle TeleCommands:\n
6 * A group of functions to handle TeleCommands:\n
7 * action launching\n
7 * action launching\n
8 * TC parsing\n
8 * TC parsing\n
9 * ...
9 * ...
10 *
10 *
11 */
11 */
12
12
13 #include "tc_handler.h"
13 #include "tc_handler.h"
14
14
15 //***********
15 //***********
16 // RTEMS TASK
16 // RTEMS TASK
17
17
18 rtems_task actn_task( rtems_task_argument unused )
18 rtems_task actn_task( rtems_task_argument unused )
19 {
19 {
20 /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands.
20 /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands.
21 *
21 *
22 * @param unused is the starting argument of the RTEMS task
22 * @param unused is the starting argument of the RTEMS task
23 *
23 *
24 * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending
24 * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending
25 * on the incoming TeleCommand.
25 * on the incoming TeleCommand.
26 *
26 *
27 */
27 */
28
28
29 int result;
29 int result;
30 rtems_status_code status; // RTEMS status code
30 rtems_status_code status; // RTEMS status code
31 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
31 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
32 size_t size; // size of the incoming TC packet
32 size_t size; // size of the incoming TC packet
33 unsigned char subtype; // subtype of the current TC packet
33 unsigned char subtype; // subtype of the current TC packet
34 unsigned char time[6];
34 unsigned char time[6];
35 rtems_id queue_rcv_id;
35 rtems_id queue_rcv_id;
36 rtems_id queue_snd_id;
36 rtems_id queue_snd_id;
37
37
38 status = get_message_queue_id_recv( &queue_rcv_id );
38 status = get_message_queue_id_recv( &queue_rcv_id );
39 if (status != RTEMS_SUCCESSFUL)
39 if (status != RTEMS_SUCCESSFUL)
40 {
40 {
41 PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status)
41 PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status)
42 }
42 }
43
43
44 status = get_message_queue_id_send( &queue_snd_id );
44 status = get_message_queue_id_send( &queue_snd_id );
45 if (status != RTEMS_SUCCESSFUL)
45 if (status != RTEMS_SUCCESSFUL)
46 {
46 {
47 PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status)
47 PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status)
48 }
48 }
49
49
50 result = LFR_SUCCESSFUL;
50 result = LFR_SUCCESSFUL;
51 subtype = 0; // subtype of the current TC packet
51 subtype = 0; // subtype of the current TC packet
52
52
53 BOOT_PRINTF("in ACTN *** \n")
53 BOOT_PRINTF("in ACTN *** \n")
54
54
55 while(1)
55 while(1)
56 {
56 {
57 status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
57 status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
58 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
58 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
59 getTime( time ); // set time to the current time
59 getTime( time ); // set time to the current time
60 if (status!=RTEMS_SUCCESSFUL)
60 if (status!=RTEMS_SUCCESSFUL)
61 {
61 {
62 PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
62 PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
63 }
63 }
64 else
64 else
65 {
65 {
66 subtype = TC.serviceSubType;
66 subtype = TC.serviceSubType;
67 switch(subtype)
67 switch(subtype)
68 {
68 {
69 case TC_SUBTYPE_RESET:
69 case TC_SUBTYPE_RESET:
70 result = action_reset( &TC, queue_snd_id, time );
70 result = action_reset( &TC, queue_snd_id, time );
71 close_action( &TC, result, queue_snd_id );
71 close_action( &TC, result, queue_snd_id );
72 break;
72 break;
73 //
73 //
74 case TC_SUBTYPE_LOAD_COMM:
74 case TC_SUBTYPE_LOAD_COMM:
75 result = action_load_common_par( &TC );
75 result = action_load_common_par( &TC );
76 close_action( &TC, result, queue_snd_id );
76 close_action( &TC, result, queue_snd_id );
77 break;
77 break;
78 //
78 //
79 case TC_SUBTYPE_LOAD_NORM:
79 case TC_SUBTYPE_LOAD_NORM:
80 result = action_load_normal_par( &TC, queue_snd_id, time );
80 result = action_load_normal_par( &TC, queue_snd_id, time );
81 close_action( &TC, result, queue_snd_id );
81 close_action( &TC, result, queue_snd_id );
82 break;
82 break;
83 //
83 //
84 case TC_SUBTYPE_LOAD_BURST:
84 case TC_SUBTYPE_LOAD_BURST:
85 result = action_load_burst_par( &TC, queue_snd_id, time );
85 result = action_load_burst_par( &TC, queue_snd_id, time );
86 close_action( &TC, result, queue_snd_id );
86 close_action( &TC, result, queue_snd_id );
87 break;
87 break;
88 //
88 //
89 case TC_SUBTYPE_LOAD_SBM1:
89 case TC_SUBTYPE_LOAD_SBM1:
90 result = action_load_sbm1_par( &TC, queue_snd_id, time );
90 result = action_load_sbm1_par( &TC, queue_snd_id, time );
91 close_action( &TC, result, queue_snd_id );
91 close_action( &TC, result, queue_snd_id );
92 break;
92 break;
93 //
93 //
94 case TC_SUBTYPE_LOAD_SBM2:
94 case TC_SUBTYPE_LOAD_SBM2:
95 result = action_load_sbm2_par( &TC, queue_snd_id, time );
95 result = action_load_sbm2_par( &TC, queue_snd_id, time );
96 close_action( &TC, result, queue_snd_id );
96 close_action( &TC, result, queue_snd_id );
97 break;
97 break;
98 //
98 //
99 case TC_SUBTYPE_DUMP:
99 case TC_SUBTYPE_DUMP:
100 result = action_dump_par( queue_snd_id );
100 result = action_dump_par( queue_snd_id );
101 close_action( &TC, result, queue_snd_id );
101 close_action( &TC, result, queue_snd_id );
102 break;
102 break;
103 //
103 //
104 case TC_SUBTYPE_ENTER:
104 case TC_SUBTYPE_ENTER:
105 result = action_enter_mode( &TC, queue_snd_id );
105 result = action_enter_mode( &TC, queue_snd_id );
106 close_action( &TC, result, queue_snd_id );
106 close_action( &TC, result, queue_snd_id );
107 break;
107 break;
108 //
108 //
109 case TC_SUBTYPE_UPDT_INFO:
109 case TC_SUBTYPE_UPDT_INFO:
110 result = action_update_info( &TC, queue_snd_id );
110 result = action_update_info( &TC, queue_snd_id );
111 close_action( &TC, result, queue_snd_id );
111 close_action( &TC, result, queue_snd_id );
112 break;
112 break;
113 //
113 //
114 case TC_SUBTYPE_EN_CAL:
114 case TC_SUBTYPE_EN_CAL:
115 result = action_enable_calibration( &TC, queue_snd_id, time );
115 result = action_enable_calibration( &TC, queue_snd_id, time );
116 close_action( &TC, result, queue_snd_id );
116 close_action( &TC, result, queue_snd_id );
117 break;
117 break;
118 //
118 //
119 case TC_SUBTYPE_DIS_CAL:
119 case TC_SUBTYPE_DIS_CAL:
120 result = action_disable_calibration( &TC, queue_snd_id, time );
120 result = action_disable_calibration( &TC, queue_snd_id, time );
121 close_action( &TC, result, queue_snd_id );
121 close_action( &TC, result, queue_snd_id );
122 break;
122 break;
123 //
123 //
124 case TC_SUBTYPE_UPDT_TIME:
124 case TC_SUBTYPE_UPDT_TIME:
125 result = action_update_time( &TC );
125 result = action_update_time( &TC );
126 close_action( &TC, result, queue_snd_id );
126 close_action( &TC, result, queue_snd_id );
127 break;
127 break;
128 //
128 //
129 default:
129 default:
130 break;
130 break;
131 }
131 }
132 }
132 }
133 }
133 }
134 }
134 }
135
135
136 //***********
136 //***********
137 // TC ACTIONS
137 // TC ACTIONS
138
138
139 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
139 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
140 {
140 {
141 /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
141 /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
142 *
142 *
143 * @param TC points to the TeleCommand packet that is being processed
143 * @param TC points to the TeleCommand packet that is being processed
144 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
144 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
145 *
145 *
146 */
146 */
147
147
148 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
148 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
149 return LFR_DEFAULT;
149 return LFR_DEFAULT;
150 }
150 }
151
151
152 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
152 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
153 {
153 {
154 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
154 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
155 *
155 *
156 * @param TC points to the TeleCommand packet that is being processed
156 * @param TC points to the TeleCommand packet that is being processed
157 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
157 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
158 *
158 *
159 */
159 */
160
160
161 rtems_status_code status;
161 rtems_status_code status;
162 unsigned char requestedMode;
162 unsigned char requestedMode;
163 unsigned int *transitionCoarseTime_ptr;
163 unsigned int *transitionCoarseTime_ptr;
164 unsigned int transitionCoarseTime;
164 unsigned int transitionCoarseTime;
165 unsigned char * bytePosPtr;
165 unsigned char * bytePosPtr;
166
166
167 bytePosPtr = (unsigned char *) &TC->packetID;
167 bytePosPtr = (unsigned char *) &TC->packetID;
168
168
169 requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ];
169 requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ];
170 transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] );
170 transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] );
171 transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff;
171 transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff;
172
172
173 status = check_mode_value( requestedMode );
173 status = check_mode_value( requestedMode );
174
174
175 if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent
175 if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent
176 {
176 {
177 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode );
177 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode );
178 }
178 }
179 else // the mode value is consistent, check the transition
179 else // the mode value is consistent, check the transition
180 {
180 {
181 status = check_mode_transition(requestedMode);
181 status = check_mode_transition(requestedMode);
182 if (status != LFR_SUCCESSFUL)
182 if (status != LFR_SUCCESSFUL)
183 {
183 {
184 PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n")
184 PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n")
185 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
185 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
186 }
186 }
187 }
187 }
188
188
189 if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode
189 if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode
190 {
190 {
191 status = check_transition_date( transitionCoarseTime );
191 status = check_transition_date( transitionCoarseTime );
192 if (status != LFR_SUCCESSFUL)
192 if (status != LFR_SUCCESSFUL)
193 {
193 {
194 PRINTF("ERR *** in action_enter_mode *** check_transition_date\n")
194 PRINTF("ERR *** in action_enter_mode *** check_transition_date\n")
195 send_tm_lfr_tc_exe_inconsistent( TC, queue_id,
195 send_tm_lfr_tc_exe_inconsistent( TC, queue_id,
196 BYTE_POS_CP_LFR_ENTER_MODE_TIME,
196 BYTE_POS_CP_LFR_ENTER_MODE_TIME,
197 bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] );
197 bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] );
198 }
198 }
199 }
199 }
200
200
201 if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode
201 if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode
202 {
202 {
203 PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode);
203 PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode);
204 status = enter_mode( requestedMode, transitionCoarseTime );
204 status = enter_mode( requestedMode, transitionCoarseTime );
205 }
205 }
206
206
207 return status;
207 return status;
208 }
208 }
209
209
210 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
210 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
211 {
211 {
212 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
212 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
213 *
213 *
214 * @param TC points to the TeleCommand packet that is being processed
214 * @param TC points to the TeleCommand packet that is being processed
215 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
215 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
216 *
216 *
217 * @return LFR directive status code:
217 * @return LFR directive status code:
218 * - LFR_DEFAULT
218 * - LFR_DEFAULT
219 * - LFR_SUCCESSFUL
219 * - LFR_SUCCESSFUL
220 *
220 *
221 */
221 */
222
222
223 unsigned int val;
223 unsigned int val;
224 int result;
224 int result;
225 unsigned int status;
225 unsigned int status;
226 unsigned char mode;
226 unsigned char mode;
227 unsigned char * bytePosPtr;
227 unsigned char * bytePosPtr;
228
228
229 bytePosPtr = (unsigned char *) &TC->packetID;
229 bytePosPtr = (unsigned char *) &TC->packetID;
230
230
231 // check LFR mode
231 // check LFR mode
232 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1;
232 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1;
233 status = check_update_info_hk_lfr_mode( mode );
233 status = check_update_info_hk_lfr_mode( mode );
234 if (status == LFR_SUCCESSFUL) // check TDS mode
234 if (status == LFR_SUCCESSFUL) // check TDS mode
235 {
235 {
236 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4;
236 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4;
237 status = check_update_info_hk_tds_mode( mode );
237 status = check_update_info_hk_tds_mode( mode );
238 }
238 }
239 if (status == LFR_SUCCESSFUL) // check THR mode
239 if (status == LFR_SUCCESSFUL) // check THR mode
240 {
240 {
241 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f);
241 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f);
242 status = check_update_info_hk_thr_mode( mode );
242 status = check_update_info_hk_thr_mode( mode );
243 }
243 }
244 if (status == LFR_SUCCESSFUL) // if the parameter check is successful
244 if (status == LFR_SUCCESSFUL) // if the parameter check is successful
245 {
245 {
246 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
246 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
247 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
247 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
248 val++;
248 val++;
249 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
249 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
250 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
250 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
251 }
251 }
252
252
253 result = status;
253 result = status;
254
254
255 return result;
255 return result;
256 }
256 }
257
257
258 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
258 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
259 {
259 {
260 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
260 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
261 *
261 *
262 * @param TC points to the TeleCommand packet that is being processed
262 * @param TC points to the TeleCommand packet that is being processed
263 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
263 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
264 *
264 *
265 */
265 */
266
266
267 int result;
267 int result;
268 unsigned char lfrMode;
268 unsigned char lfrMode;
269
269
270 result = LFR_DEFAULT;
270 result = LFR_DEFAULT;
271 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
271 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
272
272
273 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
273 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
274 result = LFR_DEFAULT;
274 result = LFR_DEFAULT;
275
275
276 return result;
276 return result;
277 }
277 }
278
278
279 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
279 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
280 {
280 {
281 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
281 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
282 *
282 *
283 * @param TC points to the TeleCommand packet that is being processed
283 * @param TC points to the TeleCommand packet that is being processed
284 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
284 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
285 *
285 *
286 */
286 */
287
287
288 int result;
288 int result;
289 unsigned char lfrMode;
289 unsigned char lfrMode;
290
290
291 result = LFR_DEFAULT;
291 result = LFR_DEFAULT;
292 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
292 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
293
293
294 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
294 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
295 result = LFR_DEFAULT;
295 result = LFR_DEFAULT;
296
296
297 return result;
297 return result;
298 }
298 }
299
299
300 int action_update_time(ccsdsTelecommandPacket_t *TC)
300 int action_update_time(ccsdsTelecommandPacket_t *TC)
301 {
301 {
302 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
302 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
303 *
303 *
304 * @param TC points to the TeleCommand packet that is being processed
304 * @param TC points to the TeleCommand packet that is being processed
305 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
305 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
306 *
306 *
307 * @return LFR_SUCCESSFUL
307 * @return LFR_SUCCESSFUL
308 *
308 *
309 */
309 */
310
310
311 unsigned int val;
311 unsigned int val;
312
312
313 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
313 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
314 + (TC->dataAndCRC[1] << 16)
314 + (TC->dataAndCRC[1] << 16)
315 + (TC->dataAndCRC[2] << 8)
315 + (TC->dataAndCRC[2] << 8)
316 + TC->dataAndCRC[3];
316 + TC->dataAndCRC[3];
317
317
318 PRINTF1("time received: %x\n", time_management_regs->coarse_time_load)
318 PRINTF1("time received: %x\n", time_management_regs->coarse_time_load)
319
319
320 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
320 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
321 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
321 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
322 val++;
322 val++;
323 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
323 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
324 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
324 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
325 // time_management_regs->ctrl = time_management_regs->ctrl | 1; // force tick
325 // time_management_regs->ctrl = time_management_regs->ctrl | 1; // force tick
326
326
327 return LFR_SUCCESSFUL;
327 return LFR_SUCCESSFUL;
328 }
328 }
329
329
330 //*******************
330 //*******************
331 // ENTERING THE MODES
331 // ENTERING THE MODES
332 int check_mode_value( unsigned char requestedMode )
332 int check_mode_value( unsigned char requestedMode )
333 {
333 {
334 int status;
334 int status;
335
335
336 if ( (requestedMode != LFR_MODE_STANDBY)
336 if ( (requestedMode != LFR_MODE_STANDBY)
337 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
337 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
338 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
338 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
339 {
339 {
340 status = LFR_DEFAULT;
340 status = LFR_DEFAULT;
341 }
341 }
342 else
342 else
343 {
343 {
344 status = LFR_SUCCESSFUL;
344 status = LFR_SUCCESSFUL;
345 }
345 }
346
346
347 return status;
347 return status;
348 }
348 }
349
349
350 int check_mode_transition( unsigned char requestedMode )
350 int check_mode_transition( unsigned char requestedMode )
351 {
351 {
352 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
352 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
353 *
353 *
354 * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
354 * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
355 *
355 *
356 * @return LFR directive status codes:
356 * @return LFR directive status codes:
357 * - LFR_SUCCESSFUL - the transition is authorized
357 * - LFR_SUCCESSFUL - the transition is authorized
358 * - LFR_DEFAULT - the transition is not authorized
358 * - LFR_DEFAULT - the transition is not authorized
359 *
359 *
360 */
360 */
361
361
362 int status;
362 int status;
363
363
364 switch (requestedMode)
364 switch (requestedMode)
365 {
365 {
366 case LFR_MODE_STANDBY:
366 case LFR_MODE_STANDBY:
367 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
367 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
368 status = LFR_DEFAULT;
368 status = LFR_DEFAULT;
369 }
369 }
370 else
370 else
371 {
371 {
372 status = LFR_SUCCESSFUL;
372 status = LFR_SUCCESSFUL;
373 }
373 }
374 break;
374 break;
375 case LFR_MODE_NORMAL:
375 case LFR_MODE_NORMAL:
376 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
376 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
377 status = LFR_DEFAULT;
377 status = LFR_DEFAULT;
378 }
378 }
379 else {
379 else {
380 status = LFR_SUCCESSFUL;
380 status = LFR_SUCCESSFUL;
381 }
381 }
382 break;
382 break;
383 case LFR_MODE_BURST:
383 case LFR_MODE_BURST:
384 if ( lfrCurrentMode == LFR_MODE_BURST ) {
384 if ( lfrCurrentMode == LFR_MODE_BURST ) {
385 status = LFR_DEFAULT;
385 status = LFR_DEFAULT;
386 }
386 }
387 else {
387 else {
388 status = LFR_SUCCESSFUL;
388 status = LFR_SUCCESSFUL;
389 }
389 }
390 break;
390 break;
391 case LFR_MODE_SBM1:
391 case LFR_MODE_SBM1:
392 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
392 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
393 status = LFR_DEFAULT;
393 status = LFR_DEFAULT;
394 }
394 }
395 else {
395 else {
396 status = LFR_SUCCESSFUL;
396 status = LFR_SUCCESSFUL;
397 }
397 }
398 break;
398 break;
399 case LFR_MODE_SBM2:
399 case LFR_MODE_SBM2:
400 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
400 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
401 status = LFR_DEFAULT;
401 status = LFR_DEFAULT;
402 }
402 }
403 else {
403 else {
404 status = LFR_SUCCESSFUL;
404 status = LFR_SUCCESSFUL;
405 }
405 }
406 break;
406 break;
407 default:
407 default:
408 status = LFR_DEFAULT;
408 status = LFR_DEFAULT;
409 break;
409 break;
410 }
410 }
411
411
412 return status;
412 return status;
413 }
413 }
414
414
415 int check_transition_date( unsigned int transitionCoarseTime )
415 int check_transition_date( unsigned int transitionCoarseTime )
416 {
416 {
417 int status;
417 int status;
418 unsigned int localCoarseTime;
418 unsigned int localCoarseTime;
419 unsigned int deltaCoarseTime;
419 unsigned int deltaCoarseTime;
420
420
421 status = LFR_SUCCESSFUL;
421 status = LFR_SUCCESSFUL;
422
422
423 if (transitionCoarseTime == 0) // transition time = 0 means an instant transition
423 if (transitionCoarseTime == 0) // transition time = 0 means an instant transition
424 {
424 {
425 status = LFR_SUCCESSFUL;
425 status = LFR_SUCCESSFUL;
426 }
426 }
427 else
427 else
428 {
428 {
429 localCoarseTime = time_management_regs->coarse_time & 0x7fffffff;
429 localCoarseTime = time_management_regs->coarse_time & 0x7fffffff;
430
430
431 if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322
431 if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322
432 {
432 {
433 status = LFR_DEFAULT;
433 status = LFR_DEFAULT;
434 PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime)
434 PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime)
435 }
435 }
436
436
437 if (status == LFR_SUCCESSFUL)
437 if (status == LFR_SUCCESSFUL)
438 {
438 {
439 deltaCoarseTime = transitionCoarseTime - localCoarseTime;
439 deltaCoarseTime = transitionCoarseTime - localCoarseTime;
440 if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323
440 if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323
441 {
441 {
442 status = LFR_DEFAULT;
442 status = LFR_DEFAULT;
443 PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime)
443 PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime)
444 }
444 }
445 }
445 }
446 }
446 }
447
447
448 return status;
448 return status;
449 }
449 }
450
450
451 int stop_current_mode( void )
451 int stop_current_mode( void )
452 {
452 {
453 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
453 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
454 *
454 *
455 * @return RTEMS directive status codes:
455 * @return RTEMS directive status codes:
456 * - RTEMS_SUCCESSFUL - task restarted successfully
456 * - RTEMS_SUCCESSFUL - task restarted successfully
457 * - RTEMS_INVALID_ID - task id invalid
457 * - RTEMS_INVALID_ID - task id invalid
458 * - RTEMS_ALREADY_SUSPENDED - task already suspended
458 * - RTEMS_ALREADY_SUSPENDED - task already suspended
459 *
459 *
460 */
460 */
461
461
462 rtems_status_code status;
462 rtems_status_code status;
463
463
464 status = RTEMS_SUCCESSFUL;
464 status = RTEMS_SUCCESSFUL;
465
465
466 // (1) mask interruptions
466 // (1) mask interruptions
467 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
467 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
468 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
468 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
469
469
470 // (2) clear interruptions
470 // (2) clear interruptions
471 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
471 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
472 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
472 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
473
473
474 // (3) reset waveform picker registers
474 // (3) reset waveform picker registers
475 reset_wfp_burst_enable(); // reset burst and enable bits
475 reset_wfp_burst_enable(); // reset burst and enable bits
476 reset_wfp_status(); // reset all the status bits
476 reset_wfp_status(); // reset all the status bits
477
477
478 // (4) reset spectral matrices registers
478 // (4) reset spectral matrices registers
479 set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices
479 set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices
480 set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0
480 set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0
481 reset_extractSWF(); // reset the extractSWF flag to false
481 reset_extractSWF(); // reset the extractSWF flag to false
482
482
483 // <Spectral Matrices simulator>
483 // <Spectral Matrices simulator>
484 LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator
484 LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator
485 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
485 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
486 LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator
486 LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator
487 // </Spectral Matrices simulator>
487 // </Spectral Matrices simulator>
488
488
489 // suspend several tasks
489 // suspend several tasks
490 if (lfrCurrentMode != LFR_MODE_STANDBY) {
490 if (lfrCurrentMode != LFR_MODE_STANDBY) {
491 status = suspend_science_tasks();
491 status = suspend_science_tasks();
492 }
492 }
493
493
494 if (status != RTEMS_SUCCESSFUL)
494 if (status != RTEMS_SUCCESSFUL)
495 {
495 {
496 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
496 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
497 }
497 }
498
498
499 return status;
499 return status;
500 }
500 }
501
501
502 int enter_mode( unsigned char mode, unsigned int transitionCoarseTime )
502 int enter_mode( unsigned char mode, unsigned int transitionCoarseTime )
503 {
503 {
504 /** This function is launched after a mode transition validation.
504 /** This function is launched after a mode transition validation.
505 *
505 *
506 * @param mode is the mode in which LFR will be put.
506 * @param mode is the mode in which LFR will be put.
507 *
507 *
508 * @return RTEMS directive status codes:
508 * @return RTEMS directive status codes:
509 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
509 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
510 * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully
510 * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully
511 *
511 *
512 */
512 */
513
513
514 rtems_status_code status;
514 rtems_status_code status;
515
515
516 //**********************
516 //**********************
517 // STOP THE CURRENT MODE
517 // STOP THE CURRENT MODE
518 status = stop_current_mode();
518 status = stop_current_mode();
519 if (status != RTEMS_SUCCESSFUL)
519 if (status != RTEMS_SUCCESSFUL)
520 {
520 {
521 PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode)
521 PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode)
522 }
522 }
523
523
524 //*************************
524 //*************************
525 // ENTER THE REQUESTED MODE
525 // ENTER THE REQUESTED MODE
526 if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST)
526 if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST)
527 || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) )
527 || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) )
528 {
528 {
529 #ifdef PRINT_TASK_STATISTICS
529 #ifdef PRINT_TASK_STATISTICS
530 rtems_cpu_usage_reset();
530 rtems_cpu_usage_reset();
531 maxCount = 0;
531 maxCount = 0;
532 #endif
532 #endif
533 status = restart_science_tasks( mode );
533 status = restart_science_tasks( mode );
534 launch_waveform_picker( mode, transitionCoarseTime );
534 launch_waveform_picker( mode, transitionCoarseTime );
535 // launch_spectral_matrix( );
535 // launch_spectral_matrix( );
536 launch_spectral_matrix_simu( );
536 launch_spectral_matrix_simu( );
537 }
537 }
538 else if ( mode == LFR_MODE_STANDBY )
538 else if ( mode == LFR_MODE_STANDBY )
539 {
539 {
540 #ifdef PRINT_TASK_STATISTICS
540 #ifdef PRINT_TASK_STATISTICS
541 rtems_cpu_usage_report();
541 rtems_cpu_usage_report();
542 #endif
542 #endif
543
543
544 #ifdef PRINT_STACK_REPORT
544 #ifdef PRINT_STACK_REPORT
545 PRINTF("stack report selected\n")
545 PRINTF("stack report selected\n")
546 rtems_stack_checker_report_usage();
546 rtems_stack_checker_report_usage();
547 #endif
547 #endif
548 PRINTF1("maxCount = %d\n", maxCount)
548 PRINTF1("maxCount = %d\n", maxCount)
549 }
549 }
550 else
550 else
551 {
551 {
552 status = RTEMS_UNSATISFIED;
552 status = RTEMS_UNSATISFIED;
553 }
553 }
554
554
555 if (status != RTEMS_SUCCESSFUL)
555 if (status != RTEMS_SUCCESSFUL)
556 {
556 {
557 PRINTF1("ERR *** in enter_mode *** status = %d\n", status)
557 PRINTF1("ERR *** in enter_mode *** status = %d\n", status)
558 status = RTEMS_UNSATISFIED;
558 status = RTEMS_UNSATISFIED;
559 }
559 }
560
560
561 return status;
561 return status;
562 }
562 }
563
563
564 int restart_science_tasks(unsigned char lfrRequestedMode )
564 int restart_science_tasks(unsigned char lfrRequestedMode )
565 {
565 {
566 /** This function is used to restart all science tasks.
566 /** This function is used to restart all science tasks.
567 *
567 *
568 * @return RTEMS directive status codes:
568 * @return RTEMS directive status codes:
569 * - RTEMS_SUCCESSFUL - task restarted successfully
569 * - RTEMS_SUCCESSFUL - task restarted successfully
570 * - RTEMS_INVALID_ID - task id invalid
570 * - RTEMS_INVALID_ID - task id invalid
571 * - RTEMS_INCORRECT_STATE - task never started
571 * - RTEMS_INCORRECT_STATE - task never started
572 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
572 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
573 *
573 *
574 * Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1
574 * Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1
575 *
575 *
576 */
576 */
577
577
578 rtems_status_code status[8];
578 rtems_status_code status[10];
579 rtems_status_code ret;
579 rtems_status_code ret;
580
580
581 ret = RTEMS_SUCCESSFUL;
581 ret = RTEMS_SUCCESSFUL;
582
582
583 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode );
583 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode );
584 if (status[0] != RTEMS_SUCCESSFUL)
584 if (status[0] != RTEMS_SUCCESSFUL)
585 {
585 {
586 PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0])
586 PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0])
587 }
587 }
588
588
589 status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode );
589 status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode );
590 if (status[1] != RTEMS_SUCCESSFUL)
590 if (status[1] != RTEMS_SUCCESSFUL)
591 {
591 {
592 PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1])
592 PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1])
593 }
593 }
594
594
595 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
595 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
596 if (status[2] != RTEMS_SUCCESSFUL)
596 if (status[2] != RTEMS_SUCCESSFUL)
597 {
597 {
598 PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[2])
598 PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[2])
599 }
599 }
600
600
601 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
601 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
602 if (status[3] != RTEMS_SUCCESSFUL)
602 if (status[3] != RTEMS_SUCCESSFUL)
603 {
603 {
604 PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[3])
604 PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[3])
605 }
605 }
606
606
607 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
607 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
608 if (status[4] != RTEMS_SUCCESSFUL)
608 if (status[4] != RTEMS_SUCCESSFUL)
609 {
609 {
610 PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[4])
610 PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[4])
611 }
611 }
612
612
613 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
613 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
614 if (status[5] != RTEMS_SUCCESSFUL)
614 if (status[5] != RTEMS_SUCCESSFUL)
615 {
615 {
616 PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[5])
616 PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[5])
617 }
617 }
618
618
619 status[6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode );
619 status[6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode );
620 if (status[6] != RTEMS_SUCCESSFUL)
620 if (status[6] != RTEMS_SUCCESSFUL)
621 {
621 {
622 PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[6])
622 PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[6])
623 }
623 }
624
624
625 status[7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode );
625 status[7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode );
626 if (status[7] != RTEMS_SUCCESSFUL)
626 if (status[7] != RTEMS_SUCCESSFUL)
627 {
627 {
628 PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7])
628 PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7])
629 }
629 }
630
630
631 status[8] = rtems_task_restart( Task_id[TASKID_AVF2], 1 );
632 if (status[8] != RTEMS_SUCCESSFUL)
633 {
634 PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[8])
635 }
636
637 status[9] = rtems_task_restart( Task_id[TASKID_PRC2], 1 );
638 if (status[9] != RTEMS_SUCCESSFUL)
639 {
640 PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[9])
641 }
642
631 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) ||
643 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) ||
632 (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) ||
644 (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) ||
633 (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ||
645 (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ||
634 (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) )
646 (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) ||
647 (status[8] != RTEMS_SUCCESSFUL) || (status[9] != RTEMS_SUCCESSFUL))
635 {
648 {
636 ret = RTEMS_UNSATISFIED;
649 ret = RTEMS_UNSATISFIED;
637 }
650 }
638
651
639 return ret;
652 return ret;
640 }
653 }
641
654
642 int suspend_science_tasks()
655 int suspend_science_tasks()
643 {
656 {
644 /** This function suspends the science tasks.
657 /** This function suspends the science tasks.
645 *
658 *
646 * @return RTEMS directive status codes:
659 * @return RTEMS directive status codes:
647 * - RTEMS_SUCCESSFUL - task restarted successfully
660 * - RTEMS_SUCCESSFUL - task restarted successfully
648 * - RTEMS_INVALID_ID - task id invalid
661 * - RTEMS_INVALID_ID - task id invalid
649 * - RTEMS_ALREADY_SUSPENDED - task already suspended
662 * - RTEMS_ALREADY_SUSPENDED - task already suspended
650 *
663 *
651 */
664 */
652
665
653 rtems_status_code status;
666 rtems_status_code status;
654
667
655 status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0
668 status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0
656 if (status != RTEMS_SUCCESSFUL)
669 if (status != RTEMS_SUCCESSFUL)
657 {
670 {
658 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
671 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
659 }
672 }
660 if (status == RTEMS_SUCCESSFUL) // suspend PRC0
673 if (status == RTEMS_SUCCESSFUL) // suspend PRC0
661 {
674 {
662 status = rtems_task_suspend( Task_id[TASKID_PRC0] );
675 status = rtems_task_suspend( Task_id[TASKID_PRC0] );
663 if (status != RTEMS_SUCCESSFUL)
676 if (status != RTEMS_SUCCESSFUL)
664 {
677 {
665 PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status)
678 PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status)
666 }
679 }
667 }
680 }
668 if (status == RTEMS_SUCCESSFUL) // suspend AVF1
681 if (status == RTEMS_SUCCESSFUL) // suspend AVF1
669 {
682 {
670 status = rtems_task_suspend( Task_id[TASKID_AVF1] );
683 status = rtems_task_suspend( Task_id[TASKID_AVF1] );
671 if (status != RTEMS_SUCCESSFUL)
684 if (status != RTEMS_SUCCESSFUL)
672 {
685 {
673 PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status)
686 PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status)
674 }
687 }
675 }
688 }
676 if (status == RTEMS_SUCCESSFUL) // suspend PRC1
689 if (status == RTEMS_SUCCESSFUL) // suspend PRC1
677 {
690 {
678 status = rtems_task_suspend( Task_id[TASKID_PRC1] );
691 status = rtems_task_suspend( Task_id[TASKID_PRC1] );
679 if (status != RTEMS_SUCCESSFUL)
692 if (status != RTEMS_SUCCESSFUL)
680 {
693 {
681 PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status)
694 PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status)
682 }
695 }
683 }
696 }
697 if (status == RTEMS_SUCCESSFUL) // suspend AVF2
698 {
699 status = rtems_task_suspend( Task_id[TASKID_AVF2] );
700 if (status != RTEMS_SUCCESSFUL)
701 {
702 PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status)
703 }
704 }
705 if (status == RTEMS_SUCCESSFUL) // suspend PRC2
706 {
707 status = rtems_task_suspend( Task_id[TASKID_PRC2] );
708 if (status != RTEMS_SUCCESSFUL)
709 {
710 PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status)
711 }
712 }
684 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
713 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
685 {
714 {
686 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
715 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
687 if (status != RTEMS_SUCCESSFUL)
716 if (status != RTEMS_SUCCESSFUL)
688 {
717 {
689 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
718 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
690 }
719 }
691 }
720 }
692 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
721 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
693 {
722 {
694 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
723 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
695 if (status != RTEMS_SUCCESSFUL)
724 if (status != RTEMS_SUCCESSFUL)
696 {
725 {
697 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
726 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
698 }
727 }
699 }
728 }
700 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
729 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
701 {
730 {
702 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
731 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
703 if (status != RTEMS_SUCCESSFUL)
732 if (status != RTEMS_SUCCESSFUL)
704 {
733 {
705 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
734 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
706 }
735 }
707 }
736 }
708 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
737 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
709 {
738 {
710 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
739 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
711 if (status != RTEMS_SUCCESSFUL)
740 if (status != RTEMS_SUCCESSFUL)
712 {
741 {
713 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
742 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
714 }
743 }
715 }
744 }
716
745
717 return status;
746 return status;
718 }
747 }
719
748
720 void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime )
749 void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime )
721 {
750 {
722 reset_current_ring_nodes();
751 reset_current_ring_nodes();
723 reset_waveform_picker_regs();
752 reset_waveform_picker_regs();
724 set_wfp_burst_enable_register( mode );
753 set_wfp_burst_enable_register( mode );
725
754
726 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
755 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
727 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
756 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
728
757
729 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
758 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
730 if (transitionCoarseTime == 0)
759 if (transitionCoarseTime == 0)
731 {
760 {
732 waveform_picker_regs->start_date = time_management_regs->coarse_time;
761 waveform_picker_regs->start_date = time_management_regs->coarse_time;
733 }
762 }
734 else
763 else
735 {
764 {
736 waveform_picker_regs->start_date = transitionCoarseTime;
765 waveform_picker_regs->start_date = transitionCoarseTime;
737 }
766 }
738 }
767 }
739
768
740 void launch_spectral_matrix( void )
769 void launch_spectral_matrix( void )
741 {
770 {
742 SM_reset_current_ring_nodes();
771 SM_reset_current_ring_nodes();
743 ASM_reset_current_ring_nodes();
744 reset_spectral_matrix_regs();
772 reset_spectral_matrix_regs();
773 reset_nb_sm();
745
774
746 struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO;
775 struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO;
747 grgpio_regs->io_port_direction_register =
776 grgpio_regs->io_port_direction_register =
748 grgpio_regs->io_port_direction_register | 0x01; // [0000 0001], 0 = output disabled, 1 = output enabled
777 grgpio_regs->io_port_direction_register | 0x01; // [0000 0001], 0 = output disabled, 1 = output enabled
749 grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfffffffe; // set the bit 0 to 0
778 grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfffffffe; // set the bit 0 to 0
750 set_irq_on_new_ready_matrix( 1 );
779 set_irq_on_new_ready_matrix( 1 );
751 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX );
780 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX );
752 LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX );
781 LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX );
753 set_run_matrix_spectral( 1 );
782 set_run_matrix_spectral( 1 );
754
783
755 }
784 }
756
785
757 void launch_spectral_matrix_simu( void )
786 void launch_spectral_matrix_simu( void )
758 {
787 {
759 SM_reset_current_ring_nodes();
788 SM_reset_current_ring_nodes();
760 ASM_reset_current_ring_nodes();
761 reset_spectral_matrix_regs();
789 reset_spectral_matrix_regs();
790 reset_nb_sm();
762
791
763 // Spectral Matrices simulator
792 // Spectral Matrices simulator
764 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
793 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
765 LEON_Clear_interrupt( IRQ_SM_SIMULATOR );
794 LEON_Clear_interrupt( IRQ_SM_SIMULATOR );
766 LEON_Unmask_interrupt( IRQ_SM_SIMULATOR );
795 LEON_Unmask_interrupt( IRQ_SM_SIMULATOR );
767 set_local_nb_interrupt_f0_MAX();
796 set_local_nb_interrupt_f0_MAX();
768 }
797 }
769
798
770 void set_irq_on_new_ready_matrix( unsigned char value )
799 void set_irq_on_new_ready_matrix( unsigned char value )
771 {
800 {
772 if (value == 1)
801 if (value == 1)
773 {
802 {
774 spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01;
803 spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01;
775 }
804 }
776 else
805 else
777 {
806 {
778 spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110
807 spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110
779 }
808 }
780 }
809 }
781
810
782 void set_run_matrix_spectral( unsigned char value )
811 void set_run_matrix_spectral( unsigned char value )
783 {
812 {
784 if (value == 1)
813 if (value == 1)
785 {
814 {
786 spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1
815 spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1
787 }
816 }
788 else
817 else
789 {
818 {
790 spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0
819 spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0
791 }
820 }
792 }
821 }
793
822
794 //****************
823 //****************
795 // CLOSING ACTIONS
824 // CLOSING ACTIONS
796 void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time )
825 void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time )
797 {
826 {
798 /** This function is used to update the HK packets statistics after a successful TC execution.
827 /** This function is used to update the HK packets statistics after a successful TC execution.
799 *
828 *
800 * @param TC points to the TC being processed
829 * @param TC points to the TC being processed
801 * @param time is the time used to date the TC execution
830 * @param time is the time used to date the TC execution
802 *
831 *
803 */
832 */
804
833
805 unsigned int val;
834 unsigned int val;
806
835
807 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
836 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
808 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
837 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
809 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
838 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
810 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
839 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
811 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
840 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
812 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
841 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
813 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
842 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
814 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
843 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
815 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
844 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
816 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
845 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
817 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
846 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
818 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
847 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
819
848
820 val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1];
849 val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1];
821 val++;
850 val++;
822 housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8);
851 housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8);
823 housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val);
852 housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val);
824 }
853 }
825
854
826 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time )
855 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time )
827 {
856 {
828 /** This function is used to update the HK packets statistics after a TC rejection.
857 /** This function is used to update the HK packets statistics after a TC rejection.
829 *
858 *
830 * @param TC points to the TC being processed
859 * @param TC points to the TC being processed
831 * @param time is the time used to date the TC rejection
860 * @param time is the time used to date the TC rejection
832 *
861 *
833 */
862 */
834
863
835 unsigned int val;
864 unsigned int val;
836
865
837 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
866 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
838 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
867 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
839 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
868 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
840 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
869 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
841 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
870 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
842 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
871 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
843 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
872 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
844 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
873 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
845 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
874 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
846 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
875 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
847 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
876 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
848 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
877 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
849
878
850 val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1];
879 val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1];
851 val++;
880 val++;
852 housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8);
881 housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8);
853 housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val);
882 housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val);
854 }
883 }
855
884
856 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id )
885 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id )
857 {
886 {
858 /** This function is the last step of the TC execution workflow.
887 /** This function is the last step of the TC execution workflow.
859 *
888 *
860 * @param TC points to the TC being processed
889 * @param TC points to the TC being processed
861 * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
890 * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
862 * @param queue_id is the id of the RTEMS message queue used to send TM packets
891 * @param queue_id is the id of the RTEMS message queue used to send TM packets
863 * @param time is the time used to date the TC execution
892 * @param time is the time used to date the TC execution
864 *
893 *
865 */
894 */
866
895
867 unsigned char requestedMode;
896 unsigned char requestedMode;
868
897
869 if (result == LFR_SUCCESSFUL)
898 if (result == LFR_SUCCESSFUL)
870 {
899 {
871 if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
900 if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
872 &
901 &
873 !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
902 !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
874 )
903 )
875 {
904 {
876 send_tm_lfr_tc_exe_success( TC, queue_id );
905 send_tm_lfr_tc_exe_success( TC, queue_id );
877 }
906 }
878 if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) )
907 if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) )
879 {
908 {
880 //**********************************
909 //**********************************
881 // UPDATE THE LFRMODE LOCAL VARIABLE
910 // UPDATE THE LFRMODE LOCAL VARIABLE
882 requestedMode = TC->dataAndCRC[1];
911 requestedMode = TC->dataAndCRC[1];
883 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d);
912 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d);
884 updateLFRCurrentMode();
913 updateLFRCurrentMode();
885 }
914 }
886 }
915 }
887 else if (result == LFR_EXE_ERROR)
916 else if (result == LFR_EXE_ERROR)
888 {
917 {
889 send_tm_lfr_tc_exe_error( TC, queue_id );
918 send_tm_lfr_tc_exe_error( TC, queue_id );
890 }
919 }
891 }
920 }
892
921
893 //***************************
922 //***************************
894 // Interrupt Service Routines
923 // Interrupt Service Routines
895 rtems_isr commutation_isr1( rtems_vector_number vector )
924 rtems_isr commutation_isr1( rtems_vector_number vector )
896 {
925 {
897 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
926 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
898 printf("In commutation_isr1 *** Error sending event to DUMB\n");
927 printf("In commutation_isr1 *** Error sending event to DUMB\n");
899 }
928 }
900 }
929 }
901
930
902 rtems_isr commutation_isr2( rtems_vector_number vector )
931 rtems_isr commutation_isr2( rtems_vector_number vector )
903 {
932 {
904 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
933 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
905 printf("In commutation_isr2 *** Error sending event to DUMB\n");
934 printf("In commutation_isr2 *** Error sending event to DUMB\n");
906 }
935 }
907 }
936 }
908
937
909 //****************
938 //****************
910 // OTHER FUNCTIONS
939 // OTHER FUNCTIONS
911 void updateLFRCurrentMode()
940 void updateLFRCurrentMode()
912 {
941 {
913 /** This function updates the value of the global variable lfrCurrentMode.
942 /** This function updates the value of the global variable lfrCurrentMode.
914 *
943 *
915 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
944 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
916 *
945 *
917 */
946 */
918 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
947 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
919 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
948 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
920 }
949 }
921
950
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
This diff has been collapsed as it changes many lines, (1273 lines changed) Show them Hide them
General Comments 0
You need to be logged in to leave comments. Login now