diff --git a/.hgsubstate b/.hgsubstate --- a/.hgsubstate +++ b/.hgsubstate @@ -1,2 +1,2 @@ -cc82265fd480dbd0344bbf888476c76602b3e9c0 LFR_basic-parameters -95a8d83f1d0c59f28a679e66e23464f21c12dd8a header/lfr_common_headers +a586fe639ac179e95bdc150ebdbab0312f31dc30 LFR_basic-parameters +b984c315bf99562bdfbbd6bda8de296d2e692adc header/lfr_common_headers diff --git a/src/fsw_spacewire.c b/src/fsw_spacewire.c --- a/src/fsw_spacewire.c +++ b/src/fsw_spacewire.c @@ -332,11 +332,11 @@ rtems_task wtdg_task( rtems_task_argumen rtems_event_receive( RTEMS_EVENT_0, RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); PRINTF("in WTDG *** wait for the link\n") - status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status - while( linkStatus != 5) // wait for the link + status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status + while( linkStatus != 5) // wait for the link { - rtems_task_wake_after( 10 ); - status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status + status = rtems_task_wake_after( 10 ); // monitor the link each 100ms + status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status } status = spacewire_stop_and_start_link( fdSPW ); @@ -480,6 +480,7 @@ int spacewire_reset_link( void ) */ rtems_status_code status_spw; + rtems_status_code status; int i; for ( i=0; iio_port_direction_register = - grgpio_regs->io_port_direction_register | 0x04; // [0000 0100], 0 = output disabled, 1 = output enabled + housekeeping_packet.hk_lfr_dpu_spw_last_timc = (unsigned char) (grspwPtr[0] & 0x3f); // [11 1111] - if ( (grgpio_regs->io_port_output_register & 0x04) == 0x04 ) + // update the number of valid timecodes that have been received + if (housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt == 255) { - grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfb; // [1111 1011] + housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt = 0; } else { - grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x04; // [0000 0100] + housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt = housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt + 1; } }