Home | History | Annotate | Line # | Download | only in dev
intiovar.h revision 1.1.2.4
      1  1.1.2.4  minoura /*	$NetBSD: intiovar.h,v 1.1.2.4 1999/01/31 06:44:26 minoura Exp $	*/
      2  1.1.2.1  minoura 
      3  1.1.2.1  minoura /*
      4  1.1.2.1  minoura  *
      5  1.1.2.1  minoura  * Copyright (c) 1998 NetBSD Foundation, Inc.
      6  1.1.2.1  minoura  * All rights reserved.
      7  1.1.2.1  minoura  *
      8  1.1.2.1  minoura  * Redistribution and use in source and binary forms, with or without
      9  1.1.2.1  minoura  * modification, are permitted provided that the following conditions
     10  1.1.2.1  minoura  * are met:
     11  1.1.2.1  minoura  * 1. Redistributions of source code must retain the above copyright
     12  1.1.2.1  minoura  *    notice, this list of conditions and the following disclaimer.
     13  1.1.2.1  minoura  * 2. Redistributions in binary form must reproduce the above copyright
     14  1.1.2.1  minoura  *    notice, this list of conditions and the following disclaimer in the
     15  1.1.2.1  minoura  *    documentation and/or other materials provided with the distribution.
     16  1.1.2.1  minoura  * 3. All advertising materials mentioning features or use of this software
     17  1.1.2.1  minoura  *    must display the following acknowledgement:
     18  1.1.2.1  minoura  *      This product includes software developed by Charles D. Cranor and
     19  1.1.2.1  minoura  *      Washington University.
     20  1.1.2.1  minoura  * 4. The name of the author may not be used to endorse or promote products
     21  1.1.2.1  minoura  *    derived from this software without specific prior written permission.
     22  1.1.2.1  minoura  *
     23  1.1.2.1  minoura  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     24  1.1.2.1  minoura  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     25  1.1.2.1  minoura  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     26  1.1.2.1  minoura  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     27  1.1.2.1  minoura  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     28  1.1.2.1  minoura  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     29  1.1.2.1  minoura  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     30  1.1.2.1  minoura  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     31  1.1.2.1  minoura  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     32  1.1.2.1  minoura  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     33  1.1.2.1  minoura  */
     34  1.1.2.1  minoura 
     35  1.1.2.1  minoura /*
     36  1.1.2.1  minoura  * NetBSD/x68k internal I/O virtual bus.
     37  1.1.2.1  minoura  */
     38  1.1.2.1  minoura 
     39  1.1.2.1  minoura #ifndef _INTIOVAR_H_
     40  1.1.2.1  minoura #define _INTIOVAR_H_
     41  1.1.2.1  minoura 
     42  1.1.2.1  minoura #include <machine/frame.h>
     43  1.1.2.1  minoura #include <sys/malloc.h>
     44  1.1.2.1  minoura #include <sys/extent.h>
     45  1.1.2.1  minoura #include "locators.h"
     46  1.1.2.1  minoura 
     47  1.1.2.1  minoura #define cf_addr		cf_loc[INTIOCF_ADDR]
     48  1.1.2.1  minoura #define cf_intr		cf_loc[INTIOCF_INTR]
     49  1.1.2.1  minoura #define cf_dma		cf_loc[INTIOCF_DMA]
     50  1.1.2.4  minoura #define cf_dmaintr	cf_loc[INTIOCF_DMAINTR]
     51  1.1.2.1  minoura 
     52  1.1.2.1  minoura 
     53  1.1.2.1  minoura struct intio_attach_args {
     54  1.1.2.1  minoura 	bus_space_tag_t	ia_bst;	/* bus_space tag */
     55  1.1.2.1  minoura 	bus_dma_tag_t	ia_dmat; /* bus_dma tag */
     56  1.1.2.1  minoura 
     57  1.1.2.2  minoura 	char		*ia_name; /* device name */
     58  1.1.2.1  minoura 	int		ia_addr; /* addr */
     59  1.1.2.1  minoura 	int		ia_size;
     60  1.1.2.1  minoura 	int		ia_intr; /* interrupt vector */
     61  1.1.2.1  minoura 	int		ia_dma;	/* dma channel */
     62  1.1.2.4  minoura 	int		ia_dmaintr; /* interrupt vector for dmac */
     63  1.1.2.1  minoura };
     64  1.1.2.1  minoura 
     65  1.1.2.1  minoura struct intio_softc {
     66  1.1.2.1  minoura 	struct device	sc_dev;
     67  1.1.2.1  minoura 	bus_space_tag_t	sc_bst;
     68  1.1.2.1  minoura 	bus_dma_tag_t	sc_dmat;
     69  1.1.2.1  minoura 	struct extent	*sc_map;
     70  1.1.2.3  minoura 	struct device	*sc_dmac;
     71  1.1.2.1  minoura };
     72  1.1.2.1  minoura 
     73  1.1.2.1  minoura enum intio_map_flag {
     74  1.1.2.1  minoura 	INTIO_MAP_ALLOCATE = 0,
     75  1.1.2.1  minoura 	INTIO_MAP_TESTONLY = 1
     76  1.1.2.1  minoura };
     77  1.1.2.1  minoura int intio_map_allocate_region __P((struct device*, struct intio_attach_args*, enum intio_map_flag));
     78  1.1.2.1  minoura int intio_map_free_region __P((struct device*, struct intio_attach_args*));
     79  1.1.2.1  minoura 
     80  1.1.2.1  minoura 
     81  1.1.2.1  minoura typedef int (*intio_intr_handler_t) __P((void*));
     82  1.1.2.1  minoura 
     83  1.1.2.1  minoura int intio_intr_establish __P((int, const char *, intio_intr_handler_t, void *));
     84  1.1.2.1  minoura int intio_intr_disestablish __P((int, void *));
     85  1.1.2.1  minoura int intio_intr __P((struct frame *));
     86  1.1.2.1  minoura 
     87  1.1.2.1  minoura 
     88  1.1.2.1  minoura #define PHYS_INTIODEV 0x00c00000
     89  1.1.2.1  minoura 
     90  1.1.2.1  minoura extern u_int8_t *intiobase;
     91  1.1.2.1  minoura 
     92  1.1.2.1  minoura #define INTIO_ADDR(a)	((volatile u_int8_t *) (((u_int32_t) (a)) - (PHYS_INTIODEV) + intiobase))
     93  1.1.2.1  minoura 
     94  1.1.2.1  minoura #define INTIO_SYSPORT		(0x00e8e000)
     95  1.1.2.1  minoura #define intio_sysport		INTIO_ADDR(INTIO_SYSPORT)
     96  1.1.2.1  minoura #define sysport_contrast	1
     97  1.1.2.1  minoura #define sysport_tvctrl		3
     98  1.1.2.1  minoura #define sysport_imageunit	5
     99  1.1.2.1  minoura #define sysport_keyctrl		7
    100  1.1.2.1  minoura #define sysport_waitctrl	9
    101  1.1.2.1  minoura #define sysport_mpustat		11
    102  1.1.2.1  minoura #define sysport_sramwp		13
    103  1.1.2.1  minoura #define sysport_powoff		15
    104  1.1.2.1  minoura 
    105  1.1.2.1  minoura #define intio_set_sysport_contrast(a) \
    106  1.1.2.1  minoura 	intio_sysport[sysport_contrast] = (a) /* 0-15 */
    107  1.1.2.1  minoura #define intio_set_sysport_tvctrl(a) \
    108  1.1.2.1  minoura 	intio_sysport[sysport_tvctrl] = (a)
    109  1.1.2.1  minoura #define INTIO_SYSPORT_TVCTRL	0x08
    110  1.1.2.1  minoura #define intio_set_sysport_imageunit(a) \
    111  1.1.2.1  minoura 	intio_sysport[sysport_imageunit] = (a)
    112  1.1.2.1  minoura #define intio_set_sysport_keyctrl(a) \
    113  1.1.2.1  minoura 	intio_sysport[sysport_keyctrl] = (a)
    114  1.1.2.1  minoura #define INTIO_SYSPORT_KBENABLE	0x08
    115  1.1.2.1  minoura #define intio_set_sysport_waitctrl(a) \
    116  1.1.2.1  minoura 	intio_sysport[sysport_waitctrl] = (a) /* X68030 only */
    117  1.1.2.1  minoura #define intio_set_sysport_sramwp(a) \
    118  1.1.2.1  minoura 	intio_sysport[sysport_sramwp] = (a)
    119  1.1.2.1  minoura #define INTIO_SYSPORT_SRAMWP	0x31
    120  1.1.2.1  minoura #define intio_set_sysport_powoff(a) \
    121  1.1.2.1  minoura 	intio_sysport[sysport_powoff] = (a)
    122  1.1.2.1  minoura 
    123  1.1.2.1  minoura #define intio_get_sysport_contrast() \
    124  1.1.2.1  minoura 	(intio_sysport[sysport_contrast])
    125  1.1.2.1  minoura #define intio_get_sysport_tvctrl() \
    126  1.1.2.1  minoura 	(intio_sysport[sysport_tvctrl])
    127  1.1.2.1  minoura #define INTIO_SYSPORT_TVSTAT	0x08
    128  1.1.2.1  minoura #define intio_get_sysport_keyctrl() \
    129  1.1.2.1  minoura 	(intio_sysport[sysport_keyctrl])
    130  1.1.2.1  minoura #define INTIO_SYSPORT_KBEXIST	0x08
    131  1.1.2.1  minoura #define intio_get_sysport_waitctrl() \
    132  1.1.2.1  minoura 	(intio_sysport[sysport_waitctrl])
    133  1.1.2.1  minoura #define intio_get_sysport_mpustat() \
    134  1.1.2.1  minoura 	(intio_sysport[sysport_mpustat])
    135  1.1.2.3  minoura 
    136  1.1.2.3  minoura struct intio_dma_cookie {
    137  1.1.2.3  minoura 	int	id_flags;		/* flags; see below */
    138  1.1.2.3  minoura 
    139  1.1.2.3  minoura 	/*
    140  1.1.2.3  minoura 	 * Information about the original buffer used during
    141  1.1.2.3  minoura 	 * DMA map syncs.  Note that origibuflen is only used
    142  1.1.2.3  minoura 	 * for ID_BUFTYPE_LINEAR.
    143  1.1.2.3  minoura 	 */
    144  1.1.2.3  minoura 	void	*id_origbuf;		/* pointer to orig buffer if
    145  1.1.2.3  minoura 					   bouncing */
    146  1.1.2.3  minoura 	bus_size_t id_origbuflen;	/* ...and size */
    147  1.1.2.3  minoura 	int	id_buftype;		/* type of buffer */
    148  1.1.2.3  minoura 
    149  1.1.2.3  minoura 	void	*id_bouncebuf;		/* pointer to the bounce buffer */
    150  1.1.2.3  minoura 	bus_size_t id_bouncebuflen;	/* ...and size */
    151  1.1.2.3  minoura 	int	id_nbouncesegs;		/* number of valid bounce segs */
    152  1.1.2.3  minoura 	bus_dma_segment_t id_bouncesegs[0]; /* array of bounce buffer
    153  1.1.2.3  minoura 					       physical memory segments */
    154  1.1.2.3  minoura };
    155  1.1.2.3  minoura 
    156  1.1.2.3  minoura /* id_flags */
    157  1.1.2.3  minoura #define	ID_MIGHT_NEED_BOUNCE	0x01	/* map could need bounce buffers */
    158  1.1.2.3  minoura #define	ID_HAS_BOUNCE		0x02	/* map currently has bounce buffers */
    159  1.1.2.3  minoura #define	ID_IS_BOUNCING		0x04	/* map is bouncing current xfer */
    160  1.1.2.3  minoura 
    161  1.1.2.3  minoura /* id_buftype */
    162  1.1.2.3  minoura #define	ID_BUFTYPE_INVALID	0
    163  1.1.2.3  minoura #define	ID_BUFTYPE_LINEAR	1
    164  1.1.2.3  minoura #define	ID_BUFTYPE_MBUF		2
    165  1.1.2.3  minoura #define	ID_BUFTYPE_UIO		3
    166  1.1.2.3  minoura #define	ID_BUFTYPE_RAW		4
    167  1.1.2.1  minoura 
    168  1.1.2.1  minoura #endif
    169