dmavar.h revision 1.12 1 1.12 thorpej /* $NetBSD: dmavar.h,v 1.12 2004/08/28 17:37:00 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.11 agc * 3. Neither the name of the University nor the names of its contributors
52 1.1 cgd * may be used to endorse or promote products derived from this software
53 1.1 cgd * without specific prior written permission.
54 1.1 cgd *
55 1.1 cgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
56 1.1 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57 1.1 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
58 1.1 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
59 1.1 cgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
60 1.1 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
61 1.1 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
62 1.1 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
63 1.1 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
64 1.1 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
65 1.1 cgd * SUCH DAMAGE.
66 1.1 cgd *
67 1.4 cgd * @(#)dmavar.h 8.1 (Berkeley) 6/10/93
68 1.1 cgd */
69 1.1 cgd
70 1.7 thorpej #include <sys/queue.h>
71 1.7 thorpej
72 1.1 cgd /* dmago flags */
73 1.1 cgd #define DMAGO_BYTE 0x00 /* do byte (8 bit) transfers */
74 1.1 cgd #define DMAGO_WORD 0x01 /* do word (16 bit) transfers */
75 1.1 cgd #define DMAGO_LWORD 0x02 /* do longword (32 bit) transfers */
76 1.1 cgd #define DMAGO_PRI 0x04 /* do "priority" DMA */
77 1.1 cgd #define DMAGO_READ 0x08 /* transfer is a read */
78 1.1 cgd #define DMAGO_NOINT 0x80 /* don't interrupt on completion */
79 1.1 cgd
80 1.1 cgd /* dma "controllers" (channels) */
81 1.1 cgd #define DMA0 0x1
82 1.1 cgd #define DMA1 0x2
83 1.7 thorpej
84 1.7 thorpej /*
85 1.7 thorpej * A DMA queue entry. Initiator drivers each have one of these,
86 1.7 thorpej * used to queue access to the DMA controller.
87 1.7 thorpej */
88 1.7 thorpej struct dmaqueue {
89 1.7 thorpej TAILQ_ENTRY(dmaqueue) dq_list; /* entry on the queue */
90 1.7 thorpej int dq_chan; /* OR of channels initiator can use */
91 1.7 thorpej void *dq_softc; /* initiator's softc */
92 1.7 thorpej
93 1.7 thorpej /*
94 1.7 thorpej * These functions are called to start the initiator when
95 1.7 thorpej * it has been given the DMA controller, and to stop the
96 1.7 thorpej * initiator when the DMA controller has stopped.
97 1.7 thorpej */
98 1.12 thorpej void (*dq_start)(void *);
99 1.12 thorpej void (*dq_done)(void *);
100 1.7 thorpej };
101 1.1 cgd
102 1.5 jtc #ifdef _KERNEL
103 1.12 thorpej void dmainit(void);
104 1.12 thorpej void dmago(int, char *, int, int);
105 1.12 thorpej void dmastop(int);
106 1.12 thorpej void dmafree(struct dmaqueue *);
107 1.12 thorpej int dmareq(struct dmaqueue *);
108 1.12 thorpej void dmacomputeipl(void);
109 1.8 scottr #endif /* _KERNEL */
110