[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: PortA Interrupt Handling



On Mon, 12 Nov 2001, Greg Cannon wrote:
> Basically, the tasklet goes into a loop where it sleeps for a little while
> before testing to see if the PortA line has returned low.
> 
> I am certain my problem lies with the interruptible_sleep_on_timeout() call.
> I cannot use delay_usec() call however, as the line may be up for a long

There is no need to do that..

static struct timer_list porta_enable_timer;

in the init code:

init_timer(&porta_enable_timer)
porta_enable_timer.function = check_porta_enable_irq;

in the porta irq code:

{ 
	DISABLE IRQ;

	<do stuff>

	mod_timer(&porta_enable_timer, HZ/10);
}


then define something like this:

static void
check_porta_enable_irq(unsigned long data)
{
	unsigned long flags;
	save_and_cli(&flags);/* dont race with the IRQ or you'll loose! */
	if (PIN INACTIVE) {
		/* let there be irq */
		REENABLE IRQ;
	} else {
		/* restart ourselves */
		mod_timer(&porta_enable_timer, HZ/10);
	}
	restore_flags(&flags);
}

/BW