itevar.h revision 1.15.10.1 1 /* $NetBSD: itevar.h,v 1.15.10.1 2014/05/21 20:56:36 bouyer 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 int scode; /* DIO selectcode or SGC slot # */
59 struct itesw *isw;
60 void *regbase, *fbbase;
61 short curx, cury;
62 short cursorx, cursory;
63 short cblankx, cblanky;
64 short rows, cols;
65 short cpl;
66 short dheight, dwidth;
67 short fbheight, fbwidth;
68 short ftheight, ftwidth;
69 short fontx, fonty;
70 short planemask;
71 ite_windowmover bmv;
72 };
73
74 struct itesw {
75 int ite_hwid;
76 void (*ite_init)(struct ite_data *);
77 void (*ite_clear)(struct ite_data *, int, int, int, int);
78 void (*ite_putc)(struct ite_data *, int, int, int);
79 void (*ite_cursor)(struct ite_data *, int);
80 void (*ite_scroll)(struct ite_data *);
81 };
82
83 /*
84 * X and Y location of character 'c' in the framebuffer, in pixels.
85 */
86 #define charX(ip,c) \
87 (((c) % (ip)->cpl) * (ip)->ftwidth + (ip)->fontx)
88
89 #define charX1bpp(ip,c) \
90 (((c) % (ip)->cpl) * ((((ip)->ftwidth + 7) / 8) * 8) + (ip)->fontx)
91
92 #define charY(ip,c) \
93 (((c) / (ip)->cpl) * (ip)->ftheight + (ip)->fonty)
94
95 /* Replacement Rules */
96 #define RR_CLEAR 0x0
97 #define RR_COPY 0x3
98 #define RR_XOR 0x6
99 #define RR_COPYINVERTED 0xc
100
101 #define DRAW_CURSOR 0x05
102 #define ERASE_CURSOR 0x06
103 #define MOVE_CURSOR 0x07
104
105 #define KBD_SSHIFT 4 /* bits to shift status */
106 #define KBD_CHARMASK 0x7F
107
108 /* keyboard status */
109 #define KBD_SMASK 0xF /* service request status mask */
110 #define KBD_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */
111 #define KBD_CTRL 0x9 /* key + CTRL */
112 #define KBD_SHIFT 0xA /* key + SHIFT */
113 #define KBD_KEY 0xB /* key only */
114
115 extern struct ite_data ite_data[];
116 extern struct itesw itesw[];
117 extern int nitesw;
118
119 /*
120 * Prototypes.
121 */
122 void ite_fontinfo(struct ite_data *);
123 void ite_fontinit1bpp(struct ite_data *);
124 void ite_fontinit8bpp(struct ite_data *);
125 void ite_dio_clear(struct ite_data *, int, int, int, int);
126 void ite_dio_cursor(struct ite_data *, int);
127 void ite_dio_putc1bpp(struct ite_data *, int, int, int);
128 void ite_dio_putc8bpp(struct ite_data *, int, int, int);
129 void ite_dio_scroll(struct ite_data *);
130 void ite_dio_windowmove1bpp(struct ite_data *, int, int, int, int,
131 int, int, int);
132
133 /*
134 * Framebuffer-specific ITE prototypes.
135 */
136 void topcat_init(struct ite_data *);
137 void gbox_init(struct ite_data *);
138 void gbox_scroll(struct ite_data *);
139 void rbox_init(struct ite_data *);
140 void dvbox_init(struct ite_data *);
141 void hyper_init(struct ite_data *);
142 void tvrx_init(struct ite_data *);
143
144 void sti_iteinit_sgc(struct ite_data *);
145 void sti_cursor(struct ite_data *, int);
146 void sti_putc(struct ite_data *, int, int, int);
147 void sti_clear(struct ite_data *, int, int, int, int);
148 void sti_scroll(struct ite_data *);
149
150 void dumb_init(struct ite_data *);
151 void dumb_cursor(struct ite_data *, int);
152 void dumb_putc(struct ite_data *, int, int, int);
153 void dumb_clear(struct ite_data *, int, int, int, int);
154 void dumb_scroll(struct ite_data *);
155