1100882Smike/* $NetBSD: dmavar.h,v 1.13 2005/12/11 12:17:13 christos Exp $ */ 2100882Smike 3100882Smike/*- 4100882Smike * Copyright (c) 1997 The NetBSD Foundation, Inc. 5100882Smike * All rights reserved. 6100882Smike * 7100882Smike * This code is derived from software contributed to The NetBSD Foundation 8100882Smike * by Jason R. Thorpe. 9100882Smike * 10100882Smike * Redistribution and use in source and binary forms, with or without 11100882Smike * modification, are permitted provided that the following conditions 12100882Smike * are met: 13100882Smike * 1. Redistributions of source code must retain the above copyright 14100882Smike * notice, this list of conditions and the following disclaimer. 15100882Smike * 2. Redistributions in binary form must reproduce the above copyright 16100882Smike * notice, this list of conditions and the following disclaimer in the 17100882Smike * documentation and/or other materials provided with the distribution. 18100882Smike * 19100882Smike * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20100882Smike * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21100882Smike * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22100882Smike * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23100882Smike * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24100882Smike * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25100882Smike * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26100882Smike * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27100882Smike * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28100882Smike * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29100882Smike * POSSIBILITY OF SUCH DAMAGE. 30100882Smike */ 31100882Smike 32100882Smike/* 33100882Smike * Copyright (c) 1982, 1990, 1993 34100882Smike * The Regents of the University of California. All rights reserved. 35100882Smike * 36100882Smike * Redistribution and use in source and binary forms, with or without 37100882Smike * modification, are permitted provided that the following conditions 38100882Smike * are met: 39100882Smike * 1. Redistributions of source code must retain the above copyright 40100882Smike * notice, this list of conditions and the following disclaimer. 41100882Smike * 2. Redistributions in binary form must reproduce the above copyright 42100882Smike * notice, this list of conditions and the following disclaimer in the 43100882Smike * documentation and/or other materials provided with the distribution. 44100882Smike * 3. Neither the name of the University nor the names of its contributors 45100882Smike * may be used to endorse or promote products derived from this software 46100882Smike * without specific prior written permission. 47100882Smike * 48100882Smike * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 49100882Smike * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 50100882Smike * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 51100882Smike * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 52209975Snwhitehorn * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 53217147Stijl * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 54209975Snwhitehorn * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 55209975Snwhitehorn * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 56209975Snwhitehorn * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57209975Snwhitehorn * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58100882Smike * SUCH DAMAGE. 59209975Snwhitehorn * 60100882Smike * @(#)dmavar.h 8.1 (Berkeley) 6/10/93 61217147Stijl */ 62217147Stijl 63217147Stijl#include <sys/queue.h> 64100882Smike 65100882Smike/* dmago flags */ 66100882Smike#define DMAGO_BYTE 0x00 /* do byte (8 bit) transfers */ 67100882Smike#define DMAGO_WORD 0x01 /* do word (16 bit) transfers */ 68255194Simp#define DMAGO_LWORD 0x02 /* do longword (32 bit) transfers */ 69229494Sandreast#define DMAGO_PRI 0x04 /* do "priority" DMA */ 70229494Sandreast#define DMAGO_READ 0x08 /* transfer is a read */ 71229494Sandreast#define DMAGO_NOINT 0x80 /* don't interrupt on completion */ 72229494Sandreast 73229494Sandreast/* dma "controllers" (channels) */ 74229494Sandreast#define DMA0 0x1 75229494Sandreast#define DMA1 0x2 76255194Simp 77229494Sandreast/* 78100882Smike * A DMA queue entry. Initiator drivers each have one of these, 79100882Smike * used to queue access to the DMA controller. 80100882Smike */ 81100882Smikestruct dmaqueue { 82100882Smike TAILQ_ENTRY(dmaqueue) dq_list; /* entry on the queue */ 83100882Smike int dq_chan; /* OR of channels initiator can use */ 84100882Smike void *dq_softc; /* initiator's softc */ 85100882Smike 86229494Sandreast /* 87100882Smike * These functions are called to start the initiator when 88100882Smike * it has been given the DMA controller, and to stop the 89100882Smike * initiator when the DMA controller has stopped. 90100882Smike */ 91100882Smike void (*dq_start)(void *); 92229494Sandreast void (*dq_done)(void *); 93100882Smike}; 94100882Smike 95100882Smike#ifdef _KERNEL 96100882Smikevoid dmainit(void); 97217147Stijlvoid dmago(int, char *, int, int); 98229494Sandreastvoid dmastop(int); 99100882Smikevoid dmafree(struct dmaqueue *); 100100882Smikeint dmareq(struct dmaqueue *); 101100882Smikevoid dmacomputeipl(void); 102100882Smike#endif /* _KERNEL */ 103100882Smike