xref: /original-bsd/sys/hp/dev/hilvar.h (revision 06bf7e12)
1 /*
2  * Copyright (c) 1988 University of Utah.
3  * Copyright (c) 1990, 1993
4  *	The Regents of the University of California.  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: hilvar.h 1.3 92/01/21$
13  *
14  *	@(#)hilvar.h	8.1 (Berkeley) 06/10/93
15  */
16 
17 #ifndef TRUE
18 #define TRUE	1
19 #define FALSE	0
20 #endif
21 
22 #define NHILD		8		/* 7 actual + loop pseudo (dev 0) */
23 #define NHILQ		8		/* must be <= sizeof(int) */
24 
25 #define HILBUFSIZE	40		/* size of interrupt poll buffer */
26 #define HILMAXCLIST	1024		/* max chars in clists for HPUX io */
27 
28 #define HILLOOPDEV	0		/* loop device index */
29 
30 /*
31  * Minor device numbers.
32  * HP-UX uses 12 bits of the form:
33  *	LLLLDDDD0000
34  * where L is 4 bits of loop number, D 4 bits of device and 4 bits of 0.
35  * BSD uses 8 bits:
36  *	LLLLDDDD
37  * Device files are in BSD format, we map device numbers to HP-UX format
38  * on stat calls.
39  */
40 #define HILUNIT(d)	((d) & 0xF)
41 #define HILLOOP(d)	(((d)>>4) & 0xF)
42 
43 #define	hildevmask(d)	(1 << (d))
44 #define	hilqmask(q)	(1 << (q))
45 
46 struct hiliqueue {
47 	HILQ	*hq_eventqueue;		/* input queue shared with user */
48 	struct	proc *hq_procp;		/* process this queue belongs to */
49 	char	hq_devmask;		/* devices mapped to this queue */
50 };
51 
52 struct hilloopdev {
53 	int	hd_flags;		/* device state */
54 	int	hd_qmask;		/* queues this device is mapped to */
55 	struct	clist hd_queue;		/* event queue for HPUX-style input */
56 	struct	selinfo hd_selr;	/* process read selecting */
57 	uid_t	hd_uid;			/* uid of mapping process */
58 };
59 
60 /* hd_flags */
61 #define	HIL_ALIVE	0x01	/* device is present */
62 #define HIL_PSEUDO	0x02	/* device is virtual */
63 #define HIL_READIN	0x04	/* device using read() input interface */
64 #define HIL_QUEUEIN	0x08	/* device using shared Q input interface */
65 #define HIL_NOBLOCK	0x20	/* device is in non-blocking read mode */
66 #define HIL_ASLEEP	0x40	/* process awaiting input on device */
67 #define HIL_DERROR	0x80	/* loop has reconfigured, reality altered */
68 
69 struct hilloop {
70 	struct	hil_dev	*hl_addr;	/* base of hardware registers */
71 	u_char 	hl_cmddone;		/* */
72 	u_char 	hl_cmdending;		/* */
73 	u_char	hl_actdev;		/* current input device */
74 	u_char	hl_cmddev;		/* device to perform command on */
75 	u_char	hl_pollbuf[HILBUFSIZE];	/* interrupt time input buffer */
76 	u_char	hl_cmdbuf[HILBUFSIZE];	/* */
77 	u_char 	*hl_pollbp;		/* pointer into hl_pollbuf */
78 	u_char	*hl_cmdbp;		/* pointer into hl_cmdbuf */
79 	struct	hiliqueue hl_queue[NHILQ];	/* input queues */
80 	struct  hilloopdev hl_device[NHILD];	/* device data */
81 	u_char  hl_maxdev;		/* number of devices on loop */
82 	u_char	hl_kbddev;		/* keyboard device on loop */
83 	u_char	hl_kbdlang;		/* keyboard language */
84 	u_char	hl_kbdflags;		/* keyboard state */
85 };
86 
87 /* hl_kbdflags */
88 #define KBD_RAW		0x01		/* keyboard is raw */
89 #define KBD_AR1		0x02		/* keyboard auto-repeat rate 1 */
90 #define KBD_AR2		0x04		/* keyboard auto-repeat rate 2 */
91