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