# HG changeset patch # User paul # Date 2014-03-27 12:17:38 # Node ID be3fd1d0953fc9ce3d923a8a70025a90d872972f # Parent f4cfe60821dcbcce7af242df01c2beaa2f5c7e9e rev 1.0.0.3 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: Tue Mar 25 09:47:02 2014 +# Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Mar 27 13:16:57 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 -DVHDL_DEV -DPRINT_MESSAGES_ON_CONSOLE +DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=3 -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 vhdl_dev +CONFIG += console verbose CONFIG -= qt include(./sparc.pri) 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/tc_handler.h b/header/tc_handler.h --- a/header/tc_handler.h +++ b/header/tc_handler.h @@ -24,17 +24,18 @@ rtems_task actn_task( rtems_task_argumen //*********** // TC ACTIONS -int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); -int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); -int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); -int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); -int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); -int action_update_time(ccsdsTelecommandPacket_t *TC); +int action_reset( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); +int action_enter_mode( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); +int action_update_info( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); +int action_enable_calibration( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); +int action_disable_calibration( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); +int action_update_time( ccsdsTelecommandPacket_t *TC); // mode transition -int transition_validation(unsigned char requestedMode); +int check_mode_value( unsigned char requestedMode ); +int check_mode_transition( unsigned char requestedMode ); int stop_current_mode( void ); -int enter_mode(unsigned char mode); +int enter_mode( unsigned char mode ); int restart_science_tasks(); int suspend_science_tasks(); void launch_waveform_picker( unsigned char mode ); diff --git a/src/fsw_misc.c b/src/fsw_misc.c --- a/src/fsw_misc.c +++ b/src/fsw_misc.c @@ -252,7 +252,7 @@ rtems_task dumb_task( rtems_task_argumen unsigned int fine_time = 0; rtems_event_set event_out; - char *DumbMessages[9] = {"in DUMB *** default", // RTEMS_EVENT_0 + 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 *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 @@ -260,7 +260,8 @@ rtems_task dumb_task( rtems_task_argumen "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 "ERR HK", // RTEMS_EVENT_6 "ready for dump", // RTEMS_EVENT_7 - "in DUMB *** spectral_matrices_isr" // RTEMS_EVENT_8 + "in DUMB *** spectral_matrices_isr", // RTEMS_EVENT_8 + "tick" // RTEMS_EVENT_9 }; BOOT_PRINTF("in DUMB *** \n") @@ -268,7 +269,7 @@ rtems_task dumb_task( rtems_task_argumen while(1){ rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7 - | RTEMS_EVENT_8, + | RTEMS_EVENT_8 | RTEMS_EVENT_9, RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT intEventOut = (unsigned int) event_out; for ( i=0; i<32; i++) diff --git a/src/fsw_spacewire.c b/src/fsw_spacewire.c --- a/src/fsw_spacewire.c +++ b/src/fsw_spacewire.c @@ -580,7 +580,7 @@ void spacewire_update_statistics( void ) void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ) { -// rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ); +// rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_9 ); struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; grgpio_regs->io_port_direction_register = @@ -594,7 +594,6 @@ void timecode_irq_handler( void *pDev, v { grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x08; } - } rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ) diff --git a/src/tc_handler.c b/src/tc_handler.c --- a/src/tc_handler.c +++ b/src/tc_handler.c @@ -163,33 +163,23 @@ int action_enter_mode(ccsdsTelecommandPa requestedMode = TC->dataAndCRC[1]; - if ( (requestedMode != LFR_MODE_STANDBY) - && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) - && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) + status = check_mode_value( requestedMode ); + if ( status != LFR_SUCCESSFUL ) { - status = RTEMS_UNSATISFIED; send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode ); } else { - printf("in action_enter_mode *** enter mode %d\n", requestedMode); - - status = transition_validation(requestedMode); + status = check_mode_transition(requestedMode); - if ( status == LFR_SUCCESSFUL ) { - if ( lfrCurrentMode != LFR_MODE_STANDBY) - { - status = stop_current_mode(); - } - if (status != RTEMS_SUCCESSFUL) - { - PRINTF("ERR *** in action_enter *** stop_current_mode\n") - } + if ( status == LFR_SUCCESSFUL ) + { + PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode); status = enter_mode( requestedMode ); } else { - PRINTF("ERR *** in action_enter *** transition rejected\n") + PRINTF("ERR *** in action_enter_mode *** transition rejected\n") send_tm_lfr_tc_exe_not_executable( TC, queue_id ); } } @@ -301,6 +291,9 @@ int action_update_time(ccsdsTelecommandP + (TC->dataAndCRC[1] << 16) + (TC->dataAndCRC[2] << 8) + TC->dataAndCRC[3]; + + PRINTF1("time received: %x\n", time_management_regs->coarse_time_load) + val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; val++; @@ -313,8 +306,25 @@ int action_update_time(ccsdsTelecommandP //******************* // ENTERING THE MODES +int check_mode_value( unsigned char requestedMode ) +{ + int status; -int transition_validation(unsigned char requestedMode) + if ( (requestedMode != LFR_MODE_STANDBY) + && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) + && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) + { + status = LFR_DEFAULT; + } + else + { + status = LFR_SUCCESSFUL; + } + + return status; +} + +int check_mode_transition( unsigned char requestedMode ) { /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. * @@ -379,7 +389,7 @@ int transition_validation(unsigned char return status; } -int stop_current_mode(void) +int stop_current_mode( void ) { /** This function stops the current mode by masking interrupt lines and suspending science tasks. * @@ -430,7 +440,7 @@ int stop_current_mode(void) return status; } -int enter_mode(unsigned char mode ) +int enter_mode( unsigned char mode ) { /** This function is launched after a mode transition validation. * @@ -444,11 +454,16 @@ int enter_mode(unsigned char mode ) rtems_status_code status; - status = RTEMS_UNSATISFIED; + //********************** + // STOP THE CURRENT MODE + status = stop_current_mode(); + if (status != RTEMS_SUCCESSFUL) + { + PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode) + } - housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d); - updateLFRCurrentMode(); - + //************************* + // ENTER THE REQUESTED MODE if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST) || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) ) { @@ -458,7 +473,7 @@ int enter_mode(unsigned char mode ) #endif status = restart_science_tasks(); launch_waveform_picker( mode ); - launch_spectral_matrix( mode ); +// launch_spectral_matrix( mode ); } else if ( mode == LFR_MODE_STANDBY ) { @@ -469,7 +484,6 @@ int enter_mode(unsigned char mode ) #ifdef PRINT_STACK_REPORT rtems_stack_checker_report_usage(); #endif - status = stop_current_mode(); PRINTF1("maxCount = %d\n", maxCount) } else @@ -479,7 +493,7 @@ int enter_mode(unsigned char mode ) if (status != RTEMS_SUCCESSFUL) { - PRINTF1("in enter_mode *** ERR = %d\n", status) + PRINTF1("ERR *** in enter_mode *** status = %d\n", status) status = RTEMS_UNSATISFIED; } @@ -625,6 +639,10 @@ void launch_spectral_matrix( unsigned ch reset_spectral_matrix_regs(); #ifdef VHDL_DEV + 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 set_irq_on_new_ready_matrix( 1 ); LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); @@ -747,6 +765,8 @@ void close_action(ccsdsTelecommandPacket * */ + unsigned char requestedMode; + if (result == LFR_SUCCESSFUL) { if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) @@ -756,6 +776,14 @@ void close_action(ccsdsTelecommandPacket { send_tm_lfr_tc_exe_success( TC, queue_id ); } + if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) ) + { + //********************************** + // UPDATE THE LFRMODE LOCAL VARIABLE + requestedMode = TC->dataAndCRC[1]; + housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d); + updateLFRCurrentMode(); + } } }