No empty .Rs/.Re
[netbsd-mini2440.git] / sys / arch / hp300 / dev / hilvar.h
blob1f54f94dac3c2b7f7607d7594401aa43847d389c
1 /* $NetBSD: hilvar.h,v 1.24 2007/12/31 13:38:49 ad Exp $ */
3 /*
4 * Copyright (c) 1990, 1993
5 * The Regents of the University of California. All rights reserved.
7 * This code is derived from software contributed to Berkeley by
8 * the Systems Programming Group of the University of Utah Computer
9 * Science Department.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
35 * from: Utah $Hdr: hilvar.h 1.3 92/01/21$
37 * @(#)hilvar.h 8.1 (Berkeley) 6/10/93
40 * Copyright (c) 1988 University of Utah.
42 * This code is derived from software contributed to Berkeley by
43 * the Systems Programming Group of the University of Utah Computer
44 * Science Department.
46 * Redistribution and use in source and binary forms, with or without
47 * modification, are permitted provided that the following conditions
48 * are met:
49 * 1. Redistributions of source code must retain the above copyright
50 * notice, this list of conditions and the following disclaimer.
51 * 2. Redistributions in binary form must reproduce the above copyright
52 * notice, this list of conditions and the following disclaimer in the
53 * documentation and/or other materials provided with the distribution.
54 * 3. All advertising materials mentioning features or use of this software
55 * must display the following acknowledgement:
56 * This product includes software developed by the University of
57 * California, Berkeley and its contributors.
58 * 4. Neither the name of the University nor the names of its contributors
59 * may be used to endorse or promote products derived from this software
60 * without specific prior written permission.
62 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
63 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
64 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
65 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
66 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
67 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
68 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
69 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
70 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
71 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
72 * SUCH DAMAGE.
74 * from: Utah $Hdr: hilvar.h 1.3 92/01/21$
76 * @(#)hilvar.h 8.1 (Berkeley) 6/10/93
79 #define NHILD 8 /* 7 actual + loop pseudo (dev 0) */
80 #define NHILQ 8 /* must be <= sizeof(int) */
82 #define HILBUFSIZE 40 /* size of interrupt poll buffer */
83 #define HILMAXCLIST 1024 /* max chars in clists for HPUX io */
85 #define HILLOOPDEV 0 /* loop device index */
88 * Minor device numbers.
89 * HP-UX uses 12 bits of the form:
90 * LLLLDDDD0000
91 * where L is 4 bits of loop number, D 4 bits of device and 4 bits of 0.
92 * BSD uses 8 bits:
93 * LLLLDDDD
94 * Device files are in BSD format, we map device numbers to HP-UX format
95 * on stat calls.
97 #define HILUNIT(d) ((d) & 0xF)
98 #define HILLOOP(d) (((d)>>4) & 0xF)
100 #define hildevmask(d) (1 << (d))
101 #define hilqmask(q) (1 << (q))
103 struct hiliqueue {
104 HILQ *hq_eventqueue; /* input queue shared with user */
105 struct proc *hq_procp; /* process this queue belongs to */
106 char hq_devmask; /* devices mapped to this queue */
109 struct hilloopdev {
110 int hd_flags; /* device state */
111 int hd_qmask; /* queues this device is mapped to */
112 struct clist hd_queue; /* event queue for HPUX-style input */
113 struct selinfo hd_selr; /* process read selecting */
114 uid_t hd_uid; /* uid of mapping process */
117 /* hd_flags */
118 #define HIL_ALIVE 0x01 /* device is present */
119 #define HIL_PSEUDO 0x02 /* device is virtual */
120 #define HIL_READIN 0x04 /* device using read() input interface */
121 #define HIL_QUEUEIN 0x08 /* device using shared Q input interface */
122 #define HIL_OPENED 0x10 /* flag for first open */
123 #define HIL_NOBLOCK 0x20 /* device is in non-blocking read mode */
124 #define HIL_ASLEEP 0x40 /* process awaiting input on device */
125 #define HIL_DERROR 0x80 /* loop has reconfigured, reality altered */
127 struct hil_softc {
128 device_t sc_dev;
129 struct hil_dev *sc_addr; /* base of hardware registers */
130 uint8_t sc_cmddone; /* */
131 uint8_t sc_cmdending; /* */
132 uint8_t sc_actdev; /* current input device */
133 uint8_t sc_cmddev; /* device to perform command on */
134 uint8_t sc_pollbuf[HILBUFSIZE]; /* interrupt time input buffer */
135 uint8_t sc_cmdbuf[HILBUFSIZE]; /* */
136 uint8_t *sc_pollbp; /* pointer into hl_pollbuf */
137 uint8_t *sc_cmdbp; /* pointer into hl_cmdbuf */
138 struct hiliqueue sc_queue[NHILQ]; /* input queues */
139 struct hilloopdev sc_device[NHILD]; /* device data */
140 uint8_t sc_maxdev; /* number of devices on loop */
141 uint8_t sc_kbddev; /* keyboard device on loop */
142 uint8_t sc_kbdlang; /* keyboard language */
143 uint8_t sc_kbdflags; /* keyboard state */
144 #if NRND > 0
145 rndsource_element_t rnd_source;
146 #endif
149 /* hl_kbdflags */
150 #define KBD_RAW 0x01 /* keyboard is raw */
151 #define KBD_AR1 0x02 /* keyboard auto-repeat rate 1 */
152 #define KBD_AR2 0x04 /* keyboard auto-repeat rate 2 */
154 #ifdef _KERNEL
155 void hilkbdbell(void *);
156 void hilkbdenable(void *);
157 void hilkbddisable(void *);
158 int hilkbdcngetc(int *);
159 int hilkbdcnattach(bus_space_tag_t, bus_addr_t);
161 int kbdnmi(void);
163 void hilsoftinit(int, struct hil_dev *);
164 void hilinit(int, struct hil_dev *);
166 void send_hil_cmd(struct hil_dev *, u_char,
167 u_char *, u_char, u_char *);
168 void send_hildev_cmd(struct hil_softc *, char, char);
170 void polloff(struct hil_dev *);
171 void pollon(struct hil_dev *);
173 #endif /* _KERNEL */