xref: /csrg-svn/sys/hp/dev/hilvar.h (revision 63148)
141480Smckusick /*
241480Smckusick  * Copyright (c) 1988 University of Utah.
3*63148Sbostic  * Copyright (c) 1990, 1993
4*63148Sbostic  *	The Regents of the University of California.  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  *
1253923Shibler  * from: Utah $Hdr: hilvar.h 1.3 92/01/21$
1341480Smckusick  *
14*63148Sbostic  *	@(#)hilvar.h	8.1 (Berkeley) 06/10/93
1541480Smckusick  */
1641480Smckusick 
1741480Smckusick #ifndef TRUE
1841480Smckusick #define TRUE	1
1941480Smckusick #define FALSE	0
2041480Smckusick #endif
2141480Smckusick 
2241480Smckusick #define NHILD		8		/* 7 actual + loop pseudo (dev 0) */
2341480Smckusick #define NHILQ		8		/* must be <= sizeof(int) */
2441480Smckusick 
2541480Smckusick #define HILBUFSIZE	40		/* size of interrupt poll buffer */
2641480Smckusick #define HILMAXCLIST	1024		/* max chars in clists for HPUX io */
2741480Smckusick 
2841480Smckusick #define HILLOOPDEV	0		/* loop device index */
2941480Smckusick 
3041480Smckusick /*
3153923Shibler  * Minor device numbers.
3253923Shibler  * HP-UX uses 12 bits of the form:
3353923Shibler  *	LLLLDDDD0000
3453923Shibler  * where L is 4 bits of loop number, D 4 bits of device and 4 bits of 0.
3553923Shibler  * BSD uses 8 bits:
3653923Shibler  *	LLLLDDDD
3753923Shibler  * Device files are in BSD format, we map device numbers to HP-UX format
3853923Shibler  * on stat calls.
3941480Smckusick  */
4053923Shibler #define HILUNIT(d)	((d) & 0xF)
4153923Shibler #define HILLOOP(d)	(((d)>>4) & 0xF)
4241480Smckusick 
4341480Smckusick #define	hildevmask(d)	(1 << (d))
4441480Smckusick #define	hilqmask(q)	(1 << (q))
4541480Smckusick 
4641480Smckusick struct hiliqueue {
4741480Smckusick 	HILQ	*hq_eventqueue;		/* input queue shared with user */
4841480Smckusick 	struct	proc *hq_procp;		/* process this queue belongs to */
4941480Smckusick 	char	hq_devmask;		/* devices mapped to this queue */
5041480Smckusick };
5141480Smckusick 
5241480Smckusick struct hilloopdev {
5341480Smckusick 	int	hd_flags;		/* device state */
5441480Smckusick 	int	hd_qmask;		/* queues this device is mapped to */
5541480Smckusick 	struct	clist hd_queue;		/* event queue for HPUX-style input */
5652531Storek 	struct	selinfo hd_selr;	/* process read selecting */
5741480Smckusick 	uid_t	hd_uid;			/* uid of mapping process */
5841480Smckusick };
5941480Smckusick 
6041480Smckusick /* hd_flags */
6141480Smckusick #define	HIL_ALIVE	0x01	/* device is present */
6241480Smckusick #define HIL_PSEUDO	0x02	/* device is virtual */
6341480Smckusick #define HIL_READIN	0x04	/* device using read() input interface */
6441480Smckusick #define HIL_QUEUEIN	0x08	/* device using shared Q input interface */
6541480Smckusick #define HIL_NOBLOCK	0x20	/* device is in non-blocking read mode */
6641480Smckusick #define HIL_ASLEEP	0x40	/* process awaiting input on device */
6741480Smckusick #define HIL_DERROR	0x80	/* loop has reconfigured, reality altered */
6841480Smckusick 
6941480Smckusick struct hilloop {
7041480Smckusick 	struct	hil_dev	*hl_addr;	/* base of hardware registers */
7141480Smckusick 	u_char 	hl_cmddone;		/* */
7241480Smckusick 	u_char 	hl_cmdending;		/* */
7341480Smckusick 	u_char	hl_actdev;		/* current input device */
7441480Smckusick 	u_char	hl_cmddev;		/* device to perform command on */
7541480Smckusick 	u_char	hl_pollbuf[HILBUFSIZE];	/* interrupt time input buffer */
7641480Smckusick 	u_char	hl_cmdbuf[HILBUFSIZE];	/* */
7741480Smckusick 	u_char 	*hl_pollbp;		/* pointer into hl_pollbuf */
7841480Smckusick 	u_char	*hl_cmdbp;		/* pointer into hl_cmdbuf */
7941480Smckusick 	struct	hiliqueue hl_queue[NHILQ];	/* input queues */
8041480Smckusick 	struct  hilloopdev hl_device[NHILD];	/* device data */
8141480Smckusick 	u_char  hl_maxdev;		/* number of devices on loop */
8241480Smckusick 	u_char	hl_kbddev;		/* keyboard device on loop */
8341480Smckusick 	u_char	hl_kbdlang;		/* keyboard language */
8441480Smckusick 	u_char	hl_kbdflags;		/* keyboard state */
8541480Smckusick };
8641480Smckusick 
8741480Smckusick /* hl_kbdflags */
8841480Smckusick #define KBD_RAW		0x01		/* keyboard is raw */
8941480Smckusick #define KBD_AR1		0x02		/* keyboard auto-repeat rate 1 */
9041480Smckusick #define KBD_AR2		0x04		/* keyboard auto-repeat rate 2 */
91