1 /* $OpenBSD: isadmavar.h,v 1.11 1998/01/20 18:40:31 niklas 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 /* XXX for now... */ 42 #ifndef __ISADMA_COMPAT 43 #define __ISADMA_COMPAT 44 #endif /* __ISADMA_COMPAT */ 45 46 #ifdef __ISADMA_COMPAT 47 48 /* XXX ugly.. but it's a deprecated API that uses it so it will go.. */ 49 extern struct device *isa_dev; 50 51 #define ISADMA_MAP_WAITOK 0x0001 /* OK for isadma_map to sleep */ 52 #define ISADMA_MAP_BOUNCE 0x0002 /* use bounce buffer if necessary */ 53 #define ISADMA_MAP_CONTIG 0x0004 /* must be physically contiguous */ 54 #define ISADMA_MAP_8BIT 0x0008 /* must not cross 64k boundary */ 55 #define ISADMA_MAP_16BIT 0x0010 /* must not cross 128k boundary */ 56 57 struct isadma_seg { /* a physical contiguous segment */ 58 vm_offset_t addr; /* address of this segment */ 59 vm_size_t length; /* length of this segment (bytes) */ 60 bus_dmamap_t dmam; /* DMA handle for bus_dma routines. */ 61 }; 62 63 int isadma_map __P((caddr_t, vm_size_t, struct isadma_seg *, int)); 64 void isadma_unmap __P((caddr_t, vm_size_t, int, struct isadma_seg *)); 65 void isadma_copytobuf __P((caddr_t, vm_size_t, int, struct isadma_seg *)); 66 void isadma_copyfrombuf __P((caddr_t, vm_size_t, int, struct isadma_seg *)); 67 68 #define isadma_acquire(c) isa_dma_acquire(isa_dev, (c)) 69 #define isadma_release(c) isa_dma_release(isa_dev, (c)) 70 #define isadma_cascade(c) isa_dmacascade(isa_dev, (c)) 71 #define isadma_start(a, s, c, f) \ 72 isa_dmastart(isa_dev, (c), (a), (s), 0, (f), BUS_DMA_WAITOK|BUS_DMA_BUS1) 73 #define isadma_abort(c) isa_dmaabort(isa_dev, (c)) 74 #define isadma_finished(c) isa_dmafinished(isa_dev, (c)) 75 #define isadma_done(c) isa_dmadone(isa_dev, (c)) 76 77 #endif /* __ISADMA_COMPAT */ 78 79 #define MAX_ISADMA 65536 80 81 #define DMAMODE_WRITE 0 82 #define DMAMODE_READ 1 83 #define DMAMODE_LOOP 2 84 85 struct proc; 86 87 void isa_dmacascade __P((struct device *, int)); 88 89 int isa_dmamap_create __P((struct device *, int, bus_size_t, int)); 90 void isa_dmamap_destroy __P((struct device *, int)); 91 92 int isa_dmastart __P((struct device *, int, void *, bus_size_t, 93 struct proc *, int, int)); 94 void isa_dmaabort __P((struct device *, int)); 95 bus_size_t isa_dmacount __P((struct device *, int)); 96 int isa_dmafinished __P((struct device *, int)); 97 void isa_dmadone __P((struct device *, int)); 98 99 int isa_dmamem_alloc __P((struct device *, int, bus_size_t, 100 bus_addr_t *, int)); 101 void isa_dmamem_free __P((struct device *, int, bus_addr_t, bus_size_t)); 102 int isa_dmamem_map __P((struct device *, int, bus_addr_t, bus_size_t, 103 caddr_t *, int)); 104 void isa_dmamem_unmap __P((struct device *, int, caddr_t, size_t)); 105 int isa_dmamem_mmap __P((struct device *, int, bus_addr_t, bus_size_t, 106 int, int, int)); 107 108 int isa_drq_isfree __P((struct device *, int)); 109 110 void *isa_malloc __P((struct device *, int, size_t, int, int)); 111 void isa_free __P((void *, int)); 112 int isa_mappage __P((void *, int, int)); 113