xref: /csrg-svn/sys/hp/dev/hilvar.h (revision 41480)
1*41480Smckusick /*
2*41480Smckusick  * Copyright (c) 1988 University of Utah.
3*41480Smckusick  * Copyright (c) 1990 The Regents of the University of California.
4*41480Smckusick  * All rights reserved.
5*41480Smckusick  *
6*41480Smckusick  * This code is derived from software contributed to Berkeley by
7*41480Smckusick  * the Systems Programming Group of the University of Utah Computer
8*41480Smckusick  * Science Department.
9*41480Smckusick  *
10*41480Smckusick  * %sccs.include.redist.c%
11*41480Smckusick  *
12*41480Smckusick  * from: Utah $Hdr: hilvar.h 1.1 89/08/22$
13*41480Smckusick  *
14*41480Smckusick  *	@(#)hilvar.h	7.1 (Berkeley) 05/08/90
15*41480Smckusick  */
16*41480Smckusick 
17*41480Smckusick #ifndef TRUE
18*41480Smckusick #define TRUE	1
19*41480Smckusick #define FALSE	0
20*41480Smckusick #endif
21*41480Smckusick 
22*41480Smckusick #define NHILD		8		/* 7 actual + loop pseudo (dev 0) */
23*41480Smckusick #define NHILQ		8		/* must be <= sizeof(int) */
24*41480Smckusick 
25*41480Smckusick #define HILBUFSIZE	40		/* size of interrupt poll buffer */
26*41480Smckusick #define HILMAXCLIST	1024		/* max chars in clists for HPUX io */
27*41480Smckusick 
28*41480Smckusick #define HILLOOPDEV	0		/* loop device index */
29*41480Smckusick 
30*41480Smckusick /*
31*41480Smckusick  * XXX: HPUX minor numbers are of the form "D0" where D is the device number
32*41480Smckusick  * BSD uses "0D".  For compatibility we accept either.  Maybe we should just
33*41480Smckusick  * use the HPUX numbering.
34*41480Smckusick  */
35*41480Smckusick #define HILUNIT(d)	(((((d)>>4)&7)==0)?((d)&7):(((d)>>4)&7))
36*41480Smckusick 
37*41480Smckusick #define	hildevmask(d)	(1 << (d))
38*41480Smckusick #define	hilqmask(q)	(1 << (q))
39*41480Smckusick 
40*41480Smckusick struct hiliqueue {
41*41480Smckusick 	HILQ	*hq_eventqueue;		/* input queue shared with user */
42*41480Smckusick 	struct	proc *hq_procp;		/* process this queue belongs to */
43*41480Smckusick 	char	hq_devmask;		/* devices mapped to this queue */
44*41480Smckusick };
45*41480Smckusick 
46*41480Smckusick struct hilloopdev {
47*41480Smckusick 	int	hd_flags;		/* device state */
48*41480Smckusick 	int	hd_qmask;		/* queues this device is mapped to */
49*41480Smckusick 	struct	clist hd_queue;		/* event queue for HPUX-style input */
50*41480Smckusick 	struct	proc *hd_selr;		/* process read selecting */
51*41480Smckusick 	uid_t	hd_uid;			/* uid of mapping process */
52*41480Smckusick };
53*41480Smckusick 
54*41480Smckusick /* hd_flags */
55*41480Smckusick #define	HIL_ALIVE	0x01	/* device is present */
56*41480Smckusick #define HIL_PSEUDO	0x02	/* device is virtual */
57*41480Smckusick #define HIL_READIN	0x04	/* device using read() input interface */
58*41480Smckusick #define HIL_QUEUEIN	0x08	/* device using shared Q input interface */
59*41480Smckusick #define HIL_SELCOLL	0x10	/* select collision on device */
60*41480Smckusick #define HIL_NOBLOCK	0x20	/* device is in non-blocking read mode */
61*41480Smckusick #define HIL_ASLEEP	0x40	/* process awaiting input on device */
62*41480Smckusick #define HIL_DERROR	0x80	/* loop has reconfigured, reality altered */
63*41480Smckusick 
64*41480Smckusick struct hilloop {
65*41480Smckusick 	struct	hil_dev	*hl_addr;	/* base of hardware registers */
66*41480Smckusick 	u_char 	hl_cmddone;		/* */
67*41480Smckusick 	u_char 	hl_cmdending;		/* */
68*41480Smckusick 	u_char	hl_actdev;		/* current input device */
69*41480Smckusick 	u_char	hl_cmddev;		/* device to perform command on */
70*41480Smckusick 	u_char	hl_pollbuf[HILBUFSIZE];	/* interrupt time input buffer */
71*41480Smckusick 	u_char	hl_cmdbuf[HILBUFSIZE];	/* */
72*41480Smckusick 	u_char 	*hl_pollbp;		/* pointer into hl_pollbuf */
73*41480Smckusick 	u_char	*hl_cmdbp;		/* pointer into hl_cmdbuf */
74*41480Smckusick 	struct	hiliqueue hl_queue[NHILQ];	/* input queues */
75*41480Smckusick 	struct  hilloopdev hl_device[NHILD];	/* device data */
76*41480Smckusick 	u_char  hl_maxdev;		/* number of devices on loop */
77*41480Smckusick 	u_char	hl_kbddev;		/* keyboard device on loop */
78*41480Smckusick 	u_char	hl_kbdlang;		/* keyboard language */
79*41480Smckusick 	u_char	hl_kbdflags;		/* keyboard state */
80*41480Smckusick };
81*41480Smckusick 
82*41480Smckusick /* hl_kbdflags */
83*41480Smckusick #define KBD_RAW		0x01		/* keyboard is raw */
84*41480Smckusick #define KBD_AR1		0x02		/* keyboard auto-repeat rate 1 */
85*41480Smckusick #define KBD_AR2		0x04		/* keyboard auto-repeat rate 2 */
86