Home | History | Annotate | Line # | Download | only in dev
itevar.h revision 1.7
      1 /*
      2  * Copyright (c) 1994 Christian E. Hopps
      3  * All rights reserved.
      4  *
      5  * Redistribution and use in source and binary forms, with or without
      6  * modification, are permitted provided that the following conditions
      7  * are met:
      8  * 1. Redistributions of source code must retain the above copyright
      9  *    notice, this list of conditions and the following disclaimer.
     10  * 2. Redistributions in binary form must reproduce the above copyright
     11  *    notice, this list of conditions and the following disclaimer in the
     12  *    documentation and/or other materials provided with the distribution.
     13  * 3. All advertising materials mentioning features or use of this software
     14  *    must display the following acknowledgement:
     15  *      This product includes software developed by Christian E. Hopps.
     16  * 4. The name of the author may not be used to endorse or promote products
     17  *    derived from this software without specific prior written permission
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     22  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     24  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     28  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29  *
     30  *	$Id: itevar.h,v 1.7 1994/02/17 09:10:52 chopps Exp $
     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	itesw *itesw;
     53 	char	argbuf[MAX_ARGSIZE];
     54 	struct  grf_softc *grf;		/* XXX */
     55 	void	*priv;
     56 	char	*ap;
     57 	u_char	*tabs;
     58 	int	flags;
     59 	int	open_count;
     60 	short	cursorx;
     61 	short	cursory;
     62 	short	rows;
     63 	short	cols;
     64 	u_char	*font;
     65 	u_char	*cursor;
     66 	u_char	font_lo;
     67 	u_char	font_hi;
     68 	short	cpl;			/* XXX? */
     69 	short	ftheight;
     70 	short	ftwidth;
     71 	short	ftbaseline;
     72 	short	ftboldsmear;
     73 	short	planemask;
     74 	short	pos;
     75 	char	imode;
     76 	char	fpd;
     77 	char	hold;
     78 	u_char	escape;
     79 	u_char	cursor_opt;
     80 	u_char	key_repeat;
     81 	char	GL;
     82 	char	GR;
     83 	char	G0;
     84 	char	G1;
     85 	char	G2;
     86 	char	G3;
     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 	void	*view;			/* XXX */
    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 struct itesw {
    115 	int	(*ite_cnprobe) __P((int minor));
    116 	void	(*ite_init) __P((struct ite_softc *));
    117 	void	(*ite_deinit) __P((struct ite_softc *));
    118 	void	(*ite_clear) __P((struct ite_softc *,int,int,int,int));
    119 	void	(*ite_putc) __P((struct ite_softc *,int,int,int,int));
    120 	void	(*ite_cursor) __P((struct ite_softc *,int));
    121 	void	(*ite_scroll) __P((struct ite_softc *,int,int,int,int));
    122 };
    123 
    124 enum ite_replrules {
    125 	RR_CLEAR = 0,
    126 	RR_COPY = 0x3,
    127 	RR_XOR = 0x6,
    128 	RR_COYINVERTED = 0xC
    129 };
    130 
    131 enum ite_scrolldir {
    132 	SCROLL_UP = 1,
    133 	SCROLL_DOWN,
    134 	SCROLL_LEFT,
    135 	SCROLL_RIGHT,
    136 };
    137 
    138 enum ite_cursact {
    139 	DRAW_CURSOR = 5,
    140 	ERASE_CURSOR,
    141 	MOVE_CURSOR,
    142 	START_CURSOROPT,
    143 	END_CURSOROPT
    144 };
    145 
    146 enum ite_special_keycodes {
    147 	KBD_LEFT_SHIFT = 0x60,
    148 	KBD_RIGHT_SHIFT,
    149 	KBD_CAPS_LOCK,
    150 	KBD_CTRL,
    151 	KBD_LEFT_ALT,
    152 	KBD_RIGHT_ALT,
    153 	KBD_LEFT_META,
    154 	KBD_RIGHT_META
    155 };
    156 
    157 enum ite_modifiers {
    158 	KBD_MOD_LSHIFT = (1 << (KBD_LEFT_SHIFT - KBD_LEFT_SHIFT)),
    159 	KBD_MOD_RSHIFT = (1 << (KBD_RIGHT_SHIFT- KBD_LEFT_SHIFT)),
    160 	KBD_MOD_CTRL = (1 << (KBD_CTRL - KBD_LEFT_SHIFT)),
    161 	KBD_MOD_LALT = (1 << (KBD_LEFT_ALT - KBD_LEFT_SHIFT)),
    162 	KBD_MOD_RALT = (1 << (KBD_RIGHT_ALT- KBD_LEFT_SHIFT)),
    163 	KBD_MOD_LMETA = (1 << (KBD_LEFT_META - KBD_LEFT_SHIFT)),
    164 	KBD_MOD_RMETA = (1 << (KBD_RIGHT_META- KBD_LEFT_SHIFT)),
    165 	KBD_MOD_CAPS = (1 << (KBD_CAPS_LOCK - KBD_LEFT_SHIFT)),
    166 
    167 	KBD_MOD_SHIFT = (KBD_MOD_LSHIFT | KBD_MOD_RSHIFT),
    168 	KBD_MOD_ALT = (KBD_MOD_LALT | KBD_MOD_RALT),
    169 	KBD_MOD_META = (KBD_MOD_LMETA | KBD_MOD_RMETA),
    170 };
    171 
    172 enum caller {
    173 	ITEFILT_TTY,
    174 	ITEFILT_CONSOLE,
    175 	ITEFILT_REPEATER
    176 };
    177 
    178 enum emul_level {
    179 	EMUL_VT100 = 1,
    180 	EMUL_VT300_8,
    181 	EMUL_VT300_7
    182 };
    183 
    184 enum ite_max_getsize { ITEBURST = 64 };
    185 
    186 enum tab_size { TABSIZE = 8 };
    187 #define TABEND(u) (ite_tty[u]->t_windsize.ws_col - TABSIZE) /* XXX */
    188 
    189 #define set_attr(ip, attr)	((ip)->attribute |= (attr))
    190 #define clr_attr(ip, attr)	((ip)->attribute &= ~(attr))
    191 #define attrloc(ip, y, x) 0
    192 #define attrclr(ip, sy, sx, h, w)
    193 #define attrmov(ip, sy, sx, dy, dx, h, w)
    194 #define attrtest(ip, attr) 0
    195 #define attrset(ip, attr)
    196 
    197 /* console related function */
    198 void	ite_cnprobe __P((struct consdev *));
    199 void	ite_cninit __P((struct consdev *));
    200 int	ite_cngetc __P((dev_t));
    201 void	ite_cnputc __P((dev_t, int));
    202 void	ite_cnfinish __P((struct ite_softc *));
    203 
    204 /* standard ite device entry points. */
    205 void	iteinit __P((dev_t));
    206 int	iteopen __P((dev_t, int, int, struct proc *));
    207 int	iteclose __P((dev_t, int, int, struct proc *));
    208 int	iteread __P((dev_t, struct uio *, int));
    209 int	itewrite __P((dev_t, struct uio *, int));
    210 int	iteioctl __P((dev_t, int, caddr_t, int, struct proc *));
    211 void	itestart __P((struct tty *));
    212 
    213 /* ite functions */
    214 int	ite_on __P((dev_t, int));
    215 int	ite_off __P((dev_t, int));
    216 void	ite_reinit __P((dev_t));
    217 int	ite_param __P((struct tty *, struct termios *));
    218 void	ite_reset __P((struct ite_softc *));
    219 int	ite_cnfilter __P((u_char, enum caller));
    220 void	ite_filter __P((u_char ,enum caller));
    221 
    222 /* lower layer functions */
    223 int	view_cnprobe __P((int));
    224 void	view_init __P((struct ite_softc *));
    225 void	view_deinit __P((struct ite_softc *));
    226 int	tiga_cnprobe __P((int));
    227 void	tiga_init __P((struct ite_softc *));
    228 void	tiga_deinit __P((struct ite_softc *));
    229 void	tiga_clear __P((struct ite_softc *,int,int,int,int));
    230 void	tiga_putc __P((struct ite_softc *,int,int,int,int));
    231 void	tiga_cursor __P((struct ite_softc *,int));
    232 void	tiga_scroll __P((struct ite_softc *,int,int,int,int));
    233 int	retina_cnprobe __P((int));
    234 void	retina_init __P((struct ite_softc *));
    235 void	retina_deinit __P((struct ite_softc *));
    236 void	retina_clear __P((struct ite_softc *,int,int,int,int));
    237 void	retina_putc __P((struct ite_softc *,int,int,int,int));
    238 void	retina_cursor __P((struct ite_softc *,int));
    239 void	retina_scroll __P((struct ite_softc *,int,int,int,int));
    240 
    241 #if defined (KERNEL)
    242 extern struct ite_softc ite_softc[];
    243 #endif
    244 
    245 #endif /* _ITEVAR_H */
    246