1 /* $NetBSD: itevar.h,v 1.6 2007/03/07 09:10:21 he Exp $ */
4 * Copyright (c) 1990, 1993
5 * The Regents of the University of California. All rights reserved.
7 * This code is derived from software contributed to Berkeley by
8 * the Systems Programming Group of the University of Utah Computer
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * from: Utah $Hdr: itevar.h 1.15 92/12/20$
37 * @(#)itevar.h 8.1 (Berkeley) 6/10/93
40 * Copyright (c) 1988 University of Utah.
42 * This code is derived from software contributed to Berkeley by
43 * the Systems Programming Group of the University of Utah Computer
46 * Redistribution and use in source and binary forms, with or without
47 * modification, are permitted provided that the following conditions
49 * 1. Redistributions of source code must retain the above copyright
50 * notice, this list of conditions and the following disclaimer.
51 * 2. Redistributions in binary form must reproduce the above copyright
52 * notice, this list of conditions and the following disclaimer in the
53 * documentation and/or other materials provided with the distribution.
54 * 3. All advertising materials mentioning features or use of this software
55 * must display the following acknowledgement:
56 * This product includes software developed by the University of
57 * California, Berkeley and its contributors.
58 * 4. Neither the name of the University nor the names of its contributors
59 * may be used to endorse or promote products derived from this software
60 * without specific prior written permission.
62 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
63 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
64 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
65 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
66 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
67 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
68 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
69 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
70 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
71 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
74 * from: Utah $Hdr: itevar.h 1.15 92/12/20$
76 * @(#)itevar.h 8.1 (Berkeley) 6/10/93
80 * Standalone version of hp300 ITE.
83 #define ITEUNIT(dev) minor(dev)
85 #define getbyte(ip, offset) \
86 ((*(ip)->isw->ite_readbyte)(ip, offset))
88 #define getword(ip, offset) \
89 ((getbyte(ip, offset) << 8) | getbyte(ip, (offset) + 2))
91 #define writeglyph(ip, offset, fontbuf) \
92 ((*(ip)->isw->ite_writeglyph)((ip), (offset), (fontbuf)))
99 void *regbase
, *fbbase
;
101 short cursorx
, cursory
;
102 short cblankx
, cblanky
;
105 short dheight
, dwidth
;
106 short fbheight
, fbwidth
;
107 short ftheight
, ftwidth
;
113 char imode
, escape
, fpd
, hold
;
114 void * devdata
; /* display dependent data */
119 void (*ite_init
)(struct ite_data
*);
120 void (*ite_deinit
)(struct ite_data
*);
121 void (*ite_clear
)(struct ite_data
*, int, int, int, int);
122 void (*ite_putc
)(struct ite_data
*, int, int, int, int);
123 void (*ite_cursor
)(struct ite_data
*, int);
124 void (*ite_scroll
)(struct ite_data
*, int, int, int, int);
125 u_char (*ite_readbyte
)(struct ite_data
*, int);
126 void (*ite_writeglyph
)(struct ite_data
*, u_char
*, u_char
*);
130 #define ITE_ALIVE 0x01 /* hardware exists */
131 #define ITE_INITED 0x02 /* device has been initialized */
132 #define ITE_CONSOLE 0x04 /* device can be console */
133 #define ITE_ISCONS 0x08 /* device is console */
134 #define ITE_ACTIVE 0x10 /* device is being used as ITE */
135 #define ITE_INGRF 0x20 /* device in use as non-ITE */
136 #define ITE_CURSORON 0x40 /* cursor being tracked */
138 #define attrloc(ip, y, x) \
139 (ip->attrbuf + ((y) * ip->cols) + (x))
141 #define attrclr(ip, sy, sx, h, w) \
142 memset(ip->attrbuf + ((sy) * ip->cols) + (sx), 0, (h) * (w))
144 #define attrmov(ip, sy, sx, dy, dx, h, w) \
145 bcopy(ip->attrbuf + ((sy) * ip->cols) + (sx), \
146 ip->attrbuf + ((dy) * ip->cols) + (dx), \
149 #define attrtest(ip, attr) \
150 ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) & attr)
152 #define attrset(ip, attr) \
153 ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) = attr)
156 * X and Y location of character 'c' in the framebuffer, in pixels.
158 #define charX(ip,c) \
159 (((c) % (ip)->cpl) * (ip)->ftwidth + (ip)->fontx)
161 #define charY(ip,c) \
162 (((c) / (ip)->cpl) * (ip)->ftheight + (ip)->fonty)
165 * The cursor is just an inverted space.
167 #define draw_cursor(ip) { \
168 WINDOWMOVER(ip, ip->cblanky, ip->cblankx, \
169 ip->cury * ip->ftheight, \
170 ip->curx * ip->ftwidth, \
171 ip->ftheight, ip->ftwidth, RR_XOR); \
172 ip->cursorx = ip->curx; \
173 ip->cursory = ip->cury; }
175 #define erase_cursor(ip) \
176 WINDOWMOVER(ip, ip->cblanky, ip->cblankx, \
177 ip->cursory * ip->ftheight, \
178 ip->cursorx * ip->ftwidth, \
179 ip->ftheight, ip->ftwidth, RR_XOR);
181 /* Character attributes */
182 #define ATTR_NOR 0x0 /* normal */
183 #define ATTR_INV 0x1 /* inverse */
184 #define ATTR_UL 0x2 /* underline */
185 #define ATTR_ALL (ATTR_INV | ATTR_UL)
187 /* Keyboard attributes */
188 #define ATTR_KPAD 0x4 /* keypad transmit */
190 /* Replacement Rules */
194 #define RR_COPYINVERTED 0xc
196 #define SCROLL_UP 0x01
197 #define SCROLL_DOWN 0x02
198 #define SCROLL_LEFT 0x03
199 #define SCROLL_RIGHT 0x04
200 #define DRAW_CURSOR 0x05
201 #define ERASE_CURSOR 0x06
202 #define MOVE_CURSOR 0x07
204 #define KBD_SSHIFT 4 /* bits to shift status */
205 #define KBD_CHARMASK 0x7F
207 /* keyboard status */
208 #define KBD_SMASK 0xF /* service request status mask */
209 #define KBD_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */
210 #define KBD_CTRL 0x9 /* key + CTRL */
211 #define KBD_SHIFT 0xA /* key + SHIFT */
212 #define KBD_KEY 0xB /* key only */
214 #define KBD_CAPSLOCK 0x18
216 #define KBD_EXT_LEFT_DOWN 0x12
217 #define KBD_EXT_LEFT_UP 0x92
218 #define KBD_EXT_RIGHT_DOWN 0x13
219 #define KBD_EXT_RIGHT_UP 0x93
222 #define TABEND(ip) ((ip)->tty->t_winsize.ws_col - TABSIZE)
224 extern struct ite_data ite_data
[];
225 extern struct itesw itesw
[];
231 u_char
ite_readbyte(struct ite_data
*, int);
232 void ite_writeglyph(struct ite_data
*, u_char
*, u_char
*);
233 void ite_fontinfo(struct ite_data
*);
234 void ite_fontinit(struct ite_data
*);
237 * Framebuffer-specific ITE prototypes.
239 void topcat_init(struct ite_data
*);
240 void topcat_clear(struct ite_data
*, int, int, int, int);
241 void topcat_putc(struct ite_data
*, int, int, int, int);
242 void topcat_cursor(struct ite_data
*, int);
243 void topcat_scroll(struct ite_data
*, int, int, int, int);
245 void gbox_init(struct ite_data
*);
246 void gbox_clear(struct ite_data
*, int, int, int, int);
247 void gbox_putc(struct ite_data
*, int, int, int, int);
248 void gbox_cursor(struct ite_data
*, int);
249 void gbox_scroll(struct ite_data
*, int, int, int, int);
251 void rbox_init(struct ite_data
*);
252 void rbox_clear(struct ite_data
*, int, int, int, int);
253 void rbox_putc(struct ite_data
*, int, int, int, int);
254 void rbox_cursor(struct ite_data
*, int);
255 void rbox_scroll(struct ite_data
*, int, int, int, int);
257 void dvbox_init(struct ite_data
*);
258 void dvbox_clear(struct ite_data
*, int, int, int, int);
259 void dvbox_putc(struct ite_data
*, int, int, int, int);
260 void dvbox_cursor(struct ite_data
*, int);
261 void dvbox_scroll(struct ite_data
*, int, int, int, int);
263 void hyper_init(struct ite_data
*);
264 void hyper_clear(struct ite_data
*, int, int, int, int);
265 void hyper_putc(struct ite_data
*, int, int, int, int);
266 void hyper_cursor(struct ite_data
*, int);
267 void hyper_scroll(struct ite_data
*, int, int, int, int);