Home | History | Annotate | Line # | Download | only in dev
itevar.h revision 1.6
      1 /*	$NetBSD: itevar.h,v 1.6 1996/10/11 20:50:37 leo 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 	struct	device		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			GL;
     76 	char			GR;
     77 	char			G0;
     78 	char			G1;
     79 	char			G2;
     80 	char			G3;
     81 	char			linefeed_newline;
     82 	char			auto_wrap;
     83 	char			cursor_appmode;
     84 	char			keypad_appmode;
     85 	short			top_margin;
     86 	short			bottom_margin;
     87 	short			inside_margins;
     88 	short 			eightbit_C1;
     89 	short			emul_level;
     90 	enum 	ite_attr	attribute;
     91 	enum 	ite_attr	save_attribute;
     92 	int			curx;
     93 	int			save_curx;
     94 	int			cury;
     95 	int			save_cury;
     96 	int			(*itexx_ioctl) __P((struct ite_softc *, u_long,
     97 						caddr_t, int, struct proc *));
     98 };
     99 
    100 enum ite_flags {
    101 	ITE_ALIVE  = 0x1,		/* grf layer is configed	*/
    102 	ITE_ISCONS = 0x2,		/* ite is acting console.	*/
    103 	ITE_INITED = 0x4,		/* ite has been inited.		*/
    104 	ITE_ISOPEN = 0x8,		/* ite has been opened		*/
    105 	ITE_INGRF  = 0x10,		/* ite is in graphics mode	*/
    106 	ITE_ACTIVE = 0x20,		/* ite is an active terminal	*/
    107 };
    108 
    109 enum ite_replrules {
    110 	RR_CLEAR = 0,
    111 	RR_COPY = 0x3,
    112 	RR_XOR = 0x6,
    113 	RR_COYINVERTED = 0xC
    114 };
    115 
    116 enum ite_scrolldir {
    117 	SCROLL_UP = 1,
    118 	SCROLL_DOWN,
    119 	SCROLL_LEFT,
    120 	SCROLL_RIGHT,
    121 };
    122 
    123 enum ite_cursact {
    124 	DRAW_CURSOR = 5,
    125 	ERASE_CURSOR,
    126 	MOVE_CURSOR,
    127 	START_CURSOROPT,
    128 	END_CURSOROPT
    129 };
    130 
    131 enum ite_special_keycodes {
    132 	KBD_LEFT_SHIFT  = 0x2a,
    133 	KBD_RIGHT_SHIFT = 0x36,
    134 	KBD_CAPS_LOCK   = 0x3a,
    135 	KBD_CTRL        = 0x1d,
    136 	KBD_ALT         = 0x38
    137 };
    138 
    139 enum ite_modifiers {
    140 	KBD_MOD_LSHIFT  = 0x01,
    141 	KBD_MOD_RSHIFT  = 0x02,
    142 	KBD_MOD_CTRL    = 0x04,
    143 	KBD_MOD_ALT     = 0x08,
    144 	KBD_MOD_CAPS    = 0x10,
    145 	KBD_MOD_SHIFT   = (KBD_MOD_LSHIFT | KBD_MOD_RSHIFT)
    146 };
    147 
    148 enum caller {
    149 	ITEFILT_TTY,
    150 	ITEFILT_CONSOLE,
    151 	ITEFILT_REPEATER
    152 };
    153 
    154 enum emul_level {
    155 	EMUL_VT100 = 1,
    156 	EMUL_VT300_8,
    157 	EMUL_VT300_7
    158 };
    159 
    160 enum ite_max_getsize { ITEBURST = 64 };
    161 
    162 enum tab_size { TABSIZE = 8 };
    163 #define TABEND(u) (ite_tty[u]->t_windsize.ws_col - TABSIZE) /* XXX */
    164 
    165 #define set_attr(ip, attr)	((ip)->attribute |= (attr))
    166 #define clr_attr(ip, attr)	((ip)->attribute &= ~(attr))
    167 #define attrloc(ip, y, x) 0
    168 #define attrclr(ip, sy, sx, h, w)
    169 #define attrmov(ip, sy, sx, dy, dx, h, w)
    170 #define attrtest(ip, attr) 0
    171 #define attrset(ip, attr)
    172 
    173 #ifdef _KERNEL
    174 
    175 struct proc;
    176 struct consdev;
    177 struct termios;
    178 
    179 /* console related function */
    180 void	ite_cnprobe __P((struct consdev *));
    181 void	ite_cninit __P((struct consdev *));
    182 int	ite_cngetc __P((dev_t));
    183 void	ite_cnputc __P((dev_t, int));
    184 void	ite_cnfinish __P((struct ite_softc *));
    185 
    186 /* standard ite device entry points. */
    187 void	iteinit __P((dev_t));
    188 
    189 /*
    190  * Standard character device functions.
    191  */
    192 dev_type_open(iteopen);
    193 dev_type_close(iteclose);
    194 dev_type_read(iteread);
    195 dev_type_write(itewrite);
    196 dev_type_ioctl(iteioctl);
    197 dev_type_tty(itetty);
    198 dev_type_stop(itestop);
    199 
    200 /* ite functions */
    201 int	ite_on __P((dev_t, int));
    202 void	ite_off __P((dev_t, int));
    203 void	ite_reinit __P((dev_t));
    204 int	ite_param __P((struct tty *, struct termios *));
    205 void	ite_reset __P((struct ite_softc *));
    206 int	ite_cnfilter __P((u_int, enum caller));
    207 void	ite_filter __P((u_int ,enum caller));
    208 
    209 /* ite_cc functions */
    210 int	grfcc_cnprobe __P((void));
    211 void	grfcc_iteinit __P((struct grf_softc *));
    212 #endif /* _KERNEL */
    213 
    214 #endif /* _ITEVAR_H */
    215