Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / hp300 / dev / hilioctl.h
blob8a7ad6e484870facec0fc3bcd35467322cfaae80
1 /* $NetBSD: hilioctl.h,v 1.8 2005/12/11 12:17:14 christos 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: hilioctl.h 1.10 92/01/21$
37 * @(#)hilioctl.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: hilioctl.h 1.10 92/01/21$
76 * @(#)hilioctl.h 8.1 (Berkeley) 6/10/93
79 struct _hilbell {
80 u_char duration;
81 u_char frequency;
84 struct _hilbuf16 {
85 u_char string[16];
88 struct _hilbuf11 {
89 u_char string[11];
92 struct _hilbuf5 {
93 u_char string[5];
96 struct _hilbuf4 {
97 u_char string[4];
100 struct _hilbuf2 {
101 u_char string[2];
104 struct hilqinfo {
105 int qid;
106 char *addr;
110 * HPUX ioctls (here for the benefit of the HIL driver).
111 * Named as they are under HPUX.
112 * The first set are loop device ioctls.
113 * The second set are ioctls for the 8042.
114 * Note that some are not defined as in HPUX
115 * due to the difference in the definitions of IOC_VOID.
117 #ifdef hp800
118 #define _IOHpux(x,y) _IO(x,y)
119 #else
120 #define _IOHpux(x,y) (IOC_IN|((x)<<8)|y) /* IOC_IN is IOC_VOID */
121 #endif
124 * The HP compiler (at least as of HP-UX 7.X) pads odd sized structures
125 * to a short boundary. To avoid issues of whether our compiler pads
126 * and, if so to what boundary, we explicitly state the values for
127 * troublesome ioctls:
129 * HILID (HILIOCID) _IOR('h',0x03, struct _hilbuf11),
130 * EFTRRT (HILIOCRRT) _IOR('H',0x31, struct _hilbuf5).
132 #define HILID 0x400C6803 /* Identify & describe */
133 #define HILSC _IOR('h',0x33, struct _hilbuf16) /* Security code */
134 #define HILRN _IOR('h',0x30, struct _hilbuf16) /* Report name */
135 #define HILRS _IOR('h',0x31, struct _hilbuf16) /* Report status */
136 #define HILED _IOR('h',0x32, struct _hilbuf16) /* Extended describe*/
137 #define HILDKR _IOHpux('h',0x3D) /* Disable autorepeat */
138 #define HILER1 _IOHpux('h',0x3E) /* Autorepeat 1/30 */
139 #define HILER2 _IOHpux('h',0x3F) /* Autorepeat 1/60 */
140 #define HILP1 _IOHpux('h',0x40) /* Prompt 1 */
141 #define HILP2 _IOHpux('h',0x41) /* Prompt 2 */
142 #define HILP3 _IOHpux('h',0x42) /* Prompt 3 */
143 #define HILP4 _IOHpux('h',0x43) /* Prompt 4 */
144 #define HILP5 _IOHpux('h',0x44) /* Prompt 5 */
145 #define HILP6 _IOHpux('h',0x45) /* Prompt 6 */
146 #define HILP7 _IOHpux('h',0x46) /* Prompt 7 */
147 #define HILP _IOHpux('h',0x47) /* Prompt */
148 #define HILA1 _IOHpux('h',0x48) /* Acknowledge 1 */
149 #define HILA2 _IOHpux('h',0x49) /* Acknowledge 2 */
150 #define HILA3 _IOHpux('h',0x4A) /* Acknowledge 3 */
151 #define HILA4 _IOHpux('h',0x4B) /* Acknowledge 4 */
152 #define HILA5 _IOHpux('h',0x4C) /* Acknowledge 5 */
153 #define HILA6 _IOHpux('h',0x4D) /* Acknowledge 6 */
154 #define HILA7 _IOHpux('h',0x4E) /* Acknowledge 7 */
155 #define HILA _IOHpux('h',0x4F) /* Acknowledge */
157 #define EFTSRD _IOW('H',0xa0,char) /* Set the repeat delay. */
158 #define EFTSRR _IOW('H',0xa2,char) /* Set the repeat rate. */
159 #define EFTSRPG _IOW('H',0xa6,char) /* Set RPG interrupt rate. */
160 #define EFTSBP _IOW('H',0xc4,struct _hilbuf4) /* Send data to the beeper. */
161 #define EFTRLC _IOR('H',0x12,char) /* Read the language code. */
162 #define EFTRCC _IOR('H',0x11,char) /* Read configuration code. */
163 #define EFTRRT 0x40064831 /* Read the real time. */
164 #define EFTRT _IOR('H',0xf4,struct _hilbuf4) /* Read the timers for the
165 four voices. */
166 #ifdef hp800
167 #define EFTSBI _IOW('H',0xa3,char) /* Do the beep thing. */
168 #else
169 #define EFTSBI _IOW('H',0xa3,struct _hilbuf2) /* Set the bell information. */
170 #endif
173 * BSD ioctls.
174 * Mostly the same as the HPUX versions except for shared-queue ioctls.
176 #define OHILIOCID 0x400B6803 /* XXX compat */
177 #define HILIOCID HILID
178 #define HILIOCSC _IOR('h',0x33, struct _hilbuf16)
179 #define HILIOCRN _IOR('h',0x30, struct _hilbuf16)
180 #define HILIOCRS _IOR('h',0x31, struct _hilbuf16)
181 #define HILIOCED _IOR('h',0x32, struct _hilbuf16)
182 #define HILIOCAROFF _IO('h',0x3D)
183 #define HILIOCAR1 _IO('h',0x3E)
184 #define HILIOCAR2 _IO('h',0x3F)
185 #define HILIOCSBP _IOW('H',0xc4,struct _hilbuf4)
186 #define OHILIOCRRT 0x40054831 /* XXX compat */
187 #define HILIOCRRT EFTRRT
188 #define HILIOCRT _IOR('H',0xf4,struct _hilbuf4)
189 #define HILIOCBEEP _IOW('H',0xA3,struct _hilbell)
190 # define BELLDUR 80 /* tone duration in msec (10 - 2560) */
191 # define BELLFREQ 8 /* tone frequency (0 - 63) */
193 #define HILIOCALLOCQ _IOWR('H',0x72, struct hilqinfo) /* allocate queue */
194 #define HILIOCFREEQ _IOW('H',0x73, struct hilqinfo) /* deallocate queue */
195 #define HILIOCMAPQ _IOW('H',0x74, int) /* map device to queue */
196 #define HILIOCUNMAPQ _IOW('H',0x75, int) /* unmap device from dev */
197 #define HILIOCTEST _IOW('H',0x76, int) /* Toggle debugging mode */
198 #define HILIOCHPUX _IO('H',0x77) /* use HPUX (read) semantics */
199 #define HILIOCRESET _IO('H',0x78) /* Reset the HIL loop. */
202 * HIL input queue.
203 * This is the circular queue (allocated by HILIOCALLOC) shared by kernel
204 * and user. It consists of a sixteen byte header followed by space for
205 * 255 input data packets (a total of 4096 bytes). The kernel adds packets
206 * at tail. The user is expected to remove packets from head. This is the
207 * only field in the header that the user should modify.
209 typedef struct hil_packet {
210 u_char size; /* total packet size */
211 u_char dev; /* loop device packet was generated by */
212 long tstamp; /* time stamp */
213 u_char data[10]; /* device data */
214 } hil_packet;
216 typedef struct hil_eventqueue {
217 int size;
218 int head;
219 int tail;
220 int pad;
221 } hil_eventqueue;
223 typedef union hilqueue {
224 char hqu_size[0x1000];
225 struct q_data {
226 hil_eventqueue h_eventqueue;
227 hil_packet h_event[1];
228 } q_data;
229 #define hil_evqueue q_data.h_eventqueue
230 #define hil_event q_data.h_event
231 } HILQ;
233 #define HEVQSIZE \
234 ((sizeof(HILQ) - sizeof(struct q_data)) / sizeof(hil_packet) + 1)