Home | History | Annotate | Line # | Download | only in dev
itevar.h revision 1.8.6.2
      1  1.8.6.1    skrll /*	$NetBSD: itevar.h,v 1.8.6.2 2004/09/18 14:42:25 skrll Exp $	*/
      2      1.2      oki 
      3      1.1      oki /*
      4      1.1      oki  * Copyright (c) 1990 The Regents of the University of California.
      5      1.1      oki  * All rights reserved.
      6      1.1      oki  *
      7      1.1      oki  * This code is derived from software contributed to Berkeley by
      8      1.1      oki  * the Systems Programming Group of the University of Utah Computer
      9      1.1      oki  * Science Department.
     10      1.1      oki  *
     11      1.1      oki  * Redistribution and use in source and binary forms, with or without
     12      1.1      oki  * modification, are permitted provided that the following conditions
     13      1.1      oki  * are met:
     14      1.1      oki  * 1. Redistributions of source code must retain the above copyright
     15      1.1      oki  *    notice, this list of conditions and the following disclaimer.
     16      1.1      oki  * 2. Redistributions in binary form must reproduce the above copyright
     17      1.1      oki  *    notice, this list of conditions and the following disclaimer in the
     18      1.1      oki  *    documentation and/or other materials provided with the distribution.
     19  1.8.6.1    skrll  * 3. Neither the name of the University nor the names of its contributors
     20  1.8.6.1    skrll  *    may be used to endorse or promote products derived from this software
     21  1.8.6.1    skrll  *    without specific prior written permission.
     22  1.8.6.1    skrll  *
     23  1.8.6.1    skrll  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     24  1.8.6.1    skrll  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25  1.8.6.1    skrll  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26  1.8.6.1    skrll  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     27  1.8.6.1    skrll  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28  1.8.6.1    skrll  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29  1.8.6.1    skrll  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30  1.8.6.1    skrll  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31  1.8.6.1    skrll  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32  1.8.6.1    skrll  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33  1.8.6.1    skrll  * SUCH DAMAGE.
     34  1.8.6.1    skrll  *
     35  1.8.6.1    skrll  * from: Utah $Hdr: itevar.h 1.1 90/07/09$
     36  1.8.6.1    skrll  *
     37  1.8.6.1    skrll  *	@(#)itevar.h	7.2 (Berkeley) 11/4/90
     38  1.8.6.1    skrll  */
     39  1.8.6.1    skrll /*
     40  1.8.6.1    skrll  * Copyright (c) 1988 University of Utah.
     41  1.8.6.1    skrll  *
     42  1.8.6.1    skrll  * This code is derived from software contributed to Berkeley by
     43  1.8.6.1    skrll  * the Systems Programming Group of the University of Utah Computer
     44  1.8.6.1    skrll  * Science Department.
     45  1.8.6.1    skrll  *
     46  1.8.6.1    skrll  * Redistribution and use in source and binary forms, with or without
     47  1.8.6.1    skrll  * modification, are permitted provided that the following conditions
     48  1.8.6.1    skrll  * are met:
     49  1.8.6.1    skrll  * 1. Redistributions of source code must retain the above copyright
     50  1.8.6.1    skrll  *    notice, this list of conditions and the following disclaimer.
     51  1.8.6.1    skrll  * 2. Redistributions in binary form must reproduce the above copyright
     52  1.8.6.1    skrll  *    notice, this list of conditions and the following disclaimer in the
     53  1.8.6.1    skrll  *    documentation and/or other materials provided with the distribution.
     54      1.1      oki  * 3. All advertising materials mentioning features or use of this software
     55      1.1      oki  *    must display the following acknowledgement:
     56      1.1      oki  *	This product includes software developed by the University of
     57      1.1      oki  *	California, Berkeley and its contributors.
     58      1.1      oki  * 4. Neither the name of the University nor the names of its contributors
     59      1.1      oki  *    may be used to endorse or promote products derived from this software
     60      1.1      oki  *    without specific prior written permission.
     61      1.1      oki  *
     62      1.1      oki  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     63      1.1      oki  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     64      1.1      oki  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     65      1.1      oki  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     66      1.1      oki  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     67      1.1      oki  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     68      1.1      oki  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     69      1.1      oki  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     70      1.1      oki  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     71      1.1      oki  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     72      1.1      oki  * SUCH DAMAGE.
     73      1.1      oki  *
     74      1.1      oki  * from: Utah $Hdr: itevar.h 1.1 90/07/09$
     75      1.1      oki  *
     76      1.1      oki  *	@(#)itevar.h	7.2 (Berkeley) 11/4/90
     77      1.1      oki  */
     78      1.1      oki 
     79      1.1      oki #define UNIT(dev)       minor(dev)
     80      1.1      oki 
     81      1.1      oki struct ite_softc;
     82      1.1      oki 
     83      1.1      oki struct itesw {
     84      1.1      oki 	int	(*ite_cnprobe) __P((int minor));
     85      1.1      oki 	void	(*ite_init) __P((struct ite_softc *));
     86      1.1      oki 	void	(*ite_deinit) __P((struct ite_softc *));
     87      1.1      oki 	void	(*ite_clear) __P((struct ite_softc *,int,int,int,int));
     88      1.1      oki 	void	(*ite_putc) __P((struct ite_softc *,int,int,int,int));
     89      1.1      oki 	void	(*ite_cursor) __P((struct ite_softc *,int));
     90      1.1      oki 	void	(*ite_scroll) __P((struct ite_softc *,int,int,int,int));
     91      1.1      oki };
     92      1.1      oki 
     93      1.1      oki enum ite_arraymaxs {
     94      1.1      oki 	MAX_ARGSIZE = 256,
     95      1.1      oki 	MAX_TABS = 256,
     96      1.1      oki };
     97      1.1      oki 
     98      1.1      oki /* maximum number of argument characters (<CSI>33;34;3m for example) */
     99      1.1      oki #define ARGBUF_SIZE 256
    100      1.1      oki 
    101      1.1      oki struct ite_softc {
    102      1.1      oki 	struct	device device;
    103      1.1      oki 	struct grf_softc *grf;
    104      1.1      oki 	struct	itesw *isw;
    105      1.1      oki 	int	flags;
    106      1.1      oki 	int	type;
    107      1.1      oki 	int	open_cnt;
    108      1.1      oki 	void	*priv;
    109      1.1      oki 	short	curx, cury;
    110      1.1      oki 	short   cursorx, cursory;
    111      1.1      oki 	u_char	*font;
    112      1.1      oki 	u_char	*cursor;
    113      1.1      oki 	u_char	font_lo, font_hi;
    114      1.1      oki 	short	rows, cols;
    115      1.1      oki 	short   cpl;
    116      1.1      oki 	short	ftheight, ftwidth, ftbaseline, ftboldsmear;
    117      1.1      oki 	short   attribute;
    118      1.1      oki 	u_char	*attrbuf;
    119      1.1      oki 	short	planemask;
    120      1.1      oki 	short	pos;
    121      1.1      oki 	char	imode, fpd, hold;
    122      1.1      oki 	u_char  escape, cursor_opt, key_repeat;
    123      1.1      oki 	char	*GL, *GR, *save_GL;
    124      1.1      oki 	char	G0, G1, G2, G3;
    125      1.1      oki 	char	fgcolor, bgcolor;
    126      1.1      oki 	char	linefeed_newline, auto_wrap;
    127      1.1      oki 	char	cursor_appmode, keypad_appmode;
    128      1.1      oki 	char	argbuf[ARGBUF_SIZE], *ap, *tabs;
    129      1.1      oki 	char	emul_level, eightbit_C1;
    130      1.1      oki 	int	top_margin, bottom_margin;
    131      1.1      oki 	char	inside_margins, sc_om;
    132      1.1      oki 	short	save_curx, save_cury, save_attribute, save_char;
    133      1.1      oki 	char	sc_G0, sc_G1, sc_G2, sc_G3;
    134      1.1      oki 	char	*sc_GL, *sc_GR;
    135      1.1      oki };
    136      1.1      oki 
    137      1.1      oki enum emul_level {
    138      1.1      oki 	EMUL_VT100 = 1,
    139      1.1      oki 	EMUL_VT300_8,
    140      1.1      oki 	EMUL_VT300_7
    141      1.1      oki };
    142      1.1      oki 
    143      1.1      oki /* Flags */
    144      1.1      oki #define ITE_ALIVE	0x01	/* hardware exists */
    145      1.1      oki #define ITE_INITED	0x02	/* device has been initialized */
    146      1.1      oki #define ITE_CONSOLE	0x04	/* device can be console */
    147      1.1      oki #define ITE_ISCONS	0x08	/* device is console */
    148      1.1      oki #define ITE_ACTIVE	0x10	/* device is being used as ITE */
    149      1.1      oki #define ITE_INGRF	0x20	/* device in use as non-ITE */
    150      1.1      oki 
    151      1.1      oki #ifdef DO_WEIRD_ATTRIBUTES
    152      1.1      oki #define attrloc(ip, y, x) \
    153      1.1      oki 	(ip->attrbuf + ((y) * ip->cols) + (x))
    154      1.1      oki 
    155      1.1      oki #define attrclr(ip, sy, sx, h, w) \
    156      1.7      wiz 	memset(ip->attrbuf + ((sy) * ip->cols) + (sx), 0, (h) * (w))
    157      1.1      oki 
    158      1.1      oki #define attrmov(ip, sy, sx, dy, dx, h, w) \
    159      1.7      wiz 	memcpy(ip->attrbuf + ((dy) * ip->cols) + (dx), \
    160      1.7      wiz 	      ip->attrbuf + ((sy) * ip->cols) + (sx), \
    161      1.1      oki 	      (h) * (w))
    162      1.1      oki 
    163      1.1      oki #define attrtest(ip, attr) \
    164      1.1      oki 	((* (u_char *) attrloc(ip, ip->cury, ip->curx)) & attr)
    165      1.1      oki 
    166      1.1      oki #define attrset(ip, attr) \
    167      1.1      oki 	((* (u_char *) attrloc(ip, ip->cury, ip->curx)) = attr)
    168      1.1      oki #else
    169      1.1      oki #define attrloc(ip, y, x) 0
    170      1.1      oki #define attrclr(ip, sy, sx, h, w)
    171      1.1      oki #define attrmov(ip, sy, sx, dy, dx, h, w)
    172      1.1      oki #define attrtest(ip, attr) 0
    173      1.1      oki #define attrset(ip, attr)
    174      1.1      oki #endif
    175      1.1      oki 
    176      1.1      oki 
    177      1.1      oki /*
    178      1.1      oki  * X and Y location of character 'c' in the framebuffer, in pixels.
    179      1.1      oki  */
    180      1.1      oki #define	charX(ip,c)	\
    181      1.1      oki 	(((c) % (ip)->cpl) * (ip)->ftwidth + (ip)->fontx)
    182      1.1      oki 
    183      1.1      oki #define	charY(ip,c)	\
    184      1.1      oki 	(((c) / (ip)->cpl) * (ip)->ftheight + (ip)->fonty)
    185      1.1      oki 
    186      1.1      oki /* Character attributes */
    187      1.1      oki #define ATTR_NOR        0x0             /* normal */
    188      1.1      oki #define	ATTR_INV	0x1		/* inverse */
    189      1.1      oki #define	ATTR_UL		0x2		/* underline */
    190      1.1      oki #define ATTR_BOLD	0x4		/* bold */
    191      1.1      oki #define ATTR_BLINK	0x8		/* blink */
    192      1.1      oki #define ATTR_ALL	(ATTR_INV | ATTR_UL|ATTR_BOLD|ATTR_BLINK)
    193      1.1      oki 
    194      1.1      oki /* Keyboard attributes */
    195      1.1      oki #define ATTR_KPAD	0x80		/* keypad transmit */
    196      1.1      oki 
    197      1.1      oki /* Replacement Rules */
    198      1.1      oki #define RR_CLEAR		0x0
    199      1.1      oki #define RR_COPY			0x3
    200      1.1      oki #define RR_XOR			0x6
    201      1.1      oki #define RR_COPYINVERTED  	0xc
    202      1.1      oki 
    203      1.1      oki #define SCROLL_UP	0x01
    204      1.1      oki #define SCROLL_DOWN	0x02
    205      1.1      oki #define SCROLL_LEFT	0x03
    206      1.1      oki #define SCROLL_RIGHT	0x04
    207      1.1      oki #define DRAW_CURSOR	0x05
    208      1.1      oki #define ERASE_CURSOR    0x06
    209      1.1      oki #define MOVE_CURSOR	0x07
    210      1.1      oki #define START_CURSOROPT	0x08	/* at start of output. May disable cursor */
    211      1.1      oki #define END_CURSOROPT	0x09	/* at end, make sure cursor state is ok */
    212      1.1      oki 
    213      1.1      oki /* special key codes */
    214      1.1      oki #define KBD_LEFT_SHIFT	0x70
    215      1.1      oki #define KBD_RIGHT_SHIFT	0x70
    216      1.1      oki #define KBD_CAPS_LOCK	0x5d
    217      1.1      oki #define KBD_CTRL	0x71
    218      1.1      oki #define KBD_LEFT_ALT	0x55
    219      1.1      oki #define KBD_RIGHT_ALT	0x58
    220      1.1      oki #define KBD_LEFT_META	0x56
    221      1.1      oki #define KBD_RIGHT_META	0x57
    222      1.1      oki #define KBD_OPT1	0x72
    223      1.1      oki #define KBD_OPT2	0x73
    224      1.1      oki #define KBD_RECONNECT	0x7f
    225      1.1      oki 
    226      1.1      oki /* modifier map for use in itefilter() */
    227      1.1      oki #define KBD_MOD_LSHIFT	(1<<0)
    228      1.1      oki #define KBD_MOD_RSHIFT	(1<<1)
    229      1.1      oki #define KBD_MOD_SHIFT	(KBD_MOD_LSHIFT | KBD_MOD_RSHIFT)
    230      1.1      oki #define KBD_MOD_CTRL	(1<<2)
    231      1.1      oki #define KBD_MOD_LALT	(1<<3)
    232      1.1      oki #define KBD_MOD_RALT	(1<<4)
    233      1.1      oki #define KBD_MOD_ALT	(KBD_MOD_LALT | KBD_MOD_RALT)
    234      1.1      oki #define KBD_MOD_LMETA	(1<<5)
    235      1.1      oki #define KBD_MOD_RMETA	(1<<6)
    236      1.1      oki #define KBD_MOD_META	(KBD_MOD_LMETA | KBD_MOD_RMETA)
    237      1.1      oki #define KBD_MOD_CAPS	(1<<7)
    238      1.1      oki #define KBD_MOD_OPT1	(1<<8)
    239      1.1      oki #define KBD_MOD_OPT2	(1<<9)
    240      1.1      oki 
    241      1.1      oki /* type for the second argument to itefilter(). Note that the
    242      1.1      oki    driver doesn't support key-repeat for console-mode, since it can't use
    243      1.1      oki    timeout() for polled I/O. */
    244      1.1      oki 
    245      1.1      oki enum tab_size { TABSIZE = 8 };
    246      1.1      oki #define TABEND(u) (ite_tty[u]->t_windsize.ws_col - TABSIZE) /* XXX */
    247      1.1      oki 
    248      1.1      oki #define set_attr(ip, attr)	((ip)->attribute |= (attr))
    249      1.1      oki #define clr_attr(ip, attr)	((ip)->attribute &= ~(attr))
    250      1.1      oki #define attrloc(ip, y, x) 0
    251      1.1      oki #define attrclr(ip, sy, sx, h, w)
    252      1.1      oki #define attrmov(ip, sy, sx, dy, dx, h, w)
    253      1.1      oki #define attrtest(ip, attr) 0
    254      1.1      oki #define attrset(ip, attr)
    255      1.1      oki 
    256      1.1      oki /* character set */
    257      1.1      oki #define CSET_MULTI	0x80 /* multibytes flag */
    258      1.1      oki #define CSET_ASCII	0 /* ascii */
    259      1.1      oki #define CSET_JISROMA	1 /* iso2022jp romaji */
    260      1.1      oki #define CSET_JISKANA	2 /* iso2022jp kana */
    261      1.1      oki #define CSET_JIS1978	(3|CSET_MULTI) /* iso2022jp old jis kanji */
    262      1.1      oki #define CSET_JIS1983	(4|CSET_MULTI) /* iso2022jp new jis kanji */
    263      1.1      oki #define CSET_JIS1990	(5|CSET_MULTI) /* iso2022jp hojo kanji */
    264      1.1      oki 
    265      1.1      oki struct consdev;
    266      1.1      oki 
    267      1.1      oki /* console related function */
    268      1.1      oki void	itecnprobe __P((struct consdev *));
    269      1.1      oki void	itecninit __P((struct consdev *));
    270      1.1      oki int	itecngetc __P((dev_t));
    271      1.1      oki void	itecnputc __P((dev_t, int));
    272      1.1      oki void	itecnfinish __P((struct ite_softc *));
    273      1.1      oki 
    274      1.1      oki /* standard ite device entry points. */
    275      1.1      oki void	iteinit __P((dev_t));
    276      1.1      oki void	itestart __P((struct tty *));
    277      1.1      oki 
    278      1.1      oki /* ite functions */
    279      1.5  minoura int	iteon __P((dev_t, int));
    280      1.5  minoura void	iteoff __P((dev_t, int));
    281      1.1      oki void	ite_reinit __P((dev_t));
    282      1.1      oki void	ite_reset __P((struct ite_softc *));
    283      1.5  minoura int	ite_cnfilter __P((u_char));
    284      1.5  minoura void	ite_filter __P((u_char));
    285      1.1      oki 
    286      1.1      oki /* lower layer functions */
    287      1.3      oki void	tv_init __P((struct ite_softc *));
    288      1.3      oki void	tv_deinit __P((struct ite_softc *));
    289      1.1      oki 
    290      1.1      oki #ifdef _KERNEL
    291      1.1      oki extern unsigned char kern_font[];
    292      1.4  minoura 
    293      1.1      oki /* keyboard LED status variable */
    294      1.1      oki extern unsigned char kbdled;
    295      1.6    isaki void ite_set_glyph __P((void));
    296      1.2      oki void kbd_setLED __P((void));
    297      1.1      oki #endif
    298