##// END OF EJS Templates
AVF1 and PRC1 tasks added for processing at f1
paul -
r121:4bba4856191b VHDLib206
parent child
Show More
@@ -1,6 +1,6
1 1 #############################################################################
2 2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Apr 17 09:53:23 2014
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Apr 22 18:10:21 2014
4 4 # Project: fsw-qt.pro
5 5 # Template: app
6 6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
@@ -1,6 +1,6
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 3.0.1, 2014-04-17T09:46:14. -->
3 <!-- Written by QtCreator 3.0.1, 2014-04-22T18:12:39. -->
4 4 <qtcreator>
5 5 <data>
6 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -203,14 +203,17 enum apid_destid{
203 203 #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET)
204 204 #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET)
205 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 - 7
207 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 (2628 - CCSDS_TC_TM_PACKET_OFFSET) // 52 * 25 * 2 + 28 - 7
208 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 (2428 - CCSDS_TC_TM_PACKET_OFFSET) // 48 * 25 * 2 + 28 - 7
209 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 (126 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 9 + 27 - 7
210 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 (356 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 30 + 25 - 7
211 #define PACKET_LENGTH_TM_LFR_SCIENCE_BURST_BP2_F1 (806 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 30 + 26 - 7
212 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 (224 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 9 + 26 - 7
213 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 (686 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 30 + 26 - 7
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
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
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
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_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
215 #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
214 217
215 218 #define PACKET_LENGTH_DELTA 11 // 7 + 4
216 219
@@ -19,30 +19,6 typedef struct ring_node
19 19 } ring_node;
20 20
21 21 typedef struct {
22 // F0
23 unsigned int f0;
24 unsigned int norm_bp1_f0;
25 unsigned int norm_bp2_f0;
26 unsigned int norm_asm_f0;
27 unsigned int sbm_bp1_f0;
28 unsigned int sbm_bp2_f0;
29 // F1
30 unsigned int f1;
31 unsigned int norm_bp1_f1;
32 unsigned int norm_bp2_f1;
33 unsigned int norm_asm_f1;
34 unsigned int sbm_bp1_f1;
35 unsigned int sbm_bp2_f1;
36 // F2
37 unsigned int f2;
38 unsigned int norm_bp1_f2;
39 unsigned int norm_bp2_f2;
40 unsigned int norm_asm_f2;
41 unsigned int sbm_bp1_f2;
42 unsigned int sbm_bp2_f2;
43 } nb_sm_t;
44
45 typedef struct {
46 22 unsigned int norm_bp1_f0;
47 23 unsigned int norm_bp2_f0;
48 24 unsigned int norm_asm_f0;
@@ -57,15 +33,15 typedef struct {
57 33 } nb_sm_before_bp_asm_f0;
58 34
59 35 typedef struct {
60 unsigned int norm_bp1_f1;
61 unsigned int norm_bp2_f1;
62 unsigned int norm_asm_f1;
63 unsigned int burst_sbm_bp1_f1;
64 unsigned int burst_sbm_bp2_f1;
65 unsigned int burst_bp1_f1;
66 unsigned int burst_bp2_f1;
67 unsigned int sbm2_bp1_f1;
68 unsigned int sbm2_bp2_f1;
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;
69 45 } nb_sm_before_bp_asm_f1;
70 46
71 47 typedef struct {
@@ -215,22 +191,23 typedef struct {
215 191 #define TASKID_RECV 1
216 192 #define TASKID_ACTN 2
217 193 #define TASKID_SPIQ 3
218 #define TASKID_SMIQ 4
219 #define TASKID_STAT 5
220 #define TASKID_AVF0 6
221 #define TASKID_SWBD 7
222 #define TASKID_WFRM 8
223 #define TASKID_DUMB 9
224 #define TASKID_HOUS 10
225 #define TASKID_PRC0 11
226 #define TASKID_CWF3 12
227 #define TASKID_CWF2 13
228 #define TASKID_CWF1 14
229 #define TASKID_SEND 15
230 #define TASKID_WTDG 16
194 #define TASKID_STAT 4
195 #define TASKID_AVF0 5
196 #define TASKID_SWBD 6
197 #define TASKID_WFRM 7
198 #define TASKID_DUMB 8
199 #define TASKID_HOUS 9
200 #define TASKID_PRC0 10
201 #define TASKID_CWF3 11
202 #define TASKID_CWF2 12
203 #define TASKID_CWF1 13
204 #define TASKID_SEND 14
205 #define TASKID_WTDG 15
206 #define TASKID_AVF1 16
207 #define TASKID_PRC1 17
231 208
232 209 #define TASK_PRIORITY_SPIQ 5
233 #define TASK_PRIORITY_SMIQ 10
210 //#define TASK_PRIORITY_SMIQ 10
234 211 #define TASK_PRIORITY_WTDG 20
235 212 #define TASK_PRIORITY_HOUS 30
236 213 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
@@ -242,8 +219,9 typedef struct {
242 219 #define TASK_PRIORITY_RECV 50
243 220 #define TASK_PRIORITY_ACTN 50
244 221 #define TASK_PRIORITY_AVF0 60
245 #define TASK_PRIORITY_BPF0 60
246 222 #define TASK_PRIORITY_PRC0 100
223 #define TASK_PRIORITY_PRC1 100
224 #define TASK_PRIORITY_AVF1 60
247 225 #define TASK_PRIORITY_STAT 200
248 226 #define TASK_PRIORITY_DUMB 200
249 227
@@ -251,7 +229,6 typedef struct {
251 229 #define MSG_QUEUE_COUNT_SEND 50
252 230 #define MSG_QUEUE_COUNT_PRC0 10
253 231 #define MSG_QUEUE_COUNT_PRC1 10
254 //#define MSG_QUEUE_SIZE_SEND (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
255 232 #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1
256 233 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
257 234 #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers
@@ -10,10 +10,12
10 10 #define TOTAL_SIZE_SBM1_BP1_F0 198 // 22 * 9 = 198
11 11 //
12 12 #define NB_RING_NODES_SM_F0 12 // 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
13 15 #define NB_RING_NODES_SM_F1 3 // 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
14 18 #define NB_RING_NODES_SM_F2 3 // AT LEAST 3
15 #define NB_RING_NODES_ASM_BURST_SBM_F0 10 // AT LEAST 3
16 #define NB_RING_NODES_ASM_NORM_F0 10 // AT LEAST 3
17 19 //
18 20 #define NB_BINS_PER_ASM_F0 88
19 21 #define NB_BINS_PER_PKT_ASM_F0 44
@@ -37,12 +39,15
37 39 #define NB_BINS_COMPRESSED_SM_F1 13
38 40 #define NB_BINS_COMPRESSED_SM_F2 12
39 41 #define NB_BINS_COMPRESSED_SM_SBM_F0 22
40
42 #define NB_BINS_COMPRESSED_SM_SBM_F1 26
43 #define NB_BINS_COMPRESSED_SM_SBM_F2 24
41 44 //
42 45 #define NB_BINS_TO_AVERAGE_ASM_F0 8
43 46 #define NB_BINS_TO_AVERAGE_ASM_F1 8
44 47 #define NB_BINS_TO_AVERAGE_ASM_F2 8
45 48 #define NB_BINS_TO_AVERAGE_ASM_SBM_F0 4
49 #define NB_BINS_TO_AVERAGE_ASM_SBM_F1 4
50 #define NB_BINS_TO_AVERAGE_ASM_SBM_F2 4
46 51 //
47 52 #define TOTAL_SIZE_COMPRESSED_ASM_F0 275 // 11 * 25 WORDS
48 53 #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 WORDS
@@ -23,7 +23,6 typedef struct ring_node_sm
23 23
24 24 typedef struct ring_node_asm
25 25 {
26 struct ring_node_asm *previous;
27 26 struct ring_node_asm *next;
28 27 float matrix[ TOTAL_SIZE_SM ];
29 28 unsigned int status;
@@ -50,7 +49,6 typedef struct asm_msg
50 49 unsigned int fineTime;
51 50 } asm_msg;
52 51
53 extern nb_sm_t nb_sm;
54 52 extern nb_sm_before_bp_asm_f0 nb_sm_before_f0;
55 53 extern nb_sm_before_bp_asm_f1 nb_sm_before_f1;
56 54 extern nb_sm_before_bp_asm_f2 nb_sm_before_f2;
@@ -75,16 +73,18 rtems_isr spectral_matrices_isr( rtems_v
75 73 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
76 74
77 75 // RTEMS TASKS
78 rtems_task smiq_task( rtems_task_argument argument ); // added to test the spectral matrix simulator
79 76 rtems_task avf0_task( rtems_task_argument lfrRequestedMode );
80 77 rtems_task prc0_task( rtems_task_argument lfrRequestedMode );
78 rtems_task avf1_task( rtems_task_argument lfrRequestedMode );
79 rtems_task prc1_task( rtems_task_argument lfrRequestedMode );
81 80
82 81 //******************
83 82 // Spectral Matrices
84 83 void SM_init_rings( void );
85 84 void ASM_init_rings( void );
85 void ASM_generic_init_ring(ring_node_asm *ring, unsigned char nbNodes );
86 86 void SM_reset_current_ring_nodes( void );
87 void ASM_reset_current_ring_node( void );
87 void ASM_reset_current_ring_nodes( void );
88 88 void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header);
89 89 void SM_average(float *averaged_spec_mat_f0, float *averaged_spec_mat_f1,
90 90 ring_node_sm *ring_node_tab[],
@@ -9,7 +9,6
9 9 #include "tm_lfr_tc_exe.h"
10 10 #include "fsw_misc.h"
11 11
12 extern nb_sm_t nb_sm;
13 12 extern nb_sm_before_bp_asm_f0 nb_sm_before_f0;
14 13 extern nb_sm_before_bp_asm_f1 nb_sm_before_f1;
15 14 extern nb_sm_before_bp_asm_f2 nb_sm_before_f2;
@@ -48,7 +48,6 char wf_cont_f3_light[ (NB_SAMPL
48 48 //***********************************
49 49 // SPECTRAL MATRICES GLOBAL VARIABLES
50 50
51 nb_sm_t nb_sm;
52 51 nb_sm_before_bp_asm_f0 nb_sm_before_f0;
53 52 nb_sm_before_bp_asm_f1 nb_sm_before_f1;
54 53 nb_sm_before_bp_asm_f2 nb_sm_before_f2;
@@ -249,7 +249,6 void create_names( void ) // create all
249 249 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
250 250 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
251 251 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
252 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
253 252 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
254 253 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
255 254 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
@@ -262,6 +261,8 void create_names( void ) // create all
262 261 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
263 262 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
264 263 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
264 Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' );
265 Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' );
265 266
266 267 // rate monotonic period names
267 268 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
@@ -333,14 +334,6 int create_all_tasks( void ) // create a
333 334
334 335 //******************
335 336 // SPECTRAL MATRICES
336 if (status == RTEMS_SUCCESSFUL) // SMIQ
337 {
338 status = rtems_task_create(
339 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
340 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
341 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
342 );
343 }
344 337 if (status == RTEMS_SUCCESSFUL) // AVF0
345 338 {
346 339 status = rtems_task_create(
@@ -349,7 +342,7 int create_all_tasks( void ) // create a
349 342 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
350 343 );
351 344 }
352 if (status == RTEMS_SUCCESSFUL) // MATR
345 if (status == RTEMS_SUCCESSFUL) // PRC0
353 346 {
354 347 status = rtems_task_create(
355 348 Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2,
@@ -357,6 +350,22 int create_all_tasks( void ) // create a
357 350 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0]
358 351 );
359 352 }
353 if (status == RTEMS_SUCCESSFUL) // AVF1
354 {
355 status = rtems_task_create(
356 Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE,
357 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
358 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1]
359 );
360 }
361 if (status == RTEMS_SUCCESSFUL) // PRC1
362 {
363 status = rtems_task_create(
364 Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2,
365 RTEMS_DEFAULT_MODES,
366 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1]
367 );
368 }
360 369
361 370 //****************
362 371 // WAVEFORM PICKER
@@ -492,29 +501,34 int start_all_tasks( void ) // start all
492 501
493 502 //******************
494 503 // SPECTRAL MATRICES
495 if (status == RTEMS_SUCCESSFUL) // SMIQ
496 {
497 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
498 if (status!=RTEMS_SUCCESSFUL) {
499 BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n")
500 }
501 }
502
503 504 if (status == RTEMS_SUCCESSFUL) // AVF0
504 505 {
505 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
506 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, LFR_MODE_STANDBY );
506 507 if (status!=RTEMS_SUCCESSFUL) {
507 508 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
508 509 }
509 510 }
510
511 511 if (status == RTEMS_SUCCESSFUL) // PRC0
512 512 {
513 status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, 1 );
513 status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, LFR_MODE_STANDBY );
514 514 if (status!=RTEMS_SUCCESSFUL) {
515 515 BOOT_PRINTF("in INIT *** Error starting TASK_PRC0\n")
516 516 }
517 517 }
518 if (status == RTEMS_SUCCESSFUL) // AVF1
519 {
520 status = rtems_task_start( Task_id[TASKID_AVF1], avf1_task, LFR_MODE_STANDBY );
521 if (status!=RTEMS_SUCCESSFUL) {
522 BOOT_PRINTF("in INIT *** Error starting TASK_AVF1\n")
523 }
524 }
525 if (status == RTEMS_SUCCESSFUL) // PRC1
526 {
527 status = rtems_task_start( Task_id[TASKID_PRC1], prc1_task, LFR_MODE_STANDBY );
528 if (status!=RTEMS_SUCCESSFUL) {
529 BOOT_PRINTF("in INIT *** Error starting TASK_PRC1\n")
530 }
531 }
518 532
519 533 //****************
520 534 // WAVEFORM PICKER
@@ -525,7 +539,6 int start_all_tasks( void ) // start all
525 539 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
526 540 }
527 541 }
528
529 542 if (status == RTEMS_SUCCESSFUL) // CWF3
530 543 {
531 544 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
@@ -533,7 +546,6 int start_all_tasks( void ) // start all
533 546 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
534 547 }
535 548 }
536
537 549 if (status == RTEMS_SUCCESSFUL) // CWF2
538 550 {
539 551 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
@@ -541,7 +553,6 int start_all_tasks( void ) // start all
541 553 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
542 554 }
543 555 }
544
545 556 if (status == RTEMS_SUCCESSFUL) // CWF1
546 557 {
547 558 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
@@ -549,7 +560,6 int start_all_tasks( void ) // start all
549 560 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
550 561 }
551 562 }
552
553 563 if (status == RTEMS_SUCCESSFUL) // SWBD
554 564 {
555 565 status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 );
@@ -567,7 +577,6 int start_all_tasks( void ) // start all
567 577 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
568 578 }
569 579 }
570
571 580 if (status == RTEMS_SUCCESSFUL) // DUMB
572 581 {
573 582 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
@@ -575,7 +584,6 int start_all_tasks( void ) // start all
575 584 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
576 585 }
577 586 }
578
579 587 if (status == RTEMS_SUCCESSFUL) // STAT
580 588 {
581 589 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
@@ -591,7 +599,8 rtems_status_code create_message_queues(
591 599 {
592 600 rtems_status_code status_recv;
593 601 rtems_status_code status_send;
594 rtems_status_code status_matr;
602 rtems_status_code status_q_p0;
603 rtems_status_code status_q_p1;
595 604 rtems_status_code ret;
596 605 rtems_id queue_id;
597 606
@@ -615,21 +624,21 rtems_status_code create_message_queues(
615 624
616 625 //*****************************************************************************
617 626 // create the queue for handling averaged spectral matrices for processing @ f0
618 status_matr = rtems_message_queue_create( misc_name[QUEUE_PRC0],
627 status_q_p0 = rtems_message_queue_create( misc_name[QUEUE_PRC0],
619 628 MSG_QUEUE_COUNT_PRC0, MSG_QUEUE_SIZE_PRC0,
620 629 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
621 if ( status_send != RTEMS_SUCCESSFUL ) {
622 PRINTF1("in create_message_queues *** ERR creating PR_0 queue, %d\n", status_matr)
630 if ( status_q_p0 != RTEMS_SUCCESSFUL ) {
631 PRINTF1("in create_message_queues *** ERR creating Q_P0 queue, %d\n", status_q_p0)
623 632 }
624 633
625 634 //*****************************************************************************
626 635 // create the queue for handling averaged spectral matrices for processing @ f1
627 // status_matr = rtems_message_queue_create( misc_name[QUEUE_PRC1],
628 // MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1,
629 // RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
630 // if ( status_send != RTEMS_SUCCESSFUL ) {
631 // PRINTF1("in create_message_queues *** ERR creating PR_1 queue, %d\n", status_matr)
632 // }
636 status_q_p1 = rtems_message_queue_create( misc_name[QUEUE_PRC1],
637 MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1,
638 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
639 if ( status_q_p1 != RTEMS_SUCCESSFUL ) {
640 PRINTF1("in create_message_queues *** ERR creating Q_P1 queue, %d\n", status_q_p1)
641 }
633 642
634 643 if ( status_recv != RTEMS_SUCCESSFUL )
635 644 {
@@ -639,9 +648,13 rtems_status_code create_message_queues(
639 648 {
640 649 ret = status_send;
641 650 }
651 else if( status_q_p0 != RTEMS_SUCCESSFUL )
652 {
653 ret = status_q_p0;
654 }
642 655 else
643 656 {
644 ret = status_matr;
657 ret = status_q_p1;
645 658 }
646 659
647 660 return ret;
This diff has been collapsed as it changes many lines, (684 lines changed) Show them Hide them
@@ -11,6 +11,8
11 11
12 12 #include "fsw_processing_globals.c"
13 13
14 unsigned int nb_sm_f0;
15
14 16 //************************
15 17 // spectral matrices rings
16 18 ring_node_sm sm_ring_f0[ NB_RING_NODES_SM_F0 ];
@@ -22,14 +24,15 ring_node_sm *current_ring_node_sm_f2;
22 24 ring_node_sm *ring_node_for_averaging_sm_f0;
23 25 ring_node_sm *ring_node_for_averaging_sm_f1;
24 26
27 ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_NORM_F0 ];
25 28 ring_node_asm asm_ring_burst_sbm_f0[ NB_RING_NODES_ASM_BURST_SBM_F0 ];
26 ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_BURST_SBM_F0 ];
29 ring_node_asm asm_ring_norm_f1 [ NB_RING_NODES_ASM_NORM_F1 ];
30 ring_node_asm asm_ring_burst_sbm_f1[ NB_RING_NODES_ASM_BURST_SBM_F1 ];
27 31 ring_node_asm *current_ring_node_asm_burst_sbm_f0;
32 ring_node_asm *current_ring_node_asm_norm_f0;
28 33 ring_node_asm *current_ring_node_asm_burst_sbm_f1;
29 ring_node_asm *current_ring_node_asm_norm_f0;
30 34 ring_node_asm *current_ring_node_asm_norm_f1;
31 35
32 float asm_norm_f0 [ TOTAL_SIZE_SM ];
33 36 float asm_f0_reorganized [ TOTAL_SIZE_SM ];
34 37 char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
35 38 float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_F0 ];
@@ -37,14 +40,10 float compressed_sm_sbm [ TOTAL_SIZE_
37 40
38 41 //***********************************************************
39 42 // Interrupt Service Routine for spectral matrices processing
43
40 44 void reset_nb_sm_f0( unsigned char lfrMode )
41 45 {
42 nb_sm.f0 = 0;
43 nb_sm.norm_bp1_f0 = 0;
44 nb_sm.norm_bp2_f0 = 0;
45 nb_sm.norm_asm_f0 = 0;
46 nb_sm.sbm_bp1_f0 = 0;
47 nb_sm.sbm_bp2_f0 = 0;
46 nb_sm_f0 = 0;
48 47
49 48 nb_sm_before_f0.norm_bp1_f0 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96;
50 49 nb_sm_before_f0.norm_bp2_f0 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96;
@@ -80,47 +79,33 void reset_nb_sm_f0( unsigned char lfrMo
80 79
81 80 void reset_nb_sm_f1( unsigned char lfrMode )
82 81 {
83 nb_sm.f1 = 0;
84 nb_sm.norm_bp1_f1 = 0;
85 nb_sm.norm_bp2_f1 = 0;
86 nb_sm.norm_asm_f1 = 0;
87 nb_sm.sbm_bp1_f1 = 0;
88 nb_sm.sbm_bp2_f1 = 0;
89
90 nb_sm_before_f1.norm_bp1_f1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 16;
91 nb_sm_before_f1.norm_bp2_f1 = parameter_dump_packet.sy_lfr_n_bp_p1 * 16;
92 nb_sm_before_f1.norm_asm_f1 = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 16;
93 nb_sm_before_f1.sbm2_bp1_f1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 16;
94 nb_sm_before_f1.sbm2_bp2_f1 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 16;
95 nb_sm_before_f1.burst_bp1_f1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 16;
96 nb_sm_before_f1.burst_bp2_f1 = parameter_dump_packet.sy_lfr_b_bp_p1 * 16;
82 nb_sm_before_f1.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 16;
83 nb_sm_before_f1.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 16;
84 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;
85 nb_sm_before_f1.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 16;
86 nb_sm_before_f1.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 16;
87 nb_sm_before_f1.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 16;
88 nb_sm_before_f1.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 16;
97 89
98 90 if (lfrMode == LFR_MODE_SBM2)
99 91 {
100 nb_sm_before_f1.burst_sbm_bp1_f1 = nb_sm_before_f1.sbm2_bp1_f1;
101 nb_sm_before_f1.burst_sbm_bp2_f1 = nb_sm_before_f1.sbm2_bp2_f1;
92 nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.sbm2_bp1;
93 nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.sbm2_bp2;
102 94 }
103 95 else if (lfrMode == LFR_MODE_BURST)
104 96 {
105 nb_sm_before_f1.burst_sbm_bp1_f1 = nb_sm_before_f1.burst_bp1_f1;
106 nb_sm_before_f1.burst_sbm_bp2_f1 = nb_sm_before_f1.burst_bp2_f1;
97 nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1;
98 nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2;
107 99 }
108 100 else
109 101 {
110 nb_sm_before_f1.burst_sbm_bp1_f1 = nb_sm_before_f1.burst_bp1_f1;
111 nb_sm_before_f1.burst_sbm_bp2_f1 = nb_sm_before_f1.burst_bp2_f1;
102 nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1;
103 nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2;
112 104 }
113 105 }
114 106
115 107 void reset_nb_sm_f2( unsigned char lfrMode )
116 108 {
117 nb_sm.f2 = 0;
118 nb_sm.norm_bp1_f2 = 0;
119 nb_sm.norm_bp2_f2 = 0;
120 nb_sm.norm_asm_f2 = 0;
121 nb_sm.sbm_bp1_f2 = 0;
122 nb_sm.sbm_bp2_f2 = 0;
123
124 109 nb_sm_before_f2.norm_bp1_f2 = parameter_dump_packet.sy_lfr_n_bp_p0;
125 110 nb_sm_before_f2.norm_bp2_f2 = parameter_dump_packet.sy_lfr_n_bp_p1;
126 111 nb_sm_before_f2.norm_asm_f2 = parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1];
@@ -159,7 +144,7 rtems_isr spectral_matrices_isr( rtems_v
159 144 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
160 145 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
161 146 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101
162 nb_sm.f0 = nb_sm.f0 + 1;
147 nb_sm_f0 = nb_sm_f0 + 1;
163 148 }
164 149
165 150 //************************
@@ -174,48 +159,40 rtems_isr spectral_matrices_isr( rtems_v
174 159 // reset ready matrix bits for f0_0, f1 and f2
175 160 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff2; // 0010
176 161
177 if (nb_sm.f0 == NB_SM_BEFORE_AVF0)
162 if (nb_sm_f0 == NB_SM_BEFORE_AVF0)
178 163 {
179 164 ring_node_for_averaging_sm_f0 = previous_ring_node_sm_f0;
180 165 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
181 166 {
182 167 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
183 168 }
184 nb_sm.f0 = 0;
169 nb_sm_f0 = 0;
185 170 }
186 171
187 172 }
188 173
189 174 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
190 175 {
191 if (nb_sm.f0 == (NB_SM_BEFORE_AVF0-1) )
176 if (nb_sm_f0 == (NB_SM_BEFORE_AVF0-1) )
192 177 {
193 178 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
194 179 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
195 180 {
196 181 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
197 182 }
198 nb_sm.f0 = 0;
183 nb_sm_f0 = 0;
199 184 }
200 185 else
201 186 {
202 nb_sm.f0 = nb_sm.f0 + 1;
187 nb_sm_f0 = nb_sm_f0 + 1;
203 188 }
204 189 }
205 190
206 191 //************
207 192 // RTEMS TASKS
208 193
209 rtems_task smiq_task( rtems_task_argument argument ) // process the Spectral Matrices IRQ
210 {
211 rtems_event_set event_out;
212
213 BOOT_PRINTF("in SMIQ *** \n")
214
215 while(1){
216 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
217 }
218 }
194 //*****************
195 // PROCESSING AT F0
219 196
220 197 rtems_task avf0_task( rtems_task_argument lfrRequestedMode )
221 198 {
@@ -227,9 +204,21 rtems_task avf0_task( rtems_task_argumen
227 204 asm_msg msgForMATR;
228 205 ring_node_sm *ring_node_tab[8];
229 206
207 static unsigned int nb_norm_bp1;
208 static unsigned int nb_norm_bp2;
209 static unsigned int nb_norm_asm;
210 static unsigned int nb_sbm_bp1;
211 static unsigned int nb_sbm_bp2;
212
213 nb_norm_bp1 = 0;
214 nb_norm_bp2 = 0;
215 nb_norm_asm = 0;
216 nb_sbm_bp1 = 0;
217 nb_sbm_bp2 = 0;
218
230 219 reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions
231 220
232 BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", lfrRequestedMode)
221 BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
233 222
234 223 status = get_message_queue_id_prc0( &queue_id_prc0 );
235 224 if (status != RTEMS_SUCCESSFUL)
@@ -250,14 +239,14 rtems_task avf0_task( rtems_task_argumen
250 239 SM_average( current_ring_node_asm_norm_f0->matrix,
251 240 current_ring_node_asm_burst_sbm_f0->matrix,
252 241 ring_node_tab,
253 nb_sm.norm_bp1_f0, nb_sm.sbm_bp1_f0 );
242 nb_norm_bp1, nb_sbm_bp1 );
254 243
255 244 // update nb_average
256 nb_sm.norm_bp1_f0 = nb_sm.norm_bp1_f0 + NB_SM_BEFORE_AVF0;
257 nb_sm.norm_bp2_f0 = nb_sm.norm_bp2_f0 + NB_SM_BEFORE_AVF0;
258 nb_sm.norm_asm_f0 = nb_sm.norm_asm_f0 + NB_SM_BEFORE_AVF0;
259 nb_sm.sbm_bp1_f0 = nb_sm.sbm_bp1_f0 + NB_SM_BEFORE_AVF0;
260 nb_sm.sbm_bp2_f0 = nb_sm.sbm_bp2_f0 + NB_SM_BEFORE_AVF0;
245 nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0;
246 nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0;
247 nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0;
248 nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0;
249 nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0;
261 250
262 251 //****************************************
263 252 // initialize the mesage for the MATR task
@@ -267,9 +256,9 rtems_task avf0_task( rtems_task_argumen
267 256 msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0];
268 257 msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1];
269 258
270 if (nb_sm.sbm_bp1_f0 == nb_sm_before_f0.burst_sbm_bp1_f0)
259 if (nb_sbm_bp1 == nb_sm_before_f0.burst_sbm_bp1_f0)
271 260 {
272 nb_sm.sbm_bp1_f0 = 0;
261 nb_sbm_bp1 = 0;
273 262 // set another ring for the ASM storage
274 263 current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next;
275 264 if ( (lfrCurrentMode == LFR_MODE_BURST)
@@ -279,9 +268,9 rtems_task avf0_task( rtems_task_argumen
279 268 }
280 269 }
281 270
282 if (nb_sm.sbm_bp2_f0 == nb_sm_before_f0.burst_sbm_bp2_f0)
271 if (nb_sbm_bp2 == nb_sm_before_f0.burst_sbm_bp2_f0)
283 272 {
284 nb_sm.sbm_bp2_f0 = 0;
273 nb_sbm_bp2 = 0;
285 274 if ( (lfrCurrentMode == LFR_MODE_BURST)
286 275 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
287 276 {
@@ -289,9 +278,9 rtems_task avf0_task( rtems_task_argumen
289 278 }
290 279 }
291 280
292 if (nb_sm.norm_bp1_f0 == nb_sm_before_f0.norm_bp1_f0)
281 if (nb_norm_bp1 == nb_sm_before_f0.norm_bp1_f0)
293 282 {
294 nb_sm.norm_bp1_f0 = 0;
283 nb_norm_bp1 = 0;
295 284 // set another ring for the ASM storage
296 285 current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next;
297 286 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
@@ -301,9 +290,9 rtems_task avf0_task( rtems_task_argumen
301 290 }
302 291 }
303 292
304 if (nb_sm.norm_bp2_f0 == nb_sm_before_f0.norm_bp2_f0)
293 if (nb_norm_bp2 == nb_sm_before_f0.norm_bp2_f0)
305 294 {
306 nb_sm.norm_bp2_f0 = 0;
295 nb_norm_bp2 = 0;
307 296 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
308 297 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
309 298 {
@@ -311,9 +300,9 rtems_task avf0_task( rtems_task_argumen
311 300 }
312 301 }
313 302
314 if (nb_sm.norm_asm_f0 == nb_sm_before_f0.norm_asm_f0)
303 if (nb_norm_asm == nb_sm_before_f0.norm_asm_f0)
315 304 {
316 nb_sm.norm_asm_f0 = 0;
305 nb_norm_asm = 0;
317 306 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
318 307 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
319 308 {
@@ -326,7 +315,7 rtems_task avf0_task( rtems_task_argumen
326 315 // send the message to MATR
327 316 if (msgForMATR.event != 0x00)
328 317 {
329 status = rtems_message_queue_send( queue_id_prc0, (char *) & msgForMATR, MSG_QUEUE_SIZE_PRC0);
318 status = rtems_message_queue_send( queue_id_prc0, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0);
330 319 }
331 320
332 321 if (status != RTEMS_SUCCESSFUL) {
@@ -337,166 +326,168 rtems_task avf0_task( rtems_task_argumen
337 326
338 327 rtems_task prc0_task( rtems_task_argument lfrRequestedMode )
339 328 {
340 // char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
341 // size_t size; // size of the incoming TC packet
342 // asm_msg *incomingMsg;
343 // //
344 // spw_ioctl_pkt_send spw_ioctl_send_ASM;
345 // rtems_status_code status;
346 // rtems_id queue_id;
347 // rtems_id queue_id_matr;
348 // Header_TM_LFR_SCIENCE_ASM_t headerASM;
349 // bp_packet_with_spare current_node_norm_bp1_f0;
350 // bp_packet current_node_norm_bp2_f0;
351 // bp_packet current_node_sbm_bp1_f0;
352 // bp_packet current_node_sbm_bp2_f0;
329 char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
330 size_t size; // size of the incoming TC packet
331 asm_msg *incomingMsg;
332 //
333 spw_ioctl_pkt_send spw_ioctl_send_ASM;
334 rtems_status_code status;
335 rtems_id queue_id;
336 rtems_id queue_id_q_p0;
337 Header_TM_LFR_SCIENCE_ASM_t headerASM;
338 bp_packet_with_spare packet_norm_bp1_f0;
339 bp_packet packet_norm_bp2_f0;
340 bp_packet packet_sbm_bp1_f0;
341 bp_packet packet_sbm_bp2_f0;
353 342
354 // unsigned long long int localTime;
343 unsigned long long int localTime;
355 344
356 // ASM_init_header( &headerASM );
345 ASM_init_header( &headerASM );
357 346
358 // //*************
359 // // NORM headers
360 // BP_init_header_with_spare( &current_node_norm_bp1_f0.header,
361 // APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0,
362 // PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 );
363 // BP_init_header( &current_node_norm_bp2_f0.header,
364 // APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0,
365 // PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0);
347 //*************
348 // NORM headers
349 BP_init_header_with_spare( &packet_norm_bp1_f0.header,
350 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0,
351 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 );
352 BP_init_header( &packet_norm_bp2_f0.header,
353 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0,
354 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0);
366 355
367 // //****************************
368 // // BURST SBM1 and SBM2 headers
369 // if ( (lfrRequestedMode == LFR_MODE_BURST)
370 // || (lfrRequestedMode == LFR_MODE_NORMAL) || (lfrRequestedMode == LFR_MODE_STANDBY) )
371 // {
372 // BP_init_header( &current_node_sbm_bp1_f0.header,
373 // APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0,
374 // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
375 // BP_init_header( &current_node_sbm_bp2_f0.header,
376 // APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0,
377 // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
378 // }
379 // else if ( lfrRequestedMode == LFR_MODE_SBM1 )
380 // {
381 // BP_init_header( &current_node_sbm_bp1_f0.header,
382 // APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0,
383 // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
384 // BP_init_header( &current_node_sbm_bp2_f0.header,
385 // APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0,
386 // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
387 // }
388 // else if ( lfrRequestedMode == LFR_MODE_SBM2 )
389 // {
390 // BP_init_header( &current_node_sbm_bp1_f0.header,
391 // APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0,
392 // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
393 // BP_init_header( &current_node_sbm_bp2_f0.header,
394 // APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0,
395 // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
396 // }
397 // else
398 // {
399 // PRINTF1("ERR *** in MATR *** unexpected lfrRequestedMode passed as argument = %d\n", (unsigned int) lfrRequestedMode)
400 // }
356 //****************************
357 // BURST SBM1 and SBM2 headers
358 if ( lfrRequestedMode == LFR_MODE_BURST )
359 {
360 BP_init_header( &packet_sbm_bp1_f0.header,
361 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0,
362 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
363 BP_init_header( &packet_sbm_bp2_f0.header,
364 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0,
365 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
366 }
367 else if ( lfrRequestedMode == LFR_MODE_SBM1 )
368 {
369 BP_init_header( &packet_sbm_bp1_f0.header,
370 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0,
371 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
372 BP_init_header( &packet_sbm_bp2_f0.header,
373 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0,
374 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
375 }
376 else if ( lfrRequestedMode == LFR_MODE_SBM2 )
377 {
378 BP_init_header( &packet_sbm_bp1_f0.header,
379 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0,
380 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
381 BP_init_header( &packet_sbm_bp2_f0.header,
382 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0,
383 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
384 }
385 else
386 {
387 PRINTF1("in PRC0 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode)
388 }
401 389
402 // status = get_message_queue_id_send( &queue_id );
403 // if (status != RTEMS_SUCCESSFUL)
404 // {
405 // PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status)
406 // }
407 // status = get_message_queue_id_prc0( &queue_id_matr);
408 // if (status != RTEMS_SUCCESSFUL)
409 // {
410 // PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status)
411 // }
390 status = get_message_queue_id_send( &queue_id );
391 if (status != RTEMS_SUCCESSFUL)
392 {
393 PRINTF1("in PRC0 *** ERR get_message_queue_id_send %d\n", status)
394 }
395 status = get_message_queue_id_prc0( &queue_id_q_p0);
396 if (status != RTEMS_SUCCESSFUL)
397 {
398 PRINTF1("in PRC0 *** ERR get_message_queue_id_prc0 %d\n", status)
399 }
412 400
413 // BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", lfrRequestedMode)
401 BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
414 402
415 // while(1){
416 // status = rtems_message_queue_receive( queue_id_matr, incomingData, &size, //************************************
417 // RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0
403 while(1){
404 status = rtems_message_queue_receive( queue_id_q_p0, incomingData, &size, //************************************
405 RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0
406
407 incomingMsg = (asm_msg*) incomingData;
418 408
419 // incomingMsg = (asm_msg*) incomingData;
420
421 // localTime = getTimeAsUnsignedLongLongInt( );
422 // //****************
423 // //****************
424 // // BURST SBM1 SBM2
425 // //****************
426 // //****************
427 // if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F0 )
428 // {
429 // // 1) compress the matrix for Basic Parameters calculation
430 // ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm,
431 // nb_sm_before_f0.burst_sbm_bp1_f0,
432 // NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0,
433 // ASM_F0_INDICE_START);
434 // // 2) compute the BP1 set
409 localTime = getTimeAsUnsignedLongLongInt( );
410 //****************
411 //****************
412 // BURST SBM1 SBM2
413 //****************
414 //****************
415 if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F0 )
416 {
417 // 1) compress the matrix for Basic Parameters calculation
418 ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm,
419 nb_sm_before_f0.burst_sbm_bp1_f0,
420 NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0,
421 ASM_F0_INDICE_START);
422 // 2) compute the BP1 set
435 423
436 // // 3) send the BP1 set
437 // set_time( current_node_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
438 // set_time( current_node_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
439 // BP_send( (char *) &current_node_sbm_bp1_f0.header, queue_id,
440 // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA);
441 // // 4) compute the BP2 set if needed
442 // if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F0 )
443 // {
444 // // 1) compute the BP2 set
424 // 3) send the BP1 set
425 set_time( packet_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
426 set_time( packet_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
427 BP_send( (char *) &packet_sbm_bp1_f0.header, queue_id,
428 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA);
429 // 4) compute the BP2 set if needed
430 if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F0 )
431 {
432 // 1) compute the BP2 set
445 433
446 // // 2) send the BP2 set
447 // set_time( current_node_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
448 // set_time( current_node_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
449 // BP_send( (char *) &current_node_sbm_bp2_f0.header, queue_id,
450 // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA);
451 // }
452 // }
434 // 2) send the BP2 set
435 set_time( packet_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
436 set_time( packet_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
437 BP_send( (char *) &packet_sbm_bp2_f0.header, queue_id,
438 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA);
439 }
440 }
453 441
454 // //*****
455 // //*****
456 // // NORM
457 // //*****
458 // //*****
459 // if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0)
460 // {
461 // // 1) compress the matrix for Basic Parameters calculation
462 // ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0,
463 // nb_sm_before_f0.norm_bp1_f0,
464 // NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
465 // ASM_F0_INDICE_START );
466 // // 2) compute the BP1 set
442 //*****
443 //*****
444 // NORM
445 //*****
446 //*****
447 if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0)
448 {
449 // 1) compress the matrix for Basic Parameters calculation
450 ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0,
451 nb_sm_before_f0.norm_bp1_f0,
452 NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
453 ASM_F0_INDICE_START );
454 // 2) compute the BP1 set
467 455
468 // // 3) send the BP1 set
469 // set_time( current_node_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
470 // set_time( current_node_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
471 // BP_send( (char *) &current_node_norm_bp1_f0.header, queue_id,
472 // PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA);
473 // if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0)
474 // {
475 // // 1) compute the BP2 set
456 // 3) send the BP1 set
457 set_time( packet_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
458 set_time( packet_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
459 BP_send( (char *) &packet_norm_bp1_f0.header, queue_id,
460 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA);
461 if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0)
462 {
463 // 1) compute the BP2 set
476 464
477 // // 2) send the BP2 set
478 // set_time( current_node_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
479 // set_time( current_node_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
480 // BP_send( (char *) &current_node_norm_bp2_f0.header, queue_id,
481 // PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA);
482 // }
483 // }
465 // 2) send the BP2 set
466 set_time( packet_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
467 set_time( packet_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
468 BP_send( (char *) &packet_norm_bp2_f0.header, queue_id,
469 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA);
470 }
471 }
484 472
485 // if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0)
486 // {
487 // // 1) reorganize the ASM and divide
488 // ASM_reorganize_and_divide( incomingMsg->norm->matrix, asm_f0_reorganized, NB_SM_BEFORE_NORM_BP1_F0 );
489 // // 2) convert the float array in a char array
490 // ASM_convert( asm_f0_reorganized, asm_f0_char);
491 // // 3) send the spectral matrix packets
492 // set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime );
493 // set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
494 // ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
495 // }
473 if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0)
474 {
475 // 1) reorganize the ASM and divide
476 ASM_reorganize_and_divide( incomingMsg->norm->matrix, asm_f0_reorganized, NB_SM_BEFORE_NORM_BP1_F0 );
477 // 2) convert the float array in a char array
478 ASM_convert( asm_f0_reorganized, asm_f0_char);
479 // 3) send the spectral matrix packets
480 set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime );
481 set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
482 ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
483 }
496 484
497 // }
485 }
498 486 }
499 487
488 //*****************
489 // PROCESSING AT F1
490
500 491 rtems_task avf1_task( rtems_task_argument lfrRequestedMode )
501 492 {
502 493 int i;
@@ -507,14 +498,26 rtems_task avf1_task( rtems_task_argumen
507 498 asm_msg msgForMATR;
508 499 ring_node_sm *ring_node_tab[8];
509 500
501 static unsigned int nb_norm_bp1;
502 static unsigned int nb_norm_bp2;
503 static unsigned int nb_norm_asm;
504 static unsigned int nb_sbm_bp1;
505 static unsigned int nb_sbm_bp2;
506
507 nb_norm_bp1 = 0;
508 nb_norm_bp2 = 0;
509 nb_norm_asm = 0;
510 nb_sbm_bp1 = 0;
511 nb_sbm_bp2 = 0;
512
510 513 reset_nb_sm_f1( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions
511 514
512 BOOT_PRINTF1("in AVF1 *** lfrRequestedMode = %d\n", lfrRequestedMode)
515 BOOT_PRINTF1("in AVF1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
513 516
514 517 status = get_message_queue_id_prc1( &queue_id_prc1 );
515 518 if (status != RTEMS_SUCCESSFUL)
516 519 {
517 PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status)
520 PRINTF1("in AVF1 *** ERR get_message_queue_id_prc1 %d\n", status)
518 521 }
519 522
520 523 while(1){
@@ -522,56 +525,56 rtems_task avf1_task( rtems_task_argumen
522 525 ring_node_tab[NB_SM_BEFORE_AVF1-1] = ring_node_for_averaging_sm_f1;
523 526 for ( i = 2; i < (NB_SM_BEFORE_AVF1+1); i++ )
524 527 {
525 ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous;
526 ring_node_tab[NB_SM_BEFORE_AVF1-i] = ring_node_for_averaging_sm_f0;
528 ring_node_for_averaging_sm_f1 = ring_node_for_averaging_sm_f1->previous;
529 ring_node_tab[NB_SM_BEFORE_AVF1-i] = ring_node_for_averaging_sm_f1;
527 530 }
528 531
529 532 // compute the average and store it in the averaged_sm_f1 buffer
530 533 SM_average( current_ring_node_asm_norm_f1->matrix,
531 534 current_ring_node_asm_burst_sbm_f1->matrix,
532 535 ring_node_tab,
533 nb_sm.norm_bp1_f1, nb_sm.sbm_bp1_f1 );
536 nb_norm_bp1, nb_sbm_bp1 );
534 537
535 538 // update nb_average
536 nb_sm.norm_bp1_f1 = nb_sm.norm_bp1_f1 + NB_SM_BEFORE_AVF1;
537 nb_sm.norm_bp2_f1 = nb_sm.norm_bp2_f1 + NB_SM_BEFORE_AVF1;
538 nb_sm.norm_asm_f1 = nb_sm.norm_asm_f1 + NB_SM_BEFORE_AVF1;
539 nb_sm.sbm_bp1_f1 = nb_sm.sbm_bp1_f1 + NB_SM_BEFORE_AVF1;
540 nb_sm.sbm_bp2_f1 = nb_sm.sbm_bp2_f1 + NB_SM_BEFORE_AVF1;
539 nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF1;
540 nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF1;
541 nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF1;
542 nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF1;
543 nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF1;
541 544
542 545 //****************************************
543 546 // initialize the mesage for the MATR task
544 msgForMATR.event = 0x00; // this composite event will be sent to the MATR task
547 msgForMATR.event = 0x00; // this composite event will be sent to the PRC1 task
545 548 msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f1;
546 549 msgForMATR.norm = current_ring_node_asm_norm_f1;
547 550 msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0];
548 551 msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1];
549 552
550 if (nb_sm.sbm_bp1_f1 == nb_sm_before_f1.burst_sbm_bp1_f1)
553 if (nb_sbm_bp1 == nb_sm_before_f1.burst_sbm_bp1)
551 554 {
552 nb_sm.sbm_bp1_f0 = 0;
555 nb_sbm_bp1 = 0;
553 556 // set another ring for the ASM storage
554 current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next;
557 current_ring_node_asm_burst_sbm_f1 = current_ring_node_asm_burst_sbm_f1->next;
555 558 if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) )
556 559 {
557 560 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F1;
558 561 }
559 562 }
560 563
561 if (nb_sm.sbm_bp2_f1 == nb_sm_before_f1.burst_sbm_bp2_f1)
564 if (nb_sbm_bp2 == nb_sm_before_f1.burst_sbm_bp2)
562 565 {
563 nb_sm.sbm_bp2_f0 = 0;
566 nb_sbm_bp2 = 0;
564 567 if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) )
565 568 {
566 569 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F1;
567 570 }
568 571 }
569 572
570 if (nb_sm.norm_bp1_f1 == nb_sm_before_f1.norm_bp1_f1)
573 if (nb_norm_bp1 == nb_sm_before_f1.norm_bp1)
571 574 {
572 nb_sm.norm_bp1_f0 = 0;
575 nb_norm_bp1 = 0;
573 576 // set another ring for the ASM storage
574 current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next;
577 current_ring_node_asm_norm_f1 = current_ring_node_asm_norm_f1->next;
575 578 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
576 579 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
577 580 {
@@ -579,9 +582,9 rtems_task avf1_task( rtems_task_argumen
579 582 }
580 583 }
581 584
582 if (nb_sm.norm_bp2_f1 == nb_sm_before_f1.norm_bp2_f1)
585 if (nb_norm_bp2 == nb_sm_before_f1.norm_bp2)
583 586 {
584 nb_sm.norm_bp2_f0 = 0;
587 nb_norm_bp2 = 0;
585 588 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
586 589 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
587 590 {
@@ -589,9 +592,9 rtems_task avf1_task( rtems_task_argumen
589 592 }
590 593 }
591 594
592 if (nb_sm.norm_asm_f1 == nb_sm_before_f1.norm_asm_f1)
595 if (nb_norm_asm == nb_sm_before_f1.norm_asm)
593 596 {
594 nb_sm.norm_asm_f0 = 0;
597 nb_norm_asm = 0;
595 598 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
596 599 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
597 600 {
@@ -603,7 +606,7 rtems_task avf1_task( rtems_task_argumen
603 606 // send the message to MATR
604 607 if (msgForMATR.event != 0x00)
605 608 {
606 status = rtems_message_queue_send( queue_id_prc1, (char *) & msgForMATR, MSG_QUEUE_SIZE_PRC1);
609 status = rtems_message_queue_send( queue_id_prc1, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC1);
607 610 }
608 611
609 612 if (status != RTEMS_SUCCESSFUL) {
@@ -612,6 +615,158 rtems_task avf1_task( rtems_task_argumen
612 615 }
613 616 }
614 617
618 rtems_task prc1_task( rtems_task_argument lfrRequestedMode )
619 {
620 char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
621 size_t size; // size of the incoming TC packet
622 asm_msg *incomingMsg;
623 //
624 spw_ioctl_pkt_send spw_ioctl_send_ASM;
625 rtems_status_code status;
626 rtems_id queue_id;
627 rtems_id queue_id_q_p1;
628 Header_TM_LFR_SCIENCE_ASM_t headerASM;
629 bp_packet_with_spare packet_norm_bp1;
630 bp_packet packet_norm_bp2;
631 bp_packet packet_sbm_bp1;
632 bp_packet packet_sbm_bp2;
633
634 unsigned long long int localTime;
635
636 ASM_init_header( &headerASM );
637
638 //*************
639 // NORM headers
640 BP_init_header_with_spare( &packet_norm_bp1.header,
641 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F1,
642 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1, NB_BINS_COMPRESSED_SM_F1 );
643 BP_init_header( &packet_norm_bp2.header,
644 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F1,
645 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1, NB_BINS_COMPRESSED_SM_F1);
646
647 //***********************
648 // BURST and SBM2 headers
649 if ( lfrRequestedMode == LFR_MODE_BURST )
650 {
651 BP_init_header( &packet_sbm_bp1.header,
652 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F1,
653 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F1);
654 BP_init_header( &packet_sbm_bp2.header,
655 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F1,
656 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F1);
657 }
658 else if ( lfrRequestedMode == LFR_MODE_SBM2 )
659 {
660 BP_init_header( &packet_sbm_bp1.header,
661 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F1,
662 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1, NB_BINS_COMPRESSED_SM_SBM_F1);
663 BP_init_header( &packet_sbm_bp2.header,
664 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F1,
665 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1, NB_BINS_COMPRESSED_SM_SBM_F1);
666 }
667 else
668 {
669 PRINTF1("ERR *** in PRC1 *** unexpected lfrRequestedMode passed as argument = %d\n", (unsigned int) lfrRequestedMode)
670 }
671
672 status = get_message_queue_id_send( &queue_id );
673 if (status != RTEMS_SUCCESSFUL)
674 {
675 PRINTF1("in PRC1 *** ERR get_message_queue_id_send %d\n", status)
676 }
677 status = get_message_queue_id_prc1( &queue_id_q_p1);
678 if (status != RTEMS_SUCCESSFUL)
679 {
680 PRINTF1("in PRC1 *** ERR get_message_queue_id_prc1 %d\n", status)
681 }
682
683 BOOT_PRINTF1("in PRC1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
684
685 while(1){
686 status = rtems_message_queue_receive( queue_id_q_p1, incomingData, &size, //************************************
687 RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0
688
689 incomingMsg = (asm_msg*) incomingData;
690
691 localTime = getTimeAsUnsignedLongLongInt( );
692 //***********
693 //***********
694 // BURST SBM2
695 //***********
696 //***********
697 if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F1 )
698 {
699 // 1) compress the matrix for Basic Parameters calculation
700 ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm,
701 nb_sm_before_f1.burst_sbm_bp1,
702 NB_BINS_COMPRESSED_SM_SBM_F1, NB_BINS_TO_AVERAGE_ASM_SBM_F1,
703 ASM_F1_INDICE_START);
704 // 2) compute the BP1 set
705
706 // 3) send the BP1 set
707 set_time( packet_sbm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime );
708 set_time( packet_sbm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
709 BP_send( (char *) &packet_sbm_bp1.header, queue_id,
710 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 + PACKET_LENGTH_DELTA);
711 // 4) compute the BP2 set if needed
712 if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F1 )
713 {
714 // 1) compute the BP2 set
715
716 // 2) send the BP2 set
717 set_time( packet_sbm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime );
718 set_time( packet_sbm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
719 BP_send( (char *) &packet_sbm_bp2.header, queue_id,
720 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 + PACKET_LENGTH_DELTA);
721 }
722 }
723
724 //*****
725 //*****
726 // NORM
727 //*****
728 //*****
729 if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F1)
730 {
731 // 1) compress the matrix for Basic Parameters calculation
732 ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0,
733 nb_sm_before_f0.norm_bp1_f0,
734 NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
735 ASM_F0_INDICE_START );
736 // 2) compute the BP1 set
737
738 // 3) send the BP1 set
739 set_time( packet_norm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime );
740 set_time( packet_norm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
741 BP_send( (char *) &packet_norm_bp1.header, queue_id,
742 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 + PACKET_LENGTH_DELTA);
743 if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F1)
744 {
745 // 1) compute the BP2 set
746
747 // 2) send the BP2 set
748 set_time( packet_norm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime );
749 set_time( packet_norm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
750 BP_send( (char *) &packet_norm_bp2.header, queue_id,
751 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 + PACKET_LENGTH_DELTA);
752 }
753 }
754
755 if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F1)
756 {
757 // 1) reorganize the ASM and divide
758 ASM_reorganize_and_divide( incomingMsg->norm->matrix, asm_f0_reorganized, NB_SM_BEFORE_NORM_BP1_F0 );
759 // 2) convert the float array in a char array
760 ASM_convert( asm_f0_reorganized, asm_f0_char);
761 // 3) send the spectral matrix packets
762 set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime );
763 set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
764 ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
765 }
766
767 }
768 }
769
615 770 //******************
616 771 // Spectral Matrices
617 772
@@ -686,38 +841,32 void SM_init_rings( void )
686 841
687 842 void ASM_init_rings( void )
688 843 {
844 //***
845 // F0
846 // NORM
847 ASM_generic_init_ring( asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0 );
848 // BURST_SBM
849 ASM_generic_init_ring( asm_ring_burst_sbm_f0, NB_RING_NODES_ASM_BURST_SBM_F0 );
850
851 //***
852 // F1
853 //*****
854 // NORM
855 ASM_generic_init_ring( asm_ring_norm_f1, NB_RING_NODES_ASM_NORM_F1 );
856 // BURST_SBM
857 ASM_generic_init_ring( asm_ring_burst_sbm_f1, NB_RING_NODES_ASM_BURST_SBM_F1 );
858 }
859
860 void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes )
861 {
689 862 unsigned char i;
690 863
691 //*************
692 // BURST_SBM_F0
693 asm_ring_burst_sbm_f0[0].next = (ring_node_asm*) &asm_ring_burst_sbm_f0[1];
694 asm_ring_burst_sbm_f0[0].previous = (ring_node_asm*) &asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-1];
864 ring[ nbNodes - 1 ].next
865 = (ring_node_asm*) &ring[ 0 ];
695 866
696 asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-1].next
697 = (ring_node_asm*) &asm_ring_burst_sbm_f0[0];
698 asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-1].previous
699 = (ring_node_asm*) &asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-2];
700
701 for(i=1; i<NB_RING_NODES_ASM_BURST_SBM_F0-1; i++)
867 for(i=0; i<nbNodes-1; i++)
702 868 {
703 asm_ring_burst_sbm_f0[i].next = (ring_node_asm*) &asm_ring_burst_sbm_f0[i+1];
704 asm_ring_burst_sbm_f0[i].previous = (ring_node_asm*) &asm_ring_burst_sbm_f0[i-1];
705 }
706
707 //*************
708 // NORM_F0
709 asm_ring_norm_f0[0].next = (ring_node_asm*) &asm_ring_norm_f0[1];
710 asm_ring_norm_f0[0].previous = (ring_node_asm*) &asm_ring_norm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-1];
711
712 asm_ring_norm_f0[NB_RING_NODES_ASM_NORM_F0-1].next
713 = (ring_node_asm*) &asm_ring_norm_f0[0];
714 asm_ring_norm_f0[NB_RING_NODES_ASM_NORM_F0-1].previous
715 = (ring_node_asm*) &asm_ring_norm_f0[NB_RING_NODES_ASM_NORM_F0-2];
716
717 for(i=1; i<NB_RING_NODES_ASM_NORM_F0-1; i++)
718 {
719 asm_ring_norm_f0[i].next = (ring_node_asm*) &asm_ring_norm_f0[i+1];
720 asm_ring_norm_f0[i].previous = (ring_node_asm*) &asm_ring_norm_f0[i-1];
869 ring[ i ].next = (ring_node_asm*) &ring[ i + 1 ];
721 870 }
722 871 }
723 872
@@ -730,10 +879,13 void SM_reset_current_ring_nodes( void )
730 879 ring_node_for_averaging_sm_f0 = sm_ring_f0;
731 880 }
732 881
733 void ASM_reset_current_ring_node( void )
882 void ASM_reset_current_ring_nodes( void )
734 883 {
735 884 current_ring_node_asm_norm_f0 = asm_ring_norm_f0;
736 885 current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0;
886
887 current_ring_node_asm_norm_f1 = asm_ring_norm_f1;
888 current_ring_node_asm_burst_sbm_f1 = asm_ring_burst_sbm_f1;
737 889 }
738 890
739 891 void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header)
@@ -571,11 +571,11 int restart_science_tasks(unsigned char
571 571 * - RTEMS_INCORRECT_STATE - task never started
572 572 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
573 573 *
574 * Science tasks are AVF0, BPF0, 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[7];
578 rtems_status_code status[8];
579 579 rtems_status_code ret;
580 580
581 581 ret = RTEMS_SUCCESSFUL;
@@ -583,42 +583,55 int restart_science_tasks(unsigned char
583 583 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode );
584 584 if (status[0] != RTEMS_SUCCESSFUL)
585 585 {
586 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
586 PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0])
587 }
588
589 status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode );
590 if (status[1] != RTEMS_SUCCESSFUL)
591 {
592 PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1])
587 593 }
588 594
589 595 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
590 596 if (status[2] != RTEMS_SUCCESSFUL)
591 597 {
592 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
598 PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[2])
593 599 }
594 600
595 601 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
596 602 if (status[3] != RTEMS_SUCCESSFUL)
597 603 {
598 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
604 PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[3])
599 605 }
600 606
601 607 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
602 608 if (status[4] != RTEMS_SUCCESSFUL)
603 609 {
604 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
610 PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[4])
605 611 }
606 612
607 613 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
608 614 if (status[5] != RTEMS_SUCCESSFUL)
609 615 {
610 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
616 PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[5])
611 617 }
612 618
613 status[6] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode );
619 status[6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode );
614 620 if (status[6] != RTEMS_SUCCESSFUL)
615 621 {
616 PRINTF1("in restart_science_task *** 6 ERR %d\n", status[6])
622 PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[6])
617 623 }
618 624
619 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
620 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) ||
621 (status[5] != RTEMS_SUCCESSFUL) || (status[6] != RTEMS_SUCCESSFUL) )
625 status[7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode );
626 if (status[7] != RTEMS_SUCCESSFUL)
627 {
628 PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7])
629 }
630
631 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) ||
632 (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) ||
633 (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ||
634 (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) )
622 635 {
623 636 ret = RTEMS_UNSATISFIED;
624 637 }
@@ -639,12 +652,35 int suspend_science_tasks()
639 652
640 653 rtems_status_code status;
641 654
642 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
655 status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0
643 656 if (status != RTEMS_SUCCESSFUL)
644 657 {
645 658 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
646 659 }
647
660 if (status == RTEMS_SUCCESSFUL) // suspend PRC0
661 {
662 status = rtems_task_suspend( Task_id[TASKID_PRC0] );
663 if (status != RTEMS_SUCCESSFUL)
664 {
665 PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status)
666 }
667 }
668 if (status == RTEMS_SUCCESSFUL) // suspend AVF1
669 {
670 status = rtems_task_suspend( Task_id[TASKID_AVF1] );
671 if (status != RTEMS_SUCCESSFUL)
672 {
673 PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status)
674 }
675 }
676 if (status == RTEMS_SUCCESSFUL) // suspend PRC1
677 {
678 status = rtems_task_suspend( Task_id[TASKID_PRC1] );
679 if (status != RTEMS_SUCCESSFUL)
680 {
681 PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status)
682 }
683 }
648 684 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
649 685 {
650 686 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
@@ -653,7 +689,6 int suspend_science_tasks()
653 689 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
654 690 }
655 691 }
656
657 692 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
658 693 {
659 694 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
@@ -662,7 +697,6 int suspend_science_tasks()
662 697 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
663 698 }
664 699 }
665
666 700 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
667 701 {
668 702 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
@@ -671,7 +705,6 int suspend_science_tasks()
671 705 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
672 706 }
673 707 }
674
675 708 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
676 709 {
677 710 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
@@ -707,7 +740,7 void launch_waveform_picker( unsigned ch
707 740 void launch_spectral_matrix( void )
708 741 {
709 742 SM_reset_current_ring_nodes();
710 ASM_reset_current_ring_node();
743 ASM_reset_current_ring_nodes();
711 744 reset_spectral_matrix_regs();
712 745
713 746 struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO;
@@ -724,7 +757,7 void launch_spectral_matrix( void )
724 757 void launch_spectral_matrix_simu( void )
725 758 {
726 759 SM_reset_current_ring_nodes();
727 ASM_reset_current_ring_node();
760 ASM_reset_current_ring_nodes();
728 761 reset_spectral_matrix_regs();
729 762
730 763 // Spectral Matrices simulator
General Comments 0
You need to be logged in to leave comments. Login now