lkml.org 
[lkml]   [1999]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Handling interrupts from userspace


Linux Lists wrote:
>
> On Wed, 28 Jul 1999, Mark Hahn wrote:
>
> > > If this is not possible ... is there any _generic_ driver to which I could
> > > "attach" a userspace application in order for this app to know when an
> > > interrupt has happened ?!?!
> >
> > yes, a generic driver could exist.
> ^^^^^
> >From your answer, I assume it does not exist _yet_. Is that correct ??
>
> What I'm looking for is a driver _already in the kernel_ that would allow
> me to tell it "watch this interrupt line and tell me when it is asserted,
> and I will then handle the interrupt request".
>
> Or (if possible) register the interrupt _from userspace_ and handle it
> directly. Is it possible ?!?!
>
> > normally, a user-level process
> > would just do a blocking read or ioctl, and the driver would sleep
> > the process until an interrupt comes in.
>
> The problem with that is that you're assuming there is already a driver
> for this specific device. I'm trying to write a HW test application that
> does _not_ depend on a specific driver to work, an application that can
> access the specific HW directly and test it. I already know how to access
> MMIO, the PCI bus and such, but I don't know how to handle interrupts from
> userspace.
>
> Suggstions ?!?!
>

A) You could have a user tread that does a 'select' against the file.
When the interrupt comes the driver releases the thread.

while (select(...))
{
/* handle interrupt */
}

The problem is how to clear the interrupt...

B) Another possibility is to use bottom halves, processed right after
the
thread has left. (but you still has to clear it inside the driver)
[I do not really like this approach...]

C) A third way is to make a driver frame work that is compiled and
loaded with using load able modules. You can unload, recompile, load
without rebooting (I think, 95%)
This should be possible, but you have to ask someone else... (I have
never done it...)

One thing more - writing device drivers in Linux is said to be easier
than in many other OSes. And you have a better framework around you
then in dos.

--

The Internet interprets Windows as damage,
and routes around it.

Roger Larsson
Skellefteå
Sweden

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:53    [W:0.034 / U:0.784 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site