Help with a driver im writing.
- From: Aceman <acemann@xxxxxxxxxxxxx>
- Date: Fri, 06 Jan 2006 16:48:39 -0500
Hello all,
I am writing a driver for a custom piece of hardware I built.
It's running on kernel version 2.6.14 single intel cpu, non-preemptable kernel.
Im quite new to device driver writing but I know enough to be dangerous :)
My driver uses interrupt driven reads, and non interrupt driven writes. It will have 1 reader and 1 writer, since it does not really make sense for this device to have more. At any rate my problem is I can't have the driver read and write at the same time because of the way the hardware is made.
My write routine is a loop (4 times) in which i shift data out to the device in a series of outb's which selects output banks (because im multiplexing to 48 bits) and writes the data to each.
My read routine is implemented in a workqueue and it loops 3 times using outb's to select and input bank and shift in data. Then of course waking up the sleeper and copying it to user space.
Problem is if a proc is sleeping on the read, and the writer is in the middle of the outb loop (bank selecting and data output) when an interrupt is serviced it of course jumps out and does the input loop, possibly corrupting data because it was not finished with the write sequence. Basically the read and write loop must finish to completion.
I was thinking something like when im in the bottom half check to see if a write is in progress - if so sleep for a while? or go back on the waitqueue with a timeout? and check again..
Im not sure the best way to implement this.
Any advice would be appreciated. Stan .
- Follow-Ups:
- Re: Help with a driver im writing.
- From: Aceman
- Re: Help with a driver im writing.
- From: Peter Z
- Re: Help with a driver im writing.
- From: Peter Z
- Re: Help with a driver im writing.
- Prev by Date: Re: sockets and threads...
- Next by Date: Re: What is "executive"?
- Previous by thread: What is "executive"?
- Next by thread: Re: Help with a driver im writing.
- Index(es):
Relevant Pages
|