home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / sys / hp300 / dev / itevar.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-08  |  4.9 KB  |  160 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: itevar.h 1.1 90/07/09$
  39.  *
  40.  *    @(#)itevar.h    7.2 (Berkeley) 11/4/90
  41.  */
  42.  
  43. #define UNIT(dev)       minor(dev)
  44.  
  45. struct itesw {
  46.     int    (*ite_init)();
  47.     int    (*ite_deinit)();
  48.     int    (*ite_clear)();
  49.     int    (*ite_putc)();
  50.     int    (*ite_cursor)();
  51.     int    (*ite_scroll)();
  52. };
  53.  
  54. struct ite_softc {
  55.     int    flags;
  56.     int    type;
  57.     caddr_t regbase, fbbase;
  58.     short    curx, cury;
  59.     short   cursorx, cursory;
  60.     short   cblankx, cblanky;
  61.     short    rows, cols;
  62.     short   cpl;
  63.     short    dheight, dwidth;
  64.     short    fbheight, fbwidth;
  65.     short    ftheight, ftwidth;
  66.     short    fontx, fonty;
  67.     short   attribute;
  68.     u_char    *attrbuf;
  69.     short    planemask;
  70.     short    pos;
  71.     char    imode, escape, fpd, hold;
  72. };
  73.  
  74. /* Flags */
  75. #define ITE_ALIVE    0x01    /* hardware exists */
  76. #define ITE_INITED    0x02    /* device has been initialized */
  77. #define ITE_CONSOLE    0x04    /* device can be console */
  78. #define ITE_ISCONS    0x08    /* device is console */
  79. #define ITE_ACTIVE    0x10    /* device is being used as ITE */
  80. #define ITE_INGRF    0x20    /* device in use as non-ITE */
  81.  
  82. /* Types - indices into itesw */
  83. #define    ITE_TOPCAT    0
  84. #define    ITE_GATORBOX    1
  85. #define    ITE_RENAISSANCE    2
  86. #define ITE_DAVINCI    3
  87.  
  88. #define attrloc(ip, y, x) \
  89.     (ip->attrbuf + ((y) * ip->cols) + (x))
  90.  
  91. #define attrclr(ip, sy, sx, h, w) \
  92.     bzero(ip->attrbuf + ((sy) * ip->cols) + (sx), (h) * (w))
  93.   
  94. #define attrmov(ip, sy, sx, dy, dx, h, w) \
  95.     bcopy(ip->attrbuf + ((sy) * ip->cols) + (sx), \
  96.           ip->attrbuf + ((dy) * ip->cols) + (dx), \
  97.           (h) * (w))
  98.  
  99. #define attrtest(ip, attr) \
  100.     ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) & attr)
  101.  
  102. #define attrset(ip, attr) \
  103.     ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) = attr)
  104.   
  105. /*
  106.  * X and Y location of character 'c' in the framebuffer, in pixels.
  107.  */
  108. #define    charX(ip,c)    \
  109.     (((c) % (ip)->cpl) * (ip)->ftwidth + (ip)->fontx)
  110.  
  111. #define    charY(ip,c)    \
  112.     (((c) / (ip)->cpl) * (ip)->ftheight + (ip)->fonty)
  113.  
  114. /* Character attributes */
  115. #define ATTR_NOR        0x0             /* normal */
  116. #define    ATTR_INV    0x1        /* inverse */
  117. #define    ATTR_UL        0x2        /* underline */
  118. #define ATTR_ALL    (ATTR_INV | ATTR_UL)
  119.  
  120. /* Keyboard attributes */
  121. #define ATTR_KPAD    0x4        /* keypad transmit */
  122.   
  123. /* Replacement Rules */
  124. #define RR_CLEAR        0x0
  125. #define RR_COPY            0x3
  126. #define RR_XOR            0x6
  127. #define RR_COPYINVERTED      0xc
  128.  
  129. #define SCROLL_UP    0x01
  130. #define SCROLL_DOWN    0x02
  131. #define SCROLL_LEFT    0x03
  132. #define SCROLL_RIGHT    0x04
  133. #define DRAW_CURSOR    0x05
  134. #define ERASE_CURSOR    0x06
  135. #define MOVE_CURSOR    0x07
  136.  
  137. #define KBD_SSHIFT    4        /* bits to shift status */
  138. #define    KBD_CHARMASK    0x7F
  139.  
  140. /* keyboard status */
  141. #define    KBD_SMASK    0xF        /* service request status mask */
  142. #define    KBD_CTRLSHIFT    0x8        /* key + CTRL + SHIFT */
  143. #define    KBD_CTRL    0x9        /* key + CTRL */
  144. #define    KBD_SHIFT    0xA        /* key + SHIFT */
  145. #define    KBD_KEY        0xB        /* key only */
  146.  
  147. #define KBD_CAPSLOCK    0x18
  148.  
  149. #define KBD_EXT_LEFT_DOWN     0x12
  150. #define KBD_EXT_LEFT_UP       0x92
  151. #define KBD_EXT_RIGHT_DOWN    0x13
  152. #define KBD_EXT_RIGHT_UP      0x93
  153.  
  154. #define    TABSIZE        8
  155. #define    TABEND(u)    (ite_tty[u].t_winsize.ws_col - TABSIZE)
  156.  
  157. #ifdef KERNEL
  158. extern    struct ite_softc ite_softc[];
  159. #endif
  160.