itevar.h revision 1.13 1 /* $NetBSD: itevar.h,v 1.13 1995/11/30 00:57:08 jtc Exp $ */
2
3 /*
4 * Copyright (c) 1994 Christian E. Hopps
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Christian E. Hopps.
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32 #if ! defined (_ITEVAR_H)
33 #define _ITEVAR_H
34
35 enum ite_arraymaxs {
36 MAX_ARGSIZE = 256,
37 MAX_TABS = 256,
38 };
39
40 enum ite_attr {
41 ATTR_NOR = 0,
42 ATTR_INV = 1,
43 ATTR_UL = 2,
44 ATTR_BOLD = 4,
45 ATTR_BLINK = 8,
46 ATTR_ALL = 16-1,
47
48 ATTR_KEYPAD = 0x80 /* XXX */
49 };
50
51 struct ite_softc {
52 struct device device;
53 struct tty *tp;
54 char argbuf[MAX_ARGSIZE];
55 struct grf_softc *grf; /* XXX */
56 void *priv;
57 char *ap;
58 u_char *tabs;
59 int flags;
60 int open_count;
61 short cursorx;
62 short cursory;
63 short rows;
64 short cols;
65 u_char *font;
66 u_char *cursor;
67 u_char font_lo;
68 u_char font_hi;
69 short cpl; /* XXX? */
70 short ftheight;
71 short ftwidth;
72 short ftbaseline;
73 short ftboldsmear;
74 short planemask;
75 short pos;
76 char imode;
77 char fpd;
78 char hold;
79 u_char escape;
80 u_char cursor_opt;
81 u_char key_repeat;
82 char GL;
83 char GR;
84 char G0;
85 char G1;
86 char G2;
87 char G3;
88 char linefeed_newline;
89 char auto_wrap;
90 char cursor_appmode;
91 char keypad_appmode;
92 short top_margin;
93 short bottom_margin;
94 short inside_margins;
95 short eightbit_C1;
96 short emul_level;
97 enum ite_attr attribute;
98 enum ite_attr save_attribute;
99 int curx;
100 int save_curx;
101 int cury;
102 int save_cury;
103 };
104
105 enum ite_flags {
106 ITE_ALIVE = 0x1, /* grf layer is configed */
107 ITE_ISCONS = 0x2, /* ite is acting console. */
108 ITE_INITED = 0x4, /* ite has been inited. */
109 ITE_ISOPEN = 0x8, /* ite has been opened */
110 ITE_INGRF = 0x10, /* ite is in graphics mode */
111 ITE_ACTIVE = 0x20, /* ite is an active terminal */
112 };
113
114 enum ite_replrules {
115 RR_CLEAR = 0,
116 RR_COPY = 0x3,
117 RR_XOR = 0x6,
118 RR_COYINVERTED = 0xC
119 };
120
121 enum ite_scrolldir {
122 SCROLL_UP = 1,
123 SCROLL_DOWN,
124 SCROLL_LEFT,
125 SCROLL_RIGHT,
126 };
127
128 enum ite_cursact {
129 DRAW_CURSOR = 5,
130 ERASE_CURSOR,
131 MOVE_CURSOR,
132 START_CURSOROPT,
133 END_CURSOROPT
134 };
135
136 enum ite_special_keycodes {
137 KBD_LEFT_SHIFT = 0x60,
138 KBD_RIGHT_SHIFT,
139 KBD_CAPS_LOCK,
140 KBD_CTRL,
141 KBD_LEFT_ALT,
142 KBD_RIGHT_ALT,
143 KBD_LEFT_META,
144 KBD_RIGHT_META
145 };
146
147 enum ite_modifiers {
148 KBD_MOD_LSHIFT = (1 << (KBD_LEFT_SHIFT - KBD_LEFT_SHIFT)),
149 KBD_MOD_RSHIFT = (1 << (KBD_RIGHT_SHIFT- KBD_LEFT_SHIFT)),
150 KBD_MOD_CTRL = (1 << (KBD_CTRL - KBD_LEFT_SHIFT)),
151 KBD_MOD_LALT = (1 << (KBD_LEFT_ALT - KBD_LEFT_SHIFT)),
152 KBD_MOD_RALT = (1 << (KBD_RIGHT_ALT- KBD_LEFT_SHIFT)),
153 KBD_MOD_LMETA = (1 << (KBD_LEFT_META - KBD_LEFT_SHIFT)),
154 KBD_MOD_RMETA = (1 << (KBD_RIGHT_META- KBD_LEFT_SHIFT)),
155 KBD_MOD_CAPS = (1 << (KBD_CAPS_LOCK - KBD_LEFT_SHIFT)),
156
157 KBD_MOD_SHIFT = (KBD_MOD_LSHIFT | KBD_MOD_RSHIFT),
158 KBD_MOD_ALT = (KBD_MOD_LALT | KBD_MOD_RALT),
159 KBD_MOD_META = (KBD_MOD_LMETA | KBD_MOD_RMETA),
160 };
161
162 enum caller {
163 ITEFILT_TTY,
164 ITEFILT_CONSOLE,
165 ITEFILT_REPEATER
166 };
167
168 enum emul_level {
169 EMUL_VT100 = 1,
170 EMUL_VT300_8,
171 EMUL_VT300_7
172 };
173
174 enum ite_max_getsize { ITEBURST = 64 };
175
176 enum tab_size { TABSIZE = 8 };
177 #define TABEND(u) (ite_tty[u]->t_windsize.ws_col - TABSIZE) /* XXX */
178
179 #define set_attr(ip, attr) ((ip)->attribute |= (attr))
180 #define clr_attr(ip, attr) ((ip)->attribute &= ~(attr))
181 #define attrloc(ip, y, x) 0
182 #define attrclr(ip, sy, sx, h, w)
183 #define attrmov(ip, sy, sx, dy, dx, h, w)
184 #define attrtest(ip, attr) 0
185 #define attrset(ip, attr)
186
187 struct proc;
188 struct consdev;
189 struct termios;
190
191 /* console related function */
192 void itecnprobe __P((struct consdev *));
193 void itecninit __P((struct consdev *));
194 int itecngetc __P((dev_t));
195 void itecnputc __P((dev_t, int));
196 void ite_cnfinish __P((struct ite_softc *));
197
198 /* standard ite device entry points. */
199 void iteinit __P((dev_t));
200 int iteopen __P((dev_t, int, int, struct proc *));
201 int iteclose __P((dev_t, int, int, struct proc *));
202 int iteread __P((dev_t, struct uio *, int));
203 int itewrite __P((dev_t, struct uio *, int));
204 int iteioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
205 void itestart __P((struct tty *));
206
207 /* ite functions */
208 int ite_on __P((dev_t, int));
209 void ite_off __P((dev_t, int));
210 void ite_reinit __P((dev_t));
211 int ite_param __P((struct tty *, struct termios *));
212 void ite_reset __P((struct ite_softc *));
213 int ite_cnfilter __P((u_char, enum caller));
214 void ite_filter __P((u_char ,enum caller));
215
216 #endif /* _ITEVAR_H */
217