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