home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / sys / hp300 / dev / hilvar.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-08  |  4.5 KB  |  112 lines

  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.  * Redistribution and use in source and binary forms, with or without
  11.  * modification, are permitted provided that the following conditions
  12.  * are met:
  13.  * 1. Redistributions of source code must retain the above copyright
  14.  *    notice, this list of conditions and the following disclaimer.
  15.  * 2. Redistributions in binary form must reproduce the above copyright
  16.  *    notice, this list of conditions and the following disclaimer in the
  17.  *    documentation and/or other materials provided with the distribution.
  18.  * 3. All advertising materials mentioning features or use of this software
  19.  *    must display the following acknowledgement:
  20.  *    This product includes software developed by the University of
  21.  *    California, Berkeley and its contributors.
  22.  * 4. Neither the name of the University nor the names of its contributors
  23.  *    may be used to endorse or promote products derived from this software
  24.  *    without specific prior written permission.
  25.  *
  26.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  27.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  30.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  31.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  32.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  33.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  34.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  35.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  36.  * SUCH DAMAGE.
  37.  *
  38.  * from: Utah $Hdr: hilvar.h 1.1 90/07/09$
  39.  *
  40.  *    @(#)hilvar.h    7.2 (Berkeley) 11/4/90
  41.  */
  42.  
  43. #ifndef TRUE
  44. #define TRUE    1
  45. #define FALSE    0
  46. #endif
  47.  
  48. #define NHILD        8        /* 7 actual + loop pseudo (dev 0) */
  49. #define NHILQ        8        /* must be <= sizeof(int) */
  50.  
  51. #define HILBUFSIZE    40        /* size of interrupt poll buffer */
  52. #define HILMAXCLIST    1024        /* max chars in clists for HPUX io */
  53.  
  54. #define HILLOOPDEV    0        /* loop device index */
  55.  
  56. /*
  57.  * XXX: HPUX minor numbers are of the form "D0" where D is the device number
  58.  * BSD uses "0D".  For compatibility we accept either.  Maybe we should just
  59.  * use the HPUX numbering.
  60.  */
  61. #define HILUNIT(d)    (((((d)>>4)&7)==0)?((d)&7):(((d)>>4)&7))
  62.  
  63. #define    hildevmask(d)    (1 << (d))
  64. #define    hilqmask(q)    (1 << (q))
  65.  
  66. struct hiliqueue {
  67.     HILQ    *hq_eventqueue;        /* input queue shared with user */
  68.     struct    proc *hq_procp;        /* process this queue belongs to */
  69.     char    hq_devmask;        /* devices mapped to this queue */
  70. };
  71.  
  72. struct hilloopdev {
  73.     int    hd_flags;        /* device state */
  74.     int    hd_qmask;        /* queues this device is mapped to */
  75.     struct    clist hd_queue;        /* event queue for HPUX-style input */
  76.     struct    proc *hd_selr;        /* process read selecting */
  77.     uid_t    hd_uid;            /* uid of mapping process */
  78. };
  79.  
  80. /* hd_flags */
  81. #define    HIL_ALIVE    0x01    /* device is present */
  82. #define HIL_PSEUDO    0x02    /* device is virtual */
  83. #define HIL_READIN    0x04    /* device using read() input interface */
  84. #define HIL_QUEUEIN    0x08    /* device using shared Q input interface */
  85. #define HIL_SELCOLL    0x10    /* select collision on device */
  86. #define HIL_NOBLOCK    0x20    /* device is in non-blocking read mode */
  87. #define HIL_ASLEEP    0x40    /* process awaiting input on device */
  88. #define HIL_DERROR    0x80    /* loop has reconfigured, reality altered */
  89.  
  90. struct hilloop {
  91.     struct    hil_dev    *hl_addr;    /* base of hardware registers */
  92.     u_char     hl_cmddone;        /* */
  93.     u_char     hl_cmdending;        /* */
  94.     u_char    hl_actdev;        /* current input device */
  95.     u_char    hl_cmddev;        /* device to perform command on */
  96.     u_char    hl_pollbuf[HILBUFSIZE];    /* interrupt time input buffer */
  97.     u_char    hl_cmdbuf[HILBUFSIZE];    /* */
  98.     u_char     *hl_pollbp;        /* pointer into hl_pollbuf */
  99.     u_char    *hl_cmdbp;        /* pointer into hl_cmdbuf */
  100.     struct    hiliqueue hl_queue[NHILQ];    /* input queues */
  101.     struct  hilloopdev hl_device[NHILD];    /* device data */
  102.     u_char  hl_maxdev;        /* number of devices on loop */
  103.     u_char    hl_kbddev;        /* keyboard device on loop */
  104.     u_char    hl_kbdlang;        /* keyboard language */
  105.     u_char    hl_kbdflags;        /* keyboard state */
  106. };
  107.  
  108. /* hl_kbdflags */
  109. #define KBD_RAW        0x01        /* keyboard is raw */
  110. #define KBD_AR1        0x02        /* keyboard auto-repeat rate 1 */
  111. #define KBD_AR2        0x04        /* keyboard auto-repeat rate 2 */
  112.