##// END OF EJS Templates
rev 3.0.0.7...
paul -
r216:7bcf44471081 R3
parent child
Show More
@@ -1,2 +1,2
1 d2dd915411c7cd1bf4405441d644c6be1cc84e7f LFR_basic-parameters
1 aa66459dff7b46d030e3263cfd9291b1d550c428 LFR_basic-parameters
2 bb9afa759d57093f7646d3be18f4a9923a4cbf84 header/lfr_common_headers
2 bb9afa759d57093f7646d3be18f4a9923a4cbf84 header/lfr_common_headers
@@ -1,112 +1,112
1 TEMPLATE = app
1 TEMPLATE = app
2 # CONFIG += console v8 sim
2 # CONFIG += console v8 sim
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
4 # lpp_dpu_destid
4 # lpp_dpu_destid
5 CONFIG += console verbose lpp_dpu_destid
5 CONFIG += console verbose lpp_dpu_destid
6 CONFIG -= qt
6 CONFIG -= qt
7
7
8 include(./sparc.pri)
8 include(./sparc.pri)
9
9
10 # flight software version
10 # flight software version
11 SWVERSION=-1-0
11 SWVERSION=-1-0
12 DEFINES += SW_VERSION_N1=3 # major
12 DEFINES += SW_VERSION_N1=3 # major
13 DEFINES += SW_VERSION_N2=0 # minor
13 DEFINES += SW_VERSION_N2=0 # minor
14 DEFINES += SW_VERSION_N3=0 # patch
14 DEFINES += SW_VERSION_N3=0 # patch
15 DEFINES += SW_VERSION_N4=6 # internal
15 DEFINES += SW_VERSION_N4=7 # internal
16
16
17 # <GCOV>
17 # <GCOV>
18 #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
18 #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
19 #LIBS += -lgcov /opt/GCOV/01A/lib/overload.o -lc
19 #LIBS += -lgcov /opt/GCOV/01A/lib/overload.o -lc
20 # </GCOV>
20 # </GCOV>
21
21
22 # <CHANGE BEFORE FLIGHT>
22 # <CHANGE BEFORE FLIGHT>
23 contains( CONFIG, lpp_dpu_destid ) {
23 contains( CONFIG, lpp_dpu_destid ) {
24 DEFINES += LPP_DPU_DESTID
24 DEFINES += LPP_DPU_DESTID
25 }
25 }
26 # </CHANGE BEFORE FLIGHT>
26 # </CHANGE BEFORE FLIGHT>
27
27
28 contains( CONFIG, debug_tch ) {
28 contains( CONFIG, debug_tch ) {
29 DEFINES += DEBUG_TCH
29 DEFINES += DEBUG_TCH
30 }
30 }
31 DEFINES += MSB_FIRST_TCH
31 DEFINES += MSB_FIRST_TCH
32
32
33 contains( CONFIG, vhdl_dev ) {
33 contains( CONFIG, vhdl_dev ) {
34 DEFINES += VHDL_DEV
34 DEFINES += VHDL_DEV
35 }
35 }
36
36
37 contains( CONFIG, verbose ) {
37 contains( CONFIG, verbose ) {
38 DEFINES += PRINT_MESSAGES_ON_CONSOLE
38 DEFINES += PRINT_MESSAGES_ON_CONSOLE
39 }
39 }
40
40
41 contains( CONFIG, debug_messages ) {
41 contains( CONFIG, debug_messages ) {
42 DEFINES += DEBUG_MESSAGES
42 DEFINES += DEBUG_MESSAGES
43 }
43 }
44
44
45 contains( CONFIG, cpu_usage_report ) {
45 contains( CONFIG, cpu_usage_report ) {
46 DEFINES += PRINT_TASK_STATISTICS
46 DEFINES += PRINT_TASK_STATISTICS
47 }
47 }
48
48
49 contains( CONFIG, stack_report ) {
49 contains( CONFIG, stack_report ) {
50 DEFINES += PRINT_STACK_REPORT
50 DEFINES += PRINT_STACK_REPORT
51 }
51 }
52
52
53 contains( CONFIG, boot_messages ) {
53 contains( CONFIG, boot_messages ) {
54 DEFINES += BOOT_MESSAGES
54 DEFINES += BOOT_MESSAGES
55 }
55 }
56
56
57 #doxygen.target = doxygen
57 #doxygen.target = doxygen
58 #doxygen.commands = doxygen ../doc/Doxyfile
58 #doxygen.commands = doxygen ../doc/Doxyfile
59 #QMAKE_EXTRA_TARGETS += doxygen
59 #QMAKE_EXTRA_TARGETS += doxygen
60
60
61 TARGET = fsw
61 TARGET = fsw
62
62
63 INCLUDEPATH += \
63 INCLUDEPATH += \
64 $${PWD}/../src \
64 $${PWD}/../src \
65 $${PWD}/../header \
65 $${PWD}/../header \
66 $${PWD}/../header/lfr_common_headers \
66 $${PWD}/../header/lfr_common_headers \
67 $${PWD}/../header/processing \
67 $${PWD}/../header/processing \
68 $${PWD}/../LFR_basic-parameters
68 $${PWD}/../LFR_basic-parameters
69
69
70 SOURCES += \
70 SOURCES += \
71 ../src/wf_handler.c \
71 ../src/wf_handler.c \
72 ../src/tc_handler.c \
72 ../src/tc_handler.c \
73 ../src/fsw_misc.c \
73 ../src/fsw_misc.c \
74 ../src/fsw_init.c \
74 ../src/fsw_init.c \
75 ../src/fsw_globals.c \
75 ../src/fsw_globals.c \
76 ../src/fsw_spacewire.c \
76 ../src/fsw_spacewire.c \
77 ../src/tc_load_dump_parameters.c \
77 ../src/tc_load_dump_parameters.c \
78 ../src/tm_lfr_tc_exe.c \
78 ../src/tm_lfr_tc_exe.c \
79 ../src/tc_acceptance.c \
79 ../src/tc_acceptance.c \
80 ../src/processing/fsw_processing.c \
80 ../src/processing/fsw_processing.c \
81 ../src/processing/avf0_prc0.c \
81 ../src/processing/avf0_prc0.c \
82 ../src/processing/avf1_prc1.c \
82 ../src/processing/avf1_prc1.c \
83 ../src/processing/avf2_prc2.c \
83 ../src/processing/avf2_prc2.c \
84 ../src/lfr_cpu_usage_report.c \
84 ../src/lfr_cpu_usage_report.c \
85 ../LFR_basic-parameters/basic_parameters.c
85 ../LFR_basic-parameters/basic_parameters.c
86
86
87 HEADERS += \
87 HEADERS += \
88 ../header/wf_handler.h \
88 ../header/wf_handler.h \
89 ../header/tc_handler.h \
89 ../header/tc_handler.h \
90 ../header/grlib_regs.h \
90 ../header/grlib_regs.h \
91 ../header/fsw_misc.h \
91 ../header/fsw_misc.h \
92 ../header/fsw_init.h \
92 ../header/fsw_init.h \
93 ../header/fsw_spacewire.h \
93 ../header/fsw_spacewire.h \
94 ../header/tc_load_dump_parameters.h \
94 ../header/tc_load_dump_parameters.h \
95 ../header/tm_lfr_tc_exe.h \
95 ../header/tm_lfr_tc_exe.h \
96 ../header/tc_acceptance.h \
96 ../header/tc_acceptance.h \
97 ../header/processing/fsw_processing.h \
97 ../header/processing/fsw_processing.h \
98 ../header/processing/avf0_prc0.h \
98 ../header/processing/avf0_prc0.h \
99 ../header/processing/avf1_prc1.h \
99 ../header/processing/avf1_prc1.h \
100 ../header/processing/avf2_prc2.h \
100 ../header/processing/avf2_prc2.h \
101 ../header/fsw_params_wf_handler.h \
101 ../header/fsw_params_wf_handler.h \
102 ../header/lfr_cpu_usage_report.h \
102 ../header/lfr_cpu_usage_report.h \
103 ../header/lfr_common_headers/ccsds_types.h \
103 ../header/lfr_common_headers/ccsds_types.h \
104 ../header/lfr_common_headers/fsw_params.h \
104 ../header/lfr_common_headers/fsw_params.h \
105 ../header/lfr_common_headers/fsw_params_nb_bytes.h \
105 ../header/lfr_common_headers/fsw_params_nb_bytes.h \
106 ../header/lfr_common_headers/fsw_params_processing.h \
106 ../header/lfr_common_headers/fsw_params_processing.h \
107 ../header/lfr_common_headers/TC_types.h \
107 ../header/lfr_common_headers/TC_types.h \
108 ../header/lfr_common_headers/tm_byte_positions.h \
108 ../header/lfr_common_headers/tm_byte_positions.h \
109 ../LFR_basic-parameters/basic_parameters.h \
109 ../LFR_basic-parameters/basic_parameters.h \
110 ../LFR_basic-parameters/basic_parameters_params.h \
110 ../LFR_basic-parameters/basic_parameters_params.h \
111 ../header/GscMemoryLPP.hpp
111 ../header/GscMemoryLPP.hpp
112
112
@@ -1,325 +1,325
1 #ifndef FSW_PROCESSING_H_INCLUDED
1 #ifndef FSW_PROCESSING_H_INCLUDED
2 #define FSW_PROCESSING_H_INCLUDED
2 #define FSW_PROCESSING_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <grspw.h>
5 #include <grspw.h>
6 #include <math.h>
6 #include <math.h>
7 #include <stdlib.h> // abs() is in the stdlib
7 #include <stdlib.h> // abs() is in the stdlib
8 #include <stdio.h> // printf()
8 #include <stdio.h> // printf()
9 #include <math.h>
9 #include <math.h>
10 #include <grlib_regs.h>
10 #include <grlib_regs.h>
11
11
12 #include "fsw_params.h"
12 #include "fsw_params.h"
13
13
14 typedef struct ring_node_asm
14 typedef struct ring_node_asm
15 {
15 {
16 struct ring_node_asm *next;
16 struct ring_node_asm *next;
17 float matrix[ TOTAL_SIZE_SM ];
17 float matrix[ TOTAL_SIZE_SM ];
18 unsigned int status;
18 unsigned int status;
19 } ring_node_asm;
19 } ring_node_asm;
20
20
21 typedef struct
21 typedef struct
22 {
22 {
23 unsigned char targetLogicalAddress;
23 unsigned char targetLogicalAddress;
24 unsigned char protocolIdentifier;
24 unsigned char protocolIdentifier;
25 unsigned char reserved;
25 unsigned char reserved;
26 unsigned char userApplication;
26 unsigned char userApplication;
27 unsigned char packetID[2];
27 unsigned char packetID[2];
28 unsigned char packetSequenceControl[2];
28 unsigned char packetSequenceControl[2];
29 unsigned char packetLength[2];
29 unsigned char packetLength[2];
30 // DATA FIELD HEADER
30 // DATA FIELD HEADER
31 unsigned char spare1_pusVersion_spare2;
31 unsigned char spare1_pusVersion_spare2;
32 unsigned char serviceType;
32 unsigned char serviceType;
33 unsigned char serviceSubType;
33 unsigned char serviceSubType;
34 unsigned char destinationID;
34 unsigned char destinationID;
35 unsigned char time[6];
35 unsigned char time[6];
36 // AUXILIARY HEADER
36 // AUXILIARY HEADER
37 unsigned char sid;
37 unsigned char sid;
38 unsigned char biaStatusInfo;
38 unsigned char biaStatusInfo;
39 unsigned char sy_lfr_common_parameters_spare;
39 unsigned char sy_lfr_common_parameters_spare;
40 unsigned char sy_lfr_common_parameters;
40 unsigned char sy_lfr_common_parameters;
41 unsigned char acquisitionTime[6];
41 unsigned char acquisitionTime[6];
42 unsigned char pa_lfr_bp_blk_nr[2];
42 unsigned char pa_lfr_bp_blk_nr[2];
43 // SOURCE DATA
43 // SOURCE DATA
44 unsigned char data[ 780 ]; // MAX size is 26 bins * 30 Bytes [TM_LFR_SCIENCE_BURST_BP2_F1]
44 unsigned char data[ 780 ]; // MAX size is 26 bins * 30 Bytes [TM_LFR_SCIENCE_BURST_BP2_F1]
45 } bp_packet;
45 } bp_packet;
46
46
47 typedef struct
47 typedef struct
48 {
48 {
49 unsigned char targetLogicalAddress;
49 unsigned char targetLogicalAddress;
50 unsigned char protocolIdentifier;
50 unsigned char protocolIdentifier;
51 unsigned char reserved;
51 unsigned char reserved;
52 unsigned char userApplication;
52 unsigned char userApplication;
53 unsigned char packetID[2];
53 unsigned char packetID[2];
54 unsigned char packetSequenceControl[2];
54 unsigned char packetSequenceControl[2];
55 unsigned char packetLength[2];
55 unsigned char packetLength[2];
56 // DATA FIELD HEADER
56 // DATA FIELD HEADER
57 unsigned char spare1_pusVersion_spare2;
57 unsigned char spare1_pusVersion_spare2;
58 unsigned char serviceType;
58 unsigned char serviceType;
59 unsigned char serviceSubType;
59 unsigned char serviceSubType;
60 unsigned char destinationID;
60 unsigned char destinationID;
61 unsigned char time[6];
61 unsigned char time[6];
62 // AUXILIARY HEADER
62 // AUXILIARY HEADER
63 unsigned char sid;
63 unsigned char sid;
64 unsigned char biaStatusInfo;
64 unsigned char biaStatusInfo;
65 unsigned char sy_lfr_common_parameters_spare;
65 unsigned char sy_lfr_common_parameters_spare;
66 unsigned char sy_lfr_common_parameters;
66 unsigned char sy_lfr_common_parameters;
67 unsigned char acquisitionTime[6];
67 unsigned char acquisitionTime[6];
68 unsigned char source_data_spare;
68 unsigned char source_data_spare;
69 unsigned char pa_lfr_bp_blk_nr[2];
69 unsigned char pa_lfr_bp_blk_nr[2];
70 // SOURCE DATA
70 // SOURCE DATA
71 unsigned char data[ 117 ]; // 13 bins * 9 Bytes only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1
71 unsigned char data[ 143 ]; // 13 bins * 11 Bytes
72 } bp_packet_with_spare;
72 } bp_packet_with_spare; // only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1
73
73
74 typedef struct asm_msg
74 typedef struct asm_msg
75 {
75 {
76 ring_node_asm *norm;
76 ring_node_asm *norm;
77 ring_node_asm *burst_sbm;
77 ring_node_asm *burst_sbm;
78 rtems_event_set event;
78 rtems_event_set event;
79 unsigned int coarseTimeNORM;
79 unsigned int coarseTimeNORM;
80 unsigned int fineTimeNORM;
80 unsigned int fineTimeNORM;
81 unsigned int coarseTimeSBM;
81 unsigned int coarseTimeSBM;
82 unsigned int fineTimeSBM;
82 unsigned int fineTimeSBM;
83 } asm_msg;
83 } asm_msg;
84
84
85 extern volatile int sm_f0[ ];
85 extern volatile int sm_f0[ ];
86 extern volatile int sm_f1[ ];
86 extern volatile int sm_f1[ ];
87 extern volatile int sm_f2[ ];
87 extern volatile int sm_f2[ ];
88
88
89 // parameters
89 // parameters
90 extern struct param_local_str param_local;
90 extern struct param_local_str param_local;
91 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
91 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
92
92
93 // registers
93 // registers
94 extern time_management_regs_t *time_management_regs;
94 extern time_management_regs_t *time_management_regs;
95 extern volatile spectral_matrix_regs_t *spectral_matrix_regs;
95 extern volatile spectral_matrix_regs_t *spectral_matrix_regs;
96
96
97 extern rtems_name misc_name[5];
97 extern rtems_name misc_name[5];
98 extern rtems_id Task_id[20]; /* array of task ids */
98 extern rtems_id Task_id[20]; /* array of task ids */
99
99
100 //
100 //
101 ring_node * getRingNodeForAveraging( unsigned char frequencyChannel);
101 ring_node * getRingNodeForAveraging( unsigned char frequencyChannel);
102 // ISR
102 // ISR
103 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
103 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
104 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
104 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
105
105
106 //******************
106 //******************
107 // Spectral Matrices
107 // Spectral Matrices
108 void reset_nb_sm( void );
108 void reset_nb_sm( void );
109 // SM
109 // SM
110 void SM_init_rings( void );
110 void SM_init_rings( void );
111 void SM_reset_current_ring_nodes( void );
111 void SM_reset_current_ring_nodes( void );
112 // ASM
112 // ASM
113 void ASM_generic_init_ring(ring_node_asm *ring, unsigned char nbNodes );
113 void ASM_generic_init_ring(ring_node_asm *ring, unsigned char nbNodes );
114
114
115 //*****************
115 //*****************
116 // Basic Parameters
116 // Basic Parameters
117
117
118 void BP_reset_current_ring_nodes( void );
118 void BP_reset_current_ring_nodes( void );
119 void BP_init_header(bp_packet *packet,
119 void BP_init_header(bp_packet *packet,
120 unsigned int apid, unsigned char sid,
120 unsigned int apid, unsigned char sid,
121 unsigned int packetLength , unsigned char blkNr);
121 unsigned int packetLength , unsigned char blkNr);
122 void BP_init_header_with_spare(bp_packet_with_spare *packet,
122 void BP_init_header_with_spare(bp_packet_with_spare *packet,
123 unsigned int apid, unsigned char sid,
123 unsigned int apid, unsigned char sid,
124 unsigned int packetLength, unsigned char blkNr );
124 unsigned int packetLength, unsigned char blkNr );
125 void BP_send( char *data,
125 void BP_send( char *data,
126 rtems_id queue_id ,
126 rtems_id queue_id ,
127 unsigned int nbBytesToSend , unsigned int sid );
127 unsigned int nbBytesToSend , unsigned int sid );
128
128
129 //******************
129 //******************
130 // general functions
130 // general functions
131 void reset_sm_status( void );
131 void reset_sm_status( void );
132 void reset_spectral_matrix_regs( void );
132 void reset_spectral_matrix_regs( void );
133 void set_time(unsigned char *time, unsigned char *timeInBuffer );
133 void set_time(unsigned char *time, unsigned char *timeInBuffer );
134 unsigned long long int get_acquisition_time( unsigned char *timePtr );
134 unsigned long long int get_acquisition_time( unsigned char *timePtr );
135 unsigned char getSID( rtems_event_set event );
135 unsigned char getSID( rtems_event_set event );
136
136
137 extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
137 extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
138 extern rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
138 extern rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
139
139
140 //***************************************
140 //***************************************
141 // DEFINITIONS OF STATIC INLINE FUNCTIONS
141 // DEFINITIONS OF STATIC INLINE FUNCTIONS
142 static inline void SM_average(float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
142 static inline void SM_average(float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
143 ring_node *ring_node_tab[],
143 ring_node *ring_node_tab[],
144 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
144 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
145 asm_msg *msgForMATR );
145 asm_msg *msgForMATR );
146
146
147 static inline void SM_average_debug(float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
147 static inline void SM_average_debug(float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
148 ring_node *ring_node_tab[],
148 ring_node *ring_node_tab[],
149 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
149 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
150 asm_msg *msgForMATR );
150 asm_msg *msgForMATR );
151
151
152 void ASM_patch( float *inputASM, float *outputASM );
152 void ASM_patch( float *inputASM, float *outputASM );
153
153
154 void extractReImVectors(float *inputASM, float *outputASM, unsigned int asmComponent );
154 void extractReImVectors(float *inputASM, float *outputASM, unsigned int asmComponent );
155
155
156 static inline void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized,
156 static inline void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized,
157 float divider );
157 float divider );
158
158
159 static inline void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat,
159 static inline void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat,
160 float divider,
160 float divider,
161 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart);
161 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart);
162
162
163 static inline void ASM_convert(volatile float *input_matrix, char *output_matrix);
163 static inline void ASM_convert(volatile float *input_matrix, char *output_matrix);
164
164
165 void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
165 void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
166 ring_node *ring_node_tab[],
166 ring_node *ring_node_tab[],
167 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
167 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
168 asm_msg *msgForMATR )
168 asm_msg *msgForMATR )
169 {
169 {
170 float sum;
170 float sum;
171 unsigned int i;
171 unsigned int i;
172
172
173 for(i=0; i<TOTAL_SIZE_SM; i++)
173 for(i=0; i<TOTAL_SIZE_SM; i++)
174 {
174 {
175 sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ]
175 sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ]
176 + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ]
176 + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ]
177 + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ]
177 + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ]
178 + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ]
178 + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ]
179 + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ]
179 + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ]
180 + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ]
180 + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ]
181 + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ]
181 + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ]
182 + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ];
182 + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ];
183
183
184 if ( (nbAverageNORM == 0) && (nbAverageSBM == 0) )
184 if ( (nbAverageNORM == 0) && (nbAverageSBM == 0) )
185 {
185 {
186 averaged_spec_mat_NORM[ i ] = sum;
186 averaged_spec_mat_NORM[ i ] = sum;
187 averaged_spec_mat_SBM[ i ] = sum;
187 averaged_spec_mat_SBM[ i ] = sum;
188 msgForMATR->coarseTimeNORM = ring_node_tab[0]->coarseTime;
188 msgForMATR->coarseTimeNORM = ring_node_tab[0]->coarseTime;
189 msgForMATR->fineTimeNORM = ring_node_tab[0]->fineTime;
189 msgForMATR->fineTimeNORM = ring_node_tab[0]->fineTime;
190 msgForMATR->coarseTimeSBM = ring_node_tab[0]->coarseTime;
190 msgForMATR->coarseTimeSBM = ring_node_tab[0]->coarseTime;
191 msgForMATR->fineTimeSBM = ring_node_tab[0]->fineTime;
191 msgForMATR->fineTimeSBM = ring_node_tab[0]->fineTime;
192 }
192 }
193 else if ( (nbAverageNORM != 0) && (nbAverageSBM != 0) )
193 else if ( (nbAverageNORM != 0) && (nbAverageSBM != 0) )
194 {
194 {
195 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
195 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
196 averaged_spec_mat_SBM[ i ] = ( averaged_spec_mat_SBM[ i ] + sum );
196 averaged_spec_mat_SBM[ i ] = ( averaged_spec_mat_SBM[ i ] + sum );
197 }
197 }
198 else if ( (nbAverageNORM != 0) && (nbAverageSBM == 0) )
198 else if ( (nbAverageNORM != 0) && (nbAverageSBM == 0) )
199 {
199 {
200 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
200 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
201 averaged_spec_mat_SBM[ i ] = sum;
201 averaged_spec_mat_SBM[ i ] = sum;
202 msgForMATR->coarseTimeSBM = ring_node_tab[0]->coarseTime;
202 msgForMATR->coarseTimeSBM = ring_node_tab[0]->coarseTime;
203 msgForMATR->fineTimeSBM = ring_node_tab[0]->fineTime;
203 msgForMATR->fineTimeSBM = ring_node_tab[0]->fineTime;
204 }
204 }
205 else
205 else
206 {
206 {
207 PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNORM, nbAverageSBM)
207 PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNORM, nbAverageSBM)
208 }
208 }
209 }
209 }
210 }
210 }
211
211
212 void SM_average_debug( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
212 void SM_average_debug( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
213 ring_node *ring_node_tab[],
213 ring_node *ring_node_tab[],
214 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
214 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
215 asm_msg *msgForMATR )
215 asm_msg *msgForMATR )
216 {
216 {
217 float sum;
217 float sum;
218 unsigned int i;
218 unsigned int i;
219
219
220 for(i=0; i<TOTAL_SIZE_SM; i++)
220 for(i=0; i<TOTAL_SIZE_SM; i++)
221 {
221 {
222 sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ];
222 sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ];
223 averaged_spec_mat_NORM[ i ] = sum;
223 averaged_spec_mat_NORM[ i ] = sum;
224 averaged_spec_mat_SBM[ i ] = sum;
224 averaged_spec_mat_SBM[ i ] = sum;
225 msgForMATR->coarseTimeNORM = ring_node_tab[0]->coarseTime;
225 msgForMATR->coarseTimeNORM = ring_node_tab[0]->coarseTime;
226 msgForMATR->fineTimeNORM = ring_node_tab[0]->fineTime;
226 msgForMATR->fineTimeNORM = ring_node_tab[0]->fineTime;
227 msgForMATR->coarseTimeSBM = ring_node_tab[0]->coarseTime;
227 msgForMATR->coarseTimeSBM = ring_node_tab[0]->coarseTime;
228 msgForMATR->fineTimeSBM = ring_node_tab[0]->fineTime;
228 msgForMATR->fineTimeSBM = ring_node_tab[0]->fineTime;
229 }
229 }
230 }
230 }
231
231
232 void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider )
232 void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider )
233 {
233 {
234 int frequencyBin;
234 int frequencyBin;
235 int asmComponent;
235 int asmComponent;
236 unsigned int offsetASM;
236 unsigned int offsetASM;
237 unsigned int offsetASMReorganized;
237 unsigned int offsetASMReorganized;
238
238
239 // BUILD DATA
239 // BUILD DATA
240 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
240 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
241 {
241 {
242 for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ )
242 for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ )
243 {
243 {
244 offsetASMReorganized =
244 offsetASMReorganized =
245 frequencyBin * NB_VALUES_PER_SM
245 frequencyBin * NB_VALUES_PER_SM
246 + asmComponent;
246 + asmComponent;
247 offsetASM =
247 offsetASM =
248 asmComponent * NB_BINS_PER_SM
248 asmComponent * NB_BINS_PER_SM
249 + frequencyBin;
249 + frequencyBin;
250 averaged_spec_mat_reorganized[offsetASMReorganized ] =
250 averaged_spec_mat_reorganized[offsetASMReorganized ] =
251 averaged_spec_mat[ offsetASM ] / divider;
251 averaged_spec_mat[ offsetASM ] / divider;
252 }
252 }
253 }
253 }
254 }
254 }
255
255
256 void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider,
256 void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider,
257 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart )
257 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart )
258 {
258 {
259 int frequencyBin;
259 int frequencyBin;
260 int asmComponent;
260 int asmComponent;
261 int offsetASM;
261 int offsetASM;
262 int offsetCompressed;
262 int offsetCompressed;
263 int k;
263 int k;
264
264
265 // BUILD DATA
265 // BUILD DATA
266 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
266 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
267 {
267 {
268 for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ )
268 for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ )
269 {
269 {
270 offsetCompressed = // NO TIME OFFSET
270 offsetCompressed = // NO TIME OFFSET
271 frequencyBin * NB_VALUES_PER_SM
271 frequencyBin * NB_VALUES_PER_SM
272 + asmComponent;
272 + asmComponent;
273 offsetASM = // NO TIME OFFSET
273 offsetASM = // NO TIME OFFSET
274 asmComponent * NB_BINS_PER_SM
274 asmComponent * NB_BINS_PER_SM
275 + ASMIndexStart
275 + ASMIndexStart
276 + frequencyBin * nbBinsToAverage;
276 + frequencyBin * nbBinsToAverage;
277 compressed_spec_mat[ offsetCompressed ] = 0;
277 compressed_spec_mat[ offsetCompressed ] = 0;
278 for ( k = 0; k < nbBinsToAverage; k++ )
278 for ( k = 0; k < nbBinsToAverage; k++ )
279 {
279 {
280 compressed_spec_mat[offsetCompressed ] =
280 compressed_spec_mat[offsetCompressed ] =
281 ( compressed_spec_mat[ offsetCompressed ]
281 ( compressed_spec_mat[ offsetCompressed ]
282 + averaged_spec_mat[ offsetASM + k ] );
282 + averaged_spec_mat[ offsetASM + k ] );
283 }
283 }
284 compressed_spec_mat[ offsetCompressed ] =
284 compressed_spec_mat[ offsetCompressed ] =
285 compressed_spec_mat[ offsetCompressed ] / (divider * nbBinsToAverage);
285 compressed_spec_mat[ offsetCompressed ] / (divider * nbBinsToAverage);
286 }
286 }
287 }
287 }
288 }
288 }
289
289
290 void ASM_convert( volatile float *input_matrix, char *output_matrix)
290 void ASM_convert( volatile float *input_matrix, char *output_matrix)
291 {
291 {
292 unsigned int frequencyBin;
292 unsigned int frequencyBin;
293 unsigned int asmComponent;
293 unsigned int asmComponent;
294 char * pt_char_input;
294 char * pt_char_input;
295 char * pt_char_output;
295 char * pt_char_output;
296 unsigned int offsetInput;
296 unsigned int offsetInput;
297 unsigned int offsetOutput;
297 unsigned int offsetOutput;
298
298
299 pt_char_input = (char*) &input_matrix;
299 pt_char_input = (char*) &input_matrix;
300 pt_char_output = (char*) &output_matrix;
300 pt_char_output = (char*) &output_matrix;
301
301
302 // convert all other data
302 // convert all other data
303 for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++)
303 for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++)
304 {
304 {
305 for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++)
305 for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++)
306 {
306 {
307 offsetInput = (frequencyBin*NB_VALUES_PER_SM) + asmComponent ;
307 offsetInput = (frequencyBin*NB_VALUES_PER_SM) + asmComponent ;
308 offsetOutput = 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) ;
308 offsetOutput = 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) ;
309 pt_char_input = (char*) &input_matrix [ offsetInput ];
309 pt_char_input = (char*) &input_matrix [ offsetInput ];
310 pt_char_output = (char*) &output_matrix[ offsetOutput ];
310 pt_char_output = (char*) &output_matrix[ offsetOutput ];
311 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
311 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
312 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
312 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
313 }
313 }
314 }
314 }
315 }
315 }
316
316
317 void ASM_compress_reorganize_and_divide_mask(float *averaged_spec_mat, float *compressed_spec_mat,
317 void ASM_compress_reorganize_and_divide_mask(float *averaged_spec_mat, float *compressed_spec_mat,
318 float divider,
318 float divider,
319 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart);
319 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart);
320
320
321 int getFBinMask(int k);
321 int getFBinMask(int k);
322
322
323 void init_kcoeff_sbm_from_kcoeff_norm( float *input_kcoeff, float *output_kcoeff, unsigned char nb_bins_norm);
323 void init_kcoeff_sbm_from_kcoeff_norm( float *input_kcoeff, float *output_kcoeff, unsigned char nb_bins_norm);
324
324
325 #endif // FSW_PROCESSING_H_INCLUDED
325 #endif // FSW_PROCESSING_H_INCLUDED
General Comments 0
You need to be logged in to leave comments. Login now