xref: /csrg-svn/sys/hp/dev/hilioctl.h (revision 53923)
141480Smckusick /*
241480Smckusick  * Copyright (c) 1988 University of Utah.
341480Smckusick  * Copyright (c) 1990 The Regents of the University of California.
441480Smckusick  * All rights reserved.
541480Smckusick  *
641480Smckusick  * This code is derived from software contributed to Berkeley by
741480Smckusick  * the Systems Programming Group of the University of Utah Computer
841480Smckusick  * Science Department.
941480Smckusick  *
1041480Smckusick  * %sccs.include.redist.c%
1141480Smckusick  *
12*53923Shibler  * from: Utah $Hdr: hilioctl.h 1.10 92/01/21$
1341480Smckusick  *
14*53923Shibler  *	@(#)hilioctl.h	7.5 (Berkeley) 06/05/92
1541480Smckusick  */
1641480Smckusick 
1741480Smckusick struct _hilbell {
1841480Smckusick 	u_char	duration;
1941480Smckusick 	u_char	frequency;
2041480Smckusick };
2141480Smckusick 
2241480Smckusick struct _hilbuf16 {
2341480Smckusick 	u_char	string[16];
2441480Smckusick };
2541480Smckusick 
2641480Smckusick struct _hilbuf11 {
2741480Smckusick 	u_char	string[11];
2841480Smckusick };
2941480Smckusick 
3041480Smckusick struct _hilbuf5 {
3141480Smckusick   	u_char  string[5];
3241480Smckusick };
3341480Smckusick 
3441480Smckusick struct _hilbuf4 {
3541480Smckusick   	u_char  string[4];
3641480Smckusick };
3741480Smckusick 
3841480Smckusick struct _hilbuf2 {
3941480Smckusick 	u_char	string[2];
4041480Smckusick };
4141480Smckusick 
4241480Smckusick struct hilqinfo {
4341480Smckusick 	int	qid;
4441480Smckusick 	char	*addr;
4541480Smckusick };
4641480Smckusick 
4741480Smckusick /*
4841480Smckusick  * HPUX ioctls (here for the benefit of the HIL driver).
4941480Smckusick  * Named as they are under HPUX.
5041480Smckusick  * The first set are loop device ioctls.
5141480Smckusick  * The second set are ioctls for the 8042.
5241480Smckusick  * Note that some are not defined as in HPUX
5341480Smckusick  * due to the difference in the definitions of IOC_VOID.
5441480Smckusick  */
55*53923Shibler #ifdef hp800
56*53923Shibler #define _IOHpux(x,y)	_IO(x,y)
57*53923Shibler #else
5841480Smckusick #define _IOHpux(x,y)	(IOC_IN|((x)<<8)|y)	/* IOC_IN is IOC_VOID */
59*53923Shibler #endif
6041480Smckusick 
6153305Sbostic #ifdef ORIGINAL_HP_CODE_ASSUMES_COMPILER_PADS_TO_EVEN
6241480Smckusick #define HILID	_IOR('h',0x03, struct _hilbuf11) /* Identify & describe */
6353305Sbostic #else
6453305Sbostic #define HILID   0x400c6803
6553305Sbostic #endif
6641480Smckusick #define HILSC	_IOR('h',0x33, struct _hilbuf16) /* Security code */
6741480Smckusick #define HILRN	_IOR('h',0x30, struct _hilbuf16) /* Report name */
6841480Smckusick #define HILRS	_IOR('h',0x31, struct _hilbuf16) /* Report status */
6941480Smckusick #define HILED	_IOR('h',0x32, struct _hilbuf16) /* Extended describe*/
7041480Smckusick #define HILDKR  _IOHpux('h',0x3D)		/* Disable autorepeat */
7141480Smckusick #define HILER1  _IOHpux('h',0x3E)		/* Autorepeat 1/30 */
7241480Smckusick #define HILER2  _IOHpux('h',0x3F)		/* Autorepeat 1/60 */
7341480Smckusick #define HILP1	_IOHpux('h',0x40)		/* Prompt 1 */
7441480Smckusick #define HILP2	_IOHpux('h',0x41)		/* Prompt 2 */
7541480Smckusick #define HILP3	_IOHpux('h',0x42)		/* Prompt 3 */
7641480Smckusick #define HILP4	_IOHpux('h',0x43)		/* Prompt 4 */
7741480Smckusick #define HILP5	_IOHpux('h',0x44)		/* Prompt 5 */
7841480Smckusick #define HILP6	_IOHpux('h',0x45)		/* Prompt 6 */
7941480Smckusick #define HILP7	_IOHpux('h',0x46)		/* Prompt 7 */
8041480Smckusick #define HILP	_IOHpux('h',0x47)		/* Prompt */
8141480Smckusick #define HILA1	_IOHpux('h',0x48)		/* Acknowledge 1 */
8241480Smckusick #define HILA2	_IOHpux('h',0x49)		/* Acknowledge 2 */
8341480Smckusick #define HILA3	_IOHpux('h',0x4A)		/* Acknowledge 3 */
8441480Smckusick #define HILA4	_IOHpux('h',0x4B)		/* Acknowledge 4 */
8541480Smckusick #define HILA5	_IOHpux('h',0x4C)		/* Acknowledge 5 */
8641480Smckusick #define HILA6	_IOHpux('h',0x4D)		/* Acknowledge 6 */
8741480Smckusick #define HILA7	_IOHpux('h',0x4E)		/* Acknowledge 7 */
8841480Smckusick #define HILA	_IOHpux('h',0x4F)		/* Acknowledge */
8941480Smckusick 
9041480Smckusick #define EFTSRD  _IOW('H',0xa0,char)		/* Set the repeat delay. */
9141480Smckusick #define EFTSRR  _IOW('H',0xa2,char)		/* Set the repeat rate. */
9241480Smckusick #define EFTSRPG _IOW('H',0xa6,char)		/* Set RPG interrupt rate. */
9341480Smckusick #define EFTSBP  _IOW('H',0xc4,struct _hilbuf4)	/* Send data to the beeper. */
9441480Smckusick #define EFTRLC  _IOR('H',0x12,char)		/* Read the language code. */
9541480Smckusick #define EFTRCC  _IOR('H',0x11,char)		/* Read configuration code. */
96*53923Shibler /*#define EFTRRT  _IOR('H',0x31,struct _hilbuf5)/* Read the real time. */
9753305Sbostic #define EFTRRT	0x40064831
9841480Smckusick #define EFTRT   _IOR('H',0xf4,struct _hilbuf4)	/* Read the timers for the
9941480Smckusick 	                                              four voices. */
100*53923Shibler #ifdef hp800
101*53923Shibler #define EFTSBI  _IOW('H',0xa3,char)		/* Do the beep thing. */
102*53923Shibler #else
10341480Smckusick #define EFTSBI  _IOW('H',0xa3,struct _hilbuf2)	/* Set the bell information. */
104*53923Shibler #endif
10541480Smckusick 
10641480Smckusick /*
10741480Smckusick  * BSD ioctls.
10841480Smckusick  * Mostly the same as the HPUX versions except for shared-queue ioctls.
10941480Smckusick  */
11041480Smckusick #define HILIOCID	_IOR('h',0x03, struct _hilbuf11)
111*53923Shibler #define OHILIOCID	HILID
11241480Smckusick #define HILIOCSC	_IOR('h',0x33, struct _hilbuf16)
11341480Smckusick #define HILIOCRN	_IOR('h',0x30, struct _hilbuf16)
11441480Smckusick #define HILIOCRS	_IOR('h',0x31, struct _hilbuf16)
11541480Smckusick #define HILIOCED	_IOR('h',0x32, struct _hilbuf16)
11641480Smckusick #define HILIOCAROFF	_IO('h',0x3D)
11741480Smckusick #define HILIOCAR1	_IO('h',0x3E)
11841480Smckusick #define HILIOCAR2	_IO('h',0x3F)
11941480Smckusick #define HILIOCSBP	_IOW('H',0xc4,struct _hilbuf4)
12041480Smckusick #define HILIOCRRT	_IOR('H',0x31,struct _hilbuf5)
12141480Smckusick #define HILIOCRT	_IOR('H',0xf4,struct _hilbuf4)
12241480Smckusick #define HILIOCBEEP	_IOW('H',0xA3,struct _hilbell)
12341480Smckusick #	define	BELLDUR		80	/* tone duration in msec (10 - 2560) */
12441480Smckusick #	define	BELLFREQ	8	/* tone frequency (0 - 63) */
12541480Smckusick 
12641480Smckusick #define HILIOCALLOCQ	_IOWR('H',0x72, struct hilqinfo)	/* allocate queue */
12741480Smckusick #define HILIOCFREEQ	_IOW('H',0x73, struct hilqinfo)	/* deallocate queue */
12841480Smckusick #define HILIOCMAPQ	_IOW('H',0x74, int)	/* map device to queue */
12941480Smckusick #define HILIOCUNMAPQ	_IOW('H',0x75, int)	/* unmap device from dev */
13041480Smckusick #define HILIOCTEST      _IOW('H',0x76, int)	/* Toggle debugging mode */
13141480Smckusick #define HILIOCHPUX	_IO('H',0x77)		/* use HPUX (read) semantics */
13241480Smckusick #define HILIOCRESET	_IO('H',0x78)		/* Reset the HIL loop. */
13341480Smckusick 
13441480Smckusick /*
13541480Smckusick  * HIL input queue.
13641480Smckusick  * This is the circular queue (allocated by HILIOCALLOC) shared by kernel
13741480Smckusick  * and user.  It consists of a sixteen byte header followed by space for
13841480Smckusick  * 255 input data packets (a total of 4096 bytes).  The kernel adds packets
13941480Smckusick  * at tail.  The user is expected to remove packets from head.  This is the
14041480Smckusick  * only field in the header that the user should modify.
14141480Smckusick  */
14241480Smckusick typedef struct hil_packet {
14341480Smckusick 	u_char	size;		/* total packet size */
14441480Smckusick 	u_char	dev;		/* loop device packet was generated by */
14541480Smckusick 	long	tstamp;		/* time stamp */
14641480Smckusick 	u_char	data[10];	/* device data */
14741480Smckusick } hil_packet;
14841480Smckusick 
14941480Smckusick typedef struct hil_eventqueue {
15041480Smckusick 	int	size;
15141480Smckusick 	int	head;
15241480Smckusick 	int	tail;
15341480Smckusick 	int	pad;
15441480Smckusick } hil_eventqueue;
15541480Smckusick 
15641480Smckusick typedef union hilqueue {
15741480Smckusick 	char	hqu_size[0x1000];
15841480Smckusick 	struct	q_data {
15941480Smckusick 		hil_eventqueue	h_eventqueue;
16041480Smckusick 		hil_packet	h_event[1];
16141480Smckusick 	} q_data;
16241480Smckusick #define hil_evqueue	q_data.h_eventqueue
16341480Smckusick #define hil_event	q_data.h_event
16441480Smckusick } HILQ;
16541480Smckusick 
16641480Smckusick #define HEVQSIZE	\
16741480Smckusick 	((sizeof(HILQ) - sizeof(struct q_data)) / sizeof(hil_packet) + 1)
168