Messages in this thread | | | Date | Thu, 7 Nov 1996 17:10:57 +0530 (IST) | From | Upinder Singh Bhalla <> | Subject | msb/lsb on dma |
| |
Hi, folks. I have written a device driver for an A/D board on a P100 with the following kernel and gcc: Linux version 2.0.14 (root@srikhand.tifrbng.res.in) (gcc version 2.7.2)
The board can be run in a mode in which it automatically generates dma requests in single transfer mode, and thereby capture data without CPU intervention. The DMA controller is even smart enough to cycle round a ring buffer for you. As the board is 12 bits, it does the DMA transfers in two bytes, padding the upper with zeroes. So far so good. However, the driver now has to be able to find out what is the last address filled by the card. I use inb(DMA_ADDR_3) for this, reading it twice to get the lower and upper bytes. Most of the time my driver works fine, but a few times every second it picks up some garbage in which it looks like the msb/lsb got swapped. The problem seems to be that every so often my reads to get the current DMA address from the controller, overlap with the DMA writes by the board. This messes up my assumptions about the state of the DMA ff. I have tried checking on the DMA status by using inb(DMA1_STAT_REG), and testing whether the DMA is busy, but that does not change the results. I have also tried reading the conversion status from the A/D board, that doesn't help either.
Any tips on what to do, or if my diagnosis is completely awry ?
Thanks, Upi
Upinder S. Bhalla National Centre for Biological Sciences bhalla@ncbs.tifrbng.res.in TIFR Centre, IISc Campus, PO Box 1234 80-334-5615 or 4062 or 3035 Bangalore 560012, INDIA Fax 80-334-3851
| |