1 1.20 chs /* $NetBSD: itevar.h,v 1.20 2012/10/27 17:17:29 chs 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.13 jtc struct tty *tp; 53 1.7 chopps char argbuf[MAX_ARGSIZE]; 54 1.7 chopps struct grf_softc *grf; /* XXX */ 55 1.7 chopps void *priv; 56 1.7 chopps char *ap; 57 1.7 chopps u_char *tabs; 58 1.1 mw int flags; 59 1.7 chopps int open_count; 60 1.7 chopps short cursorx; 61 1.7 chopps short cursory; 62 1.7 chopps short rows; 63 1.7 chopps short cols; 64 1.1 mw u_char *font; 65 1.1 mw u_char *cursor; 66 1.7 chopps u_char font_lo; 67 1.7 chopps u_char font_hi; 68 1.7 chopps short cpl; /* XXX? */ 69 1.7 chopps short ftheight; 70 1.7 chopps short ftwidth; 71 1.7 chopps short ftbaseline; 72 1.7 chopps short ftboldsmear; 73 1.1 mw short planemask; 74 1.1 mw short pos; 75 1.7 chopps char imode; 76 1.7 chopps char fpd; 77 1.7 chopps char hold; 78 1.7 chopps u_char escape; 79 1.7 chopps u_char cursor_opt; 80 1.7 chopps u_char key_repeat; 81 1.7 chopps char GL; 82 1.7 chopps char GR; 83 1.7 chopps char G0; 84 1.7 chopps char G1; 85 1.7 chopps char G2; 86 1.7 chopps char G3; 87 1.7 chopps char linefeed_newline; 88 1.7 chopps char auto_wrap; 89 1.7 chopps char cursor_appmode; 90 1.7 chopps char keypad_appmode; 91 1.7 chopps short top_margin; 92 1.7 chopps short bottom_margin; 93 1.7 chopps short inside_margins; 94 1.7 chopps short eightbit_C1; 95 1.7 chopps short emul_level; 96 1.7 chopps enum ite_attr attribute; 97 1.7 chopps enum ite_attr save_attribute; 98 1.7 chopps int curx; 99 1.7 chopps int save_curx; 100 1.7 chopps int cury; 101 1.7 chopps int save_cury; 102 1.7 chopps }; 103 1.7 chopps 104 1.7 chopps enum ite_flags { 105 1.7 chopps ITE_ALIVE = 0x1, /* grf layer is configed */ 106 1.7 chopps ITE_ISCONS = 0x2, /* ite is acting console. */ 107 1.7 chopps ITE_INITED = 0x4, /* ite has been inited. */ 108 1.7 chopps ITE_ISOPEN = 0x8, /* ite has been opened */ 109 1.7 chopps ITE_INGRF = 0x10, /* ite is in graphics mode */ 110 1.7 chopps ITE_ACTIVE = 0x20, /* ite is an active terminal */ 111 1.17 chs ITE_ATTACHED = 0x40, /* ite is attached */ 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.15 aymeric void itecnprobe(struct consdev *); 193 1.15 aymeric void itecninit(struct consdev *); 194 1.15 aymeric int itecngetc(dev_t); 195 1.15 aymeric void itecnputc(dev_t, int); 196 1.15 aymeric void ite_cnfinish(struct ite_softc *); 197 1.7 chopps 198 1.7 chopps /* standard ite device entry points. */ 199 1.15 aymeric void iteinit(dev_t); 200 1.15 aymeric void itestart(struct tty *); 201 1.7 chopps 202 1.7 chopps /* ite functions */ 203 1.17 chs void ite_on(dev_t, int); 204 1.15 aymeric void ite_off(dev_t, int); 205 1.15 aymeric void ite_reinit(dev_t); 206 1.15 aymeric int ite_param(struct tty *, struct termios *); 207 1.15 aymeric void ite_reset(struct ite_softc *); 208 1.15 aymeric int ite_cnfilter(u_char, enum caller); 209 1.15 aymeric void ite_filter(u_char ,enum caller); 210 1.19 christos int ite_grf_ioctl(struct ite_softc *, u_long, void *, int, struct lwp *); 211 1.1 mw 212 1.7 chopps #endif /* _ITEVAR_H */ 213