1 /* $NetBSD: itevar.h,v 1.11.38.1 2007/05/22 17:27:44 matt Exp $ */
4 * Copyright (c) 1990 The Regents of the University of California.
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.1 90/07/09$
37 * @(#)itevar.h 7.2 (Berkeley) 11/4/90
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.1 90/07/09$
76 * @(#)itevar.h 7.2 (Berkeley) 11/4/90
79 #define UNIT(dev) minor(dev)
84 int (*ite_cnprobe
)(int minor
);
85 void (*ite_init
)(struct ite_softc
*);
86 void (*ite_deinit
)(struct ite_softc
*);
87 void (*ite_clear
)(struct ite_softc
*, int, int, int, int);
88 void (*ite_putc
)(struct ite_softc
*, int, int, int, int);
89 void (*ite_cursor
)(struct ite_softc
*, int);
90 void (*ite_scroll
)(struct ite_softc
*, int, int, int, int);
98 /* maximum number of argument characters (<CSI>33;34;3m for example) */
99 #define ARGBUF_SIZE 256
102 struct device device
;
103 struct grf_softc
*grf
;
110 short cursorx
, cursory
;
113 u_char font_lo
, font_hi
;
116 short ftheight
, ftwidth
, ftbaseline
, ftboldsmear
;
121 char imode
, fpd
, hold
;
122 u_char escape
, cursor_opt
, key_repeat
;
123 char *GL
, *GR
, *save_GL
;
125 char fgcolor
, bgcolor
;
126 char linefeed_newline
, auto_wrap
;
127 char cursor_appmode
, keypad_appmode
;
128 char argbuf
[ARGBUF_SIZE
], *ap
, *tabs
;
129 char emul_level
, eightbit_C1
;
130 int top_margin
, bottom_margin
;
131 char inside_margins
, sc_om
;
132 short save_curx
, save_cury
, save_attribute
, save_char
;
133 char sc_G0
, sc_G1
, sc_G2
, sc_G3
;
144 #define ITE_ALIVE 0x01 /* hardware exists */
145 #define ITE_INITED 0x02 /* device has been initialized */
146 #define ITE_CONSOLE 0x04 /* device can be console */
147 #define ITE_ISCONS 0x08 /* device is console */
148 #define ITE_ACTIVE 0x10 /* device is being used as ITE */
149 #define ITE_INGRF 0x20 /* device in use as non-ITE */
151 #ifdef DO_WEIRD_ATTRIBUTES
152 #define attrloc(ip, y, x) \
153 (ip->attrbuf + ((y) * ip->cols) + (x))
155 #define attrclr(ip, sy, sx, h, w) \
156 memset(ip->attrbuf + ((sy) * ip->cols) + (sx), 0, (h) * (w))
158 #define attrmov(ip, sy, sx, dy, dx, h, w) \
159 memcpy(ip->attrbuf + ((dy) * ip->cols) + (dx), \
160 ip->attrbuf + ((sy) * ip->cols) + (sx), \
163 #define attrtest(ip, attr) \
164 ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) & attr)
166 #define attrset(ip, attr) \
167 ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) = attr)
169 #define attrloc(ip, y, x) 0
170 #define attrclr(ip, sy, sx, h, w)
171 #define attrmov(ip, sy, sx, dy, dx, h, w)
172 #define attrtest(ip, attr) 0
173 #define attrset(ip, attr)
178 * X and Y location of character 'c' in the framebuffer, in pixels.
180 #define charX(ip,c) \
181 (((c) % (ip)->cpl) * (ip)->ftwidth + (ip)->fontx)
183 #define charY(ip,c) \
184 (((c) / (ip)->cpl) * (ip)->ftheight + (ip)->fonty)
186 /* Character attributes */
187 #define ATTR_NOR 0x0 /* normal */
188 #define ATTR_INV 0x1 /* inverse */
189 #define ATTR_UL 0x2 /* underline */
190 #define ATTR_BOLD 0x4 /* bold */
191 #define ATTR_BLINK 0x8 /* blink */
192 #define ATTR_ALL (ATTR_INV | ATTR_UL|ATTR_BOLD|ATTR_BLINK)
194 /* Keyboard attributes */
195 #define ATTR_KPAD 0x80 /* keypad transmit */
197 /* Replacement Rules */
201 #define RR_COPYINVERTED 0xc
203 #define SCROLL_UP 0x01
204 #define SCROLL_DOWN 0x02
205 #define SCROLL_LEFT 0x03
206 #define SCROLL_RIGHT 0x04
207 #define DRAW_CURSOR 0x05
208 #define ERASE_CURSOR 0x06
209 #define MOVE_CURSOR 0x07
210 #define START_CURSOROPT 0x08 /* at start of output. May disable cursor */
211 #define END_CURSOROPT 0x09 /* at end, make sure cursor state is ok */
213 /* special key codes */
214 #define KBD_LEFT_SHIFT 0x70
215 #define KBD_RIGHT_SHIFT 0x70
216 #define KBD_CAPS_LOCK 0x5d
217 #define KBD_CTRL 0x71
218 #define KBD_LEFT_ALT 0x55
219 #define KBD_RIGHT_ALT 0x58
220 #define KBD_LEFT_META 0x56
221 #define KBD_RIGHT_META 0x57
222 #define KBD_OPT1 0x72
223 #define KBD_OPT2 0x73
224 #define KBD_RECONNECT 0x7f
226 /* modifier map for use in itefilter() */
227 #define KBD_MOD_LSHIFT (1<<0)
228 #define KBD_MOD_RSHIFT (1<<1)
229 #define KBD_MOD_SHIFT (KBD_MOD_LSHIFT | KBD_MOD_RSHIFT)
230 #define KBD_MOD_CTRL (1<<2)
231 #define KBD_MOD_LALT (1<<3)
232 #define KBD_MOD_RALT (1<<4)
233 #define KBD_MOD_ALT (KBD_MOD_LALT | KBD_MOD_RALT)
234 #define KBD_MOD_LMETA (1<<5)
235 #define KBD_MOD_RMETA (1<<6)
236 #define KBD_MOD_META (KBD_MOD_LMETA | KBD_MOD_RMETA)
237 #define KBD_MOD_CAPS (1<<7)
238 #define KBD_MOD_OPT1 (1<<8)
239 #define KBD_MOD_OPT2 (1<<9)
241 /* type for the second argument to itefilter(). Note that the
242 driver doesn't support key-repeat for console-mode, since it can't use
243 timeout() for polled I/O. */
245 enum tab_size
{ TABSIZE
= 8 };
246 #define TABEND(u) (ite_tty[u]->t_windsize.ws_col - TABSIZE) /* XXX */
248 #define set_attr(ip, attr) ((ip)->attribute |= (attr))
249 #define clr_attr(ip, attr) ((ip)->attribute &= ~(attr))
250 #define attrloc(ip, y, x) 0
251 #define attrclr(ip, sy, sx, h, w)
252 #define attrmov(ip, sy, sx, dy, dx, h, w)
253 #define attrtest(ip, attr) 0
254 #define attrset(ip, attr)
257 #define CSET_MULTI 0x80 /* multibytes flag */
258 #define CSET_ASCII 0 /* ascii */
259 #define CSET_JISROMA 1 /* iso2022jp romaji */
260 #define CSET_JISKANA 2 /* iso2022jp kana */
261 #define CSET_JIS1978 (3|CSET_MULTI) /* iso2022jp old jis kanji */
262 #define CSET_JIS1983 (4|CSET_MULTI) /* iso2022jp new jis kanji */
263 #define CSET_JIS1990 (5|CSET_MULTI) /* iso2022jp hojo kanji */
267 /* console related function */
268 void itecnprobe(struct consdev
*);
269 void itecninit(struct consdev
*);
270 int itecngetc(dev_t
);
271 void itecnputc(dev_t
, int);
272 void itecnfinish(struct ite_softc
*);
274 /* standard ite device entry points. */
276 void itestart(struct tty
*);
279 int iteon(dev_t
, int);
280 void iteoff(dev_t
, int);
281 void ite_reinit(dev_t
);
282 void ite_reset(struct ite_softc
*);
283 int ite_cnfilter(u_char
);
284 void ite_filter(u_char
);
286 /* lower layer functions */
287 void tv_init(struct ite_softc
*);
288 void tv_deinit(struct ite_softc
*);
291 extern unsigned char kern_font
[];
293 /* keyboard LED status variable */
294 extern unsigned char kbdled
;
295 void ite_set_glyph(void);
296 void kbd_setLED(void);