πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.msdos.programmer
2 messages
2 total messages Started by Mats Astrom Thu, 01 Oct 1992 07:39
DMA : numder of transfers
#671
Author: Mats Astrom
Date: Thu, 01 Oct 1992 07:39
53 lines
2859 bytes
While doing DMA-transfer it's possible to read the number of transfers done
by reading a specific register of the DMA-circuit. I've manage to do so but
the result seem to be somewhat instable ! The instability is due to reads of
the register in the middle of a transfer, isn't it ????
Assuming I'm setting up everthing correctly, how do I read the number of
transferred bytes to get the correct value every time ?????

I program in TP 6.0, with the following declarations the code is:

BTW, I'm doing integer ( 2 bytes ) transfers, see odd(lobyte1) below !

   lobyte1,
   lobyte2,
   hibyte1,
   hibyte2  : byte;

   DMACountReg = $03; { byte Count, ch1 }

    version 1:
                      {--- check how far DMA has gone ---}
                      repeat
                         lobyte1 := port[DMACountReg];
                         hibyte1 := port[DMACountReg];
                         lobyte2 := port[DMACountReg];
                         hibyte2 := port[DMACountReg];
                      until odd(lobyte1) and
                            (hibyte2=hibyte1) and
                            (lobyte2=lobyte1);
    version 2:
                      {--- check how far DMA has gone ---}
                      repeat
                         lobyte1 := port[DMACountReg];
                         hibyte1 := port[DMACountReg];
                         lobyte2 := port[DMACountReg];
                         hibyte2 := port[DMACountReg];
                      until odd(lobyte1) and ( ( (hibyte2=hibyte1) and
                                                 (lobyte2<=lobyte1) ) or
                                              ( (hibyte2<hibyte1) and
                                                (lobyte2>lobyte1) ) );

The calculation of how many transfers done in both versions is:

                     nr_of_transfers := ( hibyte2 shl 8 + lobyte2 ) shr 1;

None of the above versions seem to give a stable result of the amount of
transfers done !!!
-----------------------------------------------------------------------
Mats strΒ”m             email:        mats.astrom@neurofys.uu.se
tel: +46 18 66 34 52                  Dept. of Clinical Neurophysiology
fax: +46 18 55 11 32                  University Hospital
                                      S-751 85 Uppsala
                                      Sweden
-----------------------------------------------------------------------
Re: DMA : numder of transfers
#692
Author: Jerzy Tarasiuk
Date: Mon, 05 Oct 1992 17:57
22 lines
1643 bytes
>>>>> On 1 Oct 1992 07:39:13 GMT, mats.astrom@neurofys.uu.se (Mats Astrom) said:
Mats> NNTP-Posting-Host: mats.neurofys.uu.se

Mats> While doing DMA-transfer it's possible to read the number of transfers done
Mats> by reading a specific register of the DMA-circuit. I've manage to do so but
Mats> the result seem to be somewhat instable ! The instability is due to reads of
Mats> the register in the middle of a transfer, isn't it ????
Mats> Assuming I'm setting up everthing correctly, how do I read the number of
Mats> transferred bytes to get the correct value every time ?????

Few questions:
1. did you remember to reset hi/lo flip-flop (I/O address 0Ch)
   before reading the DMA count register ?
2. do you remember the DMA count register contains remaining count,
   not count transferred and it goes down to -1 ?
3. why read registers many times (the repeat)? read once:
   port[DmaRstFF]:=0;
   l1:=port[DmaCntReg]; h1:=port[DmaCntReg];
   l2:=port[DmaCntReg]; h2:=port[DmaCntReg];
   IF h1<>h2 THEN cnt:=(h1 SHL 8)+l1 ELSE cnt:=(h2 SHL 8)+l2;
   Let me know if it gives stable results (i.e. still going down).
Jerzy Tarasiuk
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads