# HG changeset patch # User paul # Date 2017-01-12 11:22:36 # Node ID 6303d998f2509251f6fbf7554437ec3e0a091942 # Parent 9f779b655c52055d990ff8a1e937f775879714f9 Bug #801 Don_Initialisation_P2 diff --git a/src/fsw_init.c b/src/fsw_init.c --- a/src/fsw_init.c +++ b/src/fsw_init.c @@ -130,6 +130,8 @@ rtems_task Init( rtems_task_argument ign rtems_status_code status_spw; rtems_isr_entry old_isr_handler; + old_isr_handler = NULL; + // UART settings enable_apbuart_transmitter(); set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); @@ -736,6 +738,9 @@ rtems_status_code create_message_queues( rtems_status_code ret; rtems_id queue_id; + ret = RTEMS_SUCCESSFUL; + queue_id = RTEMS_ID_NONE; + //**************************************** // create the queue for handling valid TCs status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], @@ -888,6 +893,8 @@ void update_queue_max_count( rtems_id qu u_int32_t count; rtems_status_code status; + count = 0; + status = rtems_message_queue_get_number_pending( queue_id, &count ); count = count + 1; diff --git a/src/fsw_misc.c b/src/fsw_misc.c --- a/src/fsw_misc.c +++ b/src/fsw_misc.c @@ -25,6 +25,8 @@ void timer_configure(unsigned char timer rtems_status_code status; rtems_isr_entry old_isr_handler; + old_isr_handler = NULL; + gptimer_regs->timer[timer].ctrl = INIT_CHAR; // reset the control register status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels @@ -190,6 +192,8 @@ rtems_task load_task(rtems_task_argument rtems_name name_watchdog_rate_monotonic; // name of the watchdog rate monotonic rtems_id watchdog_period_id; // id of the watchdog rate monotonic period + watchdog_period_id = RTEMS_ID_NONE; + name_watchdog_rate_monotonic = rtems_build_name( 'L', 'O', 'A', 'D' ); status = rtems_rate_monotonic_create( name_watchdog_rate_monotonic, &watchdog_period_id ); @@ -233,6 +237,8 @@ rtems_task hous_task(rtems_task_argument rtems_rate_monotonic_period_status period_status; bool isSynchronized; + queue_id = RTEMS_ID_NONE; + memset(&period_status, 0, sizeof(rtems_rate_monotonic_period_status)); isSynchronized = false; status = get_message_queue_id_send( &queue_id ); @@ -440,22 +446,7 @@ rtems_task dumb_task( rtems_task_argumen unsigned int fine_time = 0; rtems_event_set event_out; - char *DumbMessages[DUMB_MESSAGE_NB] = {DUMB_MESSAGE_0, // RTEMS_EVENT_0 - DUMB_MESSAGE_1, // RTEMS_EVENT_1 - DUMB_MESSAGE_2, // RTEMS_EVENT_2 - DUMB_MESSAGE_3, // RTEMS_EVENT_3 - DUMB_MESSAGE_4, // RTEMS_EVENT_4 - DUMB_MESSAGE_5, // RTEMS_EVENT_5 - DUMB_MESSAGE_6, // RTEMS_EVENT_6 - DUMB_MESSAGE_7, // RTEMS_EVENT_7 - DUMB_MESSAGE_8, // RTEMS_EVENT_8 - DUMB_MESSAGE_9, // RTEMS_EVENT_9 - DUMB_MESSAGE_10, // RTEMS_EVENT_10 - DUMB_MESSAGE_11, // RTEMS_EVENT_11 - DUMB_MESSAGE_12, // RTEMS_EVENT_12 - DUMB_MESSAGE_13, // RTEMS_EVENT_13 - DUMB_MESSAGE_14 // RTEMS_EVENT_14 - }; + event_out = EVENT_SETS_NONE_PENDING; BOOT_PRINTF("in DUMB *** \n") @@ -608,6 +599,8 @@ void send_dumb_hk( void ) unsigned int i; rtems_id queue_id; + queue_id = RTEMS_ID_NONE; + dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; dummy_hk_packet.reserved = DEFAULT_RESERVED; @@ -983,6 +976,11 @@ void set_hk_lfr_ahb_correctable() // C unsigned int fprfErrorCounter; unsigned int iurfErrorCounter; + instructionErrorCounter = 0; + dataErrorCounter = 0; + fprfErrorCounter = 0; + iurfErrorCounter = 0; + CCR_getInstructionAndDataErrorCounters( &instructionErrorCounter, &dataErrorCounter); ASR16_get_FPRF_IURF_ErrorCounters( &fprfErrorCounter, &iurfErrorCounter); diff --git a/src/fsw_spacewire.c b/src/fsw_spacewire.c --- a/src/fsw_spacewire.c +++ b/src/fsw_spacewire.c @@ -39,6 +39,9 @@ rtems_task spiq_task(rtems_task_argument rtems_status_code status; int linkStatus; + event_out = EVENT_SETS_NONE_PENDING; + linkStatus = 0; + BOOT_PRINTF("in SPIQ *** \n") while(true){ @@ -131,6 +134,11 @@ rtems_task recv_task( rtems_task_argumen rtems_id queue_recv_id; rtems_id queue_send_id; + memset( ¤tTC, 0, sizeof(ccsdsTelecommandPacket_t) ); + destinationID = 0; + queue_recv_id = RTEMS_ID_NONE; + queue_send_id = RTEMS_ID_NONE; + initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes status = get_message_queue_id_recv( &queue_recv_id ); @@ -230,6 +238,8 @@ rtems_task send_task( rtems_task_argumen incomingRingNodePtr = NULL; ring_node_address = 0; charPtr = (char *) &ring_node_address; + size = 0; + queue_send_id = RTEMS_ID_NONE; sid = 0; sidAsUnsignedChar = 0; @@ -337,6 +347,9 @@ rtems_task link_task( rtems_task_argumen rtems_status_code status; int linkStatus; + event_out = EVENT_SETS_NONE_PENDING; + linkStatus = 0; + BOOT_PRINTF("in LINK ***\n") while(1) @@ -394,6 +407,8 @@ int spacewire_open_link( void ) // by d */ rtems_status_code status; + status = RTEMS_SUCCESSFUL; + fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware if ( fdSPW < 0 ) { PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno) @@ -508,6 +523,8 @@ int spacewire_several_connect_attemps( v rtems_status_code status; int i; + status_spw = RTEMS_SUCCESSFUL; + i = 0; while (i < SY_LFR_DPU_CONNECT_ATTEMPT) { @@ -593,6 +610,8 @@ void spacewire_read_statistics( void ) rtems_status_code status; spw_stats current; + memset(¤t, 0, sizeof(spw_stats)); + spacewire_get_last_error(); // read the current statistics @@ -645,7 +664,7 @@ void spacewire_read_statistics( void ) void spacewire_get_last_error( void ) { - static spw_stats previous; + static spw_stats previous = {0}; spw_stats current; rtems_status_code status; @@ -655,6 +674,7 @@ void spacewire_get_last_error( void ) int fineTime; unsigned char update_hk_lfr_last_er; + memset(¤t, 0, sizeof(spw_stats)); update_hk_lfr_last_er = 0; status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, ¤t ); diff --git a/src/lfr_cpu_usage_report.c b/src/lfr_cpu_usage_report.c --- a/src/lfr_cpu_usage_report.c +++ b/src/lfr_cpu_usage_report.c @@ -29,6 +29,8 @@ unsigned char lfr_rtems_cpu_usage_report #endif unsigned char cpu_load; + + ival = 0; cpu_load = 0; /* diff --git a/src/processing/avf0_prc0.c b/src/processing/avf0_prc0.c --- a/src/processing/avf0_prc0.c +++ b/src/processing/avf0_prc0.c @@ -57,6 +57,8 @@ rtems_task avf0_task( rtems_task_argumen nb_norm_asm = 0; nb_sbm_bp1 = 0; nb_sbm_bp2 = 0; + event_out = EVENT_SETS_NONE_PENDING; + queue_id_prc0 = RTEMS_ID_NONE; reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions ASM_generic_init_ring( asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0 ); @@ -64,7 +66,7 @@ rtems_task avf0_task( rtems_task_argumen current_ring_node_asm_norm_f0 = asm_ring_norm_f0; current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0; - BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) + BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", (int) lfrRequestedMode); status = get_message_queue_id_prc0( &queue_id_prc0 ); if (status != RTEMS_SUCCESSFUL) @@ -197,6 +199,14 @@ rtems_task prc0_task( rtems_task_argumen float nbSMInASMNORM; float nbSMInASMSBM; + size = 0; + queue_id = RTEMS_ID_NONE; + queue_id_q_p0 = RTEMS_ID_NONE; + memset( &packet_norm_bp1, 0, sizeof(bp_packet_with_spare) ); + memset( &packet_norm_bp2, 0, sizeof(bp_packet) ); + memset( &packet_sbm_bp1, 0, sizeof(bp_packet) ); + memset( &packet_sbm_bp2, 0, sizeof(bp_packet) ); + // init the ring of the averaged spectral matrices which will be transmitted to the DPU init_ring( ring_to_send_asm_f0, NB_RING_NODES_ASM_F0, (volatile int*) buffer_asm_f0, TOTAL_SIZE_SM ); current_ring_node_to_send_asm_f0 = ring_to_send_asm_f0; diff --git a/src/processing/avf1_prc1.c b/src/processing/avf1_prc1.c --- a/src/processing/avf1_prc1.c +++ b/src/processing/avf1_prc1.c @@ -53,6 +53,9 @@ rtems_task avf1_task( rtems_task_argumen unsigned int nb_sbm_bp1; unsigned int nb_sbm_bp2; + event_out = EVENT_SETS_NONE_PENDING; + queue_id_prc1 = RTEMS_ID_NONE; + nb_norm_bp1 = 0; nb_norm_bp2 = 0; nb_norm_asm = 0; @@ -198,6 +201,14 @@ rtems_task prc1_task( rtems_task_argumen float nbSMInASMNORM; float nbSMInASMSBM; + size = 0; + queue_id_send = RTEMS_ID_NONE; + queue_id_q_p1 = RTEMS_ID_NONE; + memset( &packet_norm_bp1, 0, sizeof(bp_packet_with_spare) ); + memset( &packet_norm_bp2, 0, sizeof(bp_packet) ); + memset( &packet_sbm_bp1, 0, sizeof(bp_packet) ); + memset( &packet_sbm_bp2, 0, sizeof(bp_packet) ); + // init the ring of the averaged spectral matrices which will be transmitted to the DPU init_ring( ring_to_send_asm_f1, NB_RING_NODES_ASM_F1, (volatile int*) buffer_asm_f1, TOTAL_SIZE_SM ); current_ring_node_to_send_asm_f1 = ring_to_send_asm_f1; diff --git a/src/processing/avf2_prc2.c b/src/processing/avf2_prc2.c --- a/src/processing/avf2_prc2.c +++ b/src/processing/avf2_prc2.c @@ -45,6 +45,8 @@ rtems_task avf2_task( rtems_task_argumen unsigned int nb_norm_bp2; unsigned int nb_norm_asm; + event_out = EVENT_SETS_NONE_PENDING; + queue_id_prc2 = RTEMS_ID_NONE; nb_norm_bp1 = 0; nb_norm_bp2 = 0; nb_norm_asm = 0; @@ -146,6 +148,12 @@ rtems_task prc2_task( rtems_task_argumen unsigned long long int localTime; + size = 0; + queue_id_send = RTEMS_ID_NONE; + queue_id_q_p2 = RTEMS_ID_NONE; + memset( &packet_norm_bp1, 0, sizeof(bp_packet) ); + memset( &packet_norm_bp2, 0, sizeof(bp_packet) ); + // init the ring of the averaged spectral matrices which will be transmitted to the DPU init_ring( ring_to_send_asm_f2, NB_RING_NODES_ASM_F2, (volatile int*) buffer_asm_f2, TOTAL_SIZE_SM ); current_ring_node_to_send_asm_f2 = ring_to_send_asm_f2; diff --git a/src/processing/fsw_processing.c b/src/processing/fsw_processing.c --- a/src/processing/fsw_processing.c +++ b/src/processing/fsw_processing.c @@ -551,6 +551,8 @@ unsigned char getSID( rtems_event_set ev rtems_event_set eventSetBURST; rtems_event_set eventSetSBM; + sid = 0; + //****** // BURST eventSetBURST = RTEMS_EVENT_BURST_BP1_F0 diff --git a/src/tc_acceptance.c b/src/tc_acceptance.c --- a/src/tc_acceptance.c +++ b/src/tc_acceptance.c @@ -193,6 +193,8 @@ int tc_check_type( unsigned char packetT int status; + status = ILL_TYPE; + if ( (packetType == TC_TYPE_GEN) || (packetType == TC_TYPE_TIME)) { status = CCSDS_TM_VALID; @@ -272,6 +274,8 @@ int tc_check_sid( unsigned char sid ) int status; + status = WRONG_SRC_ID; + if ( (sid == SID_TC_MISSION_TIMELINE) || (sid == SID_TC_TC_SEQUENCES) || (sid == SID_TC_RECOVERY_ACTION_CMD) || (sid == SID_TC_BACKUP_MISSION_TIMELINE) || (sid == SID_TC_DIRECT_CMD) || (sid == SID_TC_SPARE_GRD_SRC1) || (sid == SID_TC_SPARE_GRD_SRC2) @@ -455,6 +459,8 @@ int tc_check_crc( ccsdsTelecommandPacket int status; unsigned char * CCSDSContent; + status = INCOR_CHECKSUM; + CCSDSContent = (unsigned char*) TCPacket->packetID; GetCRCAsTwoBytes(CCSDSContent, computed_CRC, length + CCSDS_TC_TM_PACKET_OFFSET - BYTES_PER_CRC); // 2 CRC bytes removed from the calculation of the CRC diff --git a/src/tc_handler.c b/src/tc_handler.c --- a/src/tc_handler.c +++ b/src/tc_handler.c @@ -36,6 +36,11 @@ rtems_task actn_task( rtems_task_argumen rtems_id queue_rcv_id; rtems_id queue_snd_id; + memset(&TC, 0, sizeof(ccsdsTelecommandPacket_t)); + size = 0; + queue_rcv_id = RTEMS_ID_NONE; + queue_snd_id = RTEMS_ID_NONE; + status = get_message_queue_id_recv( &queue_rcv_id ); if (status != RTEMS_SUCCESSFUL) { @@ -383,6 +388,8 @@ int check_mode_value( unsigned char requ { int status; + status = LFR_DEFAULT; + if ( (requestedMode != LFR_MODE_STANDBY) && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) diff --git a/src/tc_load_dump_parameters.c b/src/tc_load_dump_parameters.c --- a/src/tc_load_dump_parameters.c +++ b/src/tc_load_dump_parameters.c @@ -877,6 +877,8 @@ unsigned int check_update_info_hk_lfr_mo { unsigned int status; + status = LFR_DEFAULT; + if ( (mode == LFR_MODE_STANDBY) || (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST) || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2)) @@ -895,6 +897,8 @@ unsigned int check_update_info_hk_tds_mo { unsigned int status; + status = LFR_DEFAULT; + if ( (mode == TDS_MODE_STANDBY) || (mode == TDS_MODE_NORMAL) || (mode == TDS_MODE_BURST) || (mode == TDS_MODE_SBM1) || (mode == TDS_MODE_SBM2) @@ -914,6 +918,8 @@ unsigned int check_update_info_hk_thr_mo { unsigned int status; + status = LFR_DEFAULT; + if ( (mode == THR_MODE_STANDBY) || (mode == THR_MODE_NORMAL) || (mode == THR_MODE_BURST)) { @@ -1001,6 +1007,7 @@ void setFBinMask( unsigned char *fbins_m int binToRemove[NB_BINS_TO_REMOVE]; int k; + closestBin = 0; whichByte = 0; bin = 0; diff --git a/src/wf_handler.c b/src/wf_handler.c --- a/src/wf_handler.c +++ b/src/wf_handler.c @@ -336,6 +336,9 @@ rtems_task wfrm_task(rtems_task_argument ring_node *ring_node_swf1_extracted_ptr; ring_node *ring_node_swf2_extracted_ptr; + event_out = EVENT_SETS_NONE_PENDING; + queue_id = RTEMS_ID_NONE; + ring_node_swf1_extracted_ptr = (ring_node *) &ring_node_swf1_extracted; ring_node_swf2_extracted_ptr = (ring_node *) &ring_node_swf2_extracted; @@ -386,6 +389,9 @@ rtems_task cwf3_task(rtems_task_argument ring_node ring_node_cwf3_light; ring_node *ring_node_to_send_cwf; + event_out = EVENT_SETS_NONE_PENDING; + queue_id = RTEMS_ID_NONE; + status = get_message_queue_id_send( &queue_id ); if (status != RTEMS_SUCCESSFUL) { @@ -451,6 +457,9 @@ rtems_task cwf2_task(rtems_task_argument ring_node *ring_node_to_send; unsigned long long int acquisitionTimeF0_asLong; + event_out = EVENT_SETS_NONE_PENDING; + queue_id = RTEMS_ID_NONE; + acquisitionTimeF0_asLong = INIT_CHAR; status = get_message_queue_id_send( &queue_id ); @@ -519,6 +528,9 @@ rtems_task cwf1_task(rtems_task_argument ring_node *ring_node_to_send_cwf; + event_out = EVENT_SETS_NONE_PENDING; + queue_id = RTEMS_ID_NONE; + status = get_message_queue_id_send( &queue_id ); if (status != RTEMS_SUCCESSFUL) { @@ -574,6 +586,7 @@ rtems_task swbd_task(rtems_task_argument rtems_event_set event_out; unsigned long long int acquisitionTimeF0_asLong; + event_out = EVENT_SETS_NONE_PENDING; acquisitionTimeF0_asLong = INIT_CHAR; BOOT_PRINTF("in SWBD ***\n") @@ -796,6 +809,9 @@ void build_snapshot_from_ring( ring_node // (2) compute the central reference time centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0; + acquisitionTime_asLong = centerTime_asLong; //set to default value (Don_Initialisation_P2) + bufferAcquisitionTime_asLong = centerTime_asLong; //set to default value (Don_Initialisation_P2) + nbTicksPerSample_asLong = TICKS_PER_T2; //set to default value (Don_Initialisation_P2) // (3) compute the acquisition time of the current snapshot switch(frequencyChannel) @@ -896,6 +912,8 @@ double computeCorrection( unsigned char double deltaNext_ms; double correctionInF2; + correctionInF2 = 0; //set to default value (Don_Initialisation_P2) + // get acquisition time in fine time ticks acquisitionTime = get_acquisition_time( timePtr ); @@ -933,6 +951,8 @@ void applyCorrection( double correction { int correctionInt; + correctionInt = 0; + if (correction >= 0.) { if ( (ONE_TICK_CORR_INTERVAL_0_MIN < correction) && (correction < ONE_TICK_CORR_INTERVAL_0_MAX) ) @@ -1264,6 +1284,10 @@ void increment_seq_counter_source_id( un rtems_mode current_mode_set; rtems_status_code status; + initial_mode_set = RTEMS_DEFAULT_MODES; + current_mode_set = RTEMS_DEFAULT_MODES; + sequence_cnt = NULL; + //****************************************** // CHANGE THE MODE OF THE CALLING RTEMS TASK status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &initial_mode_set );