Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 07 Apr 1999 20:06:55 -0400
From:      "David E. Cross" <crossd@cs.rpi.edu>
To:        "David E. Cross" <crossd@cs.rpi.edu>
Cc:        freebsd-hackers@FreeBSD.ORG, crossd@cs.rpi.edu
Subject:   Re: device driver question 
Message-ID:  <199904080006.UAA07543@cs.rpi.edu>
In-Reply-To: Message from "David E. Cross" <crossd@cs.rpi.edu>  of "Wed, 07 Apr 1999 19:04:33 EDT." <199904072304.TAA06730@cs.rpi.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help
> As some of you know I have been writing a KLD SIO as a reference for a class.
> I have the driver working fully *except* for one thing I cannot figure out.
> 
> The order of my driver initialization is as follows:
> 
> probe();  /*mostly a stub, just fills in some hard coded values */
> attach(); /*init buffers, enable interupts */
> connect_intr(); /*connect to the kernel intr routines */
> siodev_intr(NULL); /*handle the race condition between attach()/connect_intr()*/
> return 0; /* pass control back to the kernel */
> 
> that works OK, as far as I can tell, and it is just background information.
> 
> when the write() function of my driver is called, if 1: The old data buffer
> had no data in it and 2: the UART is not busy sending any data then "prime"
> the driver, so the interrupts will chain and it will send the entire buffer.
> I have it print out the IIR (Interrupt Information Register) before it
> primes the buffer, no interrupts pending.  at a later point I call write()
> again, and again view the IIR.  It shows interupts, yet my handler was never
> called!
> 
> Finally in desperation I put a "siodev_intr(NULL)" in the close routine, and
> it works!  It processes that interrupt, exits.  and then is triggered again
> by the kernel for an interrupt condition and sends all of the data (receives
> too  since the device is in loopback mode).
> 
> Any ideas what I am missing?
It turns out that the handler is only getting called _one_ time, when I
actually call it.  It is handling all the IO within that one call.  Therefore
the problem appears that I am not calling intr_create() and connect_intr()
correctly.  Here is a code sample, what am I doing wrong?

imask=1<<(4-1); /* i have tried both 1<<(4-1) and 1<<4 */
idesc=intr_create(NULL, 4, siodev_intr, NULL, &imask, 0);
if (idesc==NULL)....;
if (intr_connect(idesc))....;

--
David Cross



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199904080006.UAA07543>