# HG changeset patch # User paul # Date 2017-01-12 07:58:52 # Node ID 9f779b655c52055d990ff8a1e937f775879714f9 # Parent d3701d39af114a7e2a4e677cf464c43a348f7e04 Bug #803 Tr_BoucleSortie Bug #805 Tr_OrdreChoix diff --git a/src/fsw_misc.c b/src/fsw_misc.c --- a/src/fsw_misc.c +++ b/src/fsw_misc.c @@ -231,6 +231,9 @@ rtems_task hous_task(rtems_task_argument rtems_status_code spare_status; rtems_id queue_id; rtems_rate_monotonic_period_status period_status; + bool isSynchronized; + + isSynchronized = false; status = get_message_queue_id_send( &queue_id ); if (status != RTEMS_SUCCESSFUL) @@ -259,11 +262,12 @@ rtems_task hous_task(rtems_task_argument status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks ); status = rtems_rate_monotonic_get_status( HK_id, &period_status ); DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) - while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway + while( (period_status.state != RATE_MONOTONIC_EXPIRED) + && (isSynchronized == false) ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway { if ((time_management_regs->coarse_time & VAL_LFR_SYNCHRONIZED) == INT32_ALL_0) // check time synchronization { - break; // break if LFR is synchronized + isSynchronized = true; } else { diff --git a/src/fsw_spacewire.c b/src/fsw_spacewire.c --- a/src/fsw_spacewire.c +++ b/src/fsw_spacewire.c @@ -508,7 +508,8 @@ int spacewire_several_connect_attemps( v rtems_status_code status; int i; - for ( i=0; istatus = BIT_READY_1; // [0000 0010] break; + default: + break; } } @@ -174,6 +176,8 @@ void spectral_matrices_isr_f1( int statu } spectral_matrix_regs->status = BIT_STATUS_F1_1; // [1000 0000] break; + default: + break; } } @@ -217,6 +221,8 @@ void spectral_matrices_isr_f2( int statu status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); } break; + default: + break; } } diff --git a/src/wf_handler.c b/src/wf_handler.c --- a/src/wf_handler.c +++ b/src/wf_handler.c @@ -585,7 +585,7 @@ rtems_task swbd_task(rtems_task_argument if (event_out == RTEMS_EVENT_MODE_NORM_S1_S2) { acquisitionTimeF0_asLong = get_acquisition_time( (unsigned char *) &ring_node_to_send_swf_f0->coarseTime ); - build_snapshot_from_ring( ring_node_to_send_swf_f1, 1, acquisitionTimeF0_asLong, + build_snapshot_from_ring( ring_node_to_send_swf_f1, CHANNELF1, acquisitionTimeF0_asLong, &ring_node_swf1_extracted, swf1_extracted ); swf1_ready = true; // the snapshot has been extracted and is ready to be sent } @@ -770,6 +770,7 @@ void build_snapshot_from_ring( ring_node int *swf_extracted) { unsigned int i; + unsigned int node; unsigned long long int centerTime_asLong; unsigned long long int acquisitionTime_asLong; unsigned long long int bufferAcquisitionTime_asLong; @@ -813,23 +814,29 @@ void build_snapshot_from_ring( ring_node break; default: acquisitionTime_asLong = centerTime_asLong; + nb_ring_nodes = 0; frequency_asLong = FREQ_F2; nbTicksPerSample_asLong = TICKS_PER_T2; break; } - //**************************************************************************** + //***************************************************************************** // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong - for (i=0; icoarseTime ); + //PRINTF1("%d ... ", node); + bufferAcquisitionTime_asLong = get_acquisition_time( (unsigned char *) &ring_node_to_send->coarseTime ); if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong) { //PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong); - break; + node = nb_ring_nodes; } - ring_node_to_send = ring_node_to_send->previous; + else + { + node = node + 1; + ring_node_to_send = ring_node_to_send->previous; + } } // (5) compute the number of samples to take in the current buffer