1/*	$OpenBSD: isadmavar.h,v 1.16 2008/06/26 05:42:16 ray 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 *
21 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#ifndef _DEV_ISA_ISADMAVAR_H
35#define _DEV_ISA_ISADMAVAR_H
36
37/* XXX for now... */
38#ifndef __ISADMA_COMPAT
39#define __ISADMA_COMPAT
40#endif /* __ISADMA_COMPAT */
41
42#ifdef __ISADMA_COMPAT
43
44/* XXX ugly.. but it's a deprecated API that uses it so it will go.. */
45extern struct device *isa_dev;
46
47#define isadma_acquire(c)		isa_dma_acquire(isa_dev, (c))
48#define isadma_release(c)		isa_dma_release(isa_dev, (c))
49#define isadma_cascade(c)		isa_dmacascade(isa_dev, (c))
50#define isadma_start(a, s, c, f) \
51    isa_dmastart(isa_dev, (c), (a), (s), 0, (f), BUS_DMA_WAITOK|BUS_DMA_BUS1)
52#define isadma_abort(c)			isa_dmaabort(isa_dev, (c))
53#define isadma_finished(c)		isa_dmafinished(isa_dev, (c))
54#define isadma_done(c)			isa_dmadone(isa_dev, (c))
55
56#endif /* __ISADMA_COMPAT */
57
58#define MAX_ISADMA	65536
59
60#define	DMAMODE_WRITE	0
61#define	DMAMODE_READ	1
62#define	DMAMODE_LOOP	2
63
64struct proc;
65
66void	   isa_dmacascade(struct device *, int);
67
68int	   isa_dmamap_create(struct device *, int, bus_size_t, int);
69void	   isa_dmamap_destroy(struct device *, int);
70
71int	   isa_dmastart(struct device *, int, void *, bus_size_t,
72	       struct proc *, int, int);
73void	   isa_dmaabort(struct device *, int);
74bus_size_t isa_dmacount(struct device *, int);
75int	   isa_dmafinished(struct device *, int);
76void	   isa_dmadone(struct device *, int);
77
78int	   isa_dmamem_alloc(struct device *, int, bus_size_t,
79	       bus_addr_t *, int);
80void	   isa_dmamem_free(struct device *, int, bus_addr_t, bus_size_t);
81int	   isa_dmamem_map(struct device *, int, bus_addr_t, bus_size_t,
82	       caddr_t *, int);
83void	   isa_dmamem_unmap(struct device *, int, caddr_t, size_t);
84int	   isa_dmamem_mmap(struct device *, int, bus_addr_t, bus_size_t,
85	       int, int, int);
86
87int	   isa_drq_isfree(struct device *, int);
88
89void      *isa_malloc(struct device *, int, size_t, int, int);
90void	   isa_free(void *, int);
91paddr_t	   isa_mappage(void *, off_t, int);
92
93#endif /* _DEV_ISA_ISADMAVAR_H */
94