Alan Cox (email@example.com)
Fri, 16 Oct 1998 17:08:06 +0100 (BST)
> Can anyone point me to a Linux driver that illustrates the use of DMA?
There are quite a few candidates - the floppy driver is rather convoluted as
an example but some of the net cards are easier to follow.
The interfaces you need
to get ISA DMA'able memory or NULL if it fails.
Grab a DMA channel. Makes you appear in /proc/dma as owner too
Give it back
Turns a DMA channel off
Turns a DMA channel on
set_dma_mode(channel, DMA_MODE_READ or DMA_MODE_WRITE)
(+0x10 if you need AUTOINIT)
This sets the direction of transfer
Clears the channel flip flop (do this before setting the addr/size)
The virt_to_bus isnt needed in 2.0.x intel but is needed in 2.1 for all
architectures and 2.0 for some others. It translates the kernel CPU address
space to what is seen on the address bus.
Sets the number of bytes to transfer
And get_dma_residue(chan) tells you what got left over
It tends to look something like
printk("Someone has my DMA channel\n");
and in the IRQ
printk("Card left %d bytes!\n", n);
-- To unsubscribe, send mail to: firstname.lastname@example.org --
-- with the single word "unsubscribe" in the body of the message. --
This archive was generated by hypermail 2.0b3 on Wed 30 Dec 1998 - 10:18:36 EST