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: hilvar.h 1.1 90/07/09$ 13 * 14 * @(#)hilvar.h 7.2 (Berkeley) 11/04/90 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 * XXX: HPUX minor numbers are of the form "D0" where D is the device number 32 * BSD uses "0D". For compatibility we accept either. Maybe we should just 33 * use the HPUX numbering. 34 */ 35 #define HILUNIT(d) (((((d)>>4)&7)==0)?((d)&7):(((d)>>4)&7)) 36 37 #define hildevmask(d) (1 << (d)) 38 #define hilqmask(q) (1 << (q)) 39 40 struct hiliqueue { 41 HILQ *hq_eventqueue; /* input queue shared with user */ 42 struct proc *hq_procp; /* process this queue belongs to */ 43 char hq_devmask; /* devices mapped to this queue */ 44 }; 45 46 struct hilloopdev { 47 int hd_flags; /* device state */ 48 int hd_qmask; /* queues this device is mapped to */ 49 struct clist hd_queue; /* event queue for HPUX-style input */ 50 struct proc *hd_selr; /* process read selecting */ 51 uid_t hd_uid; /* uid of mapping process */ 52 }; 53 54 /* hd_flags */ 55 #define HIL_ALIVE 0x01 /* device is present */ 56 #define HIL_PSEUDO 0x02 /* device is virtual */ 57 #define HIL_READIN 0x04 /* device using read() input interface */ 58 #define HIL_QUEUEIN 0x08 /* device using shared Q input interface */ 59 #define HIL_SELCOLL 0x10 /* select collision on device */ 60 #define HIL_NOBLOCK 0x20 /* device is in non-blocking read mode */ 61 #define HIL_ASLEEP 0x40 /* process awaiting input on device */ 62 #define HIL_DERROR 0x80 /* loop has reconfigured, reality altered */ 63 64 struct hilloop { 65 struct hil_dev *hl_addr; /* base of hardware registers */ 66 u_char hl_cmddone; /* */ 67 u_char hl_cmdending; /* */ 68 u_char hl_actdev; /* current input device */ 69 u_char hl_cmddev; /* device to perform command on */ 70 u_char hl_pollbuf[HILBUFSIZE]; /* interrupt time input buffer */ 71 u_char hl_cmdbuf[HILBUFSIZE]; /* */ 72 u_char *hl_pollbp; /* pointer into hl_pollbuf */ 73 u_char *hl_cmdbp; /* pointer into hl_cmdbuf */ 74 struct hiliqueue hl_queue[NHILQ]; /* input queues */ 75 struct hilloopdev hl_device[NHILD]; /* device data */ 76 u_char hl_maxdev; /* number of devices on loop */ 77 u_char hl_kbddev; /* keyboard device on loop */ 78 u_char hl_kbdlang; /* keyboard language */ 79 u_char hl_kbdflags; /* keyboard state */ 80 }; 81 82 /* hl_kbdflags */ 83 #define KBD_RAW 0x01 /* keyboard is raw */ 84 #define KBD_AR1 0x02 /* keyboard auto-repeat rate 1 */ 85 #define KBD_AR2 0x04 /* keyboard auto-repeat rate 2 */ 86