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