Lines Matching refs:DMA
1 /* $NetBSD: dma.c,v 1.29 2023/01/06 10:28:28 tsutsui Exp $ */
29 * This file contains special code dealing with the DMA interface
32 * The DMA circuitry requires some special treatment for the peripheral
33 * devices which make use of the ST's DMA feature (the hard disk and the
35 * All devices using DMA need mutually exclusive access and can follow some
40 * st_dmagrab: ensure exclusive access to the DMA circuitry
41 * st_dmafree: free exclusive access to the DMA circuitry
42 * st_dmawanted: somebody is queued waiting for DMA-access
43 * dmaint: DMA interrupt routine, switches to the current driver
45 * st_dmaaddr_get: get address of last DMA-op
46 * st_dmacomm: program DMA, flush FIFO first
50 __KERNEL_RCSID(0, "$NetBSD: dma.c,v 1.29 2023/01/06 10:28:28 tsutsui Exp $");
60 #include <machine/dma.h>
67 void (*int_func)(void *); /* Call on DMA interrupt */
69 int *lock_stat; /* status of DMA lock */
217 * Due to the logic of the ST-DMA chip, it is not possible to
229 * Setup address for DMA-transfer.
237 DMA->dma_addr[AD_LOW ] = (ad ) & 0xff;
238 DMA->dma_addr[AD_MID ] = (ad >> 8) & 0xff;
239 DMA->dma_addr[AD_HIGH] = (ad >>16) & 0xff;
243 * Get address from DMA unit.
250 ad = (DMA->dma_addr[AD_LOW ] & 0xff);
251 ad |= (DMA->dma_addr[AD_MID ] & 0xff) << 8;
252 ad |= (DMA->dma_addr[AD_HIGH] & 0xff) <<16;
257 * Program the DMA-controller to transfer 'nblk' blocks of 512 bytes.
258 * The DMA_WRBIT trick flushes the FIFO before doing DMA.
264 DMA->dma_mode = mode;
265 DMA->dma_mode = mode ^ DMA_WRBIT;
266 DMA->dma_mode = mode;
267 DMA->dma_data = nblk;
269 DMA->dma_mode = DMA_SCREG | (mode & DMA_WRBIT);