1 /* 2 * Copyright (c) 1988 University of Utah. 3 * Copyright (c) 1990 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * the Systems Programming Group of the University of Utah Computer 8 * Science Department. 9 * 10 * %sccs.include.redist.c% 11 * 12 * from: Utah $Hdr: itevar.h 1.1 90/07/09$ 13 * 14 * @(#)itevar.h 7.2 (Berkeley) 11/04/90 15 */ 16 17 #define UNIT(dev) minor(dev) 18 19 struct itesw { 20 int (*ite_init)(); 21 int (*ite_deinit)(); 22 int (*ite_clear)(); 23 int (*ite_putc)(); 24 int (*ite_cursor)(); 25 int (*ite_scroll)(); 26 }; 27 28 struct ite_softc { 29 int flags; 30 int type; 31 caddr_t regbase, fbbase; 32 short curx, cury; 33 short cursorx, cursory; 34 short cblankx, cblanky; 35 short rows, cols; 36 short cpl; 37 short dheight, dwidth; 38 short fbheight, fbwidth; 39 short ftheight, ftwidth; 40 short fontx, fonty; 41 short attribute; 42 u_char *attrbuf; 43 short planemask; 44 short pos; 45 char imode, escape, fpd, hold; 46 }; 47 48 /* Flags */ 49 #define ITE_ALIVE 0x01 /* hardware exists */ 50 #define ITE_INITED 0x02 /* device has been initialized */ 51 #define ITE_CONSOLE 0x04 /* device can be console */ 52 #define ITE_ISCONS 0x08 /* device is console */ 53 #define ITE_ACTIVE 0x10 /* device is being used as ITE */ 54 #define ITE_INGRF 0x20 /* device in use as non-ITE */ 55 56 /* Types - indices into itesw */ 57 #define ITE_TOPCAT 0 58 #define ITE_GATORBOX 1 59 #define ITE_RENAISSANCE 2 60 #define ITE_DAVINCI 3 61 62 #define attrloc(ip, y, x) \ 63 (ip->attrbuf + ((y) * ip->cols) + (x)) 64 65 #define attrclr(ip, sy, sx, h, w) \ 66 bzero(ip->attrbuf + ((sy) * ip->cols) + (sx), (h) * (w)) 67 68 #define attrmov(ip, sy, sx, dy, dx, h, w) \ 69 bcopy(ip->attrbuf + ((sy) * ip->cols) + (sx), \ 70 ip->attrbuf + ((dy) * ip->cols) + (dx), \ 71 (h) * (w)) 72 73 #define attrtest(ip, attr) \ 74 ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) & attr) 75 76 #define attrset(ip, attr) \ 77 ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) = attr) 78 79 /* 80 * X and Y location of character 'c' in the framebuffer, in pixels. 81 */ 82 #define charX(ip,c) \ 83 (((c) % (ip)->cpl) * (ip)->ftwidth + (ip)->fontx) 84 85 #define charY(ip,c) \ 86 (((c) / (ip)->cpl) * (ip)->ftheight + (ip)->fonty) 87 88 /* Character attributes */ 89 #define ATTR_NOR 0x0 /* normal */ 90 #define ATTR_INV 0x1 /* inverse */ 91 #define ATTR_UL 0x2 /* underline */ 92 #define ATTR_ALL (ATTR_INV | ATTR_UL) 93 94 /* Keyboard attributes */ 95 #define ATTR_KPAD 0x4 /* keypad transmit */ 96 97 /* Replacement Rules */ 98 #define RR_CLEAR 0x0 99 #define RR_COPY 0x3 100 #define RR_XOR 0x6 101 #define RR_COPYINVERTED 0xc 102 103 #define SCROLL_UP 0x01 104 #define SCROLL_DOWN 0x02 105 #define SCROLL_LEFT 0x03 106 #define SCROLL_RIGHT 0x04 107 #define DRAW_CURSOR 0x05 108 #define ERASE_CURSOR 0x06 109 #define MOVE_CURSOR 0x07 110 111 #define KBD_SSHIFT 4 /* bits to shift status */ 112 #define KBD_CHARMASK 0x7F 113 114 /* keyboard status */ 115 #define KBD_SMASK 0xF /* service request status mask */ 116 #define KBD_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */ 117 #define KBD_CTRL 0x9 /* key + CTRL */ 118 #define KBD_SHIFT 0xA /* key + SHIFT */ 119 #define KBD_KEY 0xB /* key only */ 120 121 #define KBD_CAPSLOCK 0x18 122 123 #define KBD_EXT_LEFT_DOWN 0x12 124 #define KBD_EXT_LEFT_UP 0x92 125 #define KBD_EXT_RIGHT_DOWN 0x13 126 #define KBD_EXT_RIGHT_UP 0x93 127 128 #define TABSIZE 8 129 #define TABEND(u) (ite_tty[u].t_winsize.ws_col - TABSIZE) 130 131 #ifdef KERNEL 132 extern struct ite_softc ite_softc[]; 133 #endif 134