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