141480Smckusick /* 241480Smckusick * Copyright (c) 1988 University of Utah. 341480Smckusick * Copyright (c) 1990 The Regents of the University of California. 441480Smckusick * All rights reserved. 541480Smckusick * 641480Smckusick * This code is derived from software contributed to Berkeley by 741480Smckusick * the Systems Programming Group of the University of Utah Computer 841480Smckusick * Science Department. 941480Smckusick * 1041480Smckusick * %sccs.include.redist.c% 1141480Smckusick * 12*53923Shibler * from: Utah $Hdr: itevar.h 1.14 92/01/21$ 1341480Smckusick * 14*53923Shibler * @(#)itevar.h 7.3 (Berkeley) 06/05/92 1541480Smckusick */ 1641480Smckusick 1741480Smckusick #define UNIT(dev) minor(dev) 1841480Smckusick 1941480Smckusick struct itesw { 20*53923Shibler int ite_hwid; /* Hardware id */ 2141480Smckusick int (*ite_init)(); 2241480Smckusick int (*ite_deinit)(); 2341480Smckusick int (*ite_clear)(); 2441480Smckusick int (*ite_putc)(); 2541480Smckusick int (*ite_cursor)(); 2641480Smckusick int (*ite_scroll)(); 27*53923Shibler u_char (*ite_readbyte)(); 28*53923Shibler int (*ite_writeglyph)(); 2941480Smckusick }; 3041480Smckusick 31*53923Shibler #define getbyte(ip, offset) \ 32*53923Shibler ((*(ip)->isw->ite_readbyte)(ip, offset)) 33*53923Shibler 34*53923Shibler #define getword(ip, offset) \ 35*53923Shibler ((getbyte(ip, offset) << 8) | getbyte(ip, (offset) + 2)) 36*53923Shibler 37*53923Shibler #define writeglyph(ip, offset, fontbuf) \ 38*53923Shibler ((*(ip)->isw->ite_writeglyph)((ip), (offset), (fontbuf))) 39*53923Shibler 4041480Smckusick struct ite_softc { 4141480Smckusick int flags; 42*53923Shibler struct itesw *isw; 43*53923Shibler struct grf_softc *grf; 4441480Smckusick caddr_t regbase, fbbase; 4541480Smckusick short curx, cury; 4641480Smckusick short cursorx, cursory; 4741480Smckusick short cblankx, cblanky; 4841480Smckusick short rows, cols; 4941480Smckusick short cpl; 5041480Smckusick short dheight, dwidth; 5141480Smckusick short fbheight, fbwidth; 5241480Smckusick short ftheight, ftwidth; 5341480Smckusick short fontx, fonty; 5441480Smckusick short attribute; 5541480Smckusick u_char *attrbuf; 5641480Smckusick short planemask; 5741480Smckusick short pos; 5841480Smckusick char imode, escape, fpd, hold; 59*53923Shibler caddr_t devdata; /* display dependent data */ 6041480Smckusick }; 6141480Smckusick 6241480Smckusick /* Flags */ 6341480Smckusick #define ITE_ALIVE 0x01 /* hardware exists */ 6441480Smckusick #define ITE_INITED 0x02 /* device has been initialized */ 6541480Smckusick #define ITE_CONSOLE 0x04 /* device can be console */ 6641480Smckusick #define ITE_ISCONS 0x08 /* device is console */ 6741480Smckusick #define ITE_ACTIVE 0x10 /* device is being used as ITE */ 6841480Smckusick #define ITE_INGRF 0x20 /* device in use as non-ITE */ 6941480Smckusick 7041480Smckusick #define attrloc(ip, y, x) \ 7141480Smckusick (ip->attrbuf + ((y) * ip->cols) + (x)) 7241480Smckusick 7341480Smckusick #define attrclr(ip, sy, sx, h, w) \ 7441480Smckusick bzero(ip->attrbuf + ((sy) * ip->cols) + (sx), (h) * (w)) 7541480Smckusick 7641480Smckusick #define attrmov(ip, sy, sx, dy, dx, h, w) \ 7741480Smckusick bcopy(ip->attrbuf + ((sy) * ip->cols) + (sx), \ 7841480Smckusick ip->attrbuf + ((dy) * ip->cols) + (dx), \ 7941480Smckusick (h) * (w)) 8041480Smckusick 8141480Smckusick #define attrtest(ip, attr) \ 8241480Smckusick ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) & attr) 8341480Smckusick 8441480Smckusick #define attrset(ip, attr) \ 8541480Smckusick ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) = attr) 8641480Smckusick 8741480Smckusick /* 8841480Smckusick * X and Y location of character 'c' in the framebuffer, in pixels. 8941480Smckusick */ 9041480Smckusick #define charX(ip,c) \ 9141480Smckusick (((c) % (ip)->cpl) * (ip)->ftwidth + (ip)->fontx) 9241480Smckusick 9341480Smckusick #define charY(ip,c) \ 9441480Smckusick (((c) / (ip)->cpl) * (ip)->ftheight + (ip)->fonty) 9541480Smckusick 96*53923Shibler /* 97*53923Shibler * The cursor is just an inverted space. 98*53923Shibler */ 99*53923Shibler #define draw_cursor(ip) { \ 100*53923Shibler WINDOWMOVER(ip, ip->cblanky, ip->cblankx, \ 101*53923Shibler ip->cury * ip->ftheight, \ 102*53923Shibler ip->curx * ip->ftwidth, \ 103*53923Shibler ip->ftheight, ip->ftwidth, RR_XOR); \ 104*53923Shibler ip->cursorx = ip->curx; \ 105*53923Shibler ip->cursory = ip->cury; } 106*53923Shibler 107*53923Shibler #define erase_cursor(ip) \ 108*53923Shibler WINDOWMOVER(ip, ip->cblanky, ip->cblankx, \ 109*53923Shibler ip->cursory * ip->ftheight, \ 110*53923Shibler ip->cursorx * ip->ftwidth, \ 111*53923Shibler ip->ftheight, ip->ftwidth, RR_XOR); 112*53923Shibler 11341480Smckusick /* Character attributes */ 11441480Smckusick #define ATTR_NOR 0x0 /* normal */ 11541480Smckusick #define ATTR_INV 0x1 /* inverse */ 11641480Smckusick #define ATTR_UL 0x2 /* underline */ 11741480Smckusick #define ATTR_ALL (ATTR_INV | ATTR_UL) 11841480Smckusick 11941480Smckusick /* Keyboard attributes */ 12041480Smckusick #define ATTR_KPAD 0x4 /* keypad transmit */ 12141480Smckusick 12241480Smckusick /* Replacement Rules */ 12341480Smckusick #define RR_CLEAR 0x0 12441480Smckusick #define RR_COPY 0x3 12541480Smckusick #define RR_XOR 0x6 12641480Smckusick #define RR_COPYINVERTED 0xc 12741480Smckusick 12841480Smckusick #define SCROLL_UP 0x01 12941480Smckusick #define SCROLL_DOWN 0x02 13041480Smckusick #define SCROLL_LEFT 0x03 13141480Smckusick #define SCROLL_RIGHT 0x04 13241480Smckusick #define DRAW_CURSOR 0x05 13341480Smckusick #define ERASE_CURSOR 0x06 13441480Smckusick #define MOVE_CURSOR 0x07 13541480Smckusick 13641480Smckusick #define KBD_SSHIFT 4 /* bits to shift status */ 13741480Smckusick #define KBD_CHARMASK 0x7F 13841480Smckusick 13941480Smckusick /* keyboard status */ 14041480Smckusick #define KBD_SMASK 0xF /* service request status mask */ 14141480Smckusick #define KBD_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */ 14241480Smckusick #define KBD_CTRL 0x9 /* key + CTRL */ 14341480Smckusick #define KBD_SHIFT 0xA /* key + SHIFT */ 14441480Smckusick #define KBD_KEY 0xB /* key only */ 14541480Smckusick 14641480Smckusick #define KBD_CAPSLOCK 0x18 14741480Smckusick 14841480Smckusick #define KBD_EXT_LEFT_DOWN 0x12 14941480Smckusick #define KBD_EXT_LEFT_UP 0x92 15041480Smckusick #define KBD_EXT_RIGHT_DOWN 0x13 15141480Smckusick #define KBD_EXT_RIGHT_UP 0x93 15241480Smckusick 15341480Smckusick #define TABSIZE 8 15441480Smckusick #define TABEND(u) (ite_tty[u].t_winsize.ws_col - TABSIZE) 15541480Smckusick 15641480Smckusick #ifdef KERNEL 15741480Smckusick extern struct ite_softc ite_softc[]; 158*53923Shibler extern struct itesw itesw[]; 159*53923Shibler extern int nitesw; 16041480Smckusick #endif 161