Home | History | Annotate | Line # | Download | only in include
dma.h revision 1.10
      1  1.10  tsutsui /*	$NetBSD: dma.h,v 1.10 2009/03/05 13:00:45 tsutsui Exp $	*/
      2   1.1      leo 
      3   1.1      leo /*
      4   1.1      leo  * Copyright (c) 1995 Leo Weppelman.
      5   1.1      leo  * All rights reserved.
      6   1.1      leo  *
      7   1.1      leo  * Redistribution and use in source and binary forms, with or without
      8   1.1      leo  * modification, are permitted provided that the following conditions
      9   1.1      leo  * are met:
     10   1.1      leo  * 1. Redistributions of source code must retain the above copyright
     11   1.1      leo  *    notice, this list of conditions and the following disclaimer.
     12   1.1      leo  * 2. Redistributions in binary form must reproduce the above copyright
     13   1.1      leo  *    notice, this list of conditions and the following disclaimer in the
     14   1.1      leo  *    documentation and/or other materials provided with the distribution.
     15   1.1      leo  * 3. All advertising materials mentioning features or use of this software
     16   1.1      leo  *    must display the following acknowledgement:
     17   1.1      leo  *      This product includes software developed by Leo Weppelman.
     18   1.1      leo  * 4. The name of the author may not be used to endorse or promote products
     19   1.1      leo  *    derived from this software without specific prior written permission
     20   1.1      leo  *
     21   1.1      leo  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22   1.1      leo  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23   1.1      leo  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24   1.1      leo  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25   1.1      leo  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26   1.1      leo  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27   1.1      leo  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28   1.1      leo  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29   1.1      leo  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30   1.1      leo  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31   1.1      leo  */
     32   1.1      leo 
     33   1.1      leo #ifndef _MACHINE_DMA_H
     34   1.1      leo #define _MACHINE_DMA_H
     35   1.1      leo 
     36   1.1      leo /*
     37   1.1      leo  * Atari TT hardware:
     38   1.1      leo  * FDC/ACSI DMA circuitry
     39   1.1      leo  */
     40   1.1      leo 
     41   1.1      leo #define	DMA	((struct dma *)AD_DMA)
     42   1.1      leo 
     43   1.1      leo struct dma {
     44   1.3      leo 	volatile short	  dma_gap[2];	/* reserved			*/
     45   1.3      leo 	volatile u_short  dma_data;	/* controller data path		*/
     46   1.3      leo 	volatile u_short  dma_mode;	/* mode register		*/
     47   1.3      leo 	volatile u_char   dma_addr[6];	/* base address H/M/L		*/
     48   1.7      leo 	volatile u_short  dma_drvmode;	/* floppy density settings	*/
     49   1.1      leo };
     50   1.1      leo 
     51   1.1      leo #define	dma_nsec      dma_data		/* sector count			*/
     52   1.1      leo #define	dma_stat      dma_mode		/* status register		*/
     53   1.1      leo 
     54   1.1      leo /*
     55   1.1      leo  * Mode register bits
     56   1.1      leo  */
     57   1.3      leo /*			0x0001		*//* not used			*/
     58   1.3      leo #define	DMA_A0		0x0002		/* signal A0 to fdc/hdc		*/
     59   1.3      leo #define	DMA_A1		0x0004		/* signal A1 to fdc/hdc		*/
     60   1.3      leo #define	DMA_HDC		0x0008		/* must be on if accessing hdc	*/
     61   1.3      leo #define	DMA_SCREG	0x0010		/* access sector count register	*/
     62   1.3      leo /*			0x0020		*//* reserved			*/
     63   1.3      leo #define	DMA_NODMA	0x0040		/* no DMA (yet)			*/
     64   1.3      leo #define	DMA_FDC		0x0080		/* must be on if accessing fdc	*/
     65   1.3      leo #define	DMA_WRBIT	0x0100		/* write to fdc/hdc via dma_data*/
     66   1.3      leo #define	DMA_SCSI	0x0088		/* select 5380 chip		*/
     67   1.1      leo 
     68   1.1      leo /*
     69   1.1      leo  * Status register bits
     70   1.1      leo  */
     71   1.1      leo #define	DMAOK	0x0001		/* something wrong			*/
     72   1.1      leo #define	SCNOT0	0x0002		/* sector count not 0			*/
     73   1.1      leo #define	DATREQ	0x0004		/* FDC data request signal		*/
     74   1.1      leo 
     75   1.1      leo /*
     76   1.1      leo  * Indices into dma_addr.
     77   1.1      leo  * Access low byte of 16 bits.
     78   1.1      leo  * Fill low/mid/high in this order.
     79   1.1      leo  */
     80   1.1      leo #define	AD_HIGH	1
     81   1.1      leo #define	AD_MID	3
     82   1.1      leo #define	AD_LOW	5
     83   1.1      leo 
     84   1.1      leo /*
     85   1.1      leo  * Defines for 'dmadrv_mode'.
     86   1.1      leo  */
     87   1.1      leo #define	FDC_HDSET	1	/* Set FDC for High density		*/
     88   1.1      leo #define	FDC_HDSIG	2	/* Signal HD present to drive		*/
     89   1.3      leo 
     90   1.4      leo /*
     91   1.4      leo  * Lock status bits:
     92   1.4      leo  */
     93   1.4      leo #define	DMA_LOCK_REQ	1	/* DMA lock requested			*/
     94   1.4      leo #define	DMA_LOCK_GRANT	2	/* DMA lock granted			*/
     95   1.4      leo 
     96   1.3      leo #ifdef _KERNEL
     97   1.8      leo typedef void (*dma_farg)(void*);
     98   1.8      leo 
     99  1.10  tsutsui int	st_dmagrab(dma_farg, dma_farg, void *, int *, int);
    100  1.10  tsutsui void	st_dmafree(void *, int *);
    101  1.10  tsutsui int	st_dmawanted(void);
    102  1.10  tsutsui void	st_dmaaddr_set(void *);
    103  1.10  tsutsui u_long	st_dmaaddr_get(void);
    104  1.10  tsutsui void	st_dmacomm(int, int);
    105   1.3      leo #endif /* _KERNEL	*/
    106   1.3      leo 
    107   1.1      leo #endif /* _MACHINE_DMA_H */
    108