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

  1. /*
  2.  * Copyright (c) 1982, 1990 The Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  *
  33.  *    @(#)device.h    7.3 (Berkeley) 5/7/91
  34.  */
  35.  
  36. struct driver {
  37.     int    (*d_init)();
  38.     char    *d_name;
  39.     int    (*d_start)();
  40.     int    (*d_go)();
  41.     int    (*d_intr)();
  42.     int    (*d_done)();
  43. };
  44.  
  45. struct hp_ctlr {
  46.     struct driver    *hp_driver;
  47.     int        hp_unit;
  48.     int        hp_alive;
  49.     char        *hp_addr;
  50.     int        hp_flags;
  51.     int        hp_ipl;
  52. };
  53.  
  54. struct hp_device {
  55.     struct driver    *hp_driver;
  56.     struct driver    *hp_cdriver;
  57.     int        hp_unit;
  58.     int        hp_ctlr;
  59.     int        hp_slave;
  60.     char        *hp_addr;
  61.     int        hp_dk;
  62.     int        hp_flags;
  63.     int        hp_alive;
  64.     int        hp_ipl;
  65. };
  66.  
  67. struct    devqueue {
  68.     struct    devqueue *dq_forw;
  69.     struct    devqueue *dq_back;
  70.     int    dq_ctlr;
  71.     int    dq_unit;
  72.     int    dq_slave;
  73.     struct    driver *dq_driver;
  74. };
  75.  
  76. #define    MAXCTLRS    16    /* Size of HW table (arbitrary) */
  77. #define    MAXSLAVES    8    /* Slaves per controller (HPIB/SCSI limit) */
  78.  
  79. struct hp_hw {
  80.     caddr_t    hw_pa;        /* physical address of control space */
  81.     int    hw_size;    /* size of control space */
  82.     caddr_t    hw_kva;        /* kernel virtual address of control space */
  83.     short    hw_id;        /* HW returned id */
  84.     short    hw_secid;    /* secondary HW id (displays) */
  85.     short    hw_type;    /* type (defined below) */
  86.     short    hw_sc;        /* select code (if applicable) */
  87. };
  88.  
  89. /* bus types */
  90. #define    B_MASK        0xE000
  91. #define    B_DIO        0x2000
  92. #define B_DIOII        0x4000
  93. #define B_VME        0x6000
  94. /* controller types */
  95. #define    C_MASK        0x8F
  96. #define C_FLAG        0x80
  97. #define    C_HPIB        0x81
  98. #define C_SCSI        0x82
  99. #define C_VME        0x83
  100. /* device types (controllers with no slaves) */
  101. #define D_MASK        0x8F
  102. #define    D_BITMAP    0x01
  103. #define    D_LAN        0x02
  104. #define    D_FPA        0x03
  105. #define    D_KEYBOARD    0x04
  106. #define    D_COMMDCA    0x05
  107. #define    D_COMMDCM    0x06
  108. #define    D_COMMDCL    0x07
  109. #define    D_PPORT        0x08
  110. #define    D_MISC        0x7F
  111.  
  112. #define HW_ISCTLR(hw)    ((hw)->hw_type & C_FLAG)
  113. #define HW_ISDIOII(hw)    ((hw)->hw_type & B_DIOII)
  114. #define HW_ISHPIB(hw)    (((hw)->hw_type & C_MASK) == C_HPIB)
  115. #define HW_ISSCSI(hw)    (((hw)->hw_type & C_MASK) == C_SCSI)
  116. #define HW_ISDEV(hw,d)    (((hw)->hw_type & D_MASK) == (d))
  117.  
  118. #ifdef KERNEL
  119. extern struct hp_hw sc_table[];
  120. extern struct hp_ctlr hp_cinit[];
  121. extern struct hp_device hp_dinit[];
  122. extern caddr_t sctova(), sctopa(), iomap();
  123. #endif
  124.