home *** CD-ROM | disk | FTP | other *** search
-
- Copyright 1993 by Peter Sprenger Pete@amber.dinoco.de
- Muenchener Str.6
- 50170 Kerpen
- Germany
-
- Permission to use, copy, modify, and distribute this
- software and its documentation for any purpose and without
- fee is hereby granted, provided that the above copyright
- notice appear in all copies. The author Peter Sprenger
- makes no representations about the suitability of this
- software for any purpose. It is provided "as is" without
- express or implied warranty.
-
-
-
- What is dmalib? Dmalib is an easy interface to initiate dma
- transfers. Since one dma transfer can only occur in one dma
- page, a big dma transfer has to be devided in a series of
- subtransfers. When you use dmalib, it will initiate a transfer
- up to the end of the used dma page. After the end of this transfer
- (on most devices like soundcards there occurs an interrupt), you have
- to call dma_next(). This routine will then initiate the next
- subtransfer. After the end of this subtransfer you have to call
- dma_next(), and so on...
-
- The function dma_len() gives you the remaining bytes, that are to
- transfer in subtransfers until the whole dma transfer is completed.
- When this function gives you a value of zero, there is no need for
- further calling of dma_next(). It will indicate the completion of the
- whole dma transfer. The function dma_len() will show only correct
- values BEFORE a subtransfer (before calling dma_next()).
-
-
-
-
- -------------------- Documentation ----------------------------
-
-
-
-
- WORD dma_set(DWORD adr,DWORD len,int channel,BYTE mode);
-
- The procedure dma_set() is used to initiate a big dma transfer. With
- "big" a dma transfer that crosses dma pages is meant. The first
- argument is the address where to start the dma transfer. The address
- is the memory address as an unsigned long word. You can use values in
- the range from 0 to 16mbyte (24 bits are used). The address is NOT in
- segment representation (of course far ptr can only point up to 1mbyte).
- The 2nd argument is the length of the dma transfer. The 3rd is the
- dma channel number. The channel number is valid in the range 0 - 7.
- The last argument specifies the dma mode. It is a combination of the
- following:
-
-
- [DMA_SINGLE | DMA_BLOCK | DMA_DEMAND] [DAM_IN|DMA_OUT] [DMA_AUTO] [DMA_DECREMENT]
-
- An example for dma single transfer, out of ram and with auto
- initializing:
-
- WORD dma_set(0x8000,0x1000,1,DMA_SINGLE|DMA_OUT|DMA_AUTO);
-
- The return value of dma_set() are the number of bytes that will
- transferred in this subtransfer. For sound blaster programming for
- example, you have to feed the DSP with this value.
-
- WARNING: The dma channels over 3 are 16 bit channel (in an AT only).
- Dma_set() will divide address and length through 2. So you can use
- only EVEN addresses and an EVEN length on 16 bit channels. But this
- enables you to access the range from 0 to 32mbyte and to make
- 128kbyte transfer (so say my docs - no warranty!).
-
-
-
- WORD dma_next(int channel);
-
- Just call dma_next() with the dma channel number, and the subtransfer
- is intiated. The return value is like dma_set() the number of bytes
- that will be transferred in the next subtransfer.
-
-
-
- DWORD far2long(char far *adr);
-
- The function far2long takes a segmented far (or huge) pointer and
- returns a 32 bit address, that can be used for dma_set().
-
-
-
- long dma_len(int channel);
-
- This function gives you the number of bytes that are to transfer to
- complete the whole dma transfer. The normal purpose of dma_len is the
- calling to determine if there are subsequent calls of dma_next()
- needed.
-
-
-
-
- -----------------------------------------------------------
-
-
-
- Vers. History
- -------
-
- 1.00 20-Jun-93 dmalib 1.0 library released
-
-