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