itevar.h revision 1.14 1 /* $NetBSD: itevar.h,v 1.14 2011/02/10 13:04:32 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 struct ite_data;
46
47 typedef void (*ite_windowmover)(struct ite_data *, int, int, int, int, int,
48 int, int);
49
50 struct ite_data {
51 int alive;
52 struct itesw *isw;
53 void *regbase, *fbbase;
54 short curx, cury;
55 short cursorx, cursory;
56 short cblankx, cblanky;
57 short rows, cols;
58 short cpl;
59 short dheight, dwidth;
60 short fbheight, fbwidth;
61 short ftheight, ftwidth;
62 short fontx, fonty;
63 short planemask;
64 ite_windowmover bmv;
65 };
66
67 struct itesw {
68 int ite_hwid;
69 void (*ite_init)(struct ite_data *);
70 void (*ite_clear)(struct ite_data *, int, int, int, int);
71 void (*ite_putc)(struct ite_data *, int, int, int);
72 void (*ite_cursor)(struct ite_data *, int);
73 void (*ite_scroll)(struct ite_data *);
74 };
75
76 /*
77 * X and Y location of character 'c' in the framebuffer, in pixels.
78 */
79 #define charX(ip,c) \
80 (((c) % (ip)->cpl) * (ip)->ftwidth + (ip)->fontx)
81
82 #define charX1bpp(ip,c) \
83 (((c) % (ip)->cpl) * ((((ip)->ftwidth + 7) / 8) * 8) + (ip)->fontx)
84
85 #define charY(ip,c) \
86 (((c) / (ip)->cpl) * (ip)->ftheight + (ip)->fonty)
87
88 /* Replacement Rules */
89 #define RR_CLEAR 0x0
90 #define RR_COPY 0x3
91 #define RR_XOR 0x6
92 #define RR_COPYINVERTED 0xc
93
94 #define DRAW_CURSOR 0x05
95 #define ERASE_CURSOR 0x06
96 #define MOVE_CURSOR 0x07
97
98 #define KBD_SSHIFT 4 /* bits to shift status */
99 #define KBD_CHARMASK 0x7F
100
101 /* keyboard status */
102 #define KBD_SMASK 0xF /* service request status mask */
103 #define KBD_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */
104 #define KBD_CTRL 0x9 /* key + CTRL */
105 #define KBD_SHIFT 0xA /* key + SHIFT */
106 #define KBD_KEY 0xB /* key only */
107
108 extern struct ite_data ite_data[];
109 extern struct itesw itesw[];
110 extern int nitesw;
111
112 /*
113 * Prototypes.
114 */
115 void ite_fontinfo(struct ite_data *);
116 void ite_fontinit1bpp(struct ite_data *);
117 void ite_fontinit8bpp(struct ite_data *);
118 void ite_dio_clear(struct ite_data *, int, int, int, int);
119 void ite_dio_cursor(struct ite_data *, int);
120 void ite_dio_putc1bpp(struct ite_data *, int, int, int);
121 void ite_dio_putc8bpp(struct ite_data *, int, int, int);
122 void ite_dio_scroll(struct ite_data *);
123 void ite_dio_windowmove1bpp(struct ite_data *, int, int, int, int,
124 int, int, int);
125
126 /*
127 * Framebuffer-specific ITE prototypes.
128 */
129 void topcat_init(struct ite_data *);
130 void gbox_init(struct ite_data *);
131 void gbox_scroll(struct ite_data *);
132 void rbox_init(struct ite_data *);
133 void dvbox_init(struct ite_data *);
134 void hyper_init(struct ite_data *);
135 void tvrx_init(struct ite_data *);
136