diff --git a/FSW-qt/Makefile b/FSW-qt/Makefile --- a/FSW-qt/Makefile +++ b/FSW-qt/Makefile @@ -1,6 +1,6 @@ ############################################################################# # Makefile for building: bin/fsw -# Generated by qmake (2.01a) (Qt 4.8.6) on: Tue May 6 08:24:43 2014 +# Generated by qmake (2.01a) (Qt 4.8.6) on: Tue May 6 15:49:26 2014 # Project: fsw-qt.pro # Template: app # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro diff --git a/FSW-qt/fsw-qt.pro.user b/FSW-qt/fsw-qt.pro.user --- a/FSW-qt/fsw-qt.pro.user +++ b/FSW-qt/fsw-qt.pro.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget diff --git a/header/processing/fsw_params_processing.h b/header/processing/fsw_params_processing.h deleted file mode 100644 --- a/header/processing/fsw_params_processing.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef FSW_PARAMS_PROCESSING_H -#define FSW_PARAMS_PROCESSING_H - -#define NB_BINS_PER_SM 128 -#define NB_VALUES_PER_SM 25 -#define TOTAL_SIZE_SM 3200 // 25 * 128 -#define TOTAL_SIZE_NORM_BP1_F0 99 // 11 * 9 = 99 -#define TOTAL_SIZE_NORM_BP1_F1 117 // 13 * 9 = 117 -#define TOTAL_SIZE_NORM_BP1_F2 108 // 12 * 9 = 108 -#define TOTAL_SIZE_SBM1_BP1_F0 198 // 22 * 9 = 198 -// -#define NB_RING_NODES_SM_F0 12 // AT LEAST 3 -#define NB_RING_NODES_ASM_BURST_SBM_F0 10 // AT LEAST 3 -#define NB_RING_NODES_ASM_NORM_F0 10 // AT LEAST 3 -#define NB_RING_NODES_SM_F1 3 // AT LEAST 3 -#define NB_RING_NODES_ASM_BURST_SBM_F1 5 // AT LEAST 3 -#define NB_RING_NODES_ASM_NORM_F1 5 // AT LEAST 3 -#define NB_RING_NODES_SM_F2 3 // AT LEAST 3 -#define NB_RING_NODES_ASM_BURST_SBM_F2 3 // AT LEAST 3 -#define NB_RING_NODES_ASM_NORM_F2 3 // AT LEAST 3 -// -#define NB_BINS_PER_ASM_F0 88 -#define NB_BINS_PER_PKT_ASM_F0 44 -#define TOTAL_SIZE_ASM_F0_IN_BYTES 4400 // 25 * 88 * 2 -#define ASM_F0_INDICE_START 17 // 88 bins -#define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins -// -#define NB_BINS_PER_ASM_F1 104 -#define NB_BINS_PER_PKT_ASM_F1 52 -#define TOTAL_SIZE_ASM_F1_IN_BYTES 5200 // 25 * 104 * 2 -#define ASM_F1_INDICE_START 6 // 104 bins -#define ASM_F1_INDICE_STOP 109 // 2 packets of 52 bins -// -#define NB_BINS_PER_ASM_F2 96 -#define NB_BINS_PER_PKT_ASM_F2 48 -#define TOTAL_SIZE_ASM_F2_IN_BYTES 4800 // 25 * 96 * 2 -#define ASM_F2_INDICE_START 7 // 96 bins -#define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins -// -#define NB_BINS_COMPRESSED_SM_F0 11 -#define NB_BINS_COMPRESSED_SM_F1 13 -#define NB_BINS_COMPRESSED_SM_F2 12 -#define NB_BINS_COMPRESSED_SM_SBM_F0 22 -#define NB_BINS_COMPRESSED_SM_SBM_F1 26 -#define NB_BINS_COMPRESSED_SM_SBM_F2 24 -// -#define NB_BINS_TO_AVERAGE_ASM_F0 8 -#define NB_BINS_TO_AVERAGE_ASM_F1 8 -#define NB_BINS_TO_AVERAGE_ASM_F2 8 -#define NB_BINS_TO_AVERAGE_ASM_SBM_F0 4 -#define NB_BINS_TO_AVERAGE_ASM_SBM_F1 4 -#define NB_BINS_TO_AVERAGE_ASM_SBM_F2 4 -// -#define TOTAL_SIZE_COMPRESSED_ASM_NORM_F0 275 // 11 * 25 WORDS -#define TOTAL_SIZE_COMPRESSED_ASM_NORM_F1 325 // 13 * 25 WORDS -#define TOTAL_SIZE_COMPRESSED_ASM_NORM_F2 300 // 12 * 25 WORDS -#define TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 550 // 22 * 25 WORDS -#define TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 650 // 26 * 25 WORDS -#define TOTAL_SIZE_COMPRESSED_ASM_SBM_F2 600 // 24 * 25 WORDS -// GENERAL -#define NB_SM_BEFORE_AVF0 8 // must be 8 due to the SM_average() function -#define NB_SM_BEFORE_AVF1 8 // must be 8 due to the SM_average() function -#define NB_SM_BEFORE_AVF2 1 // must be 1 due to the SM_average_f2() function - -#endif // FSW_PARAMS_PROCESSING_H diff --git a/src/fsw_misc.c b/src/fsw_misc.c --- a/src/fsw_misc.c +++ b/src/fsw_misc.c @@ -439,59 +439,61 @@ void send_dumb_hk( void ) void get_v_e1_e2_f3( unsigned char *v, unsigned char *e1, unsigned char *e2, bool init_buffer_addr ) { - static int *current_addr_data_f3 = NULL; - int *new_addr_data_f3; - unsigned char *ptr; + unsigned int coarseTime; + unsigned int acquisitionTime; + unsigned int deltaT = 0; + unsigned char *bufferPtr; - static unsigned int counter = 0; unsigned int offset_in_samples; - unsigned int offset_in_words; - unsigned char delta = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz + unsigned int offset_in_bytes; + unsigned char f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz - new_addr_data_f3 = (int *) waveform_picker_regs->addr_data_f3; - - if (init_buffer_addr == true) // when the waveform_picker is launched + if (lfrCurrentMode == LFR_MODE_STANDBY) { - current_addr_data_f3 = NULL; + v[0] = 0x00; + v[1] = 0x00; + e1[0] = 0x00; + e1[1] = 0x00; + e2[0] = 0x00; + e2[1] = 0x00; } else { - if (lfrCurrentMode == LFR_MODE_STANDBY) + coarseTime = time_management_regs->coarse_time & 0x7fffffff; + bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3; + acquisitionTime = (unsigned int) ( ( bufferPtr[2] & 0x7f ) << 24 ) + + (unsigned int) ( bufferPtr[3] << 16 ) + + (unsigned int) ( bufferPtr[0] << 8 ) + + (unsigned int) ( bufferPtr[1] ); + if ( coarseTime > acquisitionTime ) { - v[0] = 0x00; - v[1] = 0x00; - e1[0] = 0x00; - e1[1] = 0x00; - e2[0] = 0x00; - e2[1] = 0x00; + deltaT = coarseTime - acquisitionTime; + offset_in_samples = (deltaT-1) * f3 ; + } + else if( coarseTime == acquisitionTime ) + { + offset_in_samples = 0; } else { - if ( new_addr_data_f3 != current_addr_data_f3 ) - { - counter = 0; - offset_in_samples = 0; - current_addr_data_f3 = new_addr_data_f3; - } - else - { - counter = counter + 1; - offset_in_samples = counter * delta; - if ( offset_in_samples > NB_SAMPLES_PER_SNAPSHOT ) - { - offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1; - PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out the buffer, counter = %d\n", counter) - } - } - offset_in_words = TIME_OFFSET + offset_in_samples * NB_WORDS_SWF_BLK; - ptr = (unsigned char*) ¤t_addr_data_f3[ offset_in_words ]; - v[0] = ptr[0]; - v[1] = ptr[1]; - e1[0] = ptr[2]; - e1[1] = ptr[3]; - e2[0] = ptr[4]; - e2[1] = ptr[5]; + offset_in_samples = 0; + PRINTF2("ERR *** in get_v_e1_e2_f3 *** coarseTime = %x, acquisitionTime = %x\n", coarseTime, acquisitionTime) + } + + if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) ) + { + PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out the buffer, counter = %d\n", offset_in_samples) + offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1; } + PRINTF1("f3 data @ %x *** ", waveform_picker_regs->addr_data_f3 ) + PRINTF2("deltaT = %d, offset_in_samples = %d\n", deltaT, offset_in_samples ) + offset_in_bytes = TIME_OFFSET_IN_BYTES + offset_in_samples * NB_WORDS_SWF_BLK * 4; + v[0] = bufferPtr[ offset_in_bytes + 0]; + v[1] = bufferPtr[ offset_in_bytes + 1]; + e1[0] = bufferPtr[ offset_in_bytes + 2]; + e1[1] = bufferPtr[ offset_in_bytes + 3]; + e2[0] = bufferPtr[ offset_in_bytes + 4]; + e2[1] = bufferPtr[ offset_in_bytes + 5]; } } diff --git a/src/tc_handler.c b/src/tc_handler.c --- a/src/tc_handler.c +++ b/src/tc_handler.c @@ -751,7 +751,6 @@ void launch_waveform_picker( unsigned ch reset_current_ring_nodes(); reset_waveform_picker_regs(); set_wfp_burst_enable_register( mode ); - get_v_e1_e2_f3( NULL, NULL, NULL, true ); LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); diff --git a/src/wf_handler.c b/src/wf_handler.c --- a/src/wf_handler.c +++ b/src/wf_handler.c @@ -81,6 +81,7 @@ rtems_isr waveforms_isr( rtems_vector_nu if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); } + rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2); waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] } } @@ -1214,7 +1215,7 @@ void set_wfp_burst_enable_register( unsi case(LFR_MODE_BURST): waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2 - waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x06; // [0110] enable f3 AND f2 + waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 AND f2 break; case(LFR_MODE_SBM1): waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled