home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.1 (Developer) [x86] / NeXT Step 3.1 Intel dev.cdr.dmg / NextDeveloper / Headers / bsd / dev / i386 / kdsoft.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-30  |  7.4 KB  |  218 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1989 Carnegie-Mellon University
  4.  * All rights reserved.  The CMU software License Agreement specifies
  5.  * the terms and conditions for use and redistribution.
  6.  */
  7. /* 
  8.  * HISTORY
  9.  * $Log:    kdsoft.h,v $
  10.  * Revision 1.4.1.4  90/11/27  13:44:35  rvb
  11.  *     Synched 2.5 & 3.0 at I386q (r1.4.1.4) & XMK35 (r2.3)
  12.  *     [90/11/15            rvb]
  13.  * 
  14.  * Revision 2.2  90/05/03  15:45:20  dbg
  15.  *     First checkin.
  16.  * 
  17.  * Revision 1.4.1.3  90/02/28  15:50:45  rvb
  18.  *     Fix numerous typo's in Olivetti disclaimer.
  19.  *     [90/02/28            rvb]
  20.  * 
  21.  * Revision 1.4.1.2  90/01/08  13:30:35  rvb
  22.  *     Add Olivetti copyright.
  23.  *     [90/01/08            rvb]
  24.  * 
  25.  * Revision 1.4.1.1  89/10/22  11:34:39  rvb
  26.  *     Revision 1.5  89/09/27  16:02:59  kupfer
  27.  *     Add support for resetting display before reboot.
  28.  * 
  29.  * Revision 1.4  89/07/17  10:42:18  rvb
  30.  *     Olivetti Changes to X79 upto 5/9/89:
  31.  *     [89/07/11            rvb]
  32.  * 
  33.  * Revision 1.1.1.1  89/04/27  12:36:07  kupfer
  34.  * X79 from CMU.
  35.  * 
  36.  * Revision 1.3  89/02/26  12:42:58  gm0w
  37.  *     Changes for cleanup.
  38.  * 
  39.  */
  40.  
  41. /* **********************************************************************
  42.  File:         kdsoft.h
  43.  Description:  Software structures for keyboard/display driver, shared with
  44.     drivers for specific graphics cards.
  45.  
  46.  $ Header: $
  47.  
  48.  Copyright Ing. C. Olivetti & C. S.p.A. 1988, 1989.
  49.  All rights reserved.
  50. ********************************************************************** */
  51.  
  52. /*
  53.   Copyright 1988, 1989 by Olivetti Advanced Technology Center, Inc.,
  54. Cupertino, California.
  55.  
  56.         All Rights Reserved
  57.  
  58.   Permission to use, copy, modify, and distribute this software and
  59. its documentation for any purpose and without fee is hereby
  60. granted, provided that the above copyright notice appears in all
  61. copies and that both the copyright notice and this permission notice
  62. appear in supporting documentation, and that the name of Olivetti
  63. not be used in advertising or publicity pertaining to distribution
  64. of the software without specific, written prior permission.
  65.  
  66.   OLIVETTI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
  67. INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
  68. IN NO EVENT SHALL OLIVETTI BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
  69. CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  70. LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
  71. NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUR OF OR IN CONNECTION
  72. WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  73. */
  74.  
  75. /*
  76.  * This driver handles two types of graphics cards.  The first type
  77.  * (e.g., EGA, CGA), treats the screen as a page of characters and
  78.  * has a hardware cursor.  The second type (e.g., the Blit) treats the
  79.  * screen as a bitmap.  A hardware cursor may be present, but it is
  80.  * ignored in favor of a software cursor.
  81.  *
  82.  *
  83.  * Most of the driver uses the following abstraction for the display:
  84.  *
  85.  * The cursor position is simply an index into a (logical) linear char
  86.  * array that wraps around at the end of each line.  Each character
  87.  * takes up ONE_SPACE bytes.  Values in [0..ONE_PAGE) are positions in
  88.  * the displayed page.  Values < 0 and >= ONE_PAGE are off the page
  89.  * and require some scrolling to put the cursor back on the page.
  90.  *
  91.  * The kd_dxxx routines handle the conversion from this abstraction to
  92.  * what the hardware requires.
  93.  *
  94.  * (*kd_dput)(pos, ch, chattr)
  95.  *    csrpos_t pos;
  96.  *    char ch, chattr;
  97.  *  Displays a character at "pos", where "ch" = the character to
  98.  *  be displayed and "chattr" is its attribute byte.
  99.  *
  100.  * (*kd_dmvup)(from, to, count)
  101.  *    csrpos_t from, to;
  102.  *    int count;
  103.  *  Does a (relatively) fast block transfer of characters upward.
  104.  *  "count" is the number of character positions (not bytes) to move.
  105.  *  "from" is the character position to start moving from (at the start
  106.  *  of the block to be moved).  "to" is the character position to start
  107.  *  moving to.
  108.  *
  109.  * (*kd_dmvdown)(from, to, count)
  110.  *    csrpos_t from, to;
  111.  *    int count;
  112.  *  "count" is the number of character positions (not bytes) to move.
  113.  *  "from" is the character position to start moving from (at the end
  114.  *  of the block to be moved).  "to" is the character position to
  115.  *  start moving to.
  116.  *
  117.  * (*kd_dclear)(to, count, chattr)
  118.  *    csrpos_t, to;
  119.  *    int count;
  120.  *    char chattr;
  121.  *  Erases "count" character positions, starting with "to".
  122.  *
  123.  * (*kd_dsetcursor)(pos)
  124.  *  Sets kd_curpos and moves the displayed cursor to track it.  "pos"
  125.  *  should be in the range [0..ONE_PAGE).
  126.  *  
  127.  * (*kd_dreset)()
  128.  *  In some cases, the boot program expects the display to be in a
  129.  *  particular state, and doing a soft reset (i.e.,
  130.  *  software-controlled reboot) doesn't put it into that state.  For
  131.  *  these cases, the machine-specific driver should provide a "reset"
  132.  *  procedure, which will be called just before the kd code causes the
  133.  *  system to reboot.
  134.  */
  135.  
  136. extern void bmpput(), bmpmvup(), bmpmvdown(), bmpclear(), bmpsetcursor();
  137.  
  138. extern void    (*kd_dput)();        /* put attributed char */
  139. extern void    (*kd_dmvup)();        /* block move up */
  140. extern void    (*kd_dmvdown)();    /* block move down */
  141. extern void    (*kd_dclear)();        /* block clear */
  142. extern void    (*kd_dsetcursor)();
  143.                 /* set cursor position on displayed page */
  144. extern void    (*kd_dreset)();        /* prepare for reboot */
  145.  
  146.  
  147. /*
  148.  * Globals used for both character-based controllers and bitmap-based
  149.  * controllers.
  150.  */
  151. typedef    short    csrpos_t;    /* cursor position, ONE_SPACE bytes per char */
  152.  
  153. extern u_char     *vid_start;    /* VM start of video RAM or frame buffer */
  154. extern csrpos_t kd_curpos;        /* should be set only by kd_setpos */
  155. extern short    kd_lines;        /* num lines in tty display */
  156. extern short    kd_cols;
  157. extern char    kd_attr;        /* current character attribute */
  158.  
  159.  
  160. /*
  161.  * Globals used only for bitmap-based controllers.
  162.  * XXX - probably needs reworking for color.
  163.  */
  164.  
  165. /*
  166.  * The following font layout is assumed:
  167.  *
  168.  *  The top scan line of all the characters comes first.  Then the
  169.  *  second scan line, then the third, etc.
  170.  *
  171.  *     ------ ... ---------|-----N--------|-------------- ... -----------
  172.  *     ------ ... ---------|-----N--------|-------------- ... -----------
  173.  *        .
  174.  *        .
  175.  *        .
  176.  *     ------ ... ---------|-----N--------|-------------- ... -----------
  177.  *
  178.  * In the picture, each line is a scan line from the font.  Each scan
  179.  * line is stored in memory immediately after the previous one.  The
  180.  * bits between the vertical lines are the bits for a single character
  181.  * (e.g., the letter "N").
  182.  * There are "char_height" scan lines.  Each character is "char_width"
  183.  * bits wide.  We make the simplifying assumption that characters are
  184.  * on byte boundaries.  (We also assume that a byte is 8 bits.)
  185.  */
  186.  
  187. extern u_char    *font_start;        /* starting addr of font */
  188.  
  189. extern short    fb_width;        /* bits in frame buffer scan line */
  190. extern short    fb_height;        /* scan lines in frame buffer*/
  191. extern short    char_width;        /* bit width of 1 char */
  192. extern short    char_height;        /* bit height of 1 char */
  193. extern short    chars_in_font;
  194. extern short    cursor_height;        /* bit height of cursor */
  195.             /* char_height + cursor_height = line_height */
  196.  
  197. extern u_char    char_black;        /* 8 black (off) bits */
  198. extern u_char    char_white;        /* 8 white (on) bits */
  199.  
  200.  
  201. /*
  202.  * The tty emulation does not usually require the entire frame buffer.
  203.  * (xstart, ystart) is the bit address for the upper left corner of the 
  204.  * tty "screen".
  205.  */
  206.  
  207. extern short    xstart, ystart;
  208.  
  209.  
  210. /*
  211.  * Accelerators for bitmap displays.
  212.  */
  213.  
  214. extern short    char_byte_width;    /* char_width/8 */
  215. extern short    fb_byte_width;        /* fb_width/8 */
  216. extern short    font_byte_width;    /* num bytes in 1 scan line of font */
  217.  
  218.