delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/29/18:07:09

Message-ID: <00d101bf6aa8$2e315c20$0100000a@athlon>
From: "Jeremy Thomas" <yasper AT earthlink DOT net>
To: <djgpp AT delorie DOT com>
References: <F77915E7F086D31197F4009027CC81C9219F21 AT probe-2 DOT as-london DOT acclaim DOT com>
Subject: Re: a bit (a lot) offtopic! a question about DMA!
Date: Sat, 29 Jan 2000 14:28:33 -0800
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019