Common Interrupt Mistakes; Choosing A Dma Channel; Allocating A Dma Buffer - Real Time Devices AD1200 User Manual

Table of Contents

Advertisement

. Common Interrupt Mistakes
' Remember that hardware intemrpts are numbered 8 ttrrough 15, even though the corresponding tRes
are
numbered 0 through 7.
' Two of the most common mistakes when writing an ISR are forgetting to clear the interrupt satus
of the 1200
and forgetting to issue the EOI command o the 8259 intemrpt conroller before exiting the ISR.
Data Transfers Using DMA
Direct Memory Access (DMA) transfers data between a.peripheral deviceand PC memory without using the
processor as an intermediate. Bypassing the processor in this way allows very fast transfer rates. All PCs conain the
necessary hardware components for accomplishing DMA. However, software support for DMA is not included as
part of the BIOS or DOS, leaving you with the task of programming the DMA controller yourself. With a little care,
such programming can be successfully and efficiently achieved-
The following discussion is based on using the DMA controller to get data from a peripheral device and write it
to memory. The opposite can also be done; the DMA controller can read data from memory and pass it to a periph-
eral device. There are a few minor differences, mostly conceming programming the DMA controller, but in genlral
the process is the same.
The following st€ps are required when using DMA:
l.
Choose a DMA channel.
2. Allocate a buffer.
3. Calculate the page and offset of the buffer.
4. Set the DMA page register.
5. Program the DMA controller.
6. Program device generaring data (1200).
7. Waitunril DMA is complete.
8. Disable DMA.
Each step is detailed in $re following paragraphs.
. Choosing a DMA Channel
There are a number of DMA channels available on the PC for use by peripheral devices. The 1200 can use
either DMA channel 1 or DMA channel 3. The factory setting is DMA disabled. You can arbinarily choose one or
the other by setting the jumpers on P5 and P6 as described in Chapter 1; in most cases either choice is fine. Occa-
sionally though, you will have another peripheral device (for example,atapbackup or Bernoulli drive) that also
uses the DMA channel you have selected. This will certainly cause erratic results and can be hard to detect. The best
approach to pinpoint this problem is to read the documentation for the other peripheral devices in your syst€m and
try to determine which DMA channel each uses.
. Allocating a DMA Buffer
When using DMA, you must have a location in memory where the DMA controller will place data from the
1200 board. This buffer can be either static or dynamically allocated. Just be sure that its location will not change
while DMA is in progress. The following code examples show how to allocate buffers for use with DMA.
In Pascal:
V a r B u f f e r
: A r r a y t 1 . . 1 0 0 0 0 l
o f B y t e ;
-or-
V a r B u f f e r
: ^ B y t e ;
B u f f e r
: - G e t M e m ( 1 0 0 0 0 ) ;
{ s t a t i c
a l l o c a t i o n
}
4-19
tdynamic al-location
l

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ada1200

Table of Contents