Home | History | Annotate | Line # | Download | only in hil
      1  1.3  tsutsui /*	$NetBSD: hilvar.h,v 1.3 2022/06/25 02:36:27 tsutsui Exp $	*/
      2  1.1  tsutsui /*	$OpenBSD: hilvar.h,v 1.10 2006/11/05 14:39:32 miod Exp $	*/
      3  1.1  tsutsui /*
      4  1.1  tsutsui  * Copyright (c) 2003, Miodrag Vallat.
      5  1.1  tsutsui  * All rights reserved.
      6  1.1  tsutsui  *
      7  1.1  tsutsui  * Redistribution and use in source and binary forms, with or without
      8  1.1  tsutsui  * modification, are permitted provided that the following conditions
      9  1.1  tsutsui  * are met:
     10  1.1  tsutsui  * 1. Redistributions of source code must retain the above copyright
     11  1.1  tsutsui  *    notice, this list of conditions and the following disclaimer.
     12  1.1  tsutsui  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  tsutsui  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  tsutsui  *    documentation and/or other materials provided with the distribution.
     15  1.1  tsutsui  *
     16  1.1  tsutsui  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  1.1  tsutsui  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     18  1.1  tsutsui  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     19  1.1  tsutsui  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
     20  1.1  tsutsui  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     21  1.1  tsutsui  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     22  1.1  tsutsui  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     23  1.1  tsutsui  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     24  1.1  tsutsui  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
     25  1.1  tsutsui  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26  1.1  tsutsui  * POSSIBILITY OF SUCH DAMAGE.
     27  1.1  tsutsui  *
     28  1.1  tsutsui  */
     29  1.1  tsutsui 
     30  1.1  tsutsui /*
     31  1.1  tsutsui  * Copyright (c) 1988 University of Utah.
     32  1.1  tsutsui  * Copyright (c) 1990, 1993
     33  1.1  tsutsui  *	The Regents of the University of California.  All rights reserved.
     34  1.1  tsutsui  *
     35  1.1  tsutsui  * This code is derived from software contributed to Berkeley by
     36  1.1  tsutsui  * the Systems Programming Group of the University of Utah Computer
     37  1.1  tsutsui  * Science Department.
     38  1.1  tsutsui  *
     39  1.1  tsutsui  * Redistribution and use in source and binary forms, with or without
     40  1.1  tsutsui  * modification, are permitted provided that the following conditions
     41  1.1  tsutsui  * are met:
     42  1.1  tsutsui  * 1. Redistributions of source code must retain the above copyright
     43  1.1  tsutsui  *    notice, this list of conditions and the following disclaimer.
     44  1.1  tsutsui  * 2. Redistributions in binary form must reproduce the above copyright
     45  1.1  tsutsui  *    notice, this list of conditions and the following disclaimer in the
     46  1.1  tsutsui  *    documentation and/or other materials provided with the distribution.
     47  1.1  tsutsui  * 3. Neither the name of the University nor the names of its contributors
     48  1.1  tsutsui  *    may be used to endorse or promote products derived from this software
     49  1.1  tsutsui  *    without specific prior written permission.
     50  1.1  tsutsui  *
     51  1.1  tsutsui  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     52  1.1  tsutsui  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     53  1.1  tsutsui  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     54  1.1  tsutsui  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     55  1.1  tsutsui  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     56  1.1  tsutsui  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     57  1.1  tsutsui  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     58  1.1  tsutsui  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     59  1.1  tsutsui  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     60  1.1  tsutsui  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     61  1.1  tsutsui  * SUCH DAMAGE.
     62  1.1  tsutsui  *
     63  1.1  tsutsui  * from: Utah $Hdr: hilvar.h 1.3 92/01/21$
     64  1.1  tsutsui  *
     65  1.1  tsutsui  *	@(#)hilvar.h	8.1 (Berkeley) 6/10/93
     66  1.1  tsutsui  */
     67  1.1  tsutsui 
     68  1.3  tsutsui #include <sys/rndsource.h>
     69  1.3  tsutsui 
     70  1.1  tsutsui #define NHILD		8		/* 7 actual + loop pseudo (dev 0) */
     71  1.1  tsutsui 
     72  1.1  tsutsui struct hildev_softc;
     73  1.1  tsutsui 
     74  1.1  tsutsui struct hil_softc {
     75  1.1  tsutsui 	device_t	sc_dev;
     76  1.1  tsutsui 	bus_space_handle_t sc_bsh;
     77  1.1  tsutsui 	bus_space_tag_t	sc_bst;
     78  1.1  tsutsui 	int		*sc_console;	/* console path set to hil */
     79  1.1  tsutsui 
     80  1.1  tsutsui 	lwp_t		*sc_thread;	/* event handling thread */
     81  1.1  tsutsui 
     82  1.1  tsutsui 	int		sc_cmddone;
     83  1.1  tsutsui 	int		sc_cmdending;
     84  1.1  tsutsui 	u_int		sc_actdev;	/* current input device */
     85  1.1  tsutsui 	u_int		sc_cmddev;	/* device to perform command on */
     86  1.2  tsutsui 	uint8_t		sc_pollbuf[HILBUFSIZE];	/* interrupt time input buf */
     87  1.2  tsutsui 	uint8_t		sc_cmdbuf[HILBUFSIZE];
     88  1.2  tsutsui 	uint8_t		*sc_pollbp;	/* pointer into sc_pollbuf */
     89  1.2  tsutsui 	uint8_t		*sc_cmdbp;	/* pointer into sc_cmdbuf */
     90  1.1  tsutsui 
     91  1.1  tsutsui 	int		sc_status;	/* initialization status */
     92  1.1  tsutsui #define	HIL_STATUS_BUSY		0x00
     93  1.1  tsutsui #define	HIL_STATUS_READY	0x01
     94  1.1  tsutsui 	int		sc_pending;	/* reconfiguration events in progress */
     95  1.1  tsutsui #define	HIL_PENDING_RECONFIG	0x01
     96  1.1  tsutsui #define	HIL_PENDING_UNPLUGGED	0x02
     97  1.1  tsutsui 	u_int		sc_maxdev;	/* number of devices on loop */
     98  1.1  tsutsui 	device_t	sc_devices[NHILD];	/* interrupt dispatcher */
     99  1.3  tsutsui 	krndsource_t	sc_rndsource;
    100  1.1  tsutsui };
    101  1.1  tsutsui 
    102  1.1  tsutsui #ifdef _KERNEL
    103  1.1  tsutsui 
    104  1.2  tsutsui int	send_hil_cmd(struct hil_softc *, u_int, uint8_t *, u_int, uint8_t *);
    105  1.2  tsutsui int	send_hildev_cmd(struct hildev_softc *, u_int, uint8_t *, u_int *);
    106  1.1  tsutsui void	hil_set_poll(struct hil_softc *, int);
    107  1.2  tsutsui int	hil_poll_data(struct hildev_softc *, uint8_t *, uint8_t *);
    108  1.1  tsutsui 
    109  1.1  tsutsui void	hil_attach(struct hil_softc *, int *);
    110  1.1  tsutsui void	hil_attach_deferred(device_t);
    111  1.1  tsutsui int	hil_intr(void *);
    112  1.1  tsutsui int	hildevprint(void *, const char *);
    113  1.1  tsutsui 
    114  1.1  tsutsui #endif /* _KERNEL */
    115