# HG changeset patch # User paul # Date 2014-03-28 10:26:03 # Node ID 321cef60967cae03ffd79bfb946829cdb20ce562 # Parent be3fd1d0953fc9ce3d923a8a70025a90d872972f rev 1.0.0.4 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: Thu Mar 27 13:16:57 2014 +# Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Mar 27 14:01:46 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=3 -DPRINT_MESSAGES_ON_CONSOLE +DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=4 -DVHDL_DEV -DPRINT_MESSAGES_ON_CONSOLE CFLAGS = -pipe -O3 -Wall $(DEFINES) CXXFLAGS = -pipe -O3 -Wall $(DEFINES) INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../../LFR_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 vhdl_dev 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=3 # internal +DEFINES += SW_VERSION_N4=4 # 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 @@ -32,9 +32,8 @@ rtems_task hous_task( rtems_task_argumen rtems_task dumb_task( rtems_task_argument unused ); void init_housekeeping_parameters( void ); - void increment_seq_counter( unsigned char *packet_sequence_control); - void getTime( unsigned char *time); +void send_dumb_hk( void ); #endif // FSW_MISC_H_INCLUDED diff --git a/src/fsw_init.c b/src/fsw_init.c --- a/src/fsw_init.c +++ b/src/fsw_init.c @@ -92,14 +92,17 @@ rtems_task Init( rtems_task_argument ign PRINTF("*************************\n") PRINTF("\n\n") - reset_wfp_burst_enable(); // stop the waveform picker if it was running - init_waveform_rings(); // initialize the waveform rings - init_sm_rings(); - init_parameter_dump(); init_local_mode_parameters(); init_housekeeping_parameters(); + init_waveform_rings(); // initialize the waveform rings + init_sm_rings(); // initialize spectral matrices rings + + reset_wfp_burst_enable(); + reset_wfp_status(); + set_wfp_data_shaping(); + updateLFRCurrentMode(); BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) @@ -161,7 +164,7 @@ rtems_task Init( rtems_task_argument ign PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) } - // suspend science tasks. they will be restarted later depending on the mode + // suspend science tasks, they will be restarted later depending on the mode status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) if (status != RTEMS_SUCCESSFUL) { @@ -196,6 +199,8 @@ rtems_task Init( rtems_task_argument ign BOOT_PRINTF("delete INIT\n") + send_dumb_hk(); + status = rtems_task_delete(RTEMS_SELF); } diff --git a/src/fsw_misc.c b/src/fsw_misc.c --- a/src/fsw_misc.c +++ b/src/fsw_misc.c @@ -221,7 +221,7 @@ rtems_task hous_task(rtems_task_argument spacewire_update_statistics(); // SEND PACKET - status = rtems_message_queue_send( queue_id, &housekeeping_packet, + status = rtems_message_queue_urgent( queue_id, &housekeeping_packet, PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); if (status != RTEMS_SUCCESSFUL) { PRINTF1("in HOUS *** ERR send: %d\n", status) @@ -363,3 +363,52 @@ void getTime( unsigned char *time) time[5] = (unsigned char) (time_management_regs->fine_time); } +void send_dumb_hk( void ) +{ + Packet_TM_LFR_HK_t dummy_hk_packet; + unsigned char *parameters; + unsigned int i; + rtems_id queue_id; + + dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; + dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; + dummy_hk_packet.reserved = DEFAULT_RESERVED; + dummy_hk_packet.userApplication = CCSDS_USER_APP; + dummy_hk_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8); + dummy_hk_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK); + dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; + dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; + dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); + dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); + dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; + dummy_hk_packet.serviceType = TM_TYPE_HK; + dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK; + dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND; + dummy_hk_packet.sid = SID_HK; + + // init status word + dummy_hk_packet.lfr_status_word[0] = 0xff; + dummy_hk_packet.lfr_status_word[1] = 0xff; + // init software version + dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1; + dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2; + dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3; + dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4; + // init fpga version + parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xd0); + dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1 + dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2 + dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3 + + parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load; + + for (i=0; i<100; i++) + { + parameters[i] = 0xff; + } + + get_message_queue_id_send( &queue_id ); + + rtems_message_queue_urgent( queue_id, &dummy_hk_packet, + PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); +} diff --git a/src/tc_handler.c b/src/tc_handler.c --- a/src/tc_handler.c +++ b/src/tc_handler.c @@ -164,6 +164,7 @@ int action_enter_mode(ccsdsTelecommandPa requestedMode = TC->dataAndCRC[1]; status = check_mode_value( requestedMode ); + if ( status != LFR_SUCCESSFUL ) { send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode ); @@ -412,11 +413,11 @@ int stop_current_mode( void ) LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt - // (3) reset registers - // waveform picker + // (3) reset waveform picker registers reset_wfp_burst_enable(); // reset burst and enable bits reset_wfp_status(); // reset all the status bits - // spectral matrices + + // (4) reset spectral matrices registers set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0 reset_extractSWF(); // reset the extractSWF flag to false @@ -642,7 +643,7 @@ void launch_spectral_matrix( unsigned ch struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; grgpio_regs->io_port_direction_register = grgpio_regs->io_port_direction_register | 0x01; // [0001 1000], 0 = output disabled, 1 = output enabled - grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x01; // set the bit 0 to 1 + grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x00; // set the bit 0 to 1 set_irq_on_new_ready_matrix( 1 ); LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); diff --git a/src/wf_handler.c b/src/wf_handler.c --- a/src/wf_handler.c +++ b/src/wf_handler.c @@ -1013,13 +1013,13 @@ void build_snapshot_from_ring( ring_node deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144; sampleOffset_asLong = 0x00; - // get the f0 acquisition time + // (1) get the f0 acquisition time build_acquisition_time( &acquisitionTimeF0_asLong, current_ring_node_f0 ); - // compute the central reference time + // (2) compute the central reference time centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0; - // compute the acquisition time of the current snapshot + // (3) compute the acquisition time of the current snapshot switch(frequencyChannel) { case 1: // 1 is for F1 = 4096 Hz @@ -1042,7 +1042,7 @@ void build_snapshot_from_ring( ring_node } //**************************************************************************** - // 1) search the ring_node with the acquisition time <= acquisitionTime_asLong + // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong for (i=0; iprevious; } - //************************************************* - // (2) once the buffer is found, build the snapshot - - // compute the number of samples to take in the current buffer + // (5) compute the number of samples to take in the current buffer sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16; nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong; + PRINTF2("sampleOffset_asLong = %lld, nbSamplesPart1_asLong = %lld\n", sampleOffset_asLong, nbSamplesPart1_asLong) - // compute the final acquisition time + // (6) compute the final acquisition time acquisitionTime_asLong = bufferAcquisitionTime_asLong + sampleOffset_asLong * nbTicksPerSample_asLong; - // copy the acquisition time at the beginning of the extrated snapshot + // (7) copy the acquisition time at the beginning of the extrated snapshot ptr1 = (unsigned char*) &acquisitionTime_asLong; ptr2 = (unsigned char*) wf_snap_extracted; ptr2[0] = ptr1[ 2 + 2 ]; @@ -1157,13 +1155,13 @@ void reset_waveform_picker_regs(void) * */ -// waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW - waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] + set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW + reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10 - waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14 - waveform_picker_regs->status = 0x00; // 0x18 + waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14 + reset_wfp_status(); // 0x18 // set_wfp_delta_snapshot(); // 0x1c set_wfp_delta_f0_f0_2(); // 0x20, 0x24