home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / sys / hp300 / dev / hilioctl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-08  |  6.9 KB  |  180 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: hilioctl.h 1.1 90/07/09$
  39.  *
  40.  *    @(#)hilioctl.h    7.2 (Berkeley) 11/4/90
  41.  */
  42.  
  43. struct _hilbell {
  44.     u_char    duration;
  45.     u_char    frequency;
  46. };
  47.  
  48. struct _hilbuf16 {
  49.     u_char    string[16];
  50. };
  51.  
  52. struct _hilbuf11 {
  53.     u_char    string[11];
  54. };
  55.  
  56. struct _hilbuf5 {
  57.       u_char  string[5];
  58. };
  59.  
  60. struct _hilbuf4 {
  61.       u_char  string[4];
  62. };
  63.  
  64. struct _hilbuf2 {
  65.     u_char    string[2];
  66. };
  67.  
  68. struct hilqinfo {
  69.     int    qid;
  70.     char    *addr;
  71. };
  72.  
  73. /*
  74.  * HPUX ioctls (here for the benefit of the HIL driver).
  75.  * Named as they are under HPUX.
  76.  * The first set are loop device ioctls.
  77.  * The second set are ioctls for the 8042.
  78.  * Note that some are not defined as in HPUX
  79.  * due to the difference in the definitions of IOC_VOID.
  80.  */
  81. #define _IOHpux(x,y)    (IOC_IN|((x)<<8)|y)    /* IOC_IN is IOC_VOID */
  82.  
  83. #define HILID    _IOR('h',0x03, struct _hilbuf11) /* Identify & describe */
  84. #define HILSC    _IOR('h',0x33, struct _hilbuf16) /* Security code */
  85. #define HILRN    _IOR('h',0x30, struct _hilbuf16) /* Report name */
  86. #define HILRS    _IOR('h',0x31, struct _hilbuf16) /* Report status */
  87. #define HILED    _IOR('h',0x32, struct _hilbuf16) /* Extended describe*/
  88. #define HILDKR  _IOHpux('h',0x3D)        /* Disable autorepeat */
  89. #define HILER1  _IOHpux('h',0x3E)        /* Autorepeat 1/30 */
  90. #define HILER2  _IOHpux('h',0x3F)        /* Autorepeat 1/60 */
  91. #define HILP1    _IOHpux('h',0x40)        /* Prompt 1 */
  92. #define HILP2    _IOHpux('h',0x41)        /* Prompt 2 */
  93. #define HILP3    _IOHpux('h',0x42)        /* Prompt 3 */
  94. #define HILP4    _IOHpux('h',0x43)        /* Prompt 4 */
  95. #define HILP5    _IOHpux('h',0x44)        /* Prompt 5 */
  96. #define HILP6    _IOHpux('h',0x45)        /* Prompt 6 */
  97. #define HILP7    _IOHpux('h',0x46)        /* Prompt 7 */
  98. #define HILP    _IOHpux('h',0x47)        /* Prompt */
  99. #define HILA1    _IOHpux('h',0x48)        /* Acknowledge 1 */
  100. #define HILA2    _IOHpux('h',0x49)        /* Acknowledge 2 */
  101. #define HILA3    _IOHpux('h',0x4A)        /* Acknowledge 3 */
  102. #define HILA4    _IOHpux('h',0x4B)        /* Acknowledge 4 */
  103. #define HILA5    _IOHpux('h',0x4C)        /* Acknowledge 5 */
  104. #define HILA6    _IOHpux('h',0x4D)        /* Acknowledge 6 */
  105. #define HILA7    _IOHpux('h',0x4E)        /* Acknowledge 7 */
  106. #define HILA    _IOHpux('h',0x4F)        /* Acknowledge */
  107.  
  108. #define EFTSRD  _IOW('H',0xa0,char)        /* Set the repeat delay. */
  109. #define EFTSRR  _IOW('H',0xa2,char)        /* Set the repeat rate. */
  110. #define EFTSRPG _IOW('H',0xa6,char)        /* Set RPG interrupt rate. */
  111. #define EFTSBP  _IOW('H',0xc4,struct _hilbuf4)    /* Send data to the beeper. */
  112. #define EFTRLC  _IOR('H',0x12,char)        /* Read the language code. */
  113. #define EFTRCC  _IOR('H',0x11,char)        /* Read configuration code. */
  114. #define EFTRRT  _IOR('H',0x31,struct _hilbuf5)    /* Read the real time. */
  115. #define EFTRT   _IOR('H',0xf4,struct _hilbuf4)    /* Read the timers for the
  116.                                                   four voices. */
  117. #define EFTSBI  _IOW('H',0xa3,struct _hilbuf2)    /* Set the bell information. */
  118.  
  119. /*
  120.  * BSD ioctls.
  121.  * Mostly the same as the HPUX versions except for shared-queue ioctls.
  122.  */
  123. #define HILIOCID    _IOR('h',0x03, struct _hilbuf11)
  124. #define HILIOCSC    _IOR('h',0x33, struct _hilbuf16)
  125. #define HILIOCRN    _IOR('h',0x30, struct _hilbuf16)
  126. #define HILIOCRS    _IOR('h',0x31, struct _hilbuf16)
  127. #define HILIOCED    _IOR('h',0x32, struct _hilbuf16)
  128. #define HILIOCAROFF    _IO('h',0x3D)
  129. #define HILIOCAR1    _IO('h',0x3E)
  130. #define HILIOCAR2    _IO('h',0x3F)
  131. #define HILIOCSBP    _IOW('H',0xc4,struct _hilbuf4)
  132. #define HILIOCRRT    _IOR('H',0x31,struct _hilbuf5)
  133. #define HILIOCRT    _IOR('H',0xf4,struct _hilbuf4)
  134. #define HILIOCBEEP    _IOW('H',0xA3,struct _hilbell)
  135. #    define    BELLDUR        80    /* tone duration in msec (10 - 2560) */
  136. #    define    BELLFREQ    8    /* tone frequency (0 - 63) */
  137.  
  138. #define HILIOCALLOCQ    _IOWR('H',0x72, struct hilqinfo)    /* allocate queue */
  139. #define HILIOCFREEQ    _IOW('H',0x73, struct hilqinfo)    /* deallocate queue */
  140. #define HILIOCMAPQ    _IOW('H',0x74, int)    /* map device to queue */
  141. #define HILIOCUNMAPQ    _IOW('H',0x75, int)    /* unmap device from dev */
  142. #define HILIOCTEST      _IOW('H',0x76, int)    /* Toggle debugging mode */
  143. #define HILIOCHPUX    _IO('H',0x77)        /* use HPUX (read) semantics */
  144. #define HILIOCRESET    _IO('H',0x78)        /* Reset the HIL loop. */
  145.  
  146. /*
  147.  * HIL input queue.
  148.  * This is the circular queue (allocated by HILIOCALLOC) shared by kernel
  149.  * and user.  It consists of a sixteen byte header followed by space for
  150.  * 255 input data packets (a total of 4096 bytes).  The kernel adds packets
  151.  * at tail.  The user is expected to remove packets from head.  This is the
  152.  * only field in the header that the user should modify.
  153.  */
  154. typedef struct hil_packet {
  155.     u_char    size;        /* total packet size */
  156.     u_char    dev;        /* loop device packet was generated by */
  157.     long    tstamp;        /* time stamp */
  158.     u_char    data[10];    /* device data */
  159. } hil_packet;
  160.  
  161. typedef struct hil_eventqueue {
  162.     int    size;
  163.     int    head;
  164.     int    tail;
  165.     int    pad;
  166. } hil_eventqueue;
  167.  
  168. typedef union hilqueue {
  169.     char    hqu_size[0x1000];
  170.     struct    q_data {
  171.         hil_eventqueue    h_eventqueue;
  172.         hil_packet    h_event[1];
  173.     } q_data;
  174. #define hil_evqueue    q_data.h_eventqueue
  175. #define hil_event    q_data.h_event
  176. } HILQ;
  177.  
  178. #define HEVQSIZE    \
  179.     ((sizeof(HILQ) - sizeof(struct q_data)) / sizeof(hil_packet) + 1)
  180.