How to access hdd using dma?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Abdo

How to access hdd using dma?

Post by Abdo »

why is the most tutorials on net about hdd read&write uses direct I/O? I want to use dma to access hdd. How can I do that? Any tutorials, link or explanations appreciated... Thanks
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:How to access hdd using dma?

Post by Solar »

Isn't HDD DMA part of handling the PCI bus? I'd guess when you're doing your PCI driver, you are (or should be...) past the "tutorials" stage and able to go by technical specs...
Every good solution is obvious once you've found it.
pradeep

Re:How to access hdd using dma?

Post by pradeep »

A PCI hard disk consist of its own DMA, Is it possible for the hard disk to use both the DMA's? If so can we use both of them at the same time?
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:How to access hdd using dma?

Post by Candy »

Try searching for the pci ata hdd host adapter standard. I found it once, iirc it explains what you want to know. Good luck.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:How to access hdd using dma?

Post by Pype.Clicker »

i strongly recommend you google for ATADRVR.ZIP by Hale Landis ... it contains public domain commented code for accessing ATA disks and ATAPI devices in any mode you can think of: PIO, ISA DMA, PCI DMA (aka busmastering DMA or 'ultra DMA') and will point you to additionnal reference when needed.
Xardfir

Re:How to access hdd using dma?

Post by Xardfir »

DMA (using the PC's DMA chip) was used on old IBM XT hard disks. With the AT, direct access (Programmed I/O - PIO) by processor was soo much faster that they removed the DMA channel. The DMA controller is now only used for floppys and some ISA sound cards. If you are thinking of using 8237 DMA don't, you physically can't connect a hard disk to the DMA chip anymore.

From the early 90's when PCI became available, Busmastering DMA is used. For this to work, you need to know the registers for the chipset you are using.
Search the PCI bus for the Device and use the appropriate driver or fall back on PIO mode (discussed in the above ATA documents).
Unless you use the PCI busmastering PIO is the only way to access the hard disk. This document describes the PIIX and the PIIX3 that are probably the most common chipsets in use (with Intel processors anyway):
http://www.intel.com/design/chipsets/da ... 055002.pdf
I'm not sure about the VIA interface though. http://www.via.com.tw
You still need to check if the hard disk supports DMA to enable it, and even if it does, if another device on the same cable will allow it. (Think a CD and a DVD on the same IDE cable. The cable speed defaults to the slowest device, most likely PIO mode 4 even if the DVD supports DMA transfer.)
Hope this helps!
Rob

Re:How to access hdd using dma?

Post by Rob »

The archive mentioned above seems to be downloadable from:

http://www.ata-atapi.com/products.htm
Post Reply