##// END OF EJS Templates
3.1.0.1...
paul -
r292:d9dfd2a081bc R3_plus draft
parent child
Show More
@@ -1,123 +1,123
1 TEMPLATE = app
1 TEMPLATE = app
2 # CONFIG += console v8 sim
2 # CONFIG += console v8 sim
3 # CONFIG options =
3 # CONFIG options =
4 # verbose
4 # verbose
5 # boot_messages
5 # boot_messages
6 # debug_messages
6 # debug_messages
7 # cpu_usage_report
7 # cpu_usage_report
8 # stack_report
8 # stack_report
9 # vhdl_dev
9 # vhdl_dev
10 # debug_tch
10 # debug_tch
11 # lpp_dpu_destid /!\ REMOVE BEFORE DELIVERY TO LESIA /!\
11 # lpp_dpu_destid /!\ REMOVE BEFORE DELIVERY TO LESIA /!\
12 # debug_watchdog
12 # debug_watchdog
13 CONFIG += console verbose lpp_dpu_destid cpu_usage_report
13 CONFIG += console verbose lpp_dpu_destid cpu_usage_report
14 CONFIG -= qt
14 CONFIG -= qt
15
15
16 include(./sparc.pri)
16 include(./sparc.pri)
17
17
18 # flight software version
18 # flight software version
19 SWVERSION=-1-0
19 SWVERSION=-1-0
20 DEFINES += SW_VERSION_N1=3 # major
20 DEFINES += SW_VERSION_N1=3 # major
21 DEFINES += SW_VERSION_N2=1 # minor
21 DEFINES += SW_VERSION_N2=1 # minor
22 DEFINES += SW_VERSION_N3=0 # patch
22 DEFINES += SW_VERSION_N3=0 # patch
23 DEFINES += SW_VERSION_N4=0 # internal
23 DEFINES += SW_VERSION_N4=1 # internal
24
24
25 # <GCOV>
25 # <GCOV>
26 #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
26 #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
27 #LIBS += -lgcov /opt/GCOV/01A/lib/overload.o -lc
27 #LIBS += -lgcov /opt/GCOV/01A/lib/overload.o -lc
28 # </GCOV>
28 # </GCOV>
29
29
30 # <CHANGE BEFORE FLIGHT>
30 # <CHANGE BEFORE FLIGHT>
31 contains( CONFIG, lpp_dpu_destid ) {
31 contains( CONFIG, lpp_dpu_destid ) {
32 DEFINES += LPP_DPU_DESTID
32 DEFINES += LPP_DPU_DESTID
33 }
33 }
34 # </CHANGE BEFORE FLIGHT>
34 # </CHANGE BEFORE FLIGHT>
35
35
36 contains( CONFIG, debug_tch ) {
36 contains( CONFIG, debug_tch ) {
37 DEFINES += DEBUG_TCH
37 DEFINES += DEBUG_TCH
38 }
38 }
39 DEFINES += MSB_FIRST_TCH
39 DEFINES += MSB_FIRST_TCH
40
40
41 contains( CONFIG, vhdl_dev ) {
41 contains( CONFIG, vhdl_dev ) {
42 DEFINES += VHDL_DEV
42 DEFINES += VHDL_DEV
43 }
43 }
44
44
45 contains( CONFIG, verbose ) {
45 contains( CONFIG, verbose ) {
46 DEFINES += PRINT_MESSAGES_ON_CONSOLE
46 DEFINES += PRINT_MESSAGES_ON_CONSOLE
47 }
47 }
48
48
49 contains( CONFIG, debug_messages ) {
49 contains( CONFIG, debug_messages ) {
50 DEFINES += DEBUG_MESSAGES
50 DEFINES += DEBUG_MESSAGES
51 }
51 }
52
52
53 contains( CONFIG, cpu_usage_report ) {
53 contains( CONFIG, cpu_usage_report ) {
54 DEFINES += PRINT_TASK_STATISTICS
54 DEFINES += PRINT_TASK_STATISTICS
55 }
55 }
56
56
57 contains( CONFIG, stack_report ) {
57 contains( CONFIG, stack_report ) {
58 DEFINES += PRINT_STACK_REPORT
58 DEFINES += PRINT_STACK_REPORT
59 }
59 }
60
60
61 contains( CONFIG, boot_messages ) {
61 contains( CONFIG, boot_messages ) {
62 DEFINES += BOOT_MESSAGES
62 DEFINES += BOOT_MESSAGES
63 }
63 }
64
64
65 contains( CONFIG, debug_watchdog ) {
65 contains( CONFIG, debug_watchdog ) {
66 DEFINES += DEBUG_WATCHDOG
66 DEFINES += DEBUG_WATCHDOG
67 }
67 }
68
68
69 #doxygen.target = doxygen
69 #doxygen.target = doxygen
70 #doxygen.commands = doxygen ../doc/Doxyfile
70 #doxygen.commands = doxygen ../doc/Doxyfile
71 #QMAKE_EXTRA_TARGETS += doxygen
71 #QMAKE_EXTRA_TARGETS += doxygen
72
72
73 TARGET = fsw
73 TARGET = fsw
74
74
75 INCLUDEPATH += \
75 INCLUDEPATH += \
76 $${PWD}/../src \
76 $${PWD}/../src \
77 $${PWD}/../header \
77 $${PWD}/../header \
78 $${PWD}/../header/lfr_common_headers \
78 $${PWD}/../header/lfr_common_headers \
79 $${PWD}/../header/processing \
79 $${PWD}/../header/processing \
80 $${PWD}/../LFR_basic-parameters
80 $${PWD}/../LFR_basic-parameters
81
81
82 SOURCES += \
82 SOURCES += \
83 ../src/wf_handler.c \
83 ../src/wf_handler.c \
84 ../src/tc_handler.c \
84 ../src/tc_handler.c \
85 ../src/fsw_misc.c \
85 ../src/fsw_misc.c \
86 ../src/fsw_init.c \
86 ../src/fsw_init.c \
87 ../src/fsw_globals.c \
87 ../src/fsw_globals.c \
88 ../src/fsw_spacewire.c \
88 ../src/fsw_spacewire.c \
89 ../src/tc_load_dump_parameters.c \
89 ../src/tc_load_dump_parameters.c \
90 ../src/tm_lfr_tc_exe.c \
90 ../src/tm_lfr_tc_exe.c \
91 ../src/tc_acceptance.c \
91 ../src/tc_acceptance.c \
92 ../src/processing/fsw_processing.c \
92 ../src/processing/fsw_processing.c \
93 ../src/processing/avf0_prc0.c \
93 ../src/processing/avf0_prc0.c \
94 ../src/processing/avf1_prc1.c \
94 ../src/processing/avf1_prc1.c \
95 ../src/processing/avf2_prc2.c \
95 ../src/processing/avf2_prc2.c \
96 ../src/lfr_cpu_usage_report.c \
96 ../src/lfr_cpu_usage_report.c \
97 ../LFR_basic-parameters/basic_parameters.c
97 ../LFR_basic-parameters/basic_parameters.c
98
98
99 HEADERS += \
99 HEADERS += \
100 ../header/wf_handler.h \
100 ../header/wf_handler.h \
101 ../header/tc_handler.h \
101 ../header/tc_handler.h \
102 ../header/grlib_regs.h \
102 ../header/grlib_regs.h \
103 ../header/fsw_misc.h \
103 ../header/fsw_misc.h \
104 ../header/fsw_init.h \
104 ../header/fsw_init.h \
105 ../header/fsw_spacewire.h \
105 ../header/fsw_spacewire.h \
106 ../header/tc_load_dump_parameters.h \
106 ../header/tc_load_dump_parameters.h \
107 ../header/tm_lfr_tc_exe.h \
107 ../header/tm_lfr_tc_exe.h \
108 ../header/tc_acceptance.h \
108 ../header/tc_acceptance.h \
109 ../header/processing/fsw_processing.h \
109 ../header/processing/fsw_processing.h \
110 ../header/processing/avf0_prc0.h \
110 ../header/processing/avf0_prc0.h \
111 ../header/processing/avf1_prc1.h \
111 ../header/processing/avf1_prc1.h \
112 ../header/processing/avf2_prc2.h \
112 ../header/processing/avf2_prc2.h \
113 ../header/fsw_params_wf_handler.h \
113 ../header/fsw_params_wf_handler.h \
114 ../header/lfr_cpu_usage_report.h \
114 ../header/lfr_cpu_usage_report.h \
115 ../header/lfr_common_headers/ccsds_types.h \
115 ../header/lfr_common_headers/ccsds_types.h \
116 ../header/lfr_common_headers/fsw_params.h \
116 ../header/lfr_common_headers/fsw_params.h \
117 ../header/lfr_common_headers/fsw_params_nb_bytes.h \
117 ../header/lfr_common_headers/fsw_params_nb_bytes.h \
118 ../header/lfr_common_headers/fsw_params_processing.h \
118 ../header/lfr_common_headers/fsw_params_processing.h \
119 ../header/lfr_common_headers/tm_byte_positions.h \
119 ../header/lfr_common_headers/tm_byte_positions.h \
120 ../LFR_basic-parameters/basic_parameters.h \
120 ../LFR_basic-parameters/basic_parameters.h \
121 ../LFR_basic-parameters/basic_parameters_params.h \
121 ../LFR_basic-parameters/basic_parameters_params.h \
122 ../header/GscMemoryLPP.hpp
122 ../header/GscMemoryLPP.hpp
123
123
@@ -1,413 +1,414
1 /** Functions related to data processing.
1 /** Functions related to data processing.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
7 *
7 *
8 */
8 */
9
9
10 #include "avf0_prc0.h"
10 #include "avf0_prc0.h"
11 #include "fsw_processing.h"
11 #include "fsw_processing.h"
12
12
13 nb_sm_before_bp_asm_f0 nb_sm_before_f0;
13 nb_sm_before_bp_asm_f0 nb_sm_before_f0;
14
14
15 //***
15 //***
16 // F0
16 // F0
17 ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_NORM_F0 ];
17 ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_NORM_F0 ];
18 ring_node_asm asm_ring_burst_sbm_f0 [ NB_RING_NODES_ASM_BURST_SBM_F0 ];
18 ring_node_asm asm_ring_burst_sbm_f0 [ NB_RING_NODES_ASM_BURST_SBM_F0 ];
19
19
20 ring_node ring_to_send_asm_f0 [ NB_RING_NODES_ASM_F0 ];
20 ring_node ring_to_send_asm_f0 [ NB_RING_NODES_ASM_F0 ];
21 int buffer_asm_f0 [ NB_RING_NODES_ASM_F0 * TOTAL_SIZE_SM ];
21 int buffer_asm_f0 [ NB_RING_NODES_ASM_F0 * TOTAL_SIZE_SM ];
22
22
23 float asm_f0_patched_norm [ TOTAL_SIZE_SM ];
23 float asm_f0_patched_norm [ TOTAL_SIZE_SM ];
24 float asm_f0_patched_burst_sbm [ TOTAL_SIZE_SM ];
24 float asm_f0_patched_burst_sbm [ TOTAL_SIZE_SM ];
25 float asm_f0_reorganized [ TOTAL_SIZE_SM ];
25 float asm_f0_reorganized [ TOTAL_SIZE_SM ];
26
26
27 char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
27 char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
28 float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F0];
28 float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F0];
29 float compressed_sm_sbm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 ];
29 float compressed_sm_sbm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 ];
30
30
31 float k_coeff_intercalib_f0_norm[ NB_BINS_COMPRESSED_SM_F0 * NB_K_COEFF_PER_BIN ]; // 11 * 32 = 352
31 float k_coeff_intercalib_f0_norm[ NB_BINS_COMPRESSED_SM_F0 * NB_K_COEFF_PER_BIN ]; // 11 * 32 = 352
32 float k_coeff_intercalib_f0_sbm[ NB_BINS_COMPRESSED_SM_SBM_F0 * NB_K_COEFF_PER_BIN ]; // 22 * 32 = 704
32 float k_coeff_intercalib_f0_sbm[ NB_BINS_COMPRESSED_SM_SBM_F0 * NB_K_COEFF_PER_BIN ]; // 22 * 32 = 704
33
33
34 //************
34 //************
35 // RTEMS TASKS
35 // RTEMS TASKS
36
36
37 rtems_task avf0_task( rtems_task_argument lfrRequestedMode )
37 rtems_task avf0_task( rtems_task_argument lfrRequestedMode )
38 {
38 {
39 int i;
39 int i;
40
40
41 rtems_event_set event_out;
41 rtems_event_set event_out;
42 rtems_status_code status;
42 rtems_status_code status;
43 rtems_id queue_id_prc0;
43 rtems_id queue_id_prc0;
44 asm_msg msgForPRC;
44 asm_msg msgForPRC;
45 ring_node *nodeForAveraging;
45 ring_node *nodeForAveraging;
46 ring_node *ring_node_tab[8];
46 ring_node *ring_node_tab[8];
47 ring_node_asm *current_ring_node_asm_burst_sbm_f0;
47 ring_node_asm *current_ring_node_asm_burst_sbm_f0;
48 ring_node_asm *current_ring_node_asm_norm_f0;
48 ring_node_asm *current_ring_node_asm_norm_f0;
49
49
50 unsigned int nb_norm_bp1;
50 unsigned int nb_norm_bp1;
51 unsigned int nb_norm_bp2;
51 unsigned int nb_norm_bp2;
52 unsigned int nb_norm_asm;
52 unsigned int nb_norm_asm;
53 unsigned int nb_sbm_bp1;
53 unsigned int nb_sbm_bp1;
54 unsigned int nb_sbm_bp2;
54 unsigned int nb_sbm_bp2;
55
55
56 nb_norm_bp1 = 0;
56 nb_norm_bp1 = 0;
57 nb_norm_bp2 = 0;
57 nb_norm_bp2 = 0;
58 nb_norm_asm = 0;
58 nb_norm_asm = 0;
59 nb_sbm_bp1 = 0;
59 nb_sbm_bp1 = 0;
60 nb_sbm_bp2 = 0;
60 nb_sbm_bp2 = 0;
61
61
62 reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions
62 reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions
63 ASM_generic_init_ring( asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0 );
63 ASM_generic_init_ring( asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0 );
64 ASM_generic_init_ring( asm_ring_burst_sbm_f0, NB_RING_NODES_ASM_BURST_SBM_F0 );
64 ASM_generic_init_ring( asm_ring_burst_sbm_f0, NB_RING_NODES_ASM_BURST_SBM_F0 );
65 current_ring_node_asm_norm_f0 = asm_ring_norm_f0;
65 current_ring_node_asm_norm_f0 = asm_ring_norm_f0;
66 current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0;
66 current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0;
67
67
68 BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
68 BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
69
69
70 status = get_message_queue_id_prc0( &queue_id_prc0 );
70 status = get_message_queue_id_prc0( &queue_id_prc0 );
71 if (status != RTEMS_SUCCESSFUL)
71 if (status != RTEMS_SUCCESSFUL)
72 {
72 {
73 PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status)
73 PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status)
74 }
74 }
75
75
76 while(1){
76 while(1){
77 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
77 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
78
78
79 //****************************************
79 //****************************************
80 // initialize the mesage for the MATR task
80 // initialize the mesage for the MATR task
81 msgForPRC.norm = current_ring_node_asm_norm_f0;
81 msgForPRC.norm = current_ring_node_asm_norm_f0;
82 msgForPRC.burst_sbm = current_ring_node_asm_burst_sbm_f0;
82 msgForPRC.burst_sbm = current_ring_node_asm_burst_sbm_f0;
83 msgForPRC.event = 0x00; // this composite event will be sent to the PRC0 task
83 msgForPRC.event = 0x00; // this composite event will be sent to the PRC0 task
84 //
84 //
85 //****************************************
85 //****************************************
86
86
87 nodeForAveraging = getRingNodeForAveraging( 0 );
87 nodeForAveraging = getRingNodeForAveraging( 0 );
88
88
89 ring_node_tab[NB_SM_BEFORE_AVF0-1] = nodeForAveraging;
89 ring_node_tab[NB_SM_BEFORE_AVF0-1] = nodeForAveraging;
90 for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ )
90 for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ )
91 {
91 {
92 nodeForAveraging = nodeForAveraging->previous;
92 nodeForAveraging = nodeForAveraging->previous;
93 ring_node_tab[NB_SM_BEFORE_AVF0-i] = nodeForAveraging;
93 ring_node_tab[NB_SM_BEFORE_AVF0-i] = nodeForAveraging;
94 }
94 }
95
95
96 // compute the average and store it in the averaged_sm_f1 buffer
96 // compute the average and store it in the averaged_sm_f1 buffer
97 SM_average( current_ring_node_asm_norm_f0->matrix,
97 SM_average( current_ring_node_asm_norm_f0->matrix,
98 current_ring_node_asm_burst_sbm_f0->matrix,
98 current_ring_node_asm_burst_sbm_f0->matrix,
99 ring_node_tab,
99 ring_node_tab,
100 nb_norm_bp1, nb_sbm_bp1,
100 nb_norm_bp1, nb_sbm_bp1,
101 &msgForPRC, 0 ); // 0 => frequency channel 0
101 &msgForPRC, 0 ); // 0 => frequency channel 0
102
102
103 // update nb_average
103 // update nb_average
104 nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0;
104 nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0;
105 nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0;
105 nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0;
106 nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0;
106 nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0;
107 nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0;
107 nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0;
108 nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0;
108 nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0;
109
109
110 if (nb_sbm_bp1 == nb_sm_before_f0.burst_sbm_bp1)
110 if (nb_sbm_bp1 == nb_sm_before_f0.burst_sbm_bp1)
111 {
111 {
112 nb_sbm_bp1 = 0;
112 nb_sbm_bp1 = 0;
113 // set another ring for the ASM storage
113 // set another ring for the ASM storage
114 current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next;
114 current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next;
115 if ( lfrCurrentMode == LFR_MODE_BURST )
115 if ( lfrCurrentMode == LFR_MODE_BURST )
116 {
116 {
117 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_BURST_BP1_F0;
117 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_BURST_BP1_F0;
118 }
118 }
119 else if ( (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
119 else if ( (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
120 {
120 {
121 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_SBM_BP1_F0;
121 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_SBM_BP1_F0;
122 }
122 }
123 }
123 }
124
124
125 if (nb_sbm_bp2 == nb_sm_before_f0.burst_sbm_bp2)
125 if (nb_sbm_bp2 == nb_sm_before_f0.burst_sbm_bp2)
126 {
126 {
127 nb_sbm_bp2 = 0;
127 nb_sbm_bp2 = 0;
128 if ( lfrCurrentMode == LFR_MODE_BURST )
128 if ( lfrCurrentMode == LFR_MODE_BURST )
129 {
129 {
130 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_BURST_BP2_F0;
130 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_BURST_BP2_F0;
131 }
131 }
132 else if ( (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
132 else if ( (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
133 {
133 {
134 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_SBM_BP2_F0;
134 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_SBM_BP2_F0;
135 }
135 }
136 }
136 }
137
137
138 if (nb_norm_bp1 == nb_sm_before_f0.norm_bp1)
138 if (nb_norm_bp1 == nb_sm_before_f0.norm_bp1)
139 {
139 {
140 nb_norm_bp1 = 0;
140 nb_norm_bp1 = 0;
141 // set another ring for the ASM storage
141 // set another ring for the ASM storage
142 current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next;
142 current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next;
143 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
143 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
144 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
144 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
145 {
145 {
146 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_NORM_BP1_F0;
146 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_NORM_BP1_F0;
147 }
147 }
148 }
148 }
149
149
150 if (nb_norm_bp2 == nb_sm_before_f0.norm_bp2)
150 if (nb_norm_bp2 == nb_sm_before_f0.norm_bp2)
151 {
151 {
152 nb_norm_bp2 = 0;
152 nb_norm_bp2 = 0;
153 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
153 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
154 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
154 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
155 {
155 {
156 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_NORM_BP2_F0;
156 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_NORM_BP2_F0;
157 }
157 }
158 }
158 }
159
159
160 if (nb_norm_asm == nb_sm_before_f0.norm_asm)
160 if (nb_norm_asm == nb_sm_before_f0.norm_asm)
161 {
161 {
162 nb_norm_asm = 0;
162 nb_norm_asm = 0;
163 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
163 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
164 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
164 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
165 {
165 {
166 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_NORM_ASM_F0;
166 msgForPRC.event = msgForPRC.event | RTEMS_EVENT_NORM_ASM_F0;
167 }
167 }
168 }
168 }
169
169
170 //*************************
170 //*************************
171 // send the message to PRC
171 // send the message to PRC
172 if (msgForPRC.event != 0x00)
172 if (msgForPRC.event != 0x00)
173 {
173 {
174 status = rtems_message_queue_send( queue_id_prc0, (char *) &msgForPRC, MSG_QUEUE_SIZE_PRC0);
174 status = rtems_message_queue_send( queue_id_prc0, (char *) &msgForPRC, MSG_QUEUE_SIZE_PRC0);
175 }
175 }
176
176
177 if (status != RTEMS_SUCCESSFUL) {
177 if (status != RTEMS_SUCCESSFUL) {
178 PRINTF1("in AVF0 *** Error sending message to PRC, code %d\n", status)
178 PRINTF1("in AVF0 *** Error sending message to PRC, code %d\n", status)
179 }
179 }
180 }
180 }
181 }
181 }
182
182
183 rtems_task prc0_task( rtems_task_argument lfrRequestedMode )
183 rtems_task prc0_task( rtems_task_argument lfrRequestedMode )
184 {
184 {
185 char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
185 char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
186 size_t size; // size of the incoming TC packet
186 size_t size; // size of the incoming TC packet
187 asm_msg *incomingMsg;
187 asm_msg *incomingMsg;
188 //
188 //
189 unsigned char sid;
189 unsigned char sid;
190 rtems_status_code status;
190 rtems_status_code status;
191 rtems_id queue_id;
191 rtems_id queue_id;
192 rtems_id queue_id_q_p0;
192 rtems_id queue_id_q_p0;
193 bp_packet_with_spare packet_norm_bp1;
193 bp_packet_with_spare packet_norm_bp1;
194 bp_packet packet_norm_bp2;
194 bp_packet packet_norm_bp2;
195 bp_packet packet_sbm_bp1;
195 bp_packet packet_sbm_bp1;
196 bp_packet packet_sbm_bp2;
196 bp_packet packet_sbm_bp2;
197 ring_node *current_ring_node_to_send_asm_f0;
197 ring_node *current_ring_node_to_send_asm_f0;
198 float nbSMInASMNORM;
198 float nbSMInASMNORM;
199 float nbSMInASMSBM;
199 float nbSMInASMSBM;
200
200
201 // init the ring of the averaged spectral matrices which will be transmitted to the DPU
201 // init the ring of the averaged spectral matrices which will be transmitted to the DPU
202 init_ring( ring_to_send_asm_f0, NB_RING_NODES_ASM_F0, (volatile int*) buffer_asm_f0, TOTAL_SIZE_SM );
202 init_ring( ring_to_send_asm_f0, NB_RING_NODES_ASM_F0, (volatile int*) buffer_asm_f0, TOTAL_SIZE_SM );
203 current_ring_node_to_send_asm_f0 = ring_to_send_asm_f0;
203 current_ring_node_to_send_asm_f0 = ring_to_send_asm_f0;
204
204
205 //*************
205 //*************
206 // NORM headers
206 // NORM headers
207 BP_init_header_with_spare( &packet_norm_bp1,
207 BP_init_header_with_spare( &packet_norm_bp1,
208 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0,
208 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0,
209 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 );
209 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 );
210 BP_init_header( &packet_norm_bp2,
210 BP_init_header( &packet_norm_bp2,
211 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0,
211 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0,
212 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0);
212 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0);
213
213
214 //****************************
214 //****************************
215 // BURST SBM1 and SBM2 headers
215 // BURST SBM1 and SBM2 headers
216 if ( lfrRequestedMode == LFR_MODE_BURST )
216 if ( lfrRequestedMode == LFR_MODE_BURST )
217 {
217 {
218 BP_init_header( &packet_sbm_bp1,
218 BP_init_header( &packet_sbm_bp1,
219 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0,
219 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0,
220 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
220 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
221 BP_init_header( &packet_sbm_bp2,
221 BP_init_header( &packet_sbm_bp2,
222 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0,
222 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0,
223 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
223 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
224 }
224 }
225 else if ( lfrRequestedMode == LFR_MODE_SBM1 )
225 else if ( lfrRequestedMode == LFR_MODE_SBM1 )
226 {
226 {
227 BP_init_header( &packet_sbm_bp1,
227 BP_init_header( &packet_sbm_bp1,
228 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0,
228 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0,
229 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
229 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
230 BP_init_header( &packet_sbm_bp2,
230 BP_init_header( &packet_sbm_bp2,
231 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0,
231 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0,
232 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
232 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
233 }
233 }
234 else if ( lfrRequestedMode == LFR_MODE_SBM2 )
234 else if ( lfrRequestedMode == LFR_MODE_SBM2 )
235 {
235 {
236 BP_init_header( &packet_sbm_bp1,
236 BP_init_header( &packet_sbm_bp1,
237 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0,
237 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0,
238 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
238 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
239 BP_init_header( &packet_sbm_bp2,
239 BP_init_header( &packet_sbm_bp2,
240 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0,
240 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0,
241 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
241 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
242 }
242 }
243 else
243 else
244 {
244 {
245 PRINTF1("in PRC0 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode)
245 PRINTF1("in PRC0 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode)
246 }
246 }
247
247
248 status = get_message_queue_id_send( &queue_id );
248 status = get_message_queue_id_send( &queue_id );
249 if (status != RTEMS_SUCCESSFUL)
249 if (status != RTEMS_SUCCESSFUL)
250 {
250 {
251 PRINTF1("in PRC0 *** ERR get_message_queue_id_send %d\n", status)
251 PRINTF1("in PRC0 *** ERR get_message_queue_id_send %d\n", status)
252 }
252 }
253 status = get_message_queue_id_prc0( &queue_id_q_p0);
253 status = get_message_queue_id_prc0( &queue_id_q_p0);
254 if (status != RTEMS_SUCCESSFUL)
254 if (status != RTEMS_SUCCESSFUL)
255 {
255 {
256 PRINTF1("in PRC0 *** ERR get_message_queue_id_prc0 %d\n", status)
256 PRINTF1("in PRC0 *** ERR get_message_queue_id_prc0 %d\n", status)
257 }
257 }
258
258
259 BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
259 BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
260
260
261 while(1){
261 while(1){
262 status = rtems_message_queue_receive( queue_id_q_p0, incomingData, &size, //************************************
262 status = rtems_message_queue_receive( queue_id_q_p0, incomingData, &size, //************************************
263 RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0
263 RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0
264
264
265 incomingMsg = (asm_msg*) incomingData;
265 incomingMsg = (asm_msg*) incomingData;
266
266
267 ASM_patch( incomingMsg->norm->matrix, asm_f0_patched_norm );
267 ASM_patch( incomingMsg->norm->matrix, asm_f0_patched_norm );
268 ASM_patch( incomingMsg->burst_sbm->matrix, asm_f0_patched_burst_sbm );
268 ASM_patch( incomingMsg->burst_sbm->matrix, asm_f0_patched_burst_sbm );
269
269
270 nbSMInASMNORM = incomingMsg->numberOfSMInASMNORM;
270 nbSMInASMNORM = incomingMsg->numberOfSMInASMNORM;
271 nbSMInASMSBM = incomingMsg->numberOfSMInASMSBM;
271 nbSMInASMSBM = incomingMsg->numberOfSMInASMSBM;
272
272
273 //****************
273 //****************
274 //****************
274 //****************
275 // BURST SBM1 SBM2
275 // BURST SBM1 SBM2
276 //****************
276 //****************
277 //****************
277 //****************
278 if ( (incomingMsg->event & RTEMS_EVENT_BURST_BP1_F0 ) || (incomingMsg->event & RTEMS_EVENT_SBM_BP1_F0 ) )
278 if ( (incomingMsg->event & RTEMS_EVENT_BURST_BP1_F0 ) || (incomingMsg->event & RTEMS_EVENT_SBM_BP1_F0 ) )
279 {
279 {
280 sid = getSID( incomingMsg->event );
280 sid = getSID( incomingMsg->event );
281 // 1) compress the matrix for Basic Parameters calculation
281 // 1) compress the matrix for Basic Parameters calculation
282 ASM_compress_reorganize_and_divide_mask( asm_f0_patched_burst_sbm, compressed_sm_sbm_f0,
282 ASM_compress_reorganize_and_divide_mask( asm_f0_patched_burst_sbm, compressed_sm_sbm_f0,
283 nbSMInASMSBM,
283 nbSMInASMSBM,
284 NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0,
284 NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0,
285 ASM_F0_INDICE_START, CHANNELF0);
285 ASM_F0_INDICE_START, CHANNELF0);
286 // 2) compute the BP1 set
286 // 2) compute the BP1 set
287 BP1_set( compressed_sm_sbm_f0, k_coeff_intercalib_f0_sbm, NB_BINS_COMPRESSED_SM_SBM_F0, packet_sbm_bp1.data );
287 BP1_set( compressed_sm_sbm_f0, k_coeff_intercalib_f0_sbm, NB_BINS_COMPRESSED_SM_SBM_F0, packet_sbm_bp1.data );
288 // 3) send the BP1 set
288 // 3) send the BP1 set
289 set_time( packet_sbm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeSBM );
289 set_time( packet_sbm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeSBM );
290 set_time( packet_sbm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
290 set_time( packet_sbm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
291 packet_sbm_bp1.pa_bia_status_info = pa_bia_status_info;
291 packet_sbm_bp1.pa_bia_status_info = pa_bia_status_info;
292 packet_sbm_bp1.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
292 packet_sbm_bp1.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
293 BP_send_s1_s2( (char *) &packet_sbm_bp1, queue_id,
293 BP_send_s1_s2( (char *) &packet_sbm_bp1, queue_id,
294 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA,
294 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA,
295 sid);
295 sid);
296 // 4) compute the BP2 set if needed
296 // 4) compute the BP2 set if needed
297 if ( (incomingMsg->event & RTEMS_EVENT_BURST_BP2_F0) || (incomingMsg->event & RTEMS_EVENT_SBM_BP2_F0) )
297 if ( (incomingMsg->event & RTEMS_EVENT_BURST_BP2_F0) || (incomingMsg->event & RTEMS_EVENT_SBM_BP2_F0) )
298 {
298 {
299 // 1) compute the BP2 set
299 // 1) compute the BP2 set
300 BP2_set( compressed_sm_sbm_f0, NB_BINS_COMPRESSED_SM_SBM_F0, packet_sbm_bp2.data );
300 BP2_set( compressed_sm_sbm_f0, NB_BINS_COMPRESSED_SM_SBM_F0, packet_sbm_bp2.data );
301 // 2) send the BP2 set
301 // 2) send the BP2 set
302 set_time( packet_sbm_bp2.time, (unsigned char *) &incomingMsg->coarseTimeSBM );
302 set_time( packet_sbm_bp2.time, (unsigned char *) &incomingMsg->coarseTimeSBM );
303 set_time( packet_sbm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
303 set_time( packet_sbm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM );
304 packet_sbm_bp2.pa_bia_status_info = pa_bia_status_info;
304 packet_sbm_bp2.pa_bia_status_info = pa_bia_status_info;
305 packet_sbm_bp2.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
305 packet_sbm_bp2.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
306 BP_send_s1_s2( (char *) &packet_sbm_bp2, queue_id,
306 BP_send_s1_s2( (char *) &packet_sbm_bp2, queue_id,
307 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA,
307 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA,
308 sid);
308 sid);
309 }
309 }
310 }
310 }
311
311
312 //*****
312 //*****
313 //*****
313 //*****
314 // NORM
314 // NORM
315 //*****
315 //*****
316 //*****
316 //*****
317 if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0)
317 if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0)
318 {
318 {
319 // 1) compress the matrix for Basic Parameters calculation
319 // 1) compress the matrix for Basic Parameters calculation
320 ASM_compress_reorganize_and_divide_mask( asm_f0_patched_norm, compressed_sm_norm_f0,
320 ASM_compress_reorganize_and_divide_mask( asm_f0_patched_norm, compressed_sm_norm_f0,
321 nbSMInASMNORM,
321 nbSMInASMNORM,
322 NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
322 NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
323 ASM_F0_INDICE_START, CHANNELF0 );
323 ASM_F0_INDICE_START, CHANNELF0 );
324 // 2) compute the BP1 set
324 // 2) compute the BP1 set
325 BP1_set( compressed_sm_norm_f0, k_coeff_intercalib_f0_norm, NB_BINS_COMPRESSED_SM_F0, packet_norm_bp1.data );
325 BP1_set( compressed_sm_norm_f0, k_coeff_intercalib_f0_norm, NB_BINS_COMPRESSED_SM_F0, packet_norm_bp1.data );
326 // 3) send the BP1 set
326 // 3) send the BP1 set
327 set_time( packet_norm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeNORM );
327 set_time( packet_norm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeNORM );
328 set_time( packet_norm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM );
328 set_time( packet_norm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM );
329 packet_norm_bp1.pa_bia_status_info = pa_bia_status_info;
329 packet_norm_bp1.pa_bia_status_info = pa_bia_status_info;
330 packet_norm_bp1.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
330 packet_norm_bp1.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
331 BP_send( (char *) &packet_norm_bp1, queue_id,
331 BP_send( (char *) &packet_norm_bp1, queue_id,
332 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA,
332 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA,
333 SID_NORM_BP1_F0 );
333 SID_NORM_BP1_F0 );
334 if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0)
334 if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0)
335 {
335 {
336 // 1) compute the BP2 set using the same ASM as the one used for BP1
336 // 1) compute the BP2 set using the same ASM as the one used for BP1
337 BP2_set( compressed_sm_norm_f0, NB_BINS_COMPRESSED_SM_F0, packet_norm_bp2.data );
337 BP2_set( compressed_sm_norm_f0, NB_BINS_COMPRESSED_SM_F0, packet_norm_bp2.data );
338 // 2) send the BP2 set
338 // 2) send the BP2 set
339 set_time( packet_norm_bp2.time, (unsigned char *) &incomingMsg->coarseTimeNORM );
339 set_time( packet_norm_bp2.time, (unsigned char *) &incomingMsg->coarseTimeNORM );
340 set_time( packet_norm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM );
340 set_time( packet_norm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM );
341 packet_norm_bp2.pa_bia_status_info = pa_bia_status_info;
341 packet_norm_bp2.pa_bia_status_info = pa_bia_status_info;
342 packet_norm_bp2.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
342 packet_norm_bp2.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
343 BP_send( (char *) &packet_norm_bp2, queue_id,
343 BP_send( (char *) &packet_norm_bp2, queue_id,
344 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA,
344 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA,
345 SID_NORM_BP2_F0);
345 SID_NORM_BP2_F0);
346 }
346 }
347 }
347 }
348
348
349 if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0)
349 if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0)
350 {
350 {
351 // 1) reorganize the ASM and divide
351 // 1) reorganize the ASM and divide
352 ASM_reorganize_and_divide( asm_f0_patched_norm,
352 ASM_reorganize_and_divide( asm_f0_patched_norm,
353 (float*) current_ring_node_to_send_asm_f0->buffer_address,
353 (float*) current_ring_node_to_send_asm_f0->buffer_address,
354 nbSMInASMNORM );
354 nbSMInASMNORM );
355 current_ring_node_to_send_asm_f0->coarseTime = incomingMsg->coarseTimeNORM;
355 current_ring_node_to_send_asm_f0->coarseTime = incomingMsg->coarseTimeNORM;
356 current_ring_node_to_send_asm_f0->fineTime = incomingMsg->fineTimeNORM;
356 current_ring_node_to_send_asm_f0->fineTime = incomingMsg->fineTimeNORM;
357 current_ring_node_to_send_asm_f0->sid = SID_NORM_ASM_F0;
357 current_ring_node_to_send_asm_f0->sid = SID_NORM_ASM_F0;
358
358
359 // 3) send the spectral matrix packets
359 // 3) send the spectral matrix packets
360 status = rtems_message_queue_send( queue_id, &current_ring_node_to_send_asm_f0, sizeof( ring_node* ) );
360 status = rtems_message_queue_send( queue_id, &current_ring_node_to_send_asm_f0, sizeof( ring_node* ) );
361
361 // change asm ring node
362 // change asm ring node
362 current_ring_node_to_send_asm_f0 = current_ring_node_to_send_asm_f0->next;
363 current_ring_node_to_send_asm_f0 = current_ring_node_to_send_asm_f0->next;
363 }
364 }
364
365
365 update_queue_max_count( queue_id_q_p0, &hk_lfr_q_p0_fifo_size_max );
366 update_queue_max_count( queue_id_q_p0, &hk_lfr_q_p0_fifo_size_max );
366
367
367 }
368 }
368 }
369 }
369
370
370 //**********
371 //**********
371 // FUNCTIONS
372 // FUNCTIONS
372
373
373 void reset_nb_sm_f0( unsigned char lfrMode )
374 void reset_nb_sm_f0( unsigned char lfrMode )
374 {
375 {
375 nb_sm_before_f0.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96;
376 nb_sm_before_f0.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96;
376 nb_sm_before_f0.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96;
377 nb_sm_before_f0.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96;
377 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;
378 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;
378 nb_sm_before_f0.sbm1_bp1 = parameter_dump_packet.sy_lfr_s1_bp_p0 * 24; // 0.25 s per digit
379 nb_sm_before_f0.sbm1_bp1 = parameter_dump_packet.sy_lfr_s1_bp_p0 * 24; // 0.25 s per digit
379 nb_sm_before_f0.sbm1_bp2 = parameter_dump_packet.sy_lfr_s1_bp_p1 * 96;
380 nb_sm_before_f0.sbm1_bp2 = parameter_dump_packet.sy_lfr_s1_bp_p1 * 96;
380 nb_sm_before_f0.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 96;
381 nb_sm_before_f0.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 96;
381 nb_sm_before_f0.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 96;
382 nb_sm_before_f0.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 96;
382 nb_sm_before_f0.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 96;
383 nb_sm_before_f0.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 96;
383 nb_sm_before_f0.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 96;
384 nb_sm_before_f0.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 96;
384
385
385 if (lfrMode == LFR_MODE_SBM1)
386 if (lfrMode == LFR_MODE_SBM1)
386 {
387 {
387 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm1_bp1;
388 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm1_bp1;
388 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm1_bp2;
389 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm1_bp2;
389 }
390 }
390 else if (lfrMode == LFR_MODE_SBM2)
391 else if (lfrMode == LFR_MODE_SBM2)
391 {
392 {
392 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm2_bp1;
393 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm2_bp1;
393 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm2_bp2;
394 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm2_bp2;
394 }
395 }
395 else if (lfrMode == LFR_MODE_BURST)
396 else if (lfrMode == LFR_MODE_BURST)
396 {
397 {
397 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1;
398 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1;
398 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2;
399 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2;
399 }
400 }
400 else
401 else
401 {
402 {
402 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1;
403 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1;
403 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2;
404 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2;
404 }
405 }
405 }
406 }
406
407
407 void init_k_coefficients_prc0( void )
408 void init_k_coefficients_prc0( void )
408 {
409 {
409 init_k_coefficients( k_coeff_intercalib_f0_norm, NB_BINS_COMPRESSED_SM_F0 );
410 init_k_coefficients( k_coeff_intercalib_f0_norm, NB_BINS_COMPRESSED_SM_F0 );
410
411
411 init_kcoeff_sbm_from_kcoeff_norm( k_coeff_intercalib_f0_norm, k_coeff_intercalib_f0_sbm, NB_BINS_COMPRESSED_SM_F0);
412 init_kcoeff_sbm_from_kcoeff_norm( k_coeff_intercalib_f0_norm, k_coeff_intercalib_f0_sbm, NB_BINS_COMPRESSED_SM_F0);
412 }
413 }
413
414
@@ -1,396 +1,398
1 /** Functions related to data processing.
1 /** Functions related to data processing.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
7 *
7 *
8 */
8 */
9
9
10 #include "avf1_prc1.h"
10 #include "avf1_prc1.h"
11
11
12 nb_sm_before_bp_asm_f1 nb_sm_before_f1;
12 nb_sm_before_bp_asm_f1 nb_sm_before_f1;
13
13
14 extern ring_node sm_ring_f1[ ];
14 extern ring_node sm_ring_f1[ ];
15
15
16 //***
16 //***
17 // F1
17 // F1
18 ring_node_asm asm_ring_norm_f1 [ NB_RING_NODES_ASM_NORM_F1 ];
18 ring_node_asm asm_ring_norm_f1 [ NB_RING_NODES_ASM_NORM_F1 ];
19 ring_node_asm asm_ring_burst_sbm_f1 [ NB_RING_NODES_ASM_BURST_SBM_F1 ];
19 ring_node_asm asm_ring_burst_sbm_f1 [ NB_RING_NODES_ASM_BURST_SBM_F1 ];
20
20
21 ring_node ring_to_send_asm_f1 [ NB_RING_NODES_ASM_F1 ];
21 ring_node ring_to_send_asm_f1 [ NB_RING_NODES_ASM_F1 ];
22 int buffer_asm_f1 [ NB_RING_NODES_ASM_F1 * TOTAL_SIZE_SM ];
22 int buffer_asm_f1 [ NB_RING_NODES_ASM_F1 * TOTAL_SIZE_SM ];
23
23
24 float asm_f1_patched_norm [ TOTAL_SIZE_SM ];
24 float asm_f1_patched_norm [ TOTAL_SIZE_SM ];
25 float asm_f1_patched_burst_sbm [ TOTAL_SIZE_SM ];
25 float asm_f1_patched_burst_sbm [ TOTAL_SIZE_SM ];
26 float asm_f1_reorganized [ TOTAL_SIZE_SM ];
26 float asm_f1_reorganized [ TOTAL_SIZE_SM ];
27
27
28 char asm_f1_char [ TOTAL_SIZE_SM * 2 ];
28 char asm_f1_char [ TOTAL_SIZE_SM * 2 ];
29 float compressed_sm_norm_f1[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F1];
29 float compressed_sm_norm_f1[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F1];
30 float compressed_sm_sbm_f1 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 ];
30 float compressed_sm_sbm_f1 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 ];
31
31
32 float k_coeff_intercalib_f1_norm[ NB_BINS_COMPRESSED_SM_F1 * NB_K_COEFF_PER_BIN ]; // 13 * 32 = 416
32 float k_coeff_intercalib_f1_norm[ NB_BINS_COMPRESSED_SM_F1 * NB_K_COEFF_PER_BIN ]; // 13 * 32 = 416
33 float k_coeff_intercalib_f1_sbm[ NB_BINS_COMPRESSED_SM_SBM_F1 * NB_K_COEFF_PER_BIN ]; // 26 * 32 = 832
33 float k_coeff_intercalib_f1_sbm[ NB_BINS_COMPRESSED_SM_SBM_F1 * NB_K_COEFF_PER_BIN ]; // 26 * 32 = 832
34
34
35 //************
35 //************
36 // RTEMS TASKS
36 // RTEMS TASKS
37
37
38 rtems_task avf1_task( rtems_task_argument lfrRequestedMode )
38 rtems_task avf1_task( rtems_task_argument lfrRequestedMode )
39 {
39 {
40 int i;
40 int i;
41
41
42 rtems_event_set event_out;
42 rtems_event_set event_out;
43 rtems_status_code status;
43 rtems_status_code status;
44 rtems_id queue_id_prc1;
44 rtems_id queue_id_prc1;
45 asm_msg msgForPRC;
45 asm_msg msgForPRC;
46 ring_node *nodeForAveraging;
46