#define UNIT(dev) minor(dev)
struct ite_softc;
struct itesw {
int (*ite_cnprobe)(int minor);
void (*ite_init)(struct ite_softc *);
void (*ite_deinit)(struct ite_softc *);
void (*ite_clear)(struct ite_softc *, int, int, int, int);
void (*ite_putc)(struct ite_softc *, int, int, int, int);
void (*ite_cursor)(struct ite_softc *, int);
void (*ite_scroll)(struct ite_softc *, int, int, int, int);
void (*ite_sixel)(struct ite_softc *, int, int);
};
enum ite_arraymaxs {
MAX_ARGSIZE = 256,
MAX_TABS = 256,
};
#define ARGBUF_SIZE 256
struct ite_softc {
device_t device;
struct grf_softc *grf;
struct itesw *isw;
int flags;
int type;
int open_cnt;
void *priv;
short curx, cury;
short cursorx, cursory;
u_char *font;
u_char *cursor;
u_char font_lo, font_hi;
short rows, cols;
short cpl;
short ftheight, ftwidth, ftbaseline, ftboldsmear;
short attribute;
u_char *attrbuf;
short planemask;
short pos;
char imode, fpd, hold;
u_char escape, cursor_opt, key_repeat;
char *GL, *GR, *save_GL;
char G0, G1, G2, G3;
char fgcolor, bgcolor;
char linefeed_newline, auto_wrap;
char cursor_appmode, keypad_appmode;
char argbuf[ARGBUF_SIZE], *ap, *tabs;
char emul_level, eightbit_C1;
int top_margin, bottom_margin;
char inside_margins, sc_om;
short save_curx, save_cury, save_attribute, save_char;
char sc_G0, sc_G1, sc_G2, sc_G3;
char *sc_GL, *sc_GR;
enum {
DCS_START = 0,
DCS_SIXEL = 'q',
DCS_DISCARD = -1,
} dcs_cmd;
enum {
DECSIXEL_INIT = 0,
DECSIXEL_RASTER_PAD,
DECSIXEL_RASTER_PH,
DECSIXEL_RASTER_PV,
DECSIXEL_REPEAT = '!',
DECSIXEL_RASTER = '\"',
DECSIXEL_COLOR = '#',
} decsixel_state;
int decsixel_ph;
int decsixel_x;
int decsixel_y;
int decsixel_repcount;
int decsixel_color;
int decsixel_ormode;
#define MAX_SIXEL_WIDTH (768)
uint32_t decsixel_buf[MAX_SIXEL_WIDTH];
};
enum emul_level {
EMUL_VT100 = 1,
EMUL_VT300_8,
EMUL_VT300_7
};
#define ITE_ALIVE 0x01
#define ITE_INITED 0x02
#define ITE_CONSOLE 0x04
#define ITE_ISCONS 0x08
#define ITE_ACTIVE 0x10
#define ITE_INGRF 0x20
#ifdef DO_WEIRD_ATTRIBUTES
#define attrloc(ip, y, x) \
(ip->attrbuf + ((y) * ip->cols) + (x))
#define attrclr(ip, sy, sx, h, w) \
memset(ip->attrbuf + ((sy) * ip->cols) + (sx), 0, (h) * (w))
#define attrmov(ip, sy, sx, dy, dx, h, w) \
memcpy(ip->attrbuf + ((dy) * ip->cols) + (dx), \
ip->attrbuf + ((sy) * ip->cols) + (sx), \
(h) * (w))
#define attrtest(ip, attr) \
((* (u_char *) attrloc(ip, ip->cury, ip->curx)) & attr)
#define attrset(ip, attr) \
((* (u_char *) attrloc(ip, ip->cury, ip->curx)) = attr)
#else
#define attrloc(ip, y, x) 0
#define attrclr(ip, sy, sx, h, w)
#define attrmov(ip, sy, sx, dy, dx, h, w)
#define attrtest(ip, attr) 0
#define attrset(ip, attr)
#endif
#define charX(ip,c) \
(((c) % (ip)->cpl) * (ip)->ftwidth + (ip)->fontx)
#define charY(ip,c) \
(((c) / (ip)->cpl) * (ip)->ftheight + (ip)->fonty)
#define ATTR_NOR 0x0
#define ATTR_INV 0x1
#define ATTR_UL 0x2
#define ATTR_BOLD 0x4
#define ATTR_BLINK 0x8
#define ATTR_ALL (ATTR_INV | ATTR_UL|ATTR_BOLD|ATTR_BLINK)
#define ATTR_KPAD 0x80
#define RR_CLEAR 0x0
#define RR_COPY 0x3
#define RR_XOR 0x6
#define RR_COPYINVERTED 0xc
#define SCROLL_UP 0x01
#define SCROLL_DOWN 0x02
#define SCROLL_LEFT 0x03
#define SCROLL_RIGHT 0x04
#define DRAW_CURSOR 0x05
#define ERASE_CURSOR 0x06
#define MOVE_CURSOR 0x07
#define START_CURSOROPT 0x08
#define END_CURSOROPT 0x09
#define KBD_LEFT_SHIFT 0x70
#define KBD_RIGHT_SHIFT 0x70
#define KBD_CAPS_LOCK 0x5d
#define KBD_CTRL 0x71
#define KBD_LEFT_ALT 0x55
#define KBD_RIGHT_ALT 0x58
#define KBD_LEFT_META 0x56
#define KBD_RIGHT_META 0x57
#define KBD_OPT1 0x72
#define KBD_OPT2 0x73
#define KBD_RECONNECT 0x7f
#define KBD_MOD_LSHIFT (1<<0)
#define KBD_MOD_RSHIFT (1<<1)
#define KBD_MOD_SHIFT (KBD_MOD_LSHIFT | KBD_MOD_RSHIFT)
#define KBD_MOD_CTRL (1<<2)
#define KBD_MOD_LALT (1<<3)
#define KBD_MOD_RALT (1<<4)
#define KBD_MOD_ALT (KBD_MOD_LALT | KBD_MOD_RALT)
#define KBD_MOD_LMETA (1<<5)
#define KBD_MOD_RMETA (1<<6)
#define KBD_MOD_META (KBD_MOD_LMETA | KBD_MOD_RMETA)
#define KBD_MOD_CAPS (1<<7)
#define KBD_MOD_OPT1 (1<<8)
#define KBD_MOD_OPT2 (1<<9)
enum tab_size { TABSIZE = 8 };
#define TABEND(u) (ite_tty[u]->t_windsize.ws_col - TABSIZE)
#define set_attr(ip, attr) ((ip)->attribute |= (attr))
#define clr_attr(ip, attr) ((ip)->attribute &= ~(attr))
#define attrloc(ip, y, x) 0
#define attrclr(ip, sy, sx, h, w)
#define attrmov(ip, sy, sx, dy, dx, h, w)
#define attrtest(ip, attr) 0
#define attrset(ip, attr)
#define CSET_MULTI 0x80
#define CSET_ASCII 0
#define CSET_JISROMA 1
#define CSET_JISKANA 2
#define CSET_JIS1978 (3|CSET_MULTI)
#define CSET_JIS1983 (4|CSET_MULTI)
#define CSET_JIS1990 (5|CSET_MULTI)
#define CSET_DECGRAPH 6
struct consdev;
void itecnprobe(struct consdev *);
void itecninit(struct consdev *);
int itecngetc(dev_t);
void itecnputc(dev_t, int);
void itecnfinish(struct ite_softc *);
void iteinit(dev_t);
int iteon(dev_t, int);
void iteoff(dev_t, int);
void ite_reinit(dev_t);
void ite_reset(struct ite_softc *);
int ite_cnfilter(u_char);
void ite_filter(u_char);
void tv_init(struct ite_softc *);
void tv_deinit(struct ite_softc *);
#ifdef _KERNEL
extern unsigned char kern_font[];
extern unsigned char kbdled;
void ite_set_glyph(void);
void kbd_setLED(void);
extern const uint8_t ite_decgraph2ascii[];
#endif