Home | History | Annotate | Line # | Download | only in common
itevar.h revision 1.15
      1 /*	$NetBSD: itevar.h,v 1.15 2011/02/12 05:08:41 tsutsui Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1988 University of Utah.
      5  * Copyright (c) 1990, 1993
      6  *	The Regents of the University of California.  All rights reserved.
      7  *
      8  * This code is derived from software contributed to Berkeley by
      9  * the Systems Programming Group of the University of Utah Computer
     10  * Science Department.
     11  *
     12  * Redistribution and use in source and binary forms, with or without
     13  * modification, are permitted provided that the following conditions
     14  * are met:
     15  * 1. Redistributions of source code must retain the above copyright
     16  *    notice, this list of conditions and the following disclaimer.
     17  * 2. Redistributions in binary form must reproduce the above copyright
     18  *    notice, this list of conditions and the following disclaimer in the
     19  *    documentation and/or other materials provided with the distribution.
     20  * 3. Neither the name of the University nor the names of its contributors
     21  *    may be used to endorse or promote products derived from this software
     22  *    without specific prior written permission.
     23  *
     24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     34  * SUCH DAMAGE.
     35  *
     36  * from: Utah $Hdr: itevar.h 1.15 92/12/20$
     37  *
     38  *	@(#)itevar.h	8.1 (Berkeley) 6/10/93
     39  */
     40 
     41 /*
     42  * Standalone version of hp300 ITE.
     43  */
     44 
     45 #define getbyte(ip, offset) \
     46 	*(((u_char *)(ip)->regbase) + (offset))
     47 
     48 #define getword(ip, offset) \
     49 	((getbyte(ip, offset) << 8) | getbyte(ip, (offset) + 2))
     50 
     51 struct ite_data;
     52 
     53 typedef	void (*ite_windowmover)(struct ite_data *, int, int, int, int, int,
     54 	    int, int);
     55 
     56 struct ite_data {
     57 	int	alive;
     58 	struct  itesw *isw;
     59 	void 	*regbase, *fbbase;
     60 	short	curx, cury;
     61 	short   cursorx, cursory;
     62 	short   cblankx, cblanky;
     63 	short	rows, cols;
     64 	short   cpl;
     65 	short	dheight, dwidth;
     66 	short	fbheight, fbwidth;
     67 	short	ftheight, ftwidth;
     68 	short	fontx, fonty;
     69 	short	planemask;
     70 	ite_windowmover bmv;
     71 };
     72 
     73 struct itesw {
     74 	int	ite_hwid;
     75 	void	(*ite_init)(struct ite_data *);
     76 	void	(*ite_clear)(struct ite_data *, int, int, int, int);
     77 	void	(*ite_putc)(struct ite_data *, int, int, int);
     78 	void	(*ite_cursor)(struct ite_data *, int);
     79 	void	(*ite_scroll)(struct ite_data *);
     80 };
     81 
     82 /*
     83  * X and Y location of character 'c' in the framebuffer, in pixels.
     84  */
     85 #define	charX(ip,c)	\
     86 	(((c) % (ip)->cpl) * (ip)->ftwidth + (ip)->fontx)
     87 
     88 #define charX1bpp(ip,c) \
     89 	(((c) % (ip)->cpl) * ((((ip)->ftwidth + 7) / 8) * 8) + (ip)->fontx)
     90 
     91 #define	charY(ip,c)	\
     92 	(((c) / (ip)->cpl) * (ip)->ftheight + (ip)->fonty)
     93 
     94 /* Replacement Rules */
     95 #define RR_CLEAR		0x0
     96 #define RR_COPY			0x3
     97 #define RR_XOR			0x6
     98 #define RR_COPYINVERTED  	0xc
     99 
    100 #define DRAW_CURSOR	0x05
    101 #define ERASE_CURSOR    0x06
    102 #define MOVE_CURSOR	0x07
    103 
    104 #define KBD_SSHIFT	4		/* bits to shift status */
    105 #define KBD_CHARMASK	0x7F
    106 
    107 /* keyboard status */
    108 #define KBD_SMASK	0xF		/* service request status mask */
    109 #define KBD_CTRLSHIFT	0x8		/* key + CTRL + SHIFT */
    110 #define KBD_CTRL	0x9		/* key + CTRL */
    111 #define KBD_SHIFT	0xA		/* key + SHIFT */
    112 #define KBD_KEY		0xB		/* key only */
    113 
    114 extern	struct ite_data ite_data[];
    115 extern	struct itesw itesw[];
    116 extern	int nitesw;
    117 
    118 /*
    119  * Prototypes.
    120  */
    121 void ite_fontinfo(struct ite_data *);
    122 void ite_fontinit1bpp(struct ite_data *);
    123 void ite_fontinit8bpp(struct ite_data *);
    124 void ite_dio_clear(struct ite_data *, int, int, int, int);
    125 void ite_dio_cursor(struct ite_data *, int);
    126 void ite_dio_putc1bpp(struct ite_data *, int, int, int);
    127 void ite_dio_putc8bpp(struct ite_data *, int, int, int);
    128 void ite_dio_scroll(struct ite_data *);
    129 void ite_dio_windowmove1bpp(struct ite_data *, int, int, int, int,
    130     int, int, int);
    131 
    132 /*
    133  * Framebuffer-specific ITE prototypes.
    134  */
    135 void topcat_init(struct ite_data *);
    136 void gbox_init(struct ite_data *);
    137 void gbox_scroll(struct ite_data *);
    138 void rbox_init(struct ite_data *);
    139 void dvbox_init(struct ite_data *);
    140 void hyper_init(struct ite_data *);
    141 void tvrx_init(struct ite_data *);
    142 void dumb_init(struct ite_data *);
    143 void dumb_cursor(struct ite_data *, int);
    144 void dumb_putc(struct ite_data *, int, int, int);
    145 void dumb_clear(struct ite_data *, int, int, int, int);
    146 void dumb_scroll(struct ite_data *);
    147