xref: /original-bsd/sys/hp/dev/hilioctl.h (revision 68d9582f)
1 /*
2  * Copyright (c) 1988 University of Utah.
3  * Copyright (c) 1990 The Regents of the University of California.
4  * All rights reserved.
5  *
6  * This code is derived from software contributed to Berkeley by
7  * the Systems Programming Group of the University of Utah Computer
8  * Science Department.
9  *
10  * %sccs.include.redist.c%
11  *
12  * from: Utah $Hdr: hilioctl.h 1.10 92/01/21$
13  *
14  *	@(#)hilioctl.h	7.5 (Berkeley) 06/05/92
15  */
16 
17 struct _hilbell {
18 	u_char	duration;
19 	u_char	frequency;
20 };
21 
22 struct _hilbuf16 {
23 	u_char	string[16];
24 };
25 
26 struct _hilbuf11 {
27 	u_char	string[11];
28 };
29 
30 struct _hilbuf5 {
31   	u_char  string[5];
32 };
33 
34 struct _hilbuf4 {
35   	u_char  string[4];
36 };
37 
38 struct _hilbuf2 {
39 	u_char	string[2];
40 };
41 
42 struct hilqinfo {
43 	int	qid;
44 	char	*addr;
45 };
46 
47 /*
48  * HPUX ioctls (here for the benefit of the HIL driver).
49  * Named as they are under HPUX.
50  * The first set are loop device ioctls.
51  * The second set are ioctls for the 8042.
52  * Note that some are not defined as in HPUX
53  * due to the difference in the definitions of IOC_VOID.
54  */
55 #ifdef hp800
56 #define _IOHpux(x,y)	_IO(x,y)
57 #else
58 #define _IOHpux(x,y)	(IOC_IN|((x)<<8)|y)	/* IOC_IN is IOC_VOID */
59 #endif
60 
61 #ifdef ORIGINAL_HP_CODE_ASSUMES_COMPILER_PADS_TO_EVEN
62 #define HILID	_IOR('h',0x03, struct _hilbuf11) /* Identify & describe */
63 #else
64 #define HILID   0x400c6803
65 #endif
66 #define HILSC	_IOR('h',0x33, struct _hilbuf16) /* Security code */
67 #define HILRN	_IOR('h',0x30, struct _hilbuf16) /* Report name */
68 #define HILRS	_IOR('h',0x31, struct _hilbuf16) /* Report status */
69 #define HILED	_IOR('h',0x32, struct _hilbuf16) /* Extended describe*/
70 #define HILDKR  _IOHpux('h',0x3D)		/* Disable autorepeat */
71 #define HILER1  _IOHpux('h',0x3E)		/* Autorepeat 1/30 */
72 #define HILER2  _IOHpux('h',0x3F)		/* Autorepeat 1/60 */
73 #define HILP1	_IOHpux('h',0x40)		/* Prompt 1 */
74 #define HILP2	_IOHpux('h',0x41)		/* Prompt 2 */
75 #define HILP3	_IOHpux('h',0x42)		/* Prompt 3 */
76 #define HILP4	_IOHpux('h',0x43)		/* Prompt 4 */
77 #define HILP5	_IOHpux('h',0x44)		/* Prompt 5 */
78 #define HILP6	_IOHpux('h',0x45)		/* Prompt 6 */
79 #define HILP7	_IOHpux('h',0x46)		/* Prompt 7 */
80 #define HILP	_IOHpux('h',0x47)		/* Prompt */
81 #define HILA1	_IOHpux('h',0x48)		/* Acknowledge 1 */
82 #define HILA2	_IOHpux('h',0x49)		/* Acknowledge 2 */
83 #define HILA3	_IOHpux('h',0x4A)		/* Acknowledge 3 */
84 #define HILA4	_IOHpux('h',0x4B)		/* Acknowledge 4 */
85 #define HILA5	_IOHpux('h',0x4C)		/* Acknowledge 5 */
86 #define HILA6	_IOHpux('h',0x4D)		/* Acknowledge 6 */
87 #define HILA7	_IOHpux('h',0x4E)		/* Acknowledge 7 */
88 #define HILA	_IOHpux('h',0x4F)		/* Acknowledge */
89 
90 #define EFTSRD  _IOW('H',0xa0,char)		/* Set the repeat delay. */
91 #define EFTSRR  _IOW('H',0xa2,char)		/* Set the repeat rate. */
92 #define EFTSRPG _IOW('H',0xa6,char)		/* Set RPG interrupt rate. */
93 #define EFTSBP  _IOW('H',0xc4,struct _hilbuf4)	/* Send data to the beeper. */
94 #define EFTRLC  _IOR('H',0x12,char)		/* Read the language code. */
95 #define EFTRCC  _IOR('H',0x11,char)		/* Read configuration code. */
96 /*#define EFTRRT  _IOR('H',0x31,struct _hilbuf5)/* Read the real time. */
97 #define EFTRRT	0x40064831
98 #define EFTRT   _IOR('H',0xf4,struct _hilbuf4)	/* Read the timers for the
99 	                                              four voices. */
100 #ifdef hp800
101 #define EFTSBI  _IOW('H',0xa3,char)		/* Do the beep thing. */
102 #else
103 #define EFTSBI  _IOW('H',0xa3,struct _hilbuf2)	/* Set the bell information. */
104 #endif
105 
106 /*
107  * BSD ioctls.
108  * Mostly the same as the HPUX versions except for shared-queue ioctls.
109  */
110 #define HILIOCID	_IOR('h',0x03, struct _hilbuf11)
111 #define OHILIOCID	HILID
112 #define HILIOCSC	_IOR('h',0x33, struct _hilbuf16)
113 #define HILIOCRN	_IOR('h',0x30, struct _hilbuf16)
114 #define HILIOCRS	_IOR('h',0x31, struct _hilbuf16)
115 #define HILIOCED	_IOR('h',0x32, struct _hilbuf16)
116 #define HILIOCAROFF	_IO('h',0x3D)
117 #define HILIOCAR1	_IO('h',0x3E)
118 #define HILIOCAR2	_IO('h',0x3F)
119 #define HILIOCSBP	_IOW('H',0xc4,struct _hilbuf4)
120 #define HILIOCRRT	_IOR('H',0x31,struct _hilbuf5)
121 #define HILIOCRT	_IOR('H',0xf4,struct _hilbuf4)
122 #define HILIOCBEEP	_IOW('H',0xA3,struct _hilbell)
123 #	define	BELLDUR		80	/* tone duration in msec (10 - 2560) */
124 #	define	BELLFREQ	8	/* tone frequency (0 - 63) */
125 
126 #define HILIOCALLOCQ	_IOWR('H',0x72, struct hilqinfo)	/* allocate queue */
127 #define HILIOCFREEQ	_IOW('H',0x73, struct hilqinfo)	/* deallocate queue */
128 #define HILIOCMAPQ	_IOW('H',0x74, int)	/* map device to queue */
129 #define HILIOCUNMAPQ	_IOW('H',0x75, int)	/* unmap device from dev */
130 #define HILIOCTEST      _IOW('H',0x76, int)	/* Toggle debugging mode */
131 #define HILIOCHPUX	_IO('H',0x77)		/* use HPUX (read) semantics */
132 #define HILIOCRESET	_IO('H',0x78)		/* Reset the HIL loop. */
133 
134 /*
135  * HIL input queue.
136  * This is the circular queue (allocated by HILIOCALLOC) shared by kernel
137  * and user.  It consists of a sixteen byte header followed by space for
138  * 255 input data packets (a total of 4096 bytes).  The kernel adds packets
139  * at tail.  The user is expected to remove packets from head.  This is the
140  * only field in the header that the user should modify.
141  */
142 typedef struct hil_packet {
143 	u_char	size;		/* total packet size */
144 	u_char	dev;		/* loop device packet was generated by */
145 	long	tstamp;		/* time stamp */
146 	u_char	data[10];	/* device data */
147 } hil_packet;
148 
149 typedef struct hil_eventqueue {
150 	int	size;
151 	int	head;
152 	int	tail;
153 	int	pad;
154 } hil_eventqueue;
155 
156 typedef union hilqueue {
157 	char	hqu_size[0x1000];
158 	struct	q_data {
159 		hil_eventqueue	h_eventqueue;
160 		hil_packet	h_event[1];
161 	} q_data;
162 #define hil_evqueue	q_data.h_eventqueue
163 #define hil_event	q_data.h_event
164 } HILQ;
165 
166 #define HEVQSIZE	\
167 	((sizeof(HILQ) - sizeof(struct q_data)) / sizeof(hil_packet) + 1)
168