unstack - fix ipcvecs
[minix.git] / sys / arch / i386 / stand / lib / isadma.c
blobacd47ab415fbe6de1abbe62aa29be0e9359a668f
1 /* $NetBSD: isadma.c,v 1.2 2008/12/14 17:03:43 christos Exp $ */
3 /* from: NetBSD:dev/isa/isadma.c */
5 #include <sys/types.h>
6 #include <machine/pio.h>
8 #include <lib/libsa/stand.h>
10 #include "isadmavar.h"
12 #define IO_DMA1 0x000 /* 8237A DMA Controller #1 */
13 #define IO_DMA2 0x0C0 /* 8237A DMA Controller #2 */
14 #define DMA37MD_CASCADE 0xc0 /* cascade mode */
15 #define DMA1_SMSK (IO_DMA1 + 1*10) /* single mask register */
16 #define DMA1_MODE (IO_DMA1 + 1*11) /* mode register */
17 #define DMA2_SMSK (IO_DMA2 + 2*10) /* single mask register */
18 #define DMA2_MODE (IO_DMA2 + 2*11) /* mode register */
21 * isa_dmacascade(): program 8237 DMA controller channel to accept
22 * external dma control by a board.
24 void
25 isa_dmacascade(int chan)
28 #ifdef ISADMA_DEBUG
29 if (chan < 0 || chan > 7)
30 panic("isa_dmacascade: impossible request");
31 #endif
33 /* set dma channel mode, and set dma channel mode */
34 if ((chan & 4) == 0) {
35 outb(DMA1_MODE, chan | DMA37MD_CASCADE);
36 outb(DMA1_SMSK, chan);
37 } else {
38 chan &= 3;
40 outb(DMA2_MODE, chan | DMA37MD_CASCADE);
41 outb(DMA2_SMSK, chan);