/************************ * * hwt_init * * Initialize hardware timer. * * void hwt_init( * struct s_smc *smc) ; * In * smc - A pointer to the SMT Context structure. * Out * Nothing. * ************************/ void hwt_init(struct s_smc *smc) { smc->hw.t_start = 0 ; smc->hw.t_stop = 0 ; smc->hw.timer_activ = FALSE ; hwt_restart(smc) ; }
/************************ * * hwt_read * * Stop hardware timer and read time elapsed since last start. * * u_long hwt_read(smc) ; * In * smc - A pointer to the SMT Context structure. * Out * The elapsed time since last start in units of 16us. * ************************/ u_long hwt_read(struct s_smc *smc) { u_short tr ; u_long is ; if (smc->hw.timer_activ) { hwt_stop(smc) ; tr = (u_short)((inpd(ADDR(B2_TI_VAL))/200) & 0xffff) ; is = GET_ISR() ; /* Check if timer expired (or wraparound). */ if ((tr > smc->hw.t_start) || (is & IS_TIMINT)) { hwt_restart(smc) ; smc->hw.t_stop = smc->hw.t_start ; } else smc->hw.t_stop = smc->hw.t_start - tr ; } <<<<<<< HEAD
/* * interrupt source= timer */ void timer_irq(struct s_smc *smc) { hwt_restart(smc); smc->hw.t_stop = smc->hw.t_start; smt_timer_done(smc) ; }