/*
 * This file is a product of Sun Microsystems, Inc. and is provided for
 * unrestricted use provided that this legend is included on all tape
 * media and as a part of the software program in whole or part.  Users
 * may copy or modify this file without charge, but are not authorized to
 * license or distribute it to anyone else except as part of a product
 * or program developed by the user.
 *
 * THIS FILE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
 * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
 *
 * This file is provided with no support and without any obligation on the
 * part of Sun Microsystems, Inc. to assist in its use, correction,
 * modification or enhancement.
 *
 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS FILE
 * OR ANY PART THEREOF.
 *
 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
 * or profits or other special, indirect and consequential damages, even
 * if Sun has been advised of the possibility of such damages.
 *
 * Sun Microsystems, Inc.
 * 2550 Garcia Avenue
 * Mountain View, California  94043
 *
 * @(#)dma_reg.h 1.2 93/05/19 Copyright 1993 Sun Microsystems
 */

#define	DMA_NAME	"dma"	/* name of device we operate */

typedef struct dma {				/* per-unit structure */
	dev_info_t		*dip;
	kmutex_t		mutex;
	kcondvar_t		cv;
	ddi_iblock_cookie_t	iblock_cookie;	/* for mutexes */
	ddi_dma_handle_t	handle;
	u_int			dmachan;	/* from driver.conf */
	ddi_dma_win_t		dmawin;
	ddi_dma_seg_t		dmaseg;
	struct ddi_dmae_req	dmaereq;
	struct buf		*bp;
	u_int			attach_flags;
	u_int			flags;
	Dma_csr			csr;		/* CSR port on device */
	Dma_addr		addr;		/* xfer addr for DMA access */
	Dma_count		count;		/* xfer cnt for DMA access */
} Dma;


/*
 * bit fields for Dma.flags
 */
#define	DMA_DEV_OPEN	0x00000001
#define	DMA_DEV_BUSY	0x00000002

/*
 * bit fields for Dma.attach_flags
 */
#define	SOFT_STATE_ALLOCATED	0x01
#define	INTERRUPT_ADDED		0x02
#define	MUTEX_ADDED		0x04
#define	MINOR_NODE_CREATED	0x08

/*
 * maximum transfer size
 */
#define	DMA_MINPHYS	0x0000FFFF	/* 64 K */

/*
 * other stuff
 */
#ifndef	TRUE
#define	TRUE	1
#define	FALSE	0
#endif	TRUE

#ifndef	OK
#define	OK	0
#endif	OK
