Home | History | Annotate | Line # | Download | only in dev
      1 /*	$NetBSD: itevar.h,v 1.20 2012/10/27 17:17:29 chs 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	tty *tp;
     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 };
    103 
    104 enum ite_flags {
    105 	ITE_ALIVE  = 0x1,		/* grf layer is configed */
    106 	ITE_ISCONS = 0x2,		/* ite is acting console. */
    107 	ITE_INITED = 0x4,		/* ite has been inited. */
    108 	ITE_ISOPEN = 0x8,		/* ite has been opened */
    109 	ITE_INGRF  = 0x10,		/* ite is in graphics mode */
    110 	ITE_ACTIVE = 0x20,		/* ite is an active terminal */
    111 	ITE_ATTACHED = 0x40,		/* ite is attached */
    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(struct consdev *);
    193 void	itecninit(struct consdev *);
    194 int	itecngetc(dev_t);
    195 void	itecnputc(dev_t, int);
    196 void	ite_cnfinish(struct ite_softc *);
    197 
    198 /* standard ite device entry points. */
    199 void	iteinit(dev_t);
    200 void	itestart(struct tty *);
    201 
    202 /* ite functions */
    203 void	ite_on(dev_t, int);
    204 void	ite_off(dev_t, int);
    205 void	ite_reinit(dev_t);
    206 int	ite_param(struct tty *, struct termios *);
    207 void	ite_reset(struct ite_softc *);
    208 int	ite_cnfilter(u_char, enum caller);
    209 void	ite_filter(u_char ,enum caller);
    210 int	ite_grf_ioctl(struct ite_softc *, u_long, void *, int, struct lwp *);
    211 
    212 #endif /* _ITEVAR_H */
    213