@@ -1,2 +1,2 | |||||
1 | a0aa2c6f13574ae69c8645af2a2afa5d448e6c76 LFR_basic-parameters |
|
1 | 0f2eb26d750be2b6d8a3f5dee479b4575d3b93be LFR_basic-parameters | |
2 | a8668a35669295aaba22432d247158626f00a52a header/lfr_common_headers |
|
2 | 95a8d83f1d0c59f28a679e66e23464f21c12dd8a header/lfr_common_headers |
@@ -34,7 +34,8 void increment_seq_counter(unsigned shor | |||||
34 | void getTime( unsigned char *time); |
|
34 | void getTime( unsigned char *time); | |
35 | unsigned long long int getTimeAsUnsignedLongLongInt( ); |
|
35 | unsigned long long int getTimeAsUnsignedLongLongInt( ); | |
36 | void send_dumb_hk( void ); |
|
36 | void send_dumb_hk( void ); | |
37 | void get_v_e1_e2_f3(unsigned char *spacecraft_potential); |
|
37 | void get_v_e1_e2_f3( unsigned char *spacecraft_potential ); | |
|
38 | void get_temperatures( unsigned char *temperatures ); | |||
38 | void get_cpu_load( unsigned char *resource_statistics ); |
|
39 | void get_cpu_load( unsigned char *resource_statistics ); | |
39 |
|
40 | |||
40 | extern int sched_yield( void ); |
|
41 | extern int sched_yield( void ); |
@@ -45,6 +45,9 typedef struct { | |||||
45 | volatile int coarse_time_load; |
|
45 | volatile int coarse_time_load; | |
46 | volatile int coarse_time; |
|
46 | volatile int coarse_time; | |
47 | volatile int fine_time; |
|
47 | volatile int fine_time; | |
|
48 | volatile int temp_scm; | |||
|
49 | volatile int temp_pcb; | |||
|
50 | volatile int temp_fpga; | |||
48 | } time_management_regs_t; |
|
51 | } time_management_regs_t; | |
49 |
|
52 | |||
50 | // PDB >= 0.1.28 |
|
53 | // PDB >= 0.1.28 |
@@ -142,6 +142,10 static inline void SM_average(float *ave | |||||
142 | static inline void SM_average_debug( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM, |
|
142 | static inline void SM_average_debug( 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 | ||||
|
146 | void ASM_patch( float *inputASM, float *outputASM ); | |||
|
147 | void extractReImVectors(float *inputASM, float *outputASM, unsigned int asmComponent ); | |||
|
148 | ||||
145 | static inline void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized, |
|
149 | static inline void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized, | |
146 | float divider ); |
|
150 | float divider ); | |
147 | static inline void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat, |
|
151 | static inline void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat, |
@@ -391,7 +391,7 int create_all_tasks( void ) // create a | |||||
391 | { |
|
391 | { | |
392 | status = rtems_task_create( |
|
392 | status = rtems_task_create( | |
393 | Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
393 | Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2, | |
394 | RTEMS_DEFAULT_MODES, |
|
394 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
395 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0] |
|
395 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0] | |
396 | ); |
|
396 | ); | |
397 | } |
|
397 | } | |
@@ -407,7 +407,7 int create_all_tasks( void ) // create a | |||||
407 | { |
|
407 | { | |
408 | status = rtems_task_create( |
|
408 | status = rtems_task_create( | |
409 | Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
409 | Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2, | |
410 | RTEMS_DEFAULT_MODES, |
|
410 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
411 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1] |
|
411 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1] | |
412 | ); |
|
412 | ); | |
413 | } |
|
413 | } | |
@@ -423,7 +423,7 int create_all_tasks( void ) // create a | |||||
423 | { |
|
423 | { | |
424 | status = rtems_task_create( |
|
424 | status = rtems_task_create( | |
425 | Task_name[TASKID_PRC2], TASK_PRIORITY_PRC2, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
425 | Task_name[TASKID_PRC2], TASK_PRIORITY_PRC2, RTEMS_MINIMUM_STACK_SIZE * 2, | |
426 | RTEMS_DEFAULT_MODES, |
|
426 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
427 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC2] |
|
427 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC2] | |
428 | ); |
|
428 | ); | |
429 | } |
|
429 | } |
@@ -226,6 +226,7 rtems_task hous_task(rtems_task_argument | |||||
226 | spacewire_update_statistics(); |
|
226 | spacewire_update_statistics(); | |
227 |
|
227 | |||
228 | get_v_e1_e2_f3( housekeeping_packet.hk_lfr_sc_v_f3 ); |
|
228 | get_v_e1_e2_f3( housekeeping_packet.hk_lfr_sc_v_f3 ); | |
|
229 | get_temperatures( housekeeping_packet.hk_lfr_temp_scm); | |||
229 | get_cpu_load( (unsigned char *) &housekeeping_packet.hk_lfr_cpu_load ); |
|
230 | get_cpu_load( (unsigned char *) &housekeeping_packet.hk_lfr_cpu_load ); | |
230 |
|
231 | |||
231 | // SEND PACKET |
|
232 | // SEND PACKET | |
@@ -459,6 +460,24 void get_v_e1_e2_f3( unsigned char *spac | |||||
459 | spacecraft_potential[5] = e2_ptr[3]; |
|
460 | spacecraft_potential[5] = e2_ptr[3]; | |
460 | } |
|
461 | } | |
461 |
|
462 | |||
|
463 | void get_temperatures( unsigned char *temperatures ) | |||
|
464 | { | |||
|
465 | unsigned char* temp_scm_ptr; | |||
|
466 | unsigned char* temp_pcb_ptr; | |||
|
467 | unsigned char* temp_fpga_ptr; | |||
|
468 | ||||
|
469 | temp_scm_ptr = (unsigned char *) &time_management_regs->temp_scm; | |||
|
470 | temp_pcb_ptr = (unsigned char *) &time_management_regs->temp_pcb; | |||
|
471 | temp_fpga_ptr = (unsigned char *) &time_management_regs->temp_fpga; | |||
|
472 | ||||
|
473 | temperatures[0] = temp_scm_ptr[2]; | |||
|
474 | temperatures[1] = temp_scm_ptr[3]; | |||
|
475 | temperatures[2] = temp_pcb_ptr[2]; | |||
|
476 | temperatures[3] = temp_pcb_ptr[3]; | |||
|
477 | temperatures[4] = temp_fpga_ptr[2]; | |||
|
478 | temperatures[5] = temp_fpga_ptr[3]; | |||
|
479 | } | |||
|
480 | ||||
462 | void get_cpu_load( unsigned char *resource_statistics ) |
|
481 | void get_cpu_load( unsigned char *resource_statistics ) | |
463 | { |
|
482 | { | |
464 | unsigned char cpu_load; |
|
483 | unsigned char cpu_load; |
@@ -20,7 +20,10 ring_node_asm asm_ring_burst_sbm_f0 [ NB | |||||
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_ |
|
23 | float asm_f0_patched_norm [ TOTAL_SIZE_SM ]; | |
|
24 | float asm_f0_patched_burst_sbm [ TOTAL_SIZE_SM ]; | |||
|
25 | float asm_f0_reorganized [ TOTAL_SIZE_SM ]; | |||
|
26 | ||||
24 | 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) ]; | |
25 | float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F0]; |
|
28 | float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F0]; | |
26 | float compressed_sm_sbm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 ]; |
|
29 | float compressed_sm_sbm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 ]; | |
@@ -259,6 +262,9 rtems_task prc0_task( rtems_task_argumen | |||||
259 |
|
262 | |||
260 | incomingMsg = (asm_msg*) incomingData; |
|
263 | incomingMsg = (asm_msg*) incomingData; | |
261 |
|
264 | |||
|
265 | ASM_patch( incomingMsg->norm->matrix, asm_f0_patched_norm ); | |||
|
266 | ASM_patch( incomingMsg->burst_sbm->matrix, asm_f0_patched_burst_sbm ); | |||
|
267 | ||||
262 | //**************** |
|
268 | //**************** | |
263 | //**************** |
|
269 | //**************** | |
264 | // BURST SBM1 SBM2 |
|
270 | // BURST SBM1 SBM2 | |
@@ -268,12 +274,12 rtems_task prc0_task( rtems_task_argumen | |||||
268 | { |
|
274 | { | |
269 | sid = getSID( incomingMsg->event ); |
|
275 | sid = getSID( incomingMsg->event ); | |
270 | // 1) compress the matrix for Basic Parameters calculation |
|
276 | // 1) compress the matrix for Basic Parameters calculation | |
271 |
ASM_compress_reorganize_and_divide( |
|
277 | ASM_compress_reorganize_and_divide( asm_f0_patched_burst_sbm, compressed_sm_sbm_f0, | |
272 | nb_sm_before_f0.burst_sbm_bp1, |
|
278 | nb_sm_before_f0.burst_sbm_bp1, | |
273 | NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0, |
|
279 | NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0, | |
274 | ASM_F0_INDICE_START); |
|
280 | ASM_F0_INDICE_START); | |
275 | // 2) compute the BP1 set |
|
281 | // 2) compute the BP1 set | |
276 | BP1_set( compressed_sm_sbm_f0, k_coeff_intercalib_f0_sbm, NB_BINS_COMPRESSED_SM_SBM_F0, packet_sbm_bp1.data ); |
|
282 | // BP1_set( compressed_sm_sbm_f0, k_coeff_intercalib_f0_sbm, NB_BINS_COMPRESSED_SM_SBM_F0, packet_sbm_bp1.data ); | |
277 | // 3) send the BP1 set |
|
283 | // 3) send the BP1 set | |
278 | set_time( packet_sbm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeSBM ); |
|
284 | set_time( packet_sbm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeSBM ); | |
279 | set_time( packet_sbm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM ); |
|
285 | set_time( packet_sbm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeSBM ); | |
@@ -302,12 +308,12 rtems_task prc0_task( rtems_task_argumen | |||||
302 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0) |
|
308 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0) | |
303 | { |
|
309 | { | |
304 | // 1) compress the matrix for Basic Parameters calculation |
|
310 | // 1) compress the matrix for Basic Parameters calculation | |
305 |
ASM_compress_reorganize_and_divide( |
|
311 | ASM_compress_reorganize_and_divide( asm_f0_patched_norm, compressed_sm_norm_f0, | |
306 | nb_sm_before_f0.norm_bp1, |
|
312 | nb_sm_before_f0.norm_bp1, | |
307 | NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, |
|
313 | NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, | |
308 | ASM_F0_INDICE_START ); |
|
314 | ASM_F0_INDICE_START ); | |
309 | // 2) compute the BP1 set |
|
315 | // 2) compute the BP1 set | |
310 | BP1_set( compressed_sm_norm_f0, k_coeff_intercalib_f0_norm, NB_BINS_COMPRESSED_SM_F0, packet_norm_bp1.data ); |
|
316 | // BP1_set( compressed_sm_norm_f0, k_coeff_intercalib_f0_norm, NB_BINS_COMPRESSED_SM_F0, packet_norm_bp1.data ); | |
311 | // 3) send the BP1 set |
|
317 | // 3) send the BP1 set | |
312 | set_time( packet_norm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeNORM ); |
|
318 | set_time( packet_norm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeNORM ); | |
313 | set_time( packet_norm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM ); |
|
319 | set_time( packet_norm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM ); | |
@@ -330,7 +336,7 rtems_task prc0_task( rtems_task_argumen | |||||
330 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0) |
|
336 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0) | |
331 | { |
|
337 | { | |
332 | // 1) reorganize the ASM and divide |
|
338 | // 1) reorganize the ASM and divide | |
333 |
ASM_reorganize_and_divide( |
|
339 | ASM_reorganize_and_divide( asm_f0_patched_norm, | |
334 | asm_f0_reorganized, |
|
340 | asm_f0_reorganized, | |
335 | nb_sm_before_f0.norm_bp1 ); |
|
341 | nb_sm_before_f0.norm_bp1 ); | |
336 | // 2) convert the float array in a char array |
|
342 | // 2) convert the float array in a char array |
@@ -22,7 +22,7 ring_node ring_to_send_asm_f1 [ NB | |||||
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_reorganized [ TOTAL_SIZE_SM ]; |
|
24 | float asm_f1_reorganized [ TOTAL_SIZE_SM ]; | |
25 |
char asm_f1_char [ |
|
25 | char asm_f1_char [ TOTAL_SIZE_SM * 2 ]; | |
26 | float compressed_sm_norm_f1[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F1]; |
|
26 | float compressed_sm_norm_f1[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F1]; | |
27 | float compressed_sm_sbm_f1 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 ]; |
|
27 | float compressed_sm_sbm_f1 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 ]; | |
28 |
|
28 | |||
@@ -302,7 +302,7 rtems_task prc1_task( rtems_task_argumen | |||||
302 | NB_BINS_COMPRESSED_SM_F1, NB_BINS_TO_AVERAGE_ASM_F1, |
|
302 | NB_BINS_COMPRESSED_SM_F1, NB_BINS_TO_AVERAGE_ASM_F1, | |
303 | ASM_F1_INDICE_START ); |
|
303 | ASM_F1_INDICE_START ); | |
304 | // 2) compute the BP1 set |
|
304 | // 2) compute the BP1 set | |
305 | BP1_set( compressed_sm_norm_f1, k_coeff_intercalib_f1_norm, NB_BINS_COMPRESSED_SM_F1, packet_norm_bp1.data ); |
|
305 | // BP1_set( compressed_sm_norm_f1, k_coeff_intercalib_f1_norm, NB_BINS_COMPRESSED_SM_F1, packet_norm_bp1.data ); | |
306 | // 3) send the BP1 set |
|
306 | // 3) send the BP1 set | |
307 | set_time( packet_norm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeNORM ); |
|
307 | set_time( packet_norm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeNORM ); | |
308 | set_time( packet_norm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM ); |
|
308 | set_time( packet_norm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM ); |
@@ -184,7 +184,7 rtems_task prc2_task( rtems_task_argumen | |||||
184 |
|
184 | |||
185 | while(1){ |
|
185 | while(1){ | |
186 | status = rtems_message_queue_receive( queue_id_q_p2, incomingData, &size, //************************************ |
|
186 | status = rtems_message_queue_receive( queue_id_q_p2, incomingData, &size, //************************************ | |
187 |
RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF |
|
187 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF2 | |
188 |
|
188 | |||
189 | incomingMsg = (asm_msg*) incomingData; |
|
189 | incomingMsg = (asm_msg*) incomingData; | |
190 |
|
190 | |||
@@ -195,32 +195,34 rtems_task prc2_task( rtems_task_argumen | |||||
195 | // NORM |
|
195 | // NORM | |
196 | //***** |
|
196 | //***** | |
197 | //***** |
|
197 | //***** | |
|
198 | // 1) compress the matrix for Basic Parameters calculation | |||
|
199 | ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f2, | |||
|
200 | nb_sm_before_f2.norm_bp1, | |||
|
201 | NB_BINS_COMPRESSED_SM_F2, NB_BINS_TO_AVERAGE_ASM_F2, | |||
|
202 | ASM_F2_INDICE_START ); | |||
|
203 | // BP1_F2 | |||
198 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F2) |
|
204 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F2) | |
199 | { |
|
205 | { | |
200 | // 1) compress the matrix for Basic Parameters calculation |
|
206 | // 1) compute the BP1 set | |
201 | ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f2, |
|
207 | // BP1_set( compressed_sm_norm_f2, k_coeff_intercalib_f2, NB_BINS_COMPRESSED_SM_F2, packet_norm_bp1.data ); | |
202 | nb_sm_before_f2.norm_bp1, |
|
208 | // 2) send the BP1 set | |
203 | NB_BINS_COMPRESSED_SM_F2, NB_BINS_TO_AVERAGE_ASM_F2, |
|
|||
204 | ASM_F2_INDICE_START ); |
|
|||
205 | // 2) compute the BP1 set |
|
|||
206 | BP1_set( compressed_sm_norm_f2, k_coeff_intercalib_f2, NB_BINS_COMPRESSED_SM_F2, packet_norm_bp1.data ); |
|
|||
207 | // 3) send the BP1 set |
|
|||
208 | set_time( packet_norm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeNORM ); |
|
209 | set_time( packet_norm_bp1.time, (unsigned char *) &incomingMsg->coarseTimeNORM ); | |
209 | set_time( packet_norm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM ); |
|
210 | set_time( packet_norm_bp1.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM ); | |
210 | BP_send( (char *) &packet_norm_bp1, queue_id_send, |
|
211 | BP_send( (char *) &packet_norm_bp1, queue_id_send, | |
211 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 + PACKET_LENGTH_DELTA, |
|
212 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 + PACKET_LENGTH_DELTA, | |
212 | SID_NORM_BP1_F2 ); |
|
213 | SID_NORM_BP1_F2 ); | |
213 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F2) |
|
214 | } | |
214 |
|
|
215 | // BP2_F2 | |
215 | // 1) compute the BP2 set using the same ASM as the one used for BP1 |
|
216 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F2) | |
216 | BP2_set( compressed_sm_norm_f2, NB_BINS_COMPRESSED_SM_F2, packet_norm_bp2.data ); |
|
217 | { | |
217 |
|
|
218 | // 1) compute the BP2 set | |
218 | set_time( packet_norm_bp2.time, (unsigned char *) &incomingMsg->coarseTimeNORM ); |
|
219 | BP2_set( compressed_sm_norm_f2, NB_BINS_COMPRESSED_SM_F2, packet_norm_bp2.data ); | |
219 | set_time( packet_norm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM ); |
|
220 | // 2) send the BP2 set | |
220 | BP_send( (char *) &packet_norm_bp2, queue_id_send, |
|
221 | set_time( packet_norm_bp2.time, (unsigned char *) &incomingMsg->coarseTimeNORM ); | |
221 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 + PACKET_LENGTH_DELTA, |
|
222 | set_time( packet_norm_bp2.acquisitionTime, (unsigned char *) &incomingMsg->coarseTimeNORM ); | |
222 | SID_NORM_BP2_F2 ); |
|
223 | BP_send( (char *) &packet_norm_bp2, queue_id_send, | |
223 | } |
|
224 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 + PACKET_LENGTH_DELTA, | |
|
225 | SID_NORM_BP2_F2 ); | |||
224 | } |
|
226 | } | |
225 |
|
227 | |||
226 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F2) |
|
228 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F2) |
@@ -53,13 +53,13 ring_node * getRingNodeForAveraging( uns | |||||
53 | //*********************************************************** |
|
53 | //*********************************************************** | |
54 | // Interrupt Service Routine for spectral matrices processing |
|
54 | // Interrupt Service Routine for spectral matrices processing | |
55 |
|
55 | |||
56 |
void spectral_matrices_isr_f0( |
|
56 | void spectral_matrices_isr_f0( unsigned char statusReg ) | |
57 | { |
|
57 | { | |
58 | unsigned char status; |
|
58 | unsigned char status; | |
59 | rtems_status_code status_code; |
|
59 | rtems_status_code status_code; | |
60 | ring_node *full_ring_node; |
|
60 | ring_node *full_ring_node; | |
61 |
|
61 | |||
62 |
status = s |
|
62 | status = statusReg & 0x03; // [0011] get the status_ready_matrix_f0_x bits | |
63 |
|
63 | |||
64 | switch(status) |
|
64 | switch(status) | |
65 | { |
|
65 | { | |
@@ -111,13 +111,13 void spectral_matrices_isr_f0( void ) | |||||
111 | } |
|
111 | } | |
112 | } |
|
112 | } | |
113 |
|
113 | |||
114 |
void spectral_matrices_isr_f1( |
|
114 | void spectral_matrices_isr_f1( unsigned char statusReg ) | |
115 | { |
|
115 | { | |
116 | rtems_status_code status_code; |
|
116 | rtems_status_code status_code; | |
117 | unsigned char status; |
|
117 | unsigned char status; | |
118 | ring_node *full_ring_node; |
|
118 | ring_node *full_ring_node; | |
119 |
|
119 | |||
120 |
status = (s |
|
120 | status = (statusReg & 0x0c) >> 2; // [1100] get the status_ready_matrix_f0_x bits | |
121 |
|
121 | |||
122 | switch(status) |
|
122 | switch(status) | |
123 | { |
|
123 | { | |
@@ -169,12 +169,12 void spectral_matrices_isr_f1( void ) | |||||
169 | } |
|
169 | } | |
170 | } |
|
170 | } | |
171 |
|
171 | |||
172 |
void spectral_matrices_isr_f2( |
|
172 | void spectral_matrices_isr_f2( unsigned char statusReg ) | |
173 | { |
|
173 | { | |
174 | unsigned char status; |
|
174 | unsigned char status; | |
175 | rtems_status_code status_code; |
|
175 | rtems_status_code status_code; | |
176 |
|
176 | |||
177 |
status = (s |
|
177 | status = (statusReg & 0x30) >> 4; // [0011 0000] get the status_ready_matrix_f0_x bits | |
178 |
|
178 | |||
179 | switch(status) |
|
179 | switch(status) | |
180 | { |
|
180 | { | |
@@ -212,11 +212,11 void spectral_matrices_isr_f2( void ) | |||||
212 | } |
|
212 | } | |
213 | } |
|
213 | } | |
214 |
|
214 | |||
215 |
void spectral_matrix_isr_error_handler( |
|
215 | void spectral_matrix_isr_error_handler( unsigned char statusReg ) | |
216 | { |
|
216 | { | |
217 | rtems_status_code status_code; |
|
217 | rtems_status_code status_code; | |
218 |
|
218 | |||
219 |
if (s |
|
219 | if (statusReg & 0x7c0) // [0111 1100 0000] | |
220 | { |
|
220 | { | |
221 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
221 | status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
222 | } |
|
222 | } | |
@@ -232,13 +232,17 rtems_isr spectral_matrices_isr( rtems_v | |||||
232 | // buffer_full ** bad_component_err ** f2_1 ** f2_0 ** f1_1 ** f1_0 ** f0_1 ** f0_0 |
|
232 | // buffer_full ** bad_component_err ** f2_1 ** f2_0 ** f1_1 ** f1_0 ** f0_1 ** f0_0 | |
233 | // 7 6 5 4 3 2 1 0 |
|
233 | // 7 6 5 4 3 2 1 0 | |
234 |
|
234 | |||
235 | spectral_matrices_isr_f0(); |
|
235 | unsigned char statusReg; | |
236 |
|
236 | |||
237 | spectral_matrices_isr_f1(); |
|
237 | statusReg = spectral_matrix_regs->status; | |
|
238 | ||||
|
239 | spectral_matrices_isr_f0( statusReg ); | |||
238 |
|
240 | |||
239 |
spectral_matrices_isr_f |
|
241 | spectral_matrices_isr_f1( statusReg ); | |
240 |
|
242 | |||
241 |
spectral_matri |
|
243 | spectral_matrices_isr_f2( statusReg ); | |
|
244 | ||||
|
245 | spectral_matrix_isr_error_handler( statusReg ); | |||
242 | } |
|
246 | } | |
243 |
|
247 | |||
244 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
248 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) | |
@@ -536,3 +540,47 unsigned char getSID( rtems_event_set ev | |||||
536 | return sid; |
|
540 | return sid; | |
537 | } |
|
541 | } | |
538 |
|
542 | |||
|
543 | void extractReImVectors( float *inputASM, float *outputASM, unsigned int asmComponent ) | |||
|
544 | { | |||
|
545 | unsigned int i; | |||
|
546 | float re; | |||
|
547 | float im; | |||
|
548 | ||||
|
549 | for (i=0; i<NB_BINS_PER_SM; i++){ | |||
|
550 | re = inputASM[ (asmComponent*NB_BINS_PER_SM) + i * 2 ]; | |||
|
551 | im = inputASM[ (asmComponent*NB_BINS_PER_SM) + i * 2 + 1]; | |||
|
552 | outputASM[ (asmComponent *NB_BINS_PER_SM) + i] = re; | |||
|
553 | outputASM[ (asmComponent+1)*NB_BINS_PER_SM + i] = im; | |||
|
554 | } | |||
|
555 | } | |||
|
556 | ||||
|
557 | void copyReVectors( float *inputASM, float *outputASM, unsigned int asmComponent ) | |||
|
558 | { | |||
|
559 | unsigned int i; | |||
|
560 | float re; | |||
|
561 | ||||
|
562 | for (i=0; i<NB_BINS_PER_SM; i++){ | |||
|
563 | re = inputASM[ (asmComponent*NB_BINS_PER_SM) + i]; | |||
|
564 | outputASM[ (asmComponent*NB_BINS_PER_SM) + i] = re; | |||
|
565 | } | |||
|
566 | } | |||
|
567 | ||||
|
568 | void ASM_patch( float *inputASM, float *outputASM ) | |||
|
569 | { | |||
|
570 | extractReImVectors( inputASM, outputASM, 1); // b1b2 | |||
|
571 | extractReImVectors( inputASM, outputASM, 3 ); // b1b3 | |||
|
572 | extractReImVectors( inputASM, outputASM, 5 ); // b1e1 | |||
|
573 | extractReImVectors( inputASM, outputASM, 7 ); // b1e2 | |||
|
574 | extractReImVectors( inputASM, outputASM, 10 ); // b2b3 | |||
|
575 | extractReImVectors( inputASM, outputASM, 12 ); // b2e1 | |||
|
576 | extractReImVectors( inputASM, outputASM, 14 ); // b2e2 | |||
|
577 | extractReImVectors( inputASM, outputASM, 17 ); // b3e1 | |||
|
578 | extractReImVectors( inputASM, outputASM, 19 ); // b3e2 | |||
|
579 | extractReImVectors( inputASM, outputASM, 22 ); // e1e2 | |||
|
580 | ||||
|
581 | copyReVectors(inputASM, outputASM, 0 ); // b1b1 | |||
|
582 | copyReVectors(inputASM, outputASM, 9 ); // b2b2 | |||
|
583 | copyReVectors(inputASM, outputASM, 16); // b3b3 | |||
|
584 | copyReVectors(inputASM, outputASM, 21); // e1e1 | |||
|
585 | copyReVectors(inputASM, outputASM, 24); // e2e2 | |||
|
586 | } |
@@ -63,3 +63,32 void ASM_compress_reorganize_and_divide( | |||||
63 | } |
|
63 | } | |
64 | } |
|
64 | } | |
65 | } |
|
65 | } | |
|
66 | ||||
|
67 | void extractReImVectors( float *inputASM, float *outputASM, unsigned int asmComponent ) | |||
|
68 | { | |||
|
69 | unsigned int i; | |||
|
70 | float re; | |||
|
71 | float im; | |||
|
72 | ||||
|
73 | for (i=0; i<NB_BINS_PER_SM; i++){ | |||
|
74 | re = inputASM[ (asmComponent*NB_BINS_PER_SM) + i * 2 ]; | |||
|
75 | im = inputASM[ (asmComponent*NB_BINS_PER_SM) + i * 2 + 1]; | |||
|
76 | outputASM[ (asmComponent *NB_BINS_PER_SM) + i] = re; | |||
|
77 | outputASM[ (asmComponent+1)*NB_BINS_PER_SM + i] = im; | |||
|
78 | } | |||
|
79 | ||||
|
80 | } | |||
|
81 | ||||
|
82 | void ASM_patch( float *inputASM, float *outputASM ) | |||
|
83 | { | |||
|
84 | extractReImVectors( inputASM, outputASM, 1); // b1b2 | |||
|
85 | extractReImVectors( inputASM, outputASM, 3 ); // b1b3 | |||
|
86 | extractReImVectors( inputASM, outputASM, 5 ); // b1e1 | |||
|
87 | extractReImVectors( inputASM, outputASM, 7 ); // b1e2 | |||
|
88 | extractReImVectors( inputASM, outputASM, 10 ); // b2b3 | |||
|
89 | extractReImVectors( inputASM, outputASM, 12 ); // b2e1 | |||
|
90 | extractReImVectors( inputASM, outputASM, 14 ); // b2e2 | |||
|
91 | extractReImVectors( inputASM, outputASM, 17 ); // b3e1 | |||
|
92 | extractReImVectors( inputASM, outputASM, 19 ); // b3e2 | |||
|
93 | extractReImVectors( inputASM, outputASM, 22 ); // e1e2 | |||
|
94 | } |
@@ -12,6 +12,7 int main(void) | |||||
12 |
|
12 | |||
13 | float input_ASM [ NB_VALUES_PER_SM * NB_BINS_PER_SM ]; |
|
13 | float input_ASM [ NB_VALUES_PER_SM * NB_BINS_PER_SM ]; | |
14 | float output_ASM [ NB_VALUES_PER_SM * NB_BINS_PER_SM ]; |
|
14 | float output_ASM [ NB_VALUES_PER_SM * NB_BINS_PER_SM ]; | |
|
15 | float patched_ASM [ NB_VALUES_PER_SM * NB_BINS_PER_SM ]; | |||
15 | float output_ASM_compressed [ NB_VALUES_PER_SM * NB_BINS_COMPRESSED_SM_F0 ]; |
|
16 | float output_ASM_compressed [ NB_VALUES_PER_SM * NB_BINS_COMPRESSED_SM_F0 ]; | |
16 |
|
17 | |||
17 | //******* |
|
18 | //******* | |
@@ -28,6 +29,8 int main(void) | |||||
28 | } |
|
29 | } | |
29 | } |
|
30 | } | |
30 |
|
31 | |||
|
32 | ASM_patch( input_ASM, patched_ASM ); | |||
|
33 | ||||
31 | ASM_reorganize_and_divide( input_ASM, output_ASM, |
|
34 | ASM_reorganize_and_divide( input_ASM, output_ASM, | |
32 | 1 ); // divider |
|
35 | 1 ); // divider | |
33 |
|
36 | |||
@@ -59,6 +62,8 int main(void) | |||||
59 | NB_BINS_TO_AVERAGE_ASM_F0, |
|
62 | NB_BINS_TO_AVERAGE_ASM_F0, | |
60 | ASM_F0_INDICE_START); |
|
63 | ASM_F0_INDICE_START); | |
61 |
|
64 | |||
|
65 | ASM_patch( input_ASM, patched_ASM ); | |||
|
66 | ||||
62 | return 0; |
|
67 | return 0; | |
63 | } |
|
68 | } | |
64 |
|
69 |
General Comments 0
You need to be logged in to leave comments.
Login now