dmavar.h revision 1.10 1 1.10 thorpej /* $NetBSD: dmavar.h,v 1.10 1997/10/04 09:59:47 thorpej Exp $ */
2 1.10 thorpej
3 1.10 thorpej /*-
4 1.10 thorpej * Copyright (c) 1997 The NetBSD Foundation, Inc.
5 1.10 thorpej * All rights reserved.
6 1.10 thorpej *
7 1.10 thorpej * This code is derived from software contributed to The NetBSD Foundation
8 1.10 thorpej * by Jason R. Thorpe.
9 1.10 thorpej *
10 1.10 thorpej * Redistribution and use in source and binary forms, with or without
11 1.10 thorpej * modification, are permitted provided that the following conditions
12 1.10 thorpej * are met:
13 1.10 thorpej * 1. Redistributions of source code must retain the above copyright
14 1.10 thorpej * notice, this list of conditions and the following disclaimer.
15 1.10 thorpej * 2. Redistributions in binary form must reproduce the above copyright
16 1.10 thorpej * notice, this list of conditions and the following disclaimer in the
17 1.10 thorpej * documentation and/or other materials provided with the distribution.
18 1.10 thorpej * 3. All advertising materials mentioning features or use of this software
19 1.10 thorpej * must display the following acknowledgement:
20 1.10 thorpej * This product includes software developed by the NetBSD
21 1.10 thorpej * Foundation, Inc. and its contributors.
22 1.10 thorpej * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.10 thorpej * contributors may be used to endorse or promote products derived
24 1.10 thorpej * from this software without specific prior written permission.
25 1.10 thorpej *
26 1.10 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.10 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.10 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.10 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.10 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.10 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.10 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.10 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.10 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.10 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.10 thorpej * POSSIBILITY OF SUCH DAMAGE.
37 1.10 thorpej */
38 1.4 cgd
39 1.1 cgd /*
40 1.3 mycroft * Copyright (c) 1982, 1990, 1993
41 1.3 mycroft * The Regents of the University of California. All rights reserved.
42 1.1 cgd *
43 1.1 cgd * Redistribution and use in source and binary forms, with or without
44 1.1 cgd * modification, are permitted provided that the following conditions
45 1.1 cgd * are met:
46 1.1 cgd * 1. Redistributions of source code must retain the above copyright
47 1.1 cgd * notice, this list of conditions and the following disclaimer.
48 1.1 cgd * 2. Redistributions in binary form must reproduce the above copyright
49 1.1 cgd * notice, this list of conditions and the following disclaimer in the
50 1.1 cgd * documentation and/or other materials provided with the distribution.
51 1.1 cgd * 3. All advertising materials mentioning features or use of this software
52 1.1 cgd * must display the following acknowledgement:
53 1.1 cgd * This product includes software developed by the University of
54 1.1 cgd * California, Berkeley and its contributors.
55 1.1 cgd * 4. Neither the name of the University nor the names of its contributors
56 1.1 cgd * may be used to endorse or promote products derived from this software
57 1.1 cgd * without specific prior written permission.
58 1.1 cgd *
59 1.1 cgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
60 1.1 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
61 1.1 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
62 1.1 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
63 1.1 cgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
64 1.1 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
65 1.1 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
66 1.1 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
67 1.1 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
68 1.1 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
69 1.1 cgd * SUCH DAMAGE.
70 1.1 cgd *
71 1.4 cgd * @(#)dmavar.h 8.1 (Berkeley) 6/10/93
72 1.1 cgd */
73 1.1 cgd
74 1.7 thorpej #include <sys/queue.h>
75 1.7 thorpej
76 1.1 cgd /* dmago flags */
77 1.1 cgd #define DMAGO_BYTE 0x00 /* do byte (8 bit) transfers */
78 1.1 cgd #define DMAGO_WORD 0x01 /* do word (16 bit) transfers */
79 1.1 cgd #define DMAGO_LWORD 0x02 /* do longword (32 bit) transfers */
80 1.1 cgd #define DMAGO_PRI 0x04 /* do "priority" DMA */
81 1.1 cgd #define DMAGO_READ 0x08 /* transfer is a read */
82 1.1 cgd #define DMAGO_NOINT 0x80 /* don't interrupt on completion */
83 1.1 cgd
84 1.1 cgd /* dma "controllers" (channels) */
85 1.1 cgd #define DMA0 0x1
86 1.1 cgd #define DMA1 0x2
87 1.7 thorpej
88 1.7 thorpej /*
89 1.7 thorpej * A DMA queue entry. Initiator drivers each have one of these,
90 1.7 thorpej * used to queue access to the DMA controller.
91 1.7 thorpej */
92 1.7 thorpej struct dmaqueue {
93 1.7 thorpej TAILQ_ENTRY(dmaqueue) dq_list; /* entry on the queue */
94 1.7 thorpej int dq_chan; /* OR of channels initiator can use */
95 1.7 thorpej void *dq_softc; /* initiator's softc */
96 1.7 thorpej
97 1.7 thorpej /*
98 1.7 thorpej * These functions are called to start the initiator when
99 1.7 thorpej * it has been given the DMA controller, and to stop the
100 1.7 thorpej * initiator when the DMA controller has stopped.
101 1.7 thorpej */
102 1.7 thorpej void (*dq_start) __P((void *));
103 1.7 thorpej void (*dq_done) __P((void *));
104 1.7 thorpej };
105 1.1 cgd
106 1.5 jtc #ifdef _KERNEL
107 1.9 scottr void dmainit __P((void));
108 1.8 scottr void dmago __P((int, char *, int, int));
109 1.8 scottr void dmastop __P((int));
110 1.8 scottr void dmafree __P((struct dmaqueue *));
111 1.8 scottr int dmareq __P((struct dmaqueue *));
112 1.8 scottr void dmacomputeipl __P((void));
113 1.8 scottr #endif /* _KERNEL */
114