From owner-freebsd-hackers Wed Apr 7 17: 9: 0 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from cs.rpi.edu (mumble.cs.rpi.edu [128.213.8.16]) by hub.freebsd.org (Postfix) with ESMTP id 5EEBA14F28 for ; Wed, 7 Apr 1999 17:08:57 -0700 (PDT) (envelope-from crossd@cs.rpi.edu) Received: from cs.rpi.edu (monica.cs.rpi.edu [128.213.7.2]) by cs.rpi.edu (8.9.1/8.9.1) with ESMTP id UAA07543; Wed, 7 Apr 1999 20:06:56 -0400 (EDT) Message-Id: <199904080006.UAA07543@cs.rpi.edu> To: "David E. Cross" Cc: freebsd-hackers@FreeBSD.ORG, crossd@cs.rpi.edu Subject: Re: device driver question In-Reply-To: Message from "David E. Cross" of "Wed, 07 Apr 1999 19:04:33 EDT." <199904072304.TAA06730@cs.rpi.edu> Date: Wed, 07 Apr 1999 20:06:55 -0400 From: "David E. Cross" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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