itevar.h revision 1.6.4.3 1 1.6.4.3 nathanw /* $NetBSD: itevar.h,v 1.6.4.3 2002/09/17 21:18:46 nathanw Exp $ */
2 1.6.4.2 nathanw
3 1.6.4.2 nathanw /*
4 1.6.4.2 nathanw * Copyright (c) 1988 University of Utah.
5 1.6.4.2 nathanw * Copyright (c) 1990 The Regents of the University of California.
6 1.6.4.2 nathanw * All rights reserved.
7 1.6.4.2 nathanw *
8 1.6.4.2 nathanw * This code is derived from software contributed to Berkeley by
9 1.6.4.2 nathanw * the Systems Programming Group of the University of Utah Computer
10 1.6.4.2 nathanw * Science Department.
11 1.6.4.2 nathanw *
12 1.6.4.2 nathanw * Redistribution and use in source and binary forms, with or without
13 1.6.4.2 nathanw * modification, are permitted provided that the following conditions
14 1.6.4.2 nathanw * are met:
15 1.6.4.2 nathanw * 1. Redistributions of source code must retain the above copyright
16 1.6.4.2 nathanw * notice, this list of conditions and the following disclaimer.
17 1.6.4.2 nathanw * 2. Redistributions in binary form must reproduce the above copyright
18 1.6.4.2 nathanw * notice, this list of conditions and the following disclaimer in the
19 1.6.4.2 nathanw * documentation and/or other materials provided with the distribution.
20 1.6.4.2 nathanw * 3. All advertising materials mentioning features or use of this software
21 1.6.4.2 nathanw * must display the following acknowledgement:
22 1.6.4.2 nathanw * This product includes software developed by the University of
23 1.6.4.2 nathanw * California, Berkeley and its contributors.
24 1.6.4.2 nathanw * 4. Neither the name of the University nor the names of its contributors
25 1.6.4.2 nathanw * may be used to endorse or promote products derived from this software
26 1.6.4.2 nathanw * without specific prior written permission.
27 1.6.4.2 nathanw *
28 1.6.4.2 nathanw * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 1.6.4.2 nathanw * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 1.6.4.2 nathanw * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 1.6.4.2 nathanw * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 1.6.4.2 nathanw * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 1.6.4.2 nathanw * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 1.6.4.2 nathanw * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 1.6.4.2 nathanw * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 1.6.4.2 nathanw * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 1.6.4.2 nathanw * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 1.6.4.2 nathanw * SUCH DAMAGE.
39 1.6.4.2 nathanw *
40 1.6.4.2 nathanw * from: Utah $Hdr: itevar.h 1.1 90/07/09$
41 1.6.4.2 nathanw *
42 1.6.4.2 nathanw * @(#)itevar.h 7.2 (Berkeley) 11/4/90
43 1.6.4.2 nathanw */
44 1.6.4.2 nathanw
45 1.6.4.2 nathanw #define UNIT(dev) minor(dev)
46 1.6.4.2 nathanw
47 1.6.4.2 nathanw struct ite_softc;
48 1.6.4.2 nathanw
49 1.6.4.2 nathanw struct itesw {
50 1.6.4.2 nathanw int (*ite_cnprobe) __P((int minor));
51 1.6.4.2 nathanw void (*ite_init) __P((struct ite_softc *));
52 1.6.4.2 nathanw void (*ite_deinit) __P((struct ite_softc *));
53 1.6.4.2 nathanw void (*ite_clear) __P((struct ite_softc *,int,int,int,int));
54 1.6.4.2 nathanw void (*ite_putc) __P((struct ite_softc *,int,int,int,int));
55 1.6.4.2 nathanw void (*ite_cursor) __P((struct ite_softc *,int));
56 1.6.4.2 nathanw void (*ite_scroll) __P((struct ite_softc *,int,int,int,int));
57 1.6.4.2 nathanw };
58 1.6.4.2 nathanw
59 1.6.4.2 nathanw enum ite_arraymaxs {
60 1.6.4.2 nathanw MAX_ARGSIZE = 256,
61 1.6.4.2 nathanw MAX_TABS = 256,
62 1.6.4.2 nathanw };
63 1.6.4.2 nathanw
64 1.6.4.2 nathanw /* maximum number of argument characters (<CSI>33;34;3m for example) */
65 1.6.4.2 nathanw #define ARGBUF_SIZE 256
66 1.6.4.2 nathanw
67 1.6.4.2 nathanw struct ite_softc {
68 1.6.4.2 nathanw struct device device;
69 1.6.4.2 nathanw struct grf_softc *grf;
70 1.6.4.2 nathanw struct itesw *isw;
71 1.6.4.2 nathanw int flags;
72 1.6.4.2 nathanw int type;
73 1.6.4.2 nathanw int open_cnt;
74 1.6.4.2 nathanw void *priv;
75 1.6.4.2 nathanw short curx, cury;
76 1.6.4.2 nathanw short cursorx, cursory;
77 1.6.4.2 nathanw u_char *font;
78 1.6.4.2 nathanw u_char *cursor;
79 1.6.4.2 nathanw u_char font_lo, font_hi;
80 1.6.4.2 nathanw short rows, cols;
81 1.6.4.2 nathanw short cpl;
82 1.6.4.2 nathanw short ftheight, ftwidth, ftbaseline, ftboldsmear;
83 1.6.4.2 nathanw short attribute;
84 1.6.4.2 nathanw u_char *attrbuf;
85 1.6.4.2 nathanw short planemask;
86 1.6.4.2 nathanw short pos;
87 1.6.4.2 nathanw char imode, fpd, hold;
88 1.6.4.2 nathanw u_char escape, cursor_opt, key_repeat;
89 1.6.4.2 nathanw char *GL, *GR, *save_GL;
90 1.6.4.2 nathanw char G0, G1, G2, G3;
91 1.6.4.2 nathanw char fgcolor, bgcolor;
92 1.6.4.2 nathanw char linefeed_newline, auto_wrap;
93 1.6.4.2 nathanw char cursor_appmode, keypad_appmode;
94 1.6.4.2 nathanw char argbuf[ARGBUF_SIZE], *ap, *tabs;
95 1.6.4.2 nathanw char emul_level, eightbit_C1;
96 1.6.4.2 nathanw int top_margin, bottom_margin;
97 1.6.4.2 nathanw char inside_margins, sc_om;
98 1.6.4.2 nathanw short save_curx, save_cury, save_attribute, save_char;
99 1.6.4.2 nathanw char sc_G0, sc_G1, sc_G2, sc_G3;
100 1.6.4.2 nathanw char *sc_GL, *sc_GR;
101 1.6.4.2 nathanw };
102 1.6.4.2 nathanw
103 1.6.4.2 nathanw enum emul_level {
104 1.6.4.2 nathanw EMUL_VT100 = 1,
105 1.6.4.2 nathanw EMUL_VT300_8,
106 1.6.4.2 nathanw EMUL_VT300_7
107 1.6.4.2 nathanw };
108 1.6.4.2 nathanw
109 1.6.4.2 nathanw /* Flags */
110 1.6.4.2 nathanw #define ITE_ALIVE 0x01 /* hardware exists */
111 1.6.4.2 nathanw #define ITE_INITED 0x02 /* device has been initialized */
112 1.6.4.2 nathanw #define ITE_CONSOLE 0x04 /* device can be console */
113 1.6.4.2 nathanw #define ITE_ISCONS 0x08 /* device is console */
114 1.6.4.2 nathanw #define ITE_ACTIVE 0x10 /* device is being used as ITE */
115 1.6.4.2 nathanw #define ITE_INGRF 0x20 /* device in use as non-ITE */
116 1.6.4.2 nathanw
117 1.6.4.2 nathanw #ifdef DO_WEIRD_ATTRIBUTES
118 1.6.4.2 nathanw #define attrloc(ip, y, x) \
119 1.6.4.2 nathanw (ip->attrbuf + ((y) * ip->cols) + (x))
120 1.6.4.2 nathanw
121 1.6.4.2 nathanw #define attrclr(ip, sy, sx, h, w) \
122 1.6.4.2 nathanw memset(ip->attrbuf + ((sy) * ip->cols) + (sx), 0, (h) * (w))
123 1.6.4.2 nathanw
124 1.6.4.2 nathanw #define attrmov(ip, sy, sx, dy, dx, h, w) \
125 1.6.4.2 nathanw memcpy(ip->attrbuf + ((dy) * ip->cols) + (dx), \
126 1.6.4.2 nathanw ip->attrbuf + ((sy) * ip->cols) + (sx), \
127 1.6.4.2 nathanw (h) * (w))
128 1.6.4.2 nathanw
129 1.6.4.2 nathanw #define attrtest(ip, attr) \
130 1.6.4.2 nathanw ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) & attr)
131 1.6.4.2 nathanw
132 1.6.4.2 nathanw #define attrset(ip, attr) \
133 1.6.4.2 nathanw ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) = attr)
134 1.6.4.2 nathanw #else
135 1.6.4.2 nathanw #define attrloc(ip, y, x) 0
136 1.6.4.2 nathanw #define attrclr(ip, sy, sx, h, w)
137 1.6.4.2 nathanw #define attrmov(ip, sy, sx, dy, dx, h, w)
138 1.6.4.2 nathanw #define attrtest(ip, attr) 0
139 1.6.4.2 nathanw #define attrset(ip, attr)
140 1.6.4.2 nathanw #endif
141 1.6.4.2 nathanw
142 1.6.4.2 nathanw
143 1.6.4.2 nathanw /*
144 1.6.4.2 nathanw * X and Y location of character 'c' in the framebuffer, in pixels.
145 1.6.4.2 nathanw */
146 1.6.4.2 nathanw #define charX(ip,c) \
147 1.6.4.2 nathanw (((c) % (ip)->cpl) * (ip)->ftwidth + (ip)->fontx)
148 1.6.4.2 nathanw
149 1.6.4.2 nathanw #define charY(ip,c) \
150 1.6.4.2 nathanw (((c) / (ip)->cpl) * (ip)->ftheight + (ip)->fonty)
151 1.6.4.2 nathanw
152 1.6.4.2 nathanw /* Character attributes */
153 1.6.4.2 nathanw #define ATTR_NOR 0x0 /* normal */
154 1.6.4.2 nathanw #define ATTR_INV 0x1 /* inverse */
155 1.6.4.2 nathanw #define ATTR_UL 0x2 /* underline */
156 1.6.4.2 nathanw #define ATTR_BOLD 0x4 /* bold */
157 1.6.4.2 nathanw #define ATTR_BLINK 0x8 /* blink */
158 1.6.4.2 nathanw #define ATTR_ALL (ATTR_INV | ATTR_UL|ATTR_BOLD|ATTR_BLINK)
159 1.6.4.2 nathanw
160 1.6.4.2 nathanw /* Keyboard attributes */
161 1.6.4.2 nathanw #define ATTR_KPAD 0x80 /* keypad transmit */
162 1.6.4.2 nathanw
163 1.6.4.2 nathanw /* Replacement Rules */
164 1.6.4.2 nathanw #define RR_CLEAR 0x0
165 1.6.4.2 nathanw #define RR_COPY 0x3
166 1.6.4.2 nathanw #define RR_XOR 0x6
167 1.6.4.2 nathanw #define RR_COPYINVERTED 0xc
168 1.6.4.2 nathanw
169 1.6.4.2 nathanw #define SCROLL_UP 0x01
170 1.6.4.2 nathanw #define SCROLL_DOWN 0x02
171 1.6.4.2 nathanw #define SCROLL_LEFT 0x03
172 1.6.4.2 nathanw #define SCROLL_RIGHT 0x04
173 1.6.4.2 nathanw #define DRAW_CURSOR 0x05
174 1.6.4.2 nathanw #define ERASE_CURSOR 0x06
175 1.6.4.2 nathanw #define MOVE_CURSOR 0x07
176 1.6.4.2 nathanw #define START_CURSOROPT 0x08 /* at start of output. May disable cursor */
177 1.6.4.2 nathanw #define END_CURSOROPT 0x09 /* at end, make sure cursor state is ok */
178 1.6.4.2 nathanw
179 1.6.4.2 nathanw /* special key codes */
180 1.6.4.2 nathanw #define KBD_LEFT_SHIFT 0x70
181 1.6.4.2 nathanw #define KBD_RIGHT_SHIFT 0x70
182 1.6.4.2 nathanw #define KBD_CAPS_LOCK 0x5d
183 1.6.4.2 nathanw #define KBD_CTRL 0x71
184 1.6.4.2 nathanw #define KBD_LEFT_ALT 0x55
185 1.6.4.2 nathanw #define KBD_RIGHT_ALT 0x58
186 1.6.4.2 nathanw #define KBD_LEFT_META 0x56
187 1.6.4.2 nathanw #define KBD_RIGHT_META 0x57
188 1.6.4.2 nathanw #define KBD_OPT1 0x72
189 1.6.4.2 nathanw #define KBD_OPT2 0x73
190 1.6.4.2 nathanw #define KBD_RECONNECT 0x7f
191 1.6.4.2 nathanw
192 1.6.4.2 nathanw /* modifier map for use in itefilter() */
193 1.6.4.2 nathanw #define KBD_MOD_LSHIFT (1<<0)
194 1.6.4.2 nathanw #define KBD_MOD_RSHIFT (1<<1)
195 1.6.4.2 nathanw #define KBD_MOD_SHIFT (KBD_MOD_LSHIFT | KBD_MOD_RSHIFT)
196 1.6.4.2 nathanw #define KBD_MOD_CTRL (1<<2)
197 1.6.4.2 nathanw #define KBD_MOD_LALT (1<<3)
198 1.6.4.2 nathanw #define KBD_MOD_RALT (1<<4)
199 1.6.4.2 nathanw #define KBD_MOD_ALT (KBD_MOD_LALT | KBD_MOD_RALT)
200 1.6.4.2 nathanw #define KBD_MOD_LMETA (1<<5)
201 1.6.4.2 nathanw #define KBD_MOD_RMETA (1<<6)
202 1.6.4.2 nathanw #define KBD_MOD_META (KBD_MOD_LMETA | KBD_MOD_RMETA)
203 1.6.4.2 nathanw #define KBD_MOD_CAPS (1<<7)
204 1.6.4.2 nathanw #define KBD_MOD_OPT1 (1<<8)
205 1.6.4.2 nathanw #define KBD_MOD_OPT2 (1<<9)
206 1.6.4.2 nathanw
207 1.6.4.2 nathanw /* type for the second argument to itefilter(). Note that the
208 1.6.4.2 nathanw driver doesn't support key-repeat for console-mode, since it can't use
209 1.6.4.2 nathanw timeout() for polled I/O. */
210 1.6.4.2 nathanw
211 1.6.4.2 nathanw enum tab_size { TABSIZE = 8 };
212 1.6.4.2 nathanw #define TABEND(u) (ite_tty[u]->t_windsize.ws_col - TABSIZE) /* XXX */
213 1.6.4.2 nathanw
214 1.6.4.2 nathanw #define set_attr(ip, attr) ((ip)->attribute |= (attr))
215 1.6.4.2 nathanw #define clr_attr(ip, attr) ((ip)->attribute &= ~(attr))
216 1.6.4.2 nathanw #define attrloc(ip, y, x) 0
217 1.6.4.2 nathanw #define attrclr(ip, sy, sx, h, w)
218 1.6.4.2 nathanw #define attrmov(ip, sy, sx, dy, dx, h, w)
219 1.6.4.2 nathanw #define attrtest(ip, attr) 0
220 1.6.4.2 nathanw #define attrset(ip, attr)
221 1.6.4.2 nathanw
222 1.6.4.2 nathanw /* character set */
223 1.6.4.2 nathanw #define CSET_MULTI 0x80 /* multibytes flag */
224 1.6.4.2 nathanw #define CSET_ASCII 0 /* ascii */
225 1.6.4.2 nathanw #define CSET_JISROMA 1 /* iso2022jp romaji */
226 1.6.4.2 nathanw #define CSET_JISKANA 2 /* iso2022jp kana */
227 1.6.4.2 nathanw #define CSET_JIS1978 (3|CSET_MULTI) /* iso2022jp old jis kanji */
228 1.6.4.2 nathanw #define CSET_JIS1983 (4|CSET_MULTI) /* iso2022jp new jis kanji */
229 1.6.4.2 nathanw #define CSET_JIS1990 (5|CSET_MULTI) /* iso2022jp hojo kanji */
230 1.6.4.2 nathanw
231 1.6.4.2 nathanw struct consdev;
232 1.6.4.2 nathanw
233 1.6.4.2 nathanw /* console related function */
234 1.6.4.2 nathanw void itecnprobe __P((struct consdev *));
235 1.6.4.2 nathanw void itecninit __P((struct consdev *));
236 1.6.4.2 nathanw int itecngetc __P((dev_t));
237 1.6.4.2 nathanw void itecnputc __P((dev_t, int));
238 1.6.4.2 nathanw void itecnfinish __P((struct ite_softc *));
239 1.6.4.2 nathanw
240 1.6.4.2 nathanw /* standard ite device entry points. */
241 1.6.4.2 nathanw void iteinit __P((dev_t));
242 1.6.4.2 nathanw void itestart __P((struct tty *));
243 1.6.4.2 nathanw
244 1.6.4.2 nathanw /* ite functions */
245 1.6.4.2 nathanw int iteon __P((dev_t, int));
246 1.6.4.2 nathanw void iteoff __P((dev_t, int));
247 1.6.4.2 nathanw void ite_reinit __P((dev_t));
248 1.6.4.2 nathanw void ite_reset __P((struct ite_softc *));
249 1.6.4.2 nathanw int ite_cnfilter __P((u_char));
250 1.6.4.2 nathanw void ite_filter __P((u_char));
251 1.6.4.2 nathanw
252 1.6.4.2 nathanw /* lower layer functions */
253 1.6.4.2 nathanw void tv_init __P((struct ite_softc *));
254 1.6.4.2 nathanw void tv_deinit __P((struct ite_softc *));
255 1.6.4.2 nathanw
256 1.6.4.2 nathanw #ifdef _KERNEL
257 1.6.4.2 nathanw extern unsigned char kern_font[];
258 1.6.4.2 nathanw
259 1.6.4.2 nathanw /* keyboard LED status variable */
260 1.6.4.2 nathanw extern unsigned char kbdled;
261 1.6.4.2 nathanw void ite_set_glyph __P((void));
262 1.6.4.2 nathanw void kbd_setLED __P((void));
263 1.6.4.2 nathanw #endif
264