Home | History | Annotate | Line # | Download | only in hpc
hpciovar.h revision 1.4.2.2
      1  1.4.2.2  nathanw /*	$NetBSD: hpciovar.h,v 1.4.2.2 2001/06/21 20:01:40 nathanw Exp $	*/
      2  1.4.2.2  nathanw 
      3  1.4.2.2  nathanw /*-
      4  1.4.2.2  nathanw  * Copyright (c) 2001 TAKEMURA Shin.
      5  1.4.2.2  nathanw  * All rights reserved.
      6  1.4.2.2  nathanw  *
      7  1.4.2.2  nathanw  * Redistribution and use in source and binary forms, with or without
      8  1.4.2.2  nathanw  * modification, are permitted provided that the following conditions
      9  1.4.2.2  nathanw  * are met:
     10  1.4.2.2  nathanw  * 1. Redistributions of source code must retain the above copyright
     11  1.4.2.2  nathanw  *    notice, this list of conditions and the following disclaimer.
     12  1.4.2.2  nathanw  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.4.2.2  nathanw  *    notice, this list of conditions and the following disclaimer in the
     14  1.4.2.2  nathanw  *    documentation and/or other materials provided with the distribution.
     15  1.4.2.2  nathanw  * 3. Neither the name of the project nor the names of its contributors
     16  1.4.2.2  nathanw  *    may be used to endorse or promote products derived from this software
     17  1.4.2.2  nathanw  *    without specific prior written permission.
     18  1.4.2.2  nathanw  *
     19  1.4.2.2  nathanw  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     20  1.4.2.2  nathanw  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21  1.4.2.2  nathanw  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22  1.4.2.2  nathanw  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     23  1.4.2.2  nathanw  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24  1.4.2.2  nathanw  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25  1.4.2.2  nathanw  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26  1.4.2.2  nathanw  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27  1.4.2.2  nathanw  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28  1.4.2.2  nathanw  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29  1.4.2.2  nathanw  * SUCH DAMAGE.
     30  1.4.2.2  nathanw  *
     31  1.4.2.2  nathanw  */
     32  1.4.2.2  nathanw 
     33  1.4.2.2  nathanw #ifndef _DEV_HPC_HPCIOVAR_H_
     34  1.4.2.2  nathanw #define _DEV_HPC_HPCIOVAR_H_
     35  1.4.2.2  nathanw 
     36  1.4.2.2  nathanw struct hpcio_chip;
     37  1.4.2.2  nathanw typedef struct hpcio_chip *hpcio_chip_t;
     38  1.4.2.2  nathanw typedef void *hpcio_intr_handle_t;
     39  1.4.2.2  nathanw struct hpcio_chip {
     40  1.4.2.2  nathanw 	int hc_chipid;
     41  1.4.2.2  nathanw 	char *hc_name;
     42  1.4.2.2  nathanw 	void *hc_sc;
     43  1.4.2.2  nathanw 	int (*hc_portread)(hpcio_chip_t, int);
     44  1.4.2.2  nathanw 	void (*hc_portwrite)(hpcio_chip_t, int, int);
     45  1.4.2.2  nathanw 	hpcio_intr_handle_t(*hc_intr_establish)(hpcio_chip_t, int, int,
     46  1.4.2.2  nathanw 	    int (*)(void *), void *);
     47  1.4.2.2  nathanw 	void (*hc_intr_disestablish)(hpcio_chip_t, hpcio_intr_handle_t);
     48  1.4.2.2  nathanw 	void (*hc_intr_clear)(hpcio_chip_t, hpcio_intr_handle_t);
     49  1.4.2.2  nathanw 	void (*hc_register_iochip)(hpcio_chip_t, hpcio_chip_t);
     50  1.4.2.2  nathanw 	void (*hc_update)(hpcio_chip_t);
     51  1.4.2.2  nathanw 	void (*hc_dump)(hpcio_chip_t);
     52  1.4.2.2  nathanw };
     53  1.4.2.2  nathanw 
     54  1.4.2.2  nathanw struct hpcio_attach_args {
     55  1.4.2.2  nathanw 	char *haa_busname;
     56  1.4.2.2  nathanw 	void *haa_sc;
     57  1.4.2.2  nathanw 	hpcio_chip_t (*haa_getchip)(void*, int);
     58  1.4.2.2  nathanw 	bus_space_tag_t haa_iot;	/* I/O space tag */
     59  1.4.2.2  nathanw };
     60  1.4.2.2  nathanw #define HPCIO_BUSNAME	"hpcioif"
     61  1.4.2.2  nathanw 
     62  1.4.2.2  nathanw #define hpcio_portread(hc, port)					\
     63  1.4.2.2  nathanw 		((*(hc)->hc_portread)((hc), (port)))
     64  1.4.2.2  nathanw #define hpcio_portwrite(hc, port, data)					\
     65  1.4.2.2  nathanw 		((*(hc)->hc_portwrite)((hc), (port), (data)))
     66  1.4.2.2  nathanw #define hpcio_intr_establish(hc, port, mode, func, arg)			\
     67  1.4.2.2  nathanw 		((*(hc)->hc_intr_establish)((hc),(port),(mode),(func),(arg)))
     68  1.4.2.2  nathanw #define hpcio_intr_disestablish(hc, handle)				\
     69  1.4.2.2  nathanw 		((*(hc)->hc_intr_disestablish)((hc), (handle)))
     70  1.4.2.2  nathanw #define hpcio_intr_clear(hc, handle)					\
     71  1.4.2.2  nathanw 		((*(hc)->hc_intr_clear)((hc), (handle)))
     72  1.4.2.2  nathanw #define hpcio_register_iochip(hc, iochip)				\
     73  1.4.2.2  nathanw 		((*(hc)->hc_register_iochip)((hc), (iochip)))
     74  1.4.2.2  nathanw #define hpcio_update(hc)						\
     75  1.4.2.2  nathanw 		((*(hc)->hc_update)(hc))
     76  1.4.2.2  nathanw #define hpcio_dump(hc)							\
     77  1.4.2.2  nathanw 		((*(hc)->hc_dump)(hc))
     78  1.4.2.2  nathanw 
     79  1.4.2.2  nathanw /* interrupt trigger options. */
     80  1.4.2.2  nathanw #define HPCIO_INTR_EDGE		(1<<0)
     81  1.4.2.2  nathanw #define HPCIO_INTR_LEVEL	(0<<0)
     82  1.4.2.2  nathanw #define HPCIO_INTR_HOLD		(1<<1)
     83  1.4.2.2  nathanw #define HPCIO_INTR_THROUGH	(0<<1)
     84  1.4.2.2  nathanw #define HPCIO_INTR_HIGH		(1<<2)
     85  1.4.2.2  nathanw #define HPCIO_INTR_LOW		(0<<2)
     86  1.4.2.2  nathanw #define HPCIO_INTR_POSEDGE	(1<<3)
     87  1.4.2.2  nathanw #define HPCIO_INTR_NEGEDGE	(1<<4)
     88  1.4.2.2  nathanw 
     89  1.4.2.2  nathanw #define HPCIO_INTR_LEVEL_HIGH_HOLD					\
     90  1.4.2.2  nathanw 		(HPCIO_INTR_LEVEL|HPCIO_INTR_HIGH|HPCIO_INTR_HOLD)
     91  1.4.2.2  nathanw #define HPCIO_INTR_LEVEL_HIGH_THROUGH					\
     92  1.4.2.2  nathanw 		(HPCIO_INTR_LEVEL|HPCIO_INTR_HIGH|HPCIO_INTR_THROUGH)
     93  1.4.2.2  nathanw #define HPCIO_INTR_LEVEL_LOW_HOLD					\
     94  1.4.2.2  nathanw 		(HPCIO_INTR_LEVEL|HPCIO_INTR_LOW|HPCIO_INTR_HOLD)
     95  1.4.2.2  nathanw #define HPCIO_INTR_LEVEL_LOW_THROUGH					\
     96  1.4.2.2  nathanw 		(HPCIO_INTR_LEVEL|HPCIO_INTR_LOW|HPCIO_INTR_THROUGH)
     97  1.4.2.2  nathanw #define HPCIO_INTR_EDGE_HOLD						\
     98  1.4.2.2  nathanw 		(HPCIO_INTR_EDGE|HPCIO_INTR_HOLD)
     99  1.4.2.2  nathanw #define HPCIO_INTR_EDGE_THROUGH						\
    100  1.4.2.2  nathanw 		(HPCIO_INTR_EDGE|HPCIO_INTR_THROUGH)
    101  1.4.2.2  nathanw 
    102  1.4.2.2  nathanw #endif /* !_DEV_HPC_HPCIOVAR_H_ */
    103