ISA DMA: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
(Length of transfer is programmed count + 1)
(added link to datasheet, added note/fix for count=xfer_length - 1)
Line 1: Line 1:
<!--
<!--
''I've added the following to what was orignally here, some of it has been re-written a great deal of it has been written from personal experience at swearing at the little DMA chip or it's functional equivalent. Still more to come, there's a lot of thoery to understand before simply writing code. The DMA chip has a lot of 'interesting' and 'unexpected' features. Failing to take these into acount will result in nothing working. You have been warned :-). XARDFIR'' -->
''I've added the following to what was orignally here, some of it has been re-written a great deal of it has been written from personal experience at swearing at the little DMA chip or it's functional equivalent. Still more to come, there's a lot of thoery to understand before simply writing code. The DMA chip has a lot of 'interesting' and 'unexpected' features. Failing to take these into acount will result in nothing working. You have been warned :-). XARDFIR''

This page could use a rewrite. -Mystran 2007-04-02
-->


DMA in today's PC architecture is in many ways like an appendix. It is used by the floppy disk controller, ISA sound cards, ISA network cards and parallel ports (if they support ECP mode). Whilst interrupt, keyboard and timer interface circuits have obvious and relevant uses, the DMA controller and it's programming interface are still well and truly stuck in the 1970's where they were first designed. Modern PCI controllers typically have their own "bus mastering", which is far better.
DMA in today's PC architecture is in many ways like an appendix. It is used by the floppy disk controller, ISA sound cards, ISA network cards and parallel ports (if they support ECP mode). Whilst interrupt, keyboard and timer interface circuits have obvious and relevant uses, the DMA controller and it's programming interface are still well and truly stuck in the 1970's where they were first designed. Modern PCI controllers typically have their own "bus mastering", which is far better.
Line 318: Line 321:
; set DMA channel 2 to transfer data from 0 - 64k in memory
; set DMA channel 2 to transfer data from 0 - 64k in memory
; paging must map this PHYSICAL memory elsewhere and LOCK it from paging to disk!
; paging must map this PHYSICAL memory elsewhere and LOCK it from paging to disk!
; set the counter to 0x2400, the length of a track on a 1.44Mbyte floppy (assuming 512 byte sectors)
; set the counter to 0x23ff, the length of a track on a 1.44Mbyte floppy (assuming 512 byte sectors)
; the length of transfer is programmed count+1 (check datasheet if you want)
out 0x0a, 0x06 ; mask DMA channel 2
out 0x0a, 0x06 ; mask DMA channel 2
out 0xd8, 0xFF ; reset the master flip-flop
out 0xd8, 0xFF ; reset the master flip-flop
Line 324: Line 328:
out 0x04, 0 ; address to 0 (high byte)
out 0x04, 0 ; address to 0 (high byte)
out 0xd8, 0xFF ; reset the master flip-flop (again!!!)
out 0xd8, 0xFF ; reset the master flip-flop (again!!!)
out 0x05, 0 ; count to 0x2400 (low byte)
out 0x05, 0xFF ; count to 0x23ff (low byte)
out 0x05, 0x24 ; count to 0x2400 (high byte)
out 0x05, 0x23 ; count to 0x23ff (high byte),
out 0x81, 0 ; page register to 0 for total address of 00 00 00
out 0x81, 0 ; external page register to 0 for total address of 00 00 00
out 0x0a, 0x02 ; unmask DMA channel 2
out 0x0a, 0x02 ; unmask DMA channel 2
ret
ret
Line 406: Line 410:


As I've (constantly) pointed out the DMA chip has lot's of useful features. The main point in programming the chip is remembering the features that 'DON'T' work. Regardless of the problems, the less the DMA chip is used the better because of it's negative impact on system performance (4.77Mhz, 8-bit data transfer). USB floppy disk drives are now available and standard interface floppy disk drives are only an option on some systems. The future will only make this more so.
As I've (constantly) pointed out the DMA chip has lot's of useful features. The main point in programming the chip is remembering the features that 'DON'T' work. Regardless of the problems, the less the DMA chip is used the better because of it's negative impact on system performance (4.77Mhz, 8-bit data transfer). USB floppy disk drives are now available and standard interface floppy disk drives are only an option on some systems. The future will only make this more so.

== References ==

* [http://www.stud.fh-hannover.de/~heineman/extern/231466.pdf Intel 8237A datasheet]


[[Category:Storage]]
[[Category:Storage]]