Exemplo n.º 1
0
/* Called in the interrupt context */
static void process_timer_expiry(struct hwt_info *hwt)
{
        struct sw_timer *head = hwt->used_list;
        
        while(head) { /* Run through list to process all expired timers */
                struct u64_val hwt_current;

                if(0 != hwt_get_current(head->hwt_obj, &hwt_current))
                        goto handle_timer_expiry_exit1;
                
                if(0 > cmp_u64(&hwt_current, &head->hwt_expires))
                        break; /* Timer is yet to reach expiry, so quit */

                remove_elem(head, &hwt->used_list);

                handle_expired_timer(head);

                head = hwt->used_list;
        }
        
        if(head)
                sched_timer_if_new(head);
        else
                hwt_stop(hwt);
        
 handle_timer_expiry_exit1:
        return;
}
Exemplo n.º 2
0
static i32 timer_stop(struct sw_timer *swt)
{
        struct hwt_info *hwt = swt->hwt_obj;

        if(0 != remove_elem(swt, &hwt->used_list)) {
                return -1;
        }

        set_scheduled(swt, false);
        set_periodic(swt, false);

        if(NULL != hwt->used_list)
                sched_timer_if_new(hwt->used_list);
        else
                hwt_stop(hwt); /* No pending request, stop HW */

        return 0;
}
Exemplo n.º 3
0
/************************
 *
 *	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
Exemplo n.º 4
0
void smt_timer_stop(struct s_smc *smc, struct smt_timer *timer)
{
	struct smt_timer	**prev ;
	struct smt_timer	*tm ;

	
	timer->tm_active = FALSE ;
	if (smc->t.st_queue == timer && !timer->tm_next) {
		hwt_stop(smc) ;
	}
	for (prev = &smc->t.st_queue ; (tm = *prev) ; prev = &tm->tm_next ) {
		if (tm == timer) {
			*prev = tm->tm_next ;
			if (tm->tm_next) {
				tm->tm_next->tm_delta += tm->tm_delta ;
			}
			return ;
		}
	}
}
Exemplo n.º 5
0
/************************
 *
 *	hwt_restart
 *
 *	Clear timer interrupt.
 *
 *	void hwt_restart(
 *		struct s_smc *smc) ;
 * In
 *	smc - A pointer to the SMT Context structure.
 * Out
 *	Nothing.
 *
 ************************/
void hwt_restart(struct s_smc *smc)
{
	hwt_stop(smc) ;
}