Subject: can anyone help me with DMA questions?
To: None <current-users@netbsd.org>
From: John F. Woods <jfw@jfwhome.funhouse.com>
List: current-users
Date: 08/09/1998 14:55:31
My ProAudio Spectrum driver "almost" works.  It seems to be reliable in
mono mode, but in stereo it will run for a little while and then suddenly
stop in mid DMA transfer.  It also tends to swap left and right occasionally,
which is almost certainly a related problem.

When the transfer stops, I currently have a timeout routine which
dumps out some device registers, in particular the enable bits and the
DMA sample buffer counter, plus the DMA chip remaining count and the
DMA controller request-flags byte (port 0x08).  All the enables are
on, so the board ought to be running, but the DMA controller says
there are no DMA requests outstanding.  An interesting thing is that
the board and the DMA chip do not seem to agree about the number of
transfers performed; as an example, with a DMA buffer size of 65536
(programmed into the DMA chip with autoinitialize mode enabled) and a
board transfer size of 8192 16-bit words (16KB), the DMA chip claimed
to have 60470 bytes remaining (4066 transfered), and the board claimed
to have 5900 remaining (2292 words transfered, or 4584 bytes
transfered).  I don't know how many times the DMA buffer might have
wrapped; I also don't know for certain that the board actually
supports reading back the DMA transfer count (so I *might* be seeing
garbage).

So, it seems to me that there are three likely explanations:
(1) the PAS makes a DMA request which the DMA controller doesn't see;
when the next sample tick happens, the PAS substitutes one blank
sample, and if a further tick happens without a DMA request, the DMA
engine shuts down entirely.
(2) the PAS PCM engine is just broken, occasionally inventing a sample
without seeing DACK, and occasionally just losing its mind and
wandering off.


Needless to say, the board works perfectly under DOS, so I can't blame
it on a broken board.  (Anyone know how to disassemble .SYS and .DRV
files from DOS?)