πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #3454

DMA : number of transfer

#3454
From: Mats Astrom
Date: Thu, 01 Oct 1992 07:46
52 lines
2860 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
-----------------------------------------------------------------------
Technical Details
Message-ID: <mats.astrom.24.0@neurofys.uu.se>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!corax.udac.uu.se!neurofys.uu.se!mats.astrom

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!corax.udac.uu.se!neurofys.uu.se!mats.astrom
From: mats.astrom@neurofys.uu.se (Mats Astrom)
Newsgroups: comp.os.msdos.programmer
Subject: DMA : number of transfer
Date: 1 Oct 1992 07:46:13 GMT
Organization: Department of Clinical Neurophysiology, University of Uppsala
Lines: 52
Message-ID: <mats.astrom.24.0@neurofys.uu.se>
NNTP-Posting-Host: mats.neurofys.uu.se