PCI driver with IRQ+DMA problems

Claude Gamache (cgamache@cae.ca)
13 Nov 1998 11:58:14 -0500


Hi,

I am writing a device driver for a PCI card (Commtech's fastcomm
esccp-p based on Siemens 82532 chip, it's a serial communication
controller with 2 channel that go up to 10 Mb/s). It's my first
experience with drivers under Linux. I use Alessandro Rubini's Linux
Device Drivers and kernel sources to learn how to code a PCI driver.

So far, I have a basic driver (module) frame:

-the driver can be loaded / unloaded (dynamic major number)
-data structures are allocated and initialized
-the driver detects and get all the PCI infos of the PCI card
-the driver succesfully implements a few /proc entries and /dev
entries, support open/read/write/release.

Now I must implement an IRQ and a DMA in order to write and read the
serial port, and that's where I have problems and questions.

When a PCI device reports an IRQ number (IRQ 11 in my case), can it
IRQ be used directly, that is using
request_irq( pic_irq_number,
irq_handler,
SA_INTERRUPT,
"my_driver", NULL) ?

And can I use any DMA number ? For instance, now I use

dma_channel = 3;
if ( request_dma( dma_channel, "my_driver" == 0 ) {
set_dma_mode(dma_channel, DMA_MODE_WRITE);
disable_dma(dma_channel);
}

I succesfully get the dma_channel. I don't use the dma at the moment
but I can see it with cat /proc/dma.
Then I just unload the module and when I cat /proc/dma I get a oops !?

In module_cleanup() I just use free_dma( dma_channel ); to release the
DMA.

What part of the kernel sources I should look to get examples of
IRQ+DMA+PCI (most probably scsi and network cards) ?

Do you have any ideas, comments, suggestions....

Thank you for your help,

Claude

P.S.: by the way, if someone has a driver for this device, I would be
greatly interested in getting it :-)

-- 
  Claude Gamache, CAE Electronique Ltee, 8585 Cote-de-Liesse  
  Saint-Laurent,  Quebec, Canada H4T 1G6                        
  Email: cgamache@cae.ca  Tel.: (514) 341-2000 x3194, Fax: (514) 734-5612

- 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/