@@ -1,2 +1,2 | |||||
1 | cc82265fd480dbd0344bbf888476c76602b3e9c0 LFR_basic-parameters |
|
1 | a586fe639ac179e95bdc150ebdbab0312f31dc30 LFR_basic-parameters | |
2 | 95a8d83f1d0c59f28a679e66e23464f21c12dd8a header/lfr_common_headers |
|
2 | b984c315bf99562bdfbbd6bda8de296d2e692adc header/lfr_common_headers |
@@ -332,11 +332,11 rtems_task wtdg_task( rtems_task_argumen | |||||
332 | rtems_event_receive( RTEMS_EVENT_0, |
|
332 | rtems_event_receive( RTEMS_EVENT_0, | |
333 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
333 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
334 | PRINTF("in WTDG *** wait for the link\n") |
|
334 | PRINTF("in WTDG *** wait for the link\n") | |
335 |
status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); |
|
335 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |
336 | while( linkStatus != 5) // wait for the link |
|
336 | while( linkStatus != 5) // wait for the link | |
337 | { |
|
337 | { | |
338 | rtems_task_wake_after( 10 ); |
|
338 | status = rtems_task_wake_after( 10 ); // monitor the link each 100ms | |
339 |
status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); |
|
339 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |
340 | } |
|
340 | } | |
341 |
|
341 | |||
342 | status = spacewire_stop_and_start_link( fdSPW ); |
|
342 | status = spacewire_stop_and_start_link( fdSPW ); | |
@@ -480,6 +480,7 int spacewire_reset_link( void ) | |||||
480 | */ |
|
480 | */ | |
481 |
|
481 | |||
482 | rtems_status_code status_spw; |
|
482 | rtems_status_code status_spw; | |
|
483 | rtems_status_code status; | |||
483 | int i; |
|
484 | int i; | |
484 |
|
485 | |||
485 | for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ ) |
|
486 | for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ ) | |
@@ -488,6 +489,8 int spacewire_reset_link( void ) | |||||
488 |
|
489 | |||
489 | // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM |
|
490 | // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM | |
490 |
|
491 | |||
|
492 | status = rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms | |||
|
493 | ||||
491 | status_spw = spacewire_stop_and_start_link( fdSPW ); |
|
494 | status_spw = spacewire_stop_and_start_link( fdSPW ); | |
492 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
495 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
493 | { |
|
496 | { | |
@@ -652,19 +655,21 void spacewire_update_statistics( void ) | |||||
652 |
|
655 | |||
653 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ) |
|
656 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ) | |
654 | { |
|
657 | { | |
655 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_9 ); |
|
658 | // a valid timecode has been received, write it in the HK report | |
656 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; |
|
659 | unsigned int * grspwPtr; | |
|
660 | ||||
|
661 | grspwPtr = (unsigned int *) (REGS_ADDR_GRSPW + APB_OFFSET_GRSPW_TIME_REGISTER); | |||
657 |
|
662 | |||
658 | grgpio_regs->io_port_direction_register = |
|
663 | housekeeping_packet.hk_lfr_dpu_spw_last_timc = (unsigned char) (grspwPtr[0] & 0x3f); // [11 1111] | |
659 | grgpio_regs->io_port_direction_register | 0x04; // [0000 0100], 0 = output disabled, 1 = output enabled |
|
|||
660 |
|
664 | |||
661 | if ( (grgpio_regs->io_port_output_register & 0x04) == 0x04 ) |
|
665 | // update the number of valid timecodes that have been received | |
|
666 | if (housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt == 255) | |||
662 | { |
|
667 | { | |
663 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfb; // [1111 1011] |
|
668 | housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt = 0; | |
664 | } |
|
669 | } | |
665 | else |
|
670 | else | |
666 | { |
|
671 | { | |
667 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x04; // [0000 0100] |
|
672 | housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt = housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt + 1; | |
668 | } |
|
673 | } | |
669 | } |
|
674 | } | |
670 |
|
675 |
General Comments 0
You need to be logged in to leave comments.
Login now