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.5) on: Fri May 2 15:40:46 2014 +# Generated by qmake (2.01a) (Qt 4.8.6) on: Tue May 6 08:24:43 2014 # Project: fsw-qt.pro # Template: app # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro @@ -10,7 +10,7 @@ CC = sparc-rtems-gcc CXX = sparc-rtems-g++ -DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=6 -DPRINT_MESSAGES_ON_CONSOLE +DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=7 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS CFLAGS = -pipe -O3 -Wall $(DEFINES) CXXFLAGS = -pipe -O3 -Wall $(DEFINES) INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/basic_parameters diff --git a/FSW-qt/fsw-qt.pro b/FSW-qt/fsw-qt.pro --- a/FSW-qt/fsw-qt.pro +++ b/FSW-qt/fsw-qt.pro @@ -1,7 +1,7 @@ TEMPLATE = app # CONFIG += console v8 sim # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch -CONFIG += console verbose +CONFIG += console verbose cpu_usage_report CONFIG -= qt include(./sparc.pri) @@ -11,7 +11,7 @@ SWVERSION=-1-0 DEFINES += SW_VERSION_N1=1 # major DEFINES += SW_VERSION_N2=0 # minor DEFINES += SW_VERSION_N3=0 # patch -DEFINES += SW_VERSION_N4=6 # internal +DEFINES += SW_VERSION_N4=7 # internal contains( CONFIG, debug_tch ) { DEFINES += DEBUG_TCH 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/fsw_misc.h b/header/fsw_misc.h --- a/header/fsw_misc.h +++ b/header/fsw_misc.h @@ -36,6 +36,7 @@ void increment_seq_counter( unsigned cha void getTime( unsigned char *time); unsigned long long int getTimeAsUnsignedLongLongInt( ); void send_dumb_hk( void ); +void get_v_e1_e2_f3 (unsigned char *v, unsigned char *e1, unsigned char *e2, bool init_buffer_addr ); extern int sched_yield( void ); diff --git a/src/fsw_init.c b/src/fsw_init.c --- a/src/fsw_init.c +++ b/src/fsw_init.c @@ -321,7 +321,7 @@ int create_all_tasks( void ) // create a { status = rtems_task_create( Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, - RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] ); } diff --git a/src/fsw_misc.c b/src/fsw_misc.c --- a/src/fsw_misc.c +++ b/src/fsw_misc.c @@ -221,6 +221,10 @@ rtems_task hous_task(rtems_task_argument spacewire_update_statistics(); + get_v_e1_e2_f3( + housekeeping_packet.hk_lfr_sc_v_f3, housekeeping_packet.hk_lfr_sc_e1_f3, housekeeping_packet.hk_lfr_sc_e2_f3, + false ); + // SEND PACKET status = rtems_message_queue_urgent( queue_id, &housekeeping_packet, PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); @@ -255,7 +259,7 @@ rtems_task dumb_task( rtems_task_argumen char *DumbMessages[10] = {"in DUMB *** default", // RTEMS_EVENT_0 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 - "in DUMB *** waveforms_isr", // RTEMS_EVENT_2 + "in DUMB *** f3 buffer changed", // RTEMS_EVENT_2 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 @@ -432,3 +436,66 @@ void send_dumb_hk( void ) rtems_message_queue_urgent( queue_id, &dummy_hk_packet, PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); } + +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; + + 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 + + new_addr_data_f3 = (int *) waveform_picker_regs->addr_data_f3; + + if (init_buffer_addr == true) // when the waveform_picker is launched + { + current_addr_data_f3 = NULL; + } + else + { + if (lfrCurrentMode == LFR_MODE_STANDBY) + { + v[0] = 0x00; + v[1] = 0x00; + e1[0] = 0x00; + e1[1] = 0x00; + e2[0] = 0x00; + e2[1] = 0x00; + } + 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]; + } + } +} + + + + + diff --git a/src/tc_handler.c b/src/tc_handler.c --- a/src/tc_handler.c +++ b/src/tc_handler.c @@ -751,6 +751,7 @@ 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 @@ -66,7 +66,7 @@ rtems_isr waveforms_isr( rtems_vector_nu rtems_status_code status; - if ( (lfrCurrentMode == LFR_MODE_NORMAL) + if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_BURST) // in BURST the data are used to place v, e1 and e2 in the HK packet || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) { // in modes other than STANDBY and BURST, send the CWF_F3 data if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full @@ -282,35 +282,43 @@ rtems_task cwf3_task(rtems_task_argument // wait for an RTEMS_EVENT rtems_event_receive( RTEMS_EVENT_0, RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); - if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) + if ( (lfrCurrentMode == LFR_MODE_NORMAL) + || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode==LFR_MODE_SBM2) ) { - PRINTF("send CWF_LONG_F3\n") - } - else - { - PRINTF("send CWF_F3 (light)\n") - } - if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) { - send_waveform_CWF( wf_cont_f3_b, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); + PRINTF("send CWF_LONG_F3\n") } else { - send_waveform_CWF3_light( wf_cont_f3_b, headerCWF_F3_light, queue_id ); + PRINTF("send CWF_F3 (light)\n") + } + if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { + if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) + { + send_waveform_CWF( wf_cont_f3_b, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); + } + else + { + send_waveform_CWF3_light( wf_cont_f3_b, headerCWF_F3_light, queue_id ); + } + } + else + { + if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) + { + send_waveform_CWF( wf_cont_f3_a, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); + } + else + { + send_waveform_CWF3_light( wf_cont_f3_a, headerCWF_F3_light, queue_id ); + } + } } else { - if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) - { - send_waveform_CWF( wf_cont_f3_a, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); - } - else - { - send_waveform_CWF3_light( wf_cont_f3_a, headerCWF_F3_light, queue_id ); - } - + PRINTF1("in CWF3 *** lfrCurrentMode is %d, no data will be sent\n", lfrCurrentMode) } } } @@ -1205,7 +1213,8 @@ void set_wfp_burst_enable_register( unsi break; 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 | 0x04; // [0100] enable f2 + waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x06; // [0110] enable f3 AND f2 break; case(LFR_MODE_SBM1): waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled