[comp.sys.ibm.pc.misc] PC/AT DMA CHANNELS AND MEM BUFFRS

gperkins@cdp.UUCP (02/20/91)

        Help! I am working on a project that interfaces a PC via a
DMA channel.  The DMA channel (1 or 3) sends high speed data over to
the PC. I know how to set up and use the PC's DMA chip but
I can't figure out where to start the DMA capture data in the
PC's memory.
        What I need is to find some (several HUNDRED K, or whatever I
can get) memory "past" the top of my PC program for a capture
buffer.  I can't seem to find information on something this specific.
Do I need to declare some whopper data structure ahead of time, or
use a malloc()-type method?  I need to stay  within the standard 640K
PC and AT memory arrangement.   If anyone knows of some references,
or examples from projects in books or magazines, PLEASE email me!  
Thanks very much!

Gordy Perkins
Mpls,MN

rtaylor@hpdmd48.boi.hp.com (Rich Taylor) (03/01/91)

>         Help! I am working on a project that interfaces a PC via a
> DMA channel.  The DMA channel (1 or 3) sends high speed data over to
> the PC. I know how to set up and use the PC's DMA chip but
> I can't figure out where to start the DMA capture data in the
> PC's memory.
>
>         What I need is to find some (several HUNDRED K, or whatever I
> can get) memory "past" the top of my PC program for a capture
> buffer.  I can't seem to find information on something this specific.
> Do I need to declare some whopper data structure ahead of time, or
> use a malloc()-type method?  I need to stay  within the standard 640K
> PC and AT memory arrangement.   If anyone knows of some references,
> or examples from projects in books or magazines, PLEASE email me!  

The DMA can be set up to transfer up to 64K bytes of data at a time
starting at any addressable memory location. The DMA chip (8237) can
be programmed for a 16-bit address, as well as the number of bytes in the
block to be transferred to or from memory (memory to memory DMA transfers are
not possible in the PC architecture). The high-order address bits (4 bits in
a PC/XT system) are programmed via the DMA PAGE REGISTER (not a part of the
DMA controller, but provided on the PC). Note that DMA transfers cannot cross
page boundaries (but you can issue two consecutive DMA transfers).

Since the memory can exist anywhere in the PC address space, any method may
be used to allocate space (static, malloc, or DOS call). Remember that
transfers are limited to 64K, so large memory blocks will have to be segmented.
The DMA segmentation may be identical to the standard 8088-architecture
segmentation, if desired.

Note: If you are using a 80286 or better machine and your software is not
multitasking, DMA is slower than polled block IO using the REP OUTS instruction.


Good Luck

Rich Taylor, HP Boise Printer Division (the LaserJet guys)
rtaylor@hpdmd48