##// END OF EJS Templates
Bug 490 hk_lfr_time_timecode_ctr field managed properly
paul -
r225:74d90b2ce10f R3
parent child
Show More
@@ -656,11 +656,15 void spacewire_update_statistics( void )
656 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 )
657 {
657 {
658 // a valid timecode has been received, write it in the HK report
658 // a valid timecode has been received, write it in the HK report
659 unsigned int * grspwPtr;
659 unsigned int *grspwPtr;
660 unsigned char timecodeCtr;
661 unsigned char updateTimeCtr;
660
662
661 grspwPtr = (unsigned int *) (REGS_ADDR_GRSPW + APB_OFFSET_GRSPW_TIME_REGISTER);
663 grspwPtr = (unsigned int *) (REGS_ADDR_GRSPW + APB_OFFSET_GRSPW_TIME_REGISTER);
662
664
663 housekeeping_packet.hk_lfr_dpu_spw_last_timc = (unsigned char) (grspwPtr[0] & 0xff); // [11 1111]
665 housekeeping_packet.hk_lfr_dpu_spw_last_timc = (unsigned char) (grspwPtr[0] & 0xff); // [1111 1111]
666 timecodeCtr = (unsigned char) (grspwPtr[0] & 0x3f); // [0011 1111]
667 updateTimeCtr = time_management_regs->coarse_time_load & 0x3f; // [0011 1111]
664
668
665 // update the number of valid timecodes that have been received
669 // update the number of valid timecodes that have been received
666 if (housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt == 255)
670 if (housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt == 255)
@@ -671,6 +675,19 void timecode_irq_handler( void *pDev, v
671 {
675 {
672 housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt = housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt + 1;
676 housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt = housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt + 1;
673 }
677 }
678
679 // check the value of the timecode with respect to the last TC_LFR_UPDATE_TIME => SSS-CP-FS-370
680 if (timecodeCtr != updateTimeCtr)
681 {
682 if (housekeeping_packet.hk_lfr_time_timecode_ctr == 255)
683 {
684 housekeeping_packet.hk_lfr_time_timecode_ctr = 0;
685 }
686 else
687 {
688 housekeeping_packet.hk_lfr_time_timecode_ctr = housekeeping_packet.hk_lfr_time_timecode_ctr + 1;
689 }
690 }
674 }
691 }
675
692
676 rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data )
693 rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data )
General Comments 0
You need to be logged in to leave comments. Login now