# HG changeset patch # User paul # Date 2015-12-17 09:10:15 # Node ID 8d59770106437c9cbd458e67e6895d781628c6b9 # Parent 1c5814170464a101efc8b49279169308e2f55bca minor updates on documentation diff --git a/.hgsubstate b/.hgsubstate --- a/.hgsubstate +++ b/.hgsubstate @@ -1,2 +1,2 @@ 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters -721463c11a484e6a3439e16c99f8bd27720b9265 header/lfr_common_headers +ff85ce82cd9845f180cb578272717bcb76b62cb5 header/lfr_common_headers diff --git a/header/fsw_misc.h b/header/fsw_misc.h --- a/header/fsw_misc.h +++ b/header/fsw_misc.h @@ -60,6 +60,7 @@ void set_hk_lfr_sc_potential_flag( bool void set_hk_lfr_mag_fields_flag( bool state ); void set_hk_lfr_calib_enable( bool state ); void set_hk_lfr_reset_cause( enum lfr_reset_cause_t lfr_reset_cause ); +void hk_lfr_le_me_he_update(); extern int sched_yield( void ); extern void rtems_cpu_usage_reset(); diff --git a/header/fsw_spacewire.h b/header/fsw_spacewire.h --- a/header/fsw_spacewire.h +++ b/header/fsw_spacewire.h @@ -44,7 +44,6 @@ void spw_send_asm_f2( ring_node *ring_no void spw_send_k_dump( ring_node *ring_node_to_send ); void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ); -rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ); void (*grspw_timecode_callback) ( void *pDev, void *regs, int minor, unsigned int tc ); diff --git a/header/tc_handler.h b/header/tc_handler.h --- a/header/tc_handler.h +++ b/header/tc_handler.h @@ -12,6 +12,8 @@ #include "lfr_cpu_usage_report.h" +extern unsigned int lastValidTransitionDate; + //**** // ISR rtems_isr commutation_isr1( rtems_vector_number vector ); @@ -33,6 +35,7 @@ int action_update_time( ccsdsTelecommand // mode transition int check_mode_value( unsigned char requestedMode ); int check_mode_transition( unsigned char requestedMode ); +void update_last_valid_transition_date( unsigned int transitionCoarseTime ); int check_transition_date( unsigned int transitionCoarseTime ); int stop_spectral_matrices( void ); int stop_current_mode( void ); diff --git a/src/fsw_globals.c b/src/fsw_globals.c --- a/src/fsw_globals.c +++ b/src/fsw_globals.c @@ -58,6 +58,7 @@ spectral_matrix_regs_t *spectra // MODE PARAMETERS Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; struct param_local_str param_local; +unsigned int lastValidTransitionDate; // HK PACKETS Packet_TM_LFR_HK_t housekeeping_packet; diff --git a/src/fsw_init.c b/src/fsw_init.c --- a/src/fsw_init.c +++ b/src/fsw_init.c @@ -139,6 +139,7 @@ rtems_task Init( rtems_task_argument ign init_k_coefficients_prc1(); init_k_coefficients_prc2(); pa_bia_status_info = 0x00; + update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE ); // waveform picker initialization WFP_init_rings(); LEON_Clear_interrupt( IRQ_SPARC_GPTIMER_WATCHDOG ); // initialize the waveform rings diff --git a/src/fsw_misc.c b/src/fsw_misc.c --- a/src/fsw_misc.c +++ b/src/fsw_misc.c @@ -294,6 +294,8 @@ rtems_task hous_task(rtems_task_argument spacewire_update_statistics(); + hk_lfr_le_me_he_update(); + housekeeping_packet.hk_lfr_q_sd_fifo_size_max = hk_lfr_q_sd_fifo_size_max; housekeeping_packet.hk_lfr_q_rv_fifo_size_max = hk_lfr_q_rv_fifo_size_max; housekeeping_packet.hk_lfr_q_p0_fifo_size_max = hk_lfr_q_p0_fifo_size_max; @@ -650,3 +652,47 @@ void set_hk_lfr_reset_cause( enum lfr_re housekeeping_packet.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1] | (lfr_reset_cause & 0x07 ); // [0000 0111] } + +void hk_lfr_le_me_he_update() +{ + unsigned int hk_lfr_le_cnt; + unsigned int hk_lfr_me_cnt; + unsigned int hk_lfr_he_cnt; + + hk_lfr_le_cnt = 0; + hk_lfr_me_cnt = 0; + hk_lfr_he_cnt = 0; + + //update the low severity error counter + hk_lfr_le_cnt = + housekeeping_packet.hk_lfr_dpu_spw_parity + + housekeeping_packet.hk_lfr_dpu_spw_disconnect + + housekeeping_packet.hk_lfr_dpu_spw_escape + + housekeeping_packet.hk_lfr_dpu_spw_credit + + housekeeping_packet.hk_lfr_dpu_spw_write_sync + + housekeeping_packet.hk_lfr_dpu_spw_rx_ahb + + housekeeping_packet.hk_lfr_dpu_spw_tx_ahb + + housekeeping_packet.hk_lfr_time_timecode_ctr; + + //update the medium severity error counter + hk_lfr_me_cnt = + housekeeping_packet.hk_lfr_dpu_spw_early_eop + + housekeeping_packet.hk_lfr_dpu_spw_invalid_addr + + housekeeping_packet.hk_lfr_dpu_spw_eep + + housekeeping_packet.hk_lfr_dpu_spw_rx_too_big; + + //update the high severity error counter + hk_lfr_he_cnt = 0; + + // update housekeeping packet counters, convert unsigned int numbers in 2 bytes numbers + // LE + housekeeping_packet.hk_lfr_le_cnt[0] = (unsigned char) ((hk_lfr_le_cnt & 0xff00) >> 8); + housekeeping_packet.hk_lfr_le_cnt[1] = (unsigned char) (hk_lfr_le_cnt & 0x00ff); + // ME + housekeeping_packet.hk_lfr_me_cnt[0] = (unsigned char) ((hk_lfr_me_cnt & 0xff00) >> 8); + housekeeping_packet.hk_lfr_me_cnt[1] = (unsigned char) (hk_lfr_me_cnt & 0x00ff); + // HE + housekeeping_packet.hk_lfr_he_cnt[0] = (unsigned char) ((hk_lfr_he_cnt & 0xff00) >> 8); + housekeeping_packet.hk_lfr_he_cnt[1] = (unsigned char) (hk_lfr_he_cnt & 0x00ff); + +} diff --git a/src/fsw_spacewire.c b/src/fsw_spacewire.c --- a/src/fsw_spacewire.c +++ b/src/fsw_spacewire.c @@ -695,19 +695,6 @@ void timecode_irq_handler( void *pDev, v } } -rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ) -{ - int linkStatus; - rtems_status_code status; - - status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status - - if ( linkStatus == 5) { - PRINTF("in spacewire_reset_link *** link is running\n") - status = RTEMS_SUCCESSFUL; - } -} - void init_header_cwf( Header_TM_LFR_SCIENCE_CWF_t *header ) { header->targetLogicalAddress = CCSDS_DESTINATION_ID; diff --git a/src/tc_handler.c b/src/tc_handler.c --- a/src/tc_handler.c +++ b/src/tc_handler.c @@ -179,6 +179,7 @@ int action_enter_mode(ccsdsTelecommandPa { send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode ); } + else // the mode value is valid, check the transition { status = check_mode_transition(requestedMode); @@ -205,6 +206,8 @@ int action_enter_mode(ccsdsTelecommandPa { PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode); + + switch(requestedMode) { case LFR_MODE_STANDBY: @@ -441,6 +444,11 @@ int check_mode_transition( unsigned char return status; } +void update_last_valid_transition_date(unsigned int transitionCoarseTime) +{ + lastValidTransitionDate = transitionCoarseTime; +} + int check_transition_date( unsigned int transitionCoarseTime ) { int status; @@ -581,6 +589,21 @@ int stop_current_mode( void ) int enter_mode_standby() { + /** This function is used to put LFR in the STANDBY mode. + * + * @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE + * + * @return RTEMS directive status codes: + * - RTEMS_SUCCESSFUL - task restarted successfully + * - RTEMS_INVALID_ID - task id invalid + * - RTEMS_INCORRECT_STATE - task never started + * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task + * + * The STANDBY mode does not depends on a specific transition date, the effect of the TC_LFR_ENTER_MODE + * is immediate. + * + */ + int status; status = stop_current_mode(); // STOP THE CURRENT MODE @@ -599,6 +622,21 @@ int enter_mode_standby() int enter_mode_normal( unsigned int transitionCoarseTime ) { + /** This function is used to start the NORMAL mode. + * + * @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE + * + * @return RTEMS directive status codes: + * - RTEMS_SUCCESSFUL - task restarted successfully + * - RTEMS_INVALID_ID - task id invalid + * - RTEMS_INCORRECT_STATE - task never started + * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task + * + * The way the NORMAL mode is started depends on the LFR current mode. If LFR is in SBM1 or SBM2, + * the snapshots are not restarted, only ASM, BP and CWF data generation are affected. + * + */ + int status; #ifdef PRINT_TASK_STATISTICS @@ -627,12 +665,12 @@ int enter_mode_normal( unsigned int tran } break; case LFR_MODE_SBM1: - restart_asm_activities( LFR_MODE_NORMAL ); - status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action + restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters + status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action break; case LFR_MODE_SBM2: - restart_asm_activities( LFR_MODE_NORMAL ); - status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action + restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters + status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action break; default: break; @@ -649,6 +687,21 @@ int enter_mode_normal( unsigned int tran int enter_mode_burst( unsigned int transitionCoarseTime ) { + /** This function is used to start the BURST mode. + * + * @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE + * + * @return RTEMS directive status codes: + * - RTEMS_SUCCESSFUL - task restarted successfully + * - RTEMS_INVALID_ID - task id invalid + * - RTEMS_INCORRECT_STATE - task never started + * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task + * + * The way the BURST mode is started does not depend on the LFR current mode. + * + */ + + int status; #ifdef PRINT_TASK_STATISTICS @@ -674,6 +727,22 @@ int enter_mode_burst( unsigned int trans int enter_mode_sbm1( unsigned int transitionCoarseTime ) { + /** This function is used to start the SBM1 mode. + * + * @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE + * + * @return RTEMS directive status codes: + * - RTEMS_SUCCESSFUL - task restarted successfully + * - RTEMS_INVALID_ID - task id invalid + * - RTEMS_INCORRECT_STATE - task never started + * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task + * + * The way the SBM1 mode is started depends on the LFR current mode. If LFR is in NORMAL or SBM2, + * the snapshots are not restarted, only ASM, BP and CWF data generation are affected. In other + * cases, the acquisition is completely restarted. + * + */ + int status; #ifdef PRINT_TASK_STATISTICS @@ -724,6 +793,22 @@ int enter_mode_sbm1( unsigned int transi int enter_mode_sbm2( unsigned int transitionCoarseTime ) { + /** This function is used to start the SBM2 mode. + * + * @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE + * + * @return RTEMS directive status codes: + * - RTEMS_SUCCESSFUL - task restarted successfully + * - RTEMS_INVALID_ID - task id invalid + * - RTEMS_INCORRECT_STATE - task never started + * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task + * + * The way the SBM2 mode is started depends on the LFR current mode. If LFR is in NORMAL or SBM1, + * the snapshots are not restarted, only ASM, BP and CWF data generation are affected. In other + * cases, the acquisition is completely restarted. + * + */ + int status; #ifdef PRINT_TASK_STATISTICS