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