1 /*	$OpenBSD: isadmavar.h,v 1.15 2004/04/20 15:04:10 pvalchev Exp $	*/
2 /*	$NetBSD: isadmavar.h,v 1.10 1997/08/04 22:13:33 augustss Exp $	*/
3 
4 /*-
5  * Copyright (c) 1997 The NetBSD Foundation, Inc.
6  * All rights reserved.
7  *
8  * This code is derived from software contributed to The NetBSD Foundation
9  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
10  * NASA Ames Research Center.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  * 3. All advertising materials mentioning features or use of this software
21  *    must display the following acknowledgement:
22  *	This product includes software developed by the NetBSD
23  *	Foundation, Inc. and its contributors.
24  * 4. Neither the name of The NetBSD Foundation nor the names of its
25  *    contributors may be used to endorse or promote products derived
26  *    from this software without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
29  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
32  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38  * POSSIBILITY OF SUCH DAMAGE.
39  */
40 
41 #ifndef _DEV_ISA_ISADMAVAR_H
42 #define _DEV_ISA_ISADMAVAR_H
43 
44 /* XXX for now... */
45 #ifndef __ISADMA_COMPAT
46 #define __ISADMA_COMPAT
47 #endif /* __ISADMA_COMPAT */
48 
49 #ifdef __ISADMA_COMPAT
50 
51 /* XXX ugly.. but it's a deprecated API that uses it so it will go.. */
52 extern struct device *isa_dev;
53 
54 #define isadma_acquire(c)		isa_dma_acquire(isa_dev, (c))
55 #define isadma_release(c)		isa_dma_release(isa_dev, (c))
56 #define isadma_cascade(c)		isa_dmacascade(isa_dev, (c))
57 #define isadma_start(a, s, c, f) \
58     isa_dmastart(isa_dev, (c), (a), (s), 0, (f), BUS_DMA_WAITOK|BUS_DMA_BUS1)
59 #define isadma_abort(c)			isa_dmaabort(isa_dev, (c))
60 #define isadma_finished(c)		isa_dmafinished(isa_dev, (c))
61 #define isadma_done(c)			isa_dmadone(isa_dev, (c))
62 
63 #endif /* __ISADMA_COMPAT */
64 
65 #define MAX_ISADMA	65536
66 
67 #define	DMAMODE_WRITE	0
68 #define	DMAMODE_READ	1
69 #define	DMAMODE_LOOP	2
70 
71 struct proc;
72 
73 void	   isa_dmacascade(struct device *, int);
74 
75 int	   isa_dmamap_create(struct device *, int, bus_size_t, int);
76 void	   isa_dmamap_destroy(struct device *, int);
77 
78 int	   isa_dmastart(struct device *, int, void *, bus_size_t,
79 	       struct proc *, int, int);
80 void	   isa_dmaabort(struct device *, int);
81 bus_size_t isa_dmacount(struct device *, int);
82 int	   isa_dmafinished(struct device *, int);
83 void	   isa_dmadone(struct device *, int);
84 
85 int	   isa_dmamem_alloc(struct device *, int, bus_size_t,
86 	       bus_addr_t *, int);
87 void	   isa_dmamem_free(struct device *, int, bus_addr_t, bus_size_t);
88 int	   isa_dmamem_map(struct device *, int, bus_addr_t, bus_size_t,
89 	       caddr_t *, int);
90 void	   isa_dmamem_unmap(struct device *, int, caddr_t, size_t);
91 int	   isa_dmamem_mmap(struct device *, int, bus_addr_t, bus_size_t,
92 	       int, int, int);
93 
94 int	   isa_drq_isfree(struct device *, int);
95 
96 void      *isa_malloc(struct device *, int, size_t, int, int);
97 void	   isa_free(void *, int);
98 paddr_t	   isa_mappage(void *, off_t, int);
99 
100 #endif /* _DEV_ISA_ISADMAVAR_H */
101