##// END OF EJS Templates
Draft implementation of the TC_LFR_LOAD_NORMAL_PAR
admin@pc-p-leroy3.LAB-LPP.LOCAL -
r10:4baf2642cd31 default
parent child
Show More
@@ -10,7 +10,7
10 <Option output="bin/Debug/fsw" prefix_auto="1" extension_auto="1" />
10 <Option output="bin/Debug/fsw" prefix_auto="1" extension_auto="1" />
11 <Option object_output="obj/Debug/" />
11 <Option object_output="obj/Debug/" />
12 <Option type="1" />
12 <Option type="1" />
13 <Option compiler="sparcrtemsgcc446" />
13 <Option compiler="sparcrtems446" />
14 <Compiler>
14 <Compiler>
15 <Add option="-fexpensive-optimizations" />
15 <Add option="-fexpensive-optimizations" />
16 <Add option="-O3" />
16 <Add option="-O3" />
@@ -224,3 +224,87 1359614518 source:/opt/DEV_PLE/src/fsw_p
224 <stdio.h>
224 <stdio.h>
225 <leon.h>
225 <leon.h>
226
226
227 1359665502 source:/home/admin/opt/DEV_PLE/src/fsw_globals.c
228 <fsw_processing.h>
229 <rtems.h>
230
231 1359663364 /home/admin/opt/DEV_PLE/header/fsw_processing.h
232 <rtems.h>
233 <grlib_regs.h>
234 <fsw_params.h>
235
236 1359470426 /home/admin/opt/DEV_PLE/header/grlib_regs.h
237
238 1359665475 /home/admin/opt/DEV_PLE/header/fsw_params.h
239
240 1359666330 source:/home/admin/opt/DEV_PLE/src/fsw_init.c
241 <rtems.h>
242 <bsp.h>
243 <rtems/confdefs.h>
244 <drvmgr/drvmgr_confdefs.h>
245 <fsw_init.h>
246 <fsw_config.c>
247
248 1359666373 /home/admin/opt/DEV_PLE/header/fsw_init.h
249 <errno.h>
250 <fcntl.h>
251 <stdio.h>
252 <stdlib.h>
253 <grspw.h>
254 <apbuart.h>
255 <fsw_params.h>
256 <fsw_misc.h>
257 <fsw_processing.h>
258 <tc_handler.h>
259 <wf_handler.h>
260 <grlib_regs.h>
261
262 1359663364 /home/admin/opt/DEV_PLE/header/fsw_misc.h
263 <rtems.h>
264 <stdio.h>
265 <fsw_init.h>
266 <fsw_params.h>
267 <grlib_regs.h>
268 <grspw.h>
269 <ccsds_types.h>
270
271 1359663364 /home/admin/opt/DEV_PLE/header/ccsds_types.h
272
273 1359665643 /home/admin/opt/DEV_PLE/header/tc_handler.h
274 <rtems.h>
275 <stdio.h>
276 <unistd.h>
277 <sys/ioctl.h>
278 <ccsds_types.h>
279 <grspw.h>
280 <fsw_init.h>
281
282 1359663364 /home/admin/opt/DEV_PLE/header/wf_handler.h
283 <rtems.h>
284 <fsw_params.h>
285 <grspw.h>
286 <grlib_regs.h>
287 <ccsds_types.h>
288 <stdio.h>
289 <fsw_init.h>
290
291 1359470426 /home/admin/opt/DEV_PLE/src/fsw_config.c
292 <drvmgr/ambapp_bus.h>
293
294 1359663364 source:/home/admin/opt/DEV_PLE/src/fsw_misc.c
295 <fsw_misc.h>
296 <fsw_params.h>
297
298 1359663364 source:/home/admin/opt/DEV_PLE/src/fsw_processing.c
299 <fsw_processing.h>
300 <math.h>
301 <stdio.h>
302 <leon.h>
303
304 1359663364 source:/home/admin/opt/DEV_PLE/src/wf_handler.c
305 <wf_handler.h>
306
307 1359665083 source:/home/admin/opt/DEV_PLE/src/tc_handler.c
308 <tc_handler.h>
309 <fsw_params.h>
310
@@ -2,36 +2,31
2 <CodeBlocks_layout_file>
2 <CodeBlocks_layout_file>
3 <ActiveTarget name="Debug" />
3 <ActiveTarget name="Debug" />
4 <File name="../header/ccsds_types.h" open="0" top="0" tabpos="5">
4 <File name="../header/ccsds_types.h" open="0" top="0" tabpos="5">
5 <Cursor position="1172" topLine="24" />
5 <Cursor position="4079" topLine="120" />
6 </File>
6 </File>
7 <File name="../header/fsw_init.h" open="1" top="0" tabpos="3">
7 <File name="../header/fsw_init.h" open="0" top="0" tabpos="3">
8 <Cursor position="410" topLine="16" />
8 <Cursor position="1128" topLine="26" />
9 </File>
9 </File>
10 <File name="../header/fsw_misc.h" open="0" top="0" tabpos="0">
10 <File name="../header/fsw_misc.h" open="0" top="0" tabpos="0">
11 <Cursor position="114" topLine="0" />
11 <Cursor position="114" topLine="0" />
12 </File>
12 </File>
13 <File name="../header/fsw_params.h" open="0" top="0" tabpos="0">
13 <File name="../header/fsw_params.h" open="0" top="0" tabpos="0">
14 <Cursor position="1320" topLine="8" />
14 <Cursor position="1374" topLine="49" />
15 </File>
15 </File>
16 <File name="../header/fsw_processing.h" open="0" top="0" tabpos="0">
16 <File name="../header/fsw_processing.h" open="0" top="0" tabpos="0">
17 <Cursor position="510" topLine="0" />
17 <Cursor position="576" topLine="0" />
18 </File>
18 </File>
19 <File name="../header/tc_handler.h" open="0" top="0" tabpos="4">
19 <File name="../header/tc_handler.h" open="0" top="0" tabpos="4">
20 <Cursor position="634" topLine="0" />
20 <Cursor position="437" topLine="35" />
21 </File>
21 </File>
22 <File name="../header/wf_handler.h" open="0" top="0" tabpos="0">
22 <File name="../header/wf_handler.h" open="0" top="0" tabpos="0">
23 <Cursor position="212" topLine="0" />
23 <Cursor position="212" topLine="0" />
24 </File>
24 </File>
25 <File name="../src/fsw_globals.c" open="1" top="0" tabpos="4">
25 <File name="../src/fsw_globals.c" open="0" top="0" tabpos="4">
26 <Cursor position="46" topLine="0" />
26 <Cursor position="1271" topLine="18" />
27 </File>
27 </File>
28 <<<<<<< local
28 <File name="../src/fsw_init.c" open="1" top="0" tabpos="1">
29 <File name="../src/fsw_init.c" open="1" top="1" tabpos="0">
29 <Cursor position="1814" topLine="48" />
30 <Cursor position="1703" topLine="36" />
31 =======
32 <File name="../src/fsw_init.c" open="1" top="1" tabpos="2">
33 <Cursor position="3361" topLine="60" />
34 >>>>>>> other
35 </File>
30 </File>
36 <File name="../src/fsw_misc.c" open="0" top="0" tabpos="0">
31 <File name="../src/fsw_misc.c" open="0" top="0" tabpos="0">
37 <Cursor position="20" topLine="0" />
32 <Cursor position="20" topLine="0" />
@@ -39,13 +34,8
39 <File name="../src/fsw_processing.c" open="0" top="0" tabpos="2">
34 <File name="../src/fsw_processing.c" open="0" top="0" tabpos="2">
40 <Cursor position="1175" topLine="46" />
35 <Cursor position="1175" topLine="46" />
41 </File>
36 </File>
42 <<<<<<< local
37 <File name="../src/tc_handler.c" open="1" top="1" tabpos="2">
43 <File name="../src/tc_handler.c" open="0" top="0" tabpos="3">
38 <Cursor position="13133" topLine="89" />
44 <Cursor position="2672" topLine="26" />
45 =======
46 <File name="../src/tc_handler.c" open="1" top="0" tabpos="1">
47 <Cursor position="11070" topLine="270" />
48 >>>>>>> other
49 </File>
39 </File>
50 <File name="../src/wf_handler.c" open="0" top="0" tabpos="0">
40 <File name="../src/wf_handler.c" open="0" top="0" tabpos="0">
51 <Cursor position="3936" topLine="62" />
41 <Cursor position="3936" topLine="62" />
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -23,6 +23,7 extern rtems_name Task_name[ ]; /* a
23 extern rtems_name misc_name[ ]; /* arry of miscellaneous names for rtems objects */
23 extern rtems_name misc_name[ ]; /* arry of miscellaneous names for rtems objects */
24 extern int fdSPW; // grspw file descriptor
24 extern int fdSPW; // grspw file descriptor
25 extern int fdUART; // uart file descriptor
25 extern int fdUART; // uart file descriptor
26 extern struct param_norm_str param_norm;
26
27
27 // RTEMS TASKS
28 // RTEMS TASKS
28 rtems_task Init( rtems_task_argument argument); /* forward declaration needed */
29 rtems_task Init( rtems_task_argument argument); /* forward declaration needed */
@@ -35,6 +36,7 int start_all_tasks();
35 int create_message_queue();
36 int create_message_queue();
36
37
37 // OTHER functions
38 // OTHER functions
39 void init_default_mode_parameters();
38 int configure_spw_link();
40 int configure_spw_link();
39 int send_console_outputs_on_serial_port();
41 int send_console_outputs_on_serial_port();
40 extern int rtems_cpu_usage_report();
42 extern int rtems_cpu_usage_report();
@@ -52,6 +52,14
52 #define NB_SAMPLES_PER_SNAPSHOT 2048
52 #define NB_SAMPLES_PER_SNAPSHOT 2048
53 #define NB_BYTES_SWF_BLK 2 * 6
53 #define NB_BYTES_SWF_BLK 2 * 6
54
54
55 struct param_norm_str{
56 unsigned int sy_lfr_n_swf_l; // length of the snapshots
57 unsigned int sy_lfr_n_swf_p; // time between two snapshots
58 unsigned int sy_lfr_n_asm_p; // time between two asm
59 unsigned char sy_lfr_n_bp_p0; // timebetween two products BP1 set
60 unsigned char sy_lfr_n_bp_p1; // time between two products BP2 set
61 };
62
55 extern volatile int wf_snap_f0[ ]; // 24576 bytes
63 extern volatile int wf_snap_f0[ ]; // 24576 bytes
56 extern volatile int wf_snap_f1[ ]; // 24576 bytes
64 extern volatile int wf_snap_f1[ ]; // 24576 bytes
57 extern volatile int wf_snap_f2[ ]; // 24576 bytes
65 extern volatile int wf_snap_f2[ ]; // 24576 bytes
@@ -12,7 +12,8
12 extern int fdSPW;
12 extern int fdSPW;
13 extern rtems_name misc_name[ ];
13 extern rtems_name misc_name[ ];
14 extern rtems_name misc_id[ ];
14 extern rtems_name misc_id[ ];
15 extern rtems_id Task_id[ ]; /* array of task ids */
15 extern rtems_id Task_id[ ]; // array of task ids
16 extern struct param_norm_str param_norm;
16
17
17 unsigned char currentTC_LEN_RCV[2]; // SHALL be equal to the current TC packet estimated packet length field
18 unsigned char currentTC_LEN_RCV[2]; // SHALL be equal to the current TC packet estimated packet length field
18 unsigned char currentTC_COMPUTED_CRC[2];
19 unsigned char currentTC_COMPUTED_CRC[2];
@@ -30,7 +31,7 void GetCRCAsTwoBytes(unsigned char* dat
30 // ACCEPTANCE FUNCTIONS
31 // ACCEPTANCE FUNCTIONS
31 unsigned char acceptTM(ccsdsTelecommandPacket_t * TMPacket, unsigned int tc_len_recv);
32 unsigned char acceptTM(ccsdsTelecommandPacket_t * TMPacket, unsigned int tc_len_recv);
32
33
33 unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int SID, unsigned int packetLength,
34 unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int packetLength,
34 unsigned int coarseTime, unsigned int fineTime, TMHeader_t *TMHeader);
35 unsigned int coarseTime, unsigned int fineTime, TMHeader_t *TMHeader);
35 unsigned char TM_build_data(ccsdsTelecommandPacket_t *TC, char* data, unsigned int SID, unsigned char *computed_CRC);
36 unsigned char TM_build_data(ccsdsTelecommandPacket_t *TC, char* data, unsigned int SID, unsigned char *computed_CRC);
36 int TC_checker(ccsdsTelecommandPacket_t *TC, unsigned int TC_LEN_RCV);
37 int TC_checker(ccsdsTelecommandPacket_t *TC, unsigned int TC_LEN_RCV);
@@ -43,6 +44,11 int create_message_queue();
43
44
44 //***********
45 //***********
45 // TC ACTIONS
46 // TC ACTIONS
46 int default_action(ccsdsTelecommandPacket_t *TC);
47 int action_default(ccsdsTelecommandPacket_t *TC);
48 int action_load_norm(ccsdsTelecommandPacket_t *TC);
49 int action_enter(ccsdsTelecommandPacket_t *TC);
47
50
48 #endif // TC_HANDLER_H_INCLUDED
51 #endif // TC_HANDLER_H_INCLUDED
52
53
54
@@ -28,7 +28,10 volatile int spec_mat_f0_h[ TOTAL_SIZE_S
28 float averaged_spec_mat_f0[ TOTAL_SIZE_SPEC_MAT ];
28 float averaged_spec_mat_f0[ TOTAL_SIZE_SPEC_MAT ];
29 float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
29 float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
30
30
31 // BASIC PARAMETERS GLOBAL VAIRABLES
31 // NORMAL MODE PARAMETERS
32 struct param_norm_str param_norm;
33
34 // BASIC PARAMETERS GLOBAL VARIABLES
32 unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_MATRIX_f0 * 9 ];
35 unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_MATRIX_f0 * 9 ];
33
36
34 BP1_t data_BP1[ NB_BINS_COMPRESSED_MATRIX_f0 ];
37 BP1_t data_BP1[ NB_BINS_COMPRESSED_MATRIX_f0 ];
@@ -61,7 +61,7 rtems_task Init( rtems_task_argument ign
61 //send_console_outputs_on_serial_port();
61 //send_console_outputs_on_serial_port();
62
62
63 InitLookUpTableForCRC(); // in tc_handler.h
63 InitLookUpTableForCRC(); // in tc_handler.h
64
64 init_default_mode_parameters();
65 create_message_queue();
65 create_message_queue();
66 create_all_tasks();
66 create_all_tasks();
67 start_all_tasks();
67 start_all_tasks();
@@ -100,6 +100,15 rtems_task spiq_task(rtems_task_argument
100 }
100 }
101 }
101 }
102
102
103 void init_default_mode_parameters()
104 {
105 param_norm.sy_lfr_n_swf_l = 2048; // nb sample
106 param_norm.sy_lfr_n_swf_p = 300; // sec
107 param_norm.sy_lfr_n_asm_p = 3600; // sec
108 param_norm.sy_lfr_n_bp_p0 = 4; // sec
109 param_norm.sy_lfr_n_bp_p1 = 20; // sec
110 }
111
103 int create_all_tasks()
112 int create_all_tasks()
104 {
113 {
105 rtems_status_code status;
114 rtems_status_code status;
@@ -66,7 +66,7 int TC_checker(ccsdsTelecommandPacket_t
66 | (code == 3) | (code == 4) | (code == 5) )
66 | (code == 3) | (code == 4) | (code == 5) )
67 { // generate TM_LFR_TC_EXE_CORRUPTED
67 { // generate TM_LFR_TC_EXE_CORRUPTED
68 // BUILD HEADER
68 // BUILD HEADER
69 TM_build_header( TM_LFR_TC_EXE_ERR, SID_EXE_CORR, TM_LEN_EXE_CORR, 0, 0, &TM_header);
69 TM_build_header( TM_LFR_TC_EXE_ERR, TM_LEN_EXE_CORR, 0, 0, &TM_header);
70 // BUILD DATA
70 // BUILD DATA
71 TM_build_data( TC, data, SID_EXE_CORR, computed_CRC);
71 TM_build_data( TC, data, SID_EXE_CORR, computed_CRC);
72 // PREPARE TM SENDING
72 // PREPARE TM SENDING
@@ -77,7 +77,7 int TC_checker(ccsdsTelecommandPacket_t
77 // SEND PACKET
77 // SEND PACKET
78 write_spw(&spw_ioctl_send);
78 write_spw(&spw_ioctl_send);
79 }
79 }
80 else { // TM_LFR_TC_EXE_NOT_IMPLEMENTED
80 else { // send valid TC to the action launcher
81 status = rtems_message_queue_send( misc_id[0], TC, tc_len_recv + CCSDS_TC_TM_PACKET_OFFSET);
81 status = rtems_message_queue_send( misc_id[0], TC, tc_len_recv + CCSDS_TC_TM_PACKET_OFFSET);
82 return -1;
82 return -1;
83 }
83 }
@@ -164,7 +164,7 unsigned char acceptTM(ccsdsTelecommandP
164 return CCSDS_TM_VALID;
164 return CCSDS_TM_VALID;
165 }
165 }
166
166
167 unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int SID, unsigned int packetLength,
167 unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int packetLength,
168 unsigned int coarseTime, unsigned int fineTime, TMHeader_t *TMHeader)
168 unsigned int coarseTime, unsigned int fineTime, TMHeader_t *TMHeader)
169 {
169 {
170 TMHeader->targetLogicalAddress = CCSDS_DESTINATION_ID;
170 TMHeader->targetLogicalAddress = CCSDS_DESTINATION_ID;
@@ -330,6 +330,7 rtems_task actn_task( rtems_task_argumen
330 case TC_SUBTYPE_LOAD_COMM:
330 case TC_SUBTYPE_LOAD_COMM:
331 break;
331 break;
332 case TC_SUBTYPE_LOAD_NORM:
332 case TC_SUBTYPE_LOAD_NORM:
333 action_load_norm( &TC );
333 break;
334 break;
334 case TC_SUBTYPE_LOAD_BURST:
335 case TC_SUBTYPE_LOAD_BURST:
335 break;
336 break;
@@ -338,9 +339,10 rtems_task actn_task( rtems_task_argumen
338 case TC_SUBTYPE_LOAD_SBM2:
339 case TC_SUBTYPE_LOAD_SBM2:
339 break;
340 break;
340 case TC_SUBTYPE_DUMP:
341 case TC_SUBTYPE_DUMP:
341 default_action( &TC );
342 action_default( &TC );
342 break;
343 break;
343 case TC_SUBTYPE_ENTER:
344 case TC_SUBTYPE_ENTER:
345 action_enter( &TC );
344 break;
346 break;
345 case TC_SUBTYPE_UPDT_INFO:
347 case TC_SUBTYPE_UPDT_INFO:
346 break;
348 break;
@@ -370,13 +372,13 int create_message_queue()
370
372
371 //***********
373 //***********
372 // TC ACTIONS
374 // TC ACTIONS
373 int default_action(ccsdsTelecommandPacket_t *TC)
375 int action_default(ccsdsTelecommandPacket_t *TC)
374 {
376 {
375 char data[100]; // buffer for the generic TM packet
377 char data[100]; // buffer for the generic TM packet
376 TMHeader_t TM_header; // TM header
378 TMHeader_t TM_header; // TM header
377 spw_ioctl_pkt_send spw_ioctl_send; // structure to send the TM packet if any
379 spw_ioctl_pkt_send spw_ioctl_send; // structure to send the TM packet if any
378 // BUILD HEADER
380 // BUILD HEADER
379 TM_build_header( TM_LFR_TC_EXE_ERR, SID_NOT_IMP, TM_LEN_NOT_IMP, 0, 0, &TM_header);
381 TM_build_header( TM_LFR_TC_EXE_ERR, TM_LEN_NOT_IMP, 0, 0, &TM_header);
380 // BUILD DATA
382 // BUILD DATA
381 TM_build_data( TC, data, SID_NOT_IMP, NULL);
383 TM_build_data( TC, data, SID_NOT_IMP, NULL);
382 // filling the strture for the spcawire transmission
384 // filling the strture for the spcawire transmission
@@ -390,7 +392,23 int default_action(ccsdsTelecommandPacke
390 return 0;
392 return 0;
391 }
393 }
392
394
395 int action_enter(ccsdsTelecommandPacket_t *TC)
396 {
397 return 0;
398 }
399
400 int action_load_norm(ccsdsTelecommandPacket_t *TC)
401 {
402 param_norm.sy_lfr_n_swf_l = TC->dataAndCRC[0] * 256 + TC->dataAndCRC[1];
403 param_norm.sy_lfr_n_swf_p = TC->dataAndCRC[2] * 256 + TC->dataAndCRC[3];
404 param_norm.sy_lfr_n_asm_p = TC->dataAndCRC[4] * 256 + TC->dataAndCRC[5];
405 param_norm.sy_lfr_n_bp_p0 = TC->dataAndCRC[6];
406 param_norm.sy_lfr_n_bp_p1 = TC->dataAndCRC[7];
407 printf("sy_lfr_n_ => swf_l %d, swf_p %d, asm_p %d, bsp_p0 %d, bsp_p1 %d\n",
408 param_norm.sy_lfr_n_swf_l, param_norm.sy_lfr_n_swf_p,
409 param_norm.sy_lfr_n_asm_p, param_norm.sy_lfr_n_bp_p0, param_norm.sy_lfr_n_bp_p1);
410 return 0;
411 }
393
412
394
413
395
414
396
General Comments 0
You need to be logged in to leave comments. Login now