Mail Archives: djgpp/2000/01/29/18:07:09
The DMA controller does have a mechanism for finding out if a DMA channel
has finished a transfer. The exact way of doing it depends of the channel.
What you do is read the data in from a port, 08h for channels 0-3, and d0h
for channels 4-7. The read is a byte read and the information conatined is
as follows:
bit 7 request: channel 3 or 7
6 request: channel 2 or 6
5 request: channel 1 or 5
4 request: channel 0 or 4
3 terminal count: channel 3 or 7
2 terminal count: channel 2 or 6
1 terminal count: channel 1 or 5
0 terminal count: channel 0 or 4
the terminal count is the bit you're looking for. If it is set then the
transfer is complete. If the request bit is set then there is another
request pending for that channel. One thing to keep in mind is that channel
4 does not refer to a device, its best not to mess with that one.
So let's say you have a sound card on DMA channel 5 and you want to know if
the DMA transfer is done and you want to use the DMA controller to do this:
check_transfer:
in ax, d0h
and al, 20h
jnz transfer_done
jmp check_transfer
This code will poll the DMA controller until the sound card is done. Of
course this is a really slow way to do things, but it illustrates how the
DMA controller works.
----- Original Message -----
From: Shawn Hargreaves <SHargreaves AT acclaimstudios DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
To: <djgpp AT delorie DOT com>
Sent: Wednesday, January 26, 2000 4:42 AM
Subject: Re: a bit (a lot) offtopic! a question about DMA!
> Mohamed Saad writes:
> > what is the interrupt that the DMA generates when
> > it finishes transferring data??
> > is there any other way i can check if the DMA has
> > finished transferring or not??
>
> The interrupt is normally raised by the recieving device, rather than
> the DMA controller itself, eg. when playing sounds on an SB, it is up
> to the SB to tell you when the transfer is complete. Obviously methods
> for doing this will depend on what device you are accessing.
>
> I don't know if the DMA controller itself has any mechanism for doing
> this, sorry. If it does, I've never come across that.
>
>
> Shawn Hargreaves.
>
- Raw text -