xref: /netbsd-src/sys/arch/amiga/dev/itevar.h (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1 /*	$NetBSD: itevar.h,v 1.19 2007/03/04 05:59:23 christos 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 	ITE_ATTACHED = 0x40,		/* ite is attached */
113 };
114 
115 enum ite_replrules {
116 	RR_CLEAR = 0,
117 	RR_COPY = 0x3,
118 	RR_XOR = 0x6,
119 	RR_COYINVERTED = 0xC
120 };
121 
122 enum ite_scrolldir {
123 	SCROLL_UP = 1,
124 	SCROLL_DOWN,
125 	SCROLL_LEFT,
126 	SCROLL_RIGHT,
127 };
128 
129 enum ite_cursact {
130 	DRAW_CURSOR = 5,
131 	ERASE_CURSOR,
132 	MOVE_CURSOR,
133 	START_CURSOROPT,
134 	END_CURSOROPT
135 };
136 
137 enum ite_special_keycodes {
138 	KBD_LEFT_SHIFT = 0x60,
139 	KBD_RIGHT_SHIFT,
140 	KBD_CAPS_LOCK,
141 	KBD_CTRL,
142 	KBD_LEFT_ALT,
143 	KBD_RIGHT_ALT,
144 	KBD_LEFT_META,
145 	KBD_RIGHT_META
146 };
147 
148 enum ite_modifiers {
149 	KBD_MOD_LSHIFT = (1 << (KBD_LEFT_SHIFT - KBD_LEFT_SHIFT)),
150 	KBD_MOD_RSHIFT = (1 << (KBD_RIGHT_SHIFT- KBD_LEFT_SHIFT)),
151 	KBD_MOD_CTRL = (1 << (KBD_CTRL - KBD_LEFT_SHIFT)),
152 	KBD_MOD_LALT = (1 << (KBD_LEFT_ALT - KBD_LEFT_SHIFT)),
153 	KBD_MOD_RALT = (1 << (KBD_RIGHT_ALT- KBD_LEFT_SHIFT)),
154 	KBD_MOD_LMETA = (1 << (KBD_LEFT_META - KBD_LEFT_SHIFT)),
155 	KBD_MOD_RMETA = (1 << (KBD_RIGHT_META- KBD_LEFT_SHIFT)),
156 	KBD_MOD_CAPS = (1 << (KBD_CAPS_LOCK - KBD_LEFT_SHIFT)),
157 
158 	KBD_MOD_SHIFT = (KBD_MOD_LSHIFT | KBD_MOD_RSHIFT),
159 	KBD_MOD_ALT = (KBD_MOD_LALT | KBD_MOD_RALT),
160 	KBD_MOD_META = (KBD_MOD_LMETA | KBD_MOD_RMETA),
161 };
162 
163 enum caller {
164 	ITEFILT_TTY,
165 	ITEFILT_CONSOLE,
166 	ITEFILT_REPEATER
167 };
168 
169 enum emul_level {
170 	EMUL_VT100 = 1,
171 	EMUL_VT300_8,
172 	EMUL_VT300_7
173 };
174 
175 enum ite_max_getsize { ITEBURST = 64 };
176 
177 enum tab_size { TABSIZE = 8 };
178 #define TABEND(u) (ite_tty[u]->t_windsize.ws_col - TABSIZE) /* XXX */
179 
180 #define set_attr(ip, attr)	((ip)->attribute |= (attr))
181 #define clr_attr(ip, attr)	((ip)->attribute &= ~(attr))
182 #define attrloc(ip, y, x) 0
183 #define attrclr(ip, sy, sx, h, w)
184 #define attrmov(ip, sy, sx, dy, dx, h, w)
185 #define attrtest(ip, attr) 0
186 #define attrset(ip, attr)
187 
188 struct proc;
189 struct consdev;
190 struct termios;
191 
192 /* console related function */
193 void	itecnprobe(struct consdev *);
194 void	itecninit(struct consdev *);
195 int	itecngetc(dev_t);
196 void	itecnputc(dev_t, int);
197 void	ite_cnfinish(struct ite_softc *);
198 
199 /* standard ite device entry points. */
200 void	iteinit(dev_t);
201 void	itestart(struct tty *);
202 
203 /* ite functions */
204 void	ite_on(dev_t, int);
205 void	ite_off(dev_t, int);
206 void	ite_reinit(dev_t);
207 int	ite_param(struct tty *, struct termios *);
208 void	ite_reset(struct ite_softc *);
209 int	ite_cnfilter(u_char, enum caller);
210 void	ite_filter(u_char ,enum caller);
211 int	ite_grf_ioctl(struct ite_softc *, u_long, void *, int, struct lwp *);
212 
213 #endif /* _ITEVAR_H */
214