1997-04-01 23:29:09 +04:00
|
|
|
/* $NetBSD: hilvar.h,v 1.14 1997/04/01 19:29:10 scottr Exp $ */
|
1994-10-26 10:22:45 +03:00
|
|
|
|
1993-05-13 17:56:20 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1988 University of Utah.
|
1994-05-25 15:47:14 +04:00
|
|
|
* Copyright (c) 1990, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
1993-05-13 17:56:20 +04:00
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* the Systems Programming Group of the University of Utah Computer
|
|
|
|
* Science Department.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1994-05-25 15:47:14 +04:00
|
|
|
* from: Utah $Hdr: hilvar.h 1.3 92/01/21$
|
|
|
|
*
|
1994-10-26 10:22:45 +03:00
|
|
|
* @(#)hilvar.h 8.1 (Berkeley) 6/10/93
|
1993-05-13 17:56:20 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TRUE
|
|
|
|
#define TRUE 1
|
|
|
|
#define FALSE 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define NHILD 8 /* 7 actual + loop pseudo (dev 0) */
|
|
|
|
#define NHILQ 8 /* must be <= sizeof(int) */
|
|
|
|
|
|
|
|
#define HILBUFSIZE 40 /* size of interrupt poll buffer */
|
|
|
|
#define HILMAXCLIST 1024 /* max chars in clists for HPUX io */
|
|
|
|
|
|
|
|
#define HILLOOPDEV 0 /* loop device index */
|
|
|
|
|
|
|
|
/*
|
1994-05-25 15:47:14 +04:00
|
|
|
* Minor device numbers.
|
|
|
|
* HP-UX uses 12 bits of the form:
|
|
|
|
* LLLLDDDD0000
|
|
|
|
* where L is 4 bits of loop number, D 4 bits of device and 4 bits of 0.
|
|
|
|
* BSD uses 8 bits:
|
|
|
|
* LLLLDDDD
|
|
|
|
* Device files are in BSD format, we map device numbers to HP-UX format
|
|
|
|
* on stat calls.
|
1993-05-13 17:56:20 +04:00
|
|
|
*/
|
1994-05-25 15:47:14 +04:00
|
|
|
#define HILUNIT(d) ((d) & 0xF)
|
|
|
|
#define HILLOOP(d) (((d)>>4) & 0xF)
|
1993-05-13 17:56:20 +04:00
|
|
|
|
|
|
|
#define hildevmask(d) (1 << (d))
|
|
|
|
#define hilqmask(q) (1 << (q))
|
|
|
|
|
|
|
|
struct hiliqueue {
|
|
|
|
HILQ *hq_eventqueue; /* input queue shared with user */
|
|
|
|
struct proc *hq_procp; /* process this queue belongs to */
|
|
|
|
char hq_devmask; /* devices mapped to this queue */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct hilloopdev {
|
|
|
|
int hd_flags; /* device state */
|
|
|
|
int hd_qmask; /* queues this device is mapped to */
|
1993-08-07 08:42:15 +04:00
|
|
|
struct clist hd_queue; /* event queue for HPUX-style input */
|
1993-05-18 22:18:40 +04:00
|
|
|
struct selinfo hd_selr; /* process read selecting */
|
1993-05-13 17:56:20 +04:00
|
|
|
uid_t hd_uid; /* uid of mapping process */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* hd_flags */
|
|
|
|
#define HIL_ALIVE 0x01 /* device is present */
|
|
|
|
#define HIL_PSEUDO 0x02 /* device is virtual */
|
|
|
|
#define HIL_READIN 0x04 /* device using read() input interface */
|
|
|
|
#define HIL_QUEUEIN 0x08 /* device using shared Q input interface */
|
1994-05-25 15:47:14 +04:00
|
|
|
#define HIL_OPENED 0x10 /* flag for first open */
|
1993-05-13 17:56:20 +04:00
|
|
|
#define HIL_NOBLOCK 0x20 /* device is in non-blocking read mode */
|
|
|
|
#define HIL_ASLEEP 0x40 /* process awaiting input on device */
|
|
|
|
#define HIL_DERROR 0x80 /* loop has reconfigured, reality altered */
|
|
|
|
|
1995-12-11 22:41:47 +03:00
|
|
|
struct hil_softc {
|
1993-05-13 17:56:20 +04:00
|
|
|
struct hil_dev *hl_addr; /* base of hardware registers */
|
|
|
|
u_char hl_cmddone; /* */
|
|
|
|
u_char hl_cmdending; /* */
|
|
|
|
u_char hl_actdev; /* current input device */
|
|
|
|
u_char hl_cmddev; /* device to perform command on */
|
|
|
|
u_char hl_pollbuf[HILBUFSIZE]; /* interrupt time input buffer */
|
|
|
|
u_char hl_cmdbuf[HILBUFSIZE]; /* */
|
|
|
|
u_char *hl_pollbp; /* pointer into hl_pollbuf */
|
|
|
|
u_char *hl_cmdbp; /* pointer into hl_cmdbuf */
|
|
|
|
struct hiliqueue hl_queue[NHILQ]; /* input queues */
|
|
|
|
struct hilloopdev hl_device[NHILD]; /* device data */
|
|
|
|
u_char hl_maxdev; /* number of devices on loop */
|
|
|
|
u_char hl_kbddev; /* keyboard device on loop */
|
|
|
|
u_char hl_kbdlang; /* keyboard language */
|
|
|
|
u_char hl_kbdflags; /* keyboard state */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* hl_kbdflags */
|
|
|
|
#define KBD_RAW 0x01 /* keyboard is raw */
|
|
|
|
#define KBD_AR1 0x02 /* keyboard auto-repeat rate 1 */
|
|
|
|
#define KBD_AR2 0x04 /* keyboard auto-repeat rate 2 */
|
1997-03-31 11:32:14 +04:00
|
|
|
|
|
|
|
#ifdef _KERNEL
|
|
|
|
void kbdbell __P((int));
|
|
|
|
void kbdenable __P((int));
|
|
|
|
void kbddisable __P((int));
|
|
|
|
int kbdgetc __P((int *));
|
|
|
|
void kbdcninit __P((void));
|
|
|
|
|
1997-04-01 07:07:19 +04:00
|
|
|
int kbdnmi __P((void));
|
|
|
|
|
|
|
|
void hilsoftinit __P((int, struct hil_dev *));
|
|
|
|
void hilinit __P((int, struct hil_dev *));
|
|
|
|
|
|
|
|
void send_hil_cmd __P((struct hil_dev *, u_char,
|
|
|
|
u_char *, u_char, u_char *));
|
|
|
|
void send_hildev_cmd __P((struct hil_softc *, char, char));
|
|
|
|
|
|
|
|
void polloff __P((struct hil_dev *));
|
|
|
|
void pollon __P((struct hil_dev *));
|
1997-04-01 23:29:09 +04:00
|
|
|
|
|
|
|
#ifdef COMPAT_HPUX
|
|
|
|
int hpuxhilioctl __P((dev_t, int, caddr_t, int));
|
|
|
|
int hildevno __P((dev_t));
|
|
|
|
#endif /* COMPAT_HPUX */
|
1997-03-31 11:32:14 +04:00
|
|
|
#endif /* _KERNEL */
|