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*45500Smckusick * from: Utah $Hdr: hilvar.h 1.1 90/07/09$ 1341480Smckusick * 14*45500Smckusick * @(#)hilvar.h 7.2 (Berkeley) 11/04/90 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 /* 3141480Smckusick * XXX: HPUX minor numbers are of the form "D0" where D is the device number 3241480Smckusick * BSD uses "0D". For compatibility we accept either. Maybe we should just 3341480Smckusick * use the HPUX numbering. 3441480Smckusick */ 3541480Smckusick #define HILUNIT(d) (((((d)>>4)&7)==0)?((d)&7):(((d)>>4)&7)) 3641480Smckusick 3741480Smckusick #define hildevmask(d) (1 << (d)) 3841480Smckusick #define hilqmask(q) (1 << (q)) 3941480Smckusick 4041480Smckusick struct hiliqueue { 4141480Smckusick HILQ *hq_eventqueue; /* input queue shared with user */ 4241480Smckusick struct proc *hq_procp; /* process this queue belongs to */ 4341480Smckusick char hq_devmask; /* devices mapped to this queue */ 4441480Smckusick }; 4541480Smckusick 4641480Smckusick struct hilloopdev { 4741480Smckusick int hd_flags; /* device state */ 4841480Smckusick int hd_qmask; /* queues this device is mapped to */ 4941480Smckusick struct clist hd_queue; /* event queue for HPUX-style input */ 5041480Smckusick struct proc *hd_selr; /* process read selecting */ 5141480Smckusick uid_t hd_uid; /* uid of mapping process */ 5241480Smckusick }; 5341480Smckusick 5441480Smckusick /* hd_flags */ 5541480Smckusick #define HIL_ALIVE 0x01 /* device is present */ 5641480Smckusick #define HIL_PSEUDO 0x02 /* device is virtual */ 5741480Smckusick #define HIL_READIN 0x04 /* device using read() input interface */ 5841480Smckusick #define HIL_QUEUEIN 0x08 /* device using shared Q input interface */ 5941480Smckusick #define HIL_SELCOLL 0x10 /* select collision on device */ 6041480Smckusick #define HIL_NOBLOCK 0x20 /* device is in non-blocking read mode */ 6141480Smckusick #define HIL_ASLEEP 0x40 /* process awaiting input on device */ 6241480Smckusick #define HIL_DERROR 0x80 /* loop has reconfigured, reality altered */ 6341480Smckusick 6441480Smckusick struct hilloop { 6541480Smckusick struct hil_dev *hl_addr; /* base of hardware registers */ 6641480Smckusick u_char hl_cmddone; /* */ 6741480Smckusick u_char hl_cmdending; /* */ 6841480Smckusick u_char hl_actdev; /* current input device */ 6941480Smckusick u_char hl_cmddev; /* device to perform command on */ 7041480Smckusick u_char hl_pollbuf[HILBUFSIZE]; /* interrupt time input buffer */ 7141480Smckusick u_char hl_cmdbuf[HILBUFSIZE]; /* */ 7241480Smckusick u_char *hl_pollbp; /* pointer into hl_pollbuf */ 7341480Smckusick u_char *hl_cmdbp; /* pointer into hl_cmdbuf */ 7441480Smckusick struct hiliqueue hl_queue[NHILQ]; /* input queues */ 7541480Smckusick struct hilloopdev hl_device[NHILD]; /* device data */ 7641480Smckusick u_char hl_maxdev; /* number of devices on loop */ 7741480Smckusick u_char hl_kbddev; /* keyboard device on loop */ 7841480Smckusick u_char hl_kbdlang; /* keyboard language */ 7941480Smckusick u_char hl_kbdflags; /* keyboard state */ 8041480Smckusick }; 8141480Smckusick 8241480Smckusick /* hl_kbdflags */ 8341480Smckusick #define KBD_RAW 0x01 /* keyboard is raw */ 8441480Smckusick #define KBD_AR1 0x02 /* keyboard auto-repeat rate 1 */ 8541480Smckusick #define KBD_AR2 0x04 /* keyboard auto-repeat rate 2 */ 86