141480Smckusick /* 241480Smckusick * Copyright (c) 1988 University of Utah. 3*63148Sbostic * Copyright (c) 1990, 1993 4*63148Sbostic * The Regents of the University of California. 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 * 1257312Shibler * from: Utah $Hdr: itevar.h 1.15 92/12/20$ 1341480Smckusick * 14*63148Sbostic * @(#)itevar.h 8.1 (Berkeley) 06/10/93 1541480Smckusick */ 1641480Smckusick 1741480Smckusick #define UNIT(dev) minor(dev) 1841480Smckusick 1941480Smckusick struct itesw { 2053923Shibler 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)(); 2753923Shibler u_char (*ite_readbyte)(); 2853923Shibler int (*ite_writeglyph)(); 2941480Smckusick }; 3041480Smckusick 3153923Shibler #define getbyte(ip, offset) \ 3253923Shibler ((*(ip)->isw->ite_readbyte)(ip, offset)) 3353923Shibler 3453923Shibler #define getword(ip, offset) \ 3553923Shibler ((getbyte(ip, offset) << 8) | getbyte(ip, (offset) + 2)) 3653923Shibler 3753923Shibler #define writeglyph(ip, offset, fontbuf) \ 3853923Shibler ((*(ip)->isw->ite_writeglyph)((ip), (offset), (fontbuf))) 3953923Shibler 4041480Smckusick struct ite_softc { 4141480Smckusick int flags; 4253923Shibler struct itesw *isw; 4353923Shibler 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; 5953923Shibler 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 */ 6957312Shibler #define ITE_CURSORON 0x40 /* cursor being tracked */ 7041480Smckusick 7141480Smckusick #define attrloc(ip, y, x) \ 7241480Smckusick (ip->attrbuf + ((y) * ip->cols) + (x)) 7341480Smckusick 7441480Smckusick #define attrclr(ip, sy, sx, h, w) \ 7541480Smckusick bzero(ip->attrbuf + ((sy) * ip->cols) + (sx), (h) * (w)) 7641480Smckusick 7741480Smckusick #define attrmov(ip, sy, sx, dy, dx, h, w) \ 7841480Smckusick bcopy(ip->attrbuf + ((sy) * ip->cols) + (sx), \ 7941480Smckusick ip->attrbuf + ((dy) * ip->cols) + (dx), \ 8041480Smckusick (h) * (w)) 8141480Smckusick 8241480Smckusick #define attrtest(ip, attr) \ 8341480Smckusick ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) & attr) 8441480Smckusick 8541480Smckusick #define attrset(ip, attr) \ 8641480Smckusick ((* (u_char *) attrloc(ip, ip->cury, ip->curx)) = attr) 8741480Smckusick 8841480Smckusick /* 8941480Smckusick * X and Y location of character 'c' in the framebuffer, in pixels. 9041480Smckusick */ 9141480Smckusick #define charX(ip,c) \ 9241480Smckusick (((c) % (ip)->cpl) * (ip)->ftwidth + (ip)->fontx) 9341480Smckusick 9441480Smckusick #define charY(ip,c) \ 9541480Smckusick (((c) / (ip)->cpl) * (ip)->ftheight + (ip)->fonty) 9641480Smckusick 9753923Shibler /* 9853923Shibler * The cursor is just an inverted space. 9953923Shibler */ 10053923Shibler #define draw_cursor(ip) { \ 10153923Shibler WINDOWMOVER(ip, ip->cblanky, ip->cblankx, \ 10253923Shibler ip->cury * ip->ftheight, \ 10353923Shibler ip->curx * ip->ftwidth, \ 10453923Shibler ip->ftheight, ip->ftwidth, RR_XOR); \ 10553923Shibler ip->cursorx = ip->curx; \ 10653923Shibler ip->cursory = ip->cury; } 10753923Shibler 10853923Shibler #define erase_cursor(ip) \ 10953923Shibler WINDOWMOVER(ip, ip->cblanky, ip->cblankx, \ 11053923Shibler ip->cursory * ip->ftheight, \ 11153923Shibler ip->cursorx * ip->ftwidth, \ 11253923Shibler ip->ftheight, ip->ftwidth, RR_XOR); 11353923Shibler 11441480Smckusick /* Character attributes */ 11541480Smckusick #define ATTR_NOR 0x0 /* normal */ 11641480Smckusick #define ATTR_INV 0x1 /* inverse */ 11741480Smckusick #define ATTR_UL 0x2 /* underline */ 11841480Smckusick #define ATTR_ALL (ATTR_INV | ATTR_UL) 11941480Smckusick 12041480Smckusick /* Keyboard attributes */ 12141480Smckusick #define ATTR_KPAD 0x4 /* keypad transmit */ 12241480Smckusick 12341480Smckusick /* Replacement Rules */ 12441480Smckusick #define RR_CLEAR 0x0 12541480Smckusick #define RR_COPY 0x3 12641480Smckusick #define RR_XOR 0x6 12741480Smckusick #define RR_COPYINVERTED 0xc 12841480Smckusick 12941480Smckusick #define SCROLL_UP 0x01 13041480Smckusick #define SCROLL_DOWN 0x02 13141480Smckusick #define SCROLL_LEFT 0x03 13241480Smckusick #define SCROLL_RIGHT 0x04 13341480Smckusick #define DRAW_CURSOR 0x05 13441480Smckusick #define ERASE_CURSOR 0x06 13541480Smckusick #define MOVE_CURSOR 0x07 13641480Smckusick 13741480Smckusick #define KBD_SSHIFT 4 /* bits to shift status */ 13841480Smckusick #define KBD_CHARMASK 0x7F 13941480Smckusick 14041480Smckusick /* keyboard status */ 14141480Smckusick #define KBD_SMASK 0xF /* service request status mask */ 14241480Smckusick #define KBD_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */ 14341480Smckusick #define KBD_CTRL 0x9 /* key + CTRL */ 14441480Smckusick #define KBD_SHIFT 0xA /* key + SHIFT */ 14541480Smckusick #define KBD_KEY 0xB /* key only */ 14641480Smckusick 14741480Smckusick #define KBD_CAPSLOCK 0x18 14841480Smckusick 14941480Smckusick #define KBD_EXT_LEFT_DOWN 0x12 15041480Smckusick #define KBD_EXT_LEFT_UP 0x92 15141480Smckusick #define KBD_EXT_RIGHT_DOWN 0x13 15241480Smckusick #define KBD_EXT_RIGHT_UP 0x93 15341480Smckusick 15441480Smckusick #define TABSIZE 8 15541480Smckusick #define TABEND(u) (ite_tty[u].t_winsize.ws_col - TABSIZE) 15641480Smckusick 15741480Smckusick #ifdef KERNEL 15841480Smckusick extern struct ite_softc ite_softc[]; 15953923Shibler extern struct itesw itesw[]; 16053923Shibler extern int nitesw; 16141480Smckusick #endif 162