syscons.h revision 30662
1290650Shselasky/*- 2290650Shselasky * Copyright (c) 1995-1997 S�ren Schmidt 3290650Shselasky * All rights reserved. 4290650Shselasky * 5290650Shselasky * Redistribution and use in source and binary forms, with or without 6290650Shselasky * modification, are permitted provided that the following conditions 7290650Shselasky * are met: 8290650Shselasky * 1. Redistributions of source code must retain the above copyright 9290650Shselasky * notice, this list of conditions and the following disclaimer 10290650Shselasky * in this position and unchanged. 11290650Shselasky * 2. Redistributions in binary form must reproduce the above copyright 12290650Shselasky * notice, this list of conditions and the following disclaimer in the 13290650Shselasky * documentation and/or other materials provided with the distribution. 14290650Shselasky * 3. The name of the author may not be used to endorse or promote products 15290650Shselasky * derived from this software without specific prior written permission 16290650Shselasky * 17290650Shselasky * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18290650Shselasky * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19290650Shselasky * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20290650Shselasky * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21290650Shselasky * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22290650Shselasky * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23290650Shselasky * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24290650Shselasky * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25290650Shselasky * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26290650Shselasky * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27290650Shselasky * 28290650Shselasky * $Id: syscons.h,v 1.34 1997/10/01 20:46:29 sos Exp $ 29290650Shselasky */ 30290650Shselasky 31290650Shselasky#ifndef _I386_ISA_SYSCONS_H_ 32290650Shselasky#define _I386_ISA_SYSCONS_H_ 33290650Shselasky 34290650Shselasky/* vm things */ 35290650Shselasky#define ISMAPPED(pa, width) \ 36290650Shselasky (((pa) <= (u_long)0x1000 - (width)) \ 37290650Shselasky || ((pa) >= 0xa0000 && (pa) <= 0x100000 - (width))) 38290650Shselasky#define pa_to_va(pa) (KERNBASE + (pa)) /* works if ISMAPPED(pa...) */ 39290650Shselasky 40290650Shselasky/* printable chars */ 41290650Shselasky#define PRINTABLE(ch) ((ch) > 0x1b || ((ch) > 0x0d && (ch) < 0x1b) \ 42290650Shselasky || (ch) < 0x07) 43290650Shselasky 44290650Shselasky/* macros for "intelligent" screen update */ 45290650Shselasky#define mark_for_update(scp, x) {\ 46290650Shselasky if ((x) < scp->start) scp->start = (x);\ 47290650Shselasky else if ((x) > scp->end) scp->end = (x);\ 48290650Shselasky } 49290650Shselasky#define mark_all(scp) {\ 50290650Shselasky scp->start = 0;\ 51300277Shselasky scp->end = scp->xsize * scp->ysize;\ 52300277Shselasky } 53300277Shselasky 54300277Shselasky/* status flags */ 55300277Shselasky#define LOCK_KEY_MASK 0x0000F 56300277Shselasky#define LED_MASK 0x00007 57300277Shselasky#define UNKNOWN_MODE 0x00010 58300277Shselasky#define KBD_RAW_MODE 0x00020 59300277Shselasky#define KBD_CODE_MODE 0x00040 60300277Shselasky#define SWITCH_WAIT_REL 0x00080 61300277Shselasky#define SWITCH_WAIT_ACQ 0x00100 62300277Shselasky#define BUFFER_SAVED 0x00200 63300277Shselasky#define CURSOR_ENABLED 0x00400 64300277Shselasky#define MOUSE_ENABLED 0x00800 65300277Shselasky#define MOUSE_MOVED 0x01000 66300277Shselasky#define MOUSE_CUTTING 0x02000 67300277Shselasky#define MOUSE_VISIBLE 0x04000 68300277Shselasky 69300277Shselasky/* configuration flags */ 70300277Shselasky#define VISUAL_BELL 0x00001 71300277Shselasky#define BLINK_CURSOR 0x00002 72300277Shselasky#define CHAR_CURSOR 0x00004 73300277Shselasky#define DETECT_KBD 0x00008 74300277Shselasky#define XT_KEYBD 0x00010 75300277Shselasky#define KBD_NORESET 0x00020 76300277Shselasky 77300277Shselasky/* attribute flags */ 78300277Shselasky#define NORMAL_ATTR 0x00 79300277Shselasky#define BLINK_ATTR 0x01 80300277Shselasky#define BOLD_ATTR 0x02 81300277Shselasky#define UNDERLINE_ATTR 0x04 82300277Shselasky#define REVERSE_ATTR 0x08 83300277Shselasky#define FOREGROUND_CHANGED 0x10 84300277Shselasky#define BACKGROUND_CHANGED 0x20 85300277Shselasky 86300277Shselasky/* video hardware memory addresses */ 87331577Shselasky#define VIDEOMEM 0x000A0000 88331577Shselasky 89331577Shselasky/* misc defines */ 90331577Shselasky#define FALSE 0 91331577Shselasky#define TRUE 1 92331577Shselasky#define MAX_ESC_PAR 5 93331577Shselasky#define LOAD 1 94331577Shselasky#define SAVE 0 95331577Shselasky#define COL 80 96331577Shselasky#define ROW 25 97331577Shselasky#define BELL_DURATION 5 98331577Shselasky#define BELL_PITCH 800 99331577Shselasky#define CONSOLE_BUFSIZE 1024 100331577Shselasky#define PCBURST 128 101331577Shselasky#define FONT_NONE 1 102331577Shselasky#define FONT_8 2 103331577Shselasky#define FONT_14 4 104331577Shselasky#define FONT_16 8 105331577Shselasky 106331577Shselasky/* defines related to hardware addresses */ 107331577Shselasky#define MONO_BASE 0x3B4 /* crt controller base mono */ 108331577Shselasky#define COLOR_BASE 0x3D4 /* crt controller base color */ 109331577Shselasky#define MISC 0x3C2 /* misc output register */ 110331577Shselasky#define ATC IO_VGA+0x00 /* attribute controller */ 111331577Shselasky#define TSIDX IO_VGA+0x04 /* timing sequencer idx */ 112331577Shselasky#define TSREG IO_VGA+0x05 /* timing sequencer data */ 113331577Shselasky#define PIXMASK IO_VGA+0x06 /* pixel write mask */ 114331577Shselasky#define PALRADR IO_VGA+0x07 /* palette read address */ 115331577Shselasky#define PALWADR IO_VGA+0x08 /* palette write address */ 116331577Shselasky#define PALDATA IO_VGA+0x09 /* palette data register */ 117331577Shselasky#define GDCIDX IO_VGA+0x0E /* graph data controller idx */ 118331577Shselasky#define GDCREG IO_VGA+0x0F /* graph data controller data */ 119331577Shselasky 120331577Shselasky/* special characters */ 121331577Shselasky#define cntlc 0x03 122331577Shselasky#define cntld 0x04 123331577Shselasky#define bs 0x08 124331577Shselasky#define lf 0x0a 125331577Shselasky#define cr 0x0d 126331577Shselasky#define del 0x7f 127331577Shselasky 128331577Shselasky#define DEAD_CHAR 0x07 /* char used for cursor */ 129331577Shselasky 130331577Shselaskytypedef struct term_stat { 131331577Shselasky int esc; /* processing escape sequence */ 132331577Shselasky int num_param; /* # of parameters to ESC */ 133331577Shselasky int last_param; /* last parameter # */ 134331577Shselasky int param[MAX_ESC_PAR]; /* contains ESC parameters */ 135331577Shselasky int cur_attr; /* current hardware attr word */ 136331577Shselasky int attr_mask; /* current logical attr mask */ 137331577Shselasky int cur_color; /* current hardware color */ 138331577Shselasky int std_color; /* normal hardware color */ 139331577Shselasky int rev_color; /* reverse hardware color */ 140331577Shselasky} term_stat; 141331577Shselasky 142331577Shselaskytypedef struct scr_stat { 143331577Shselasky u_short *scr_buf; /* buffer when off screen */ 144331577Shselasky int xpos; /* current X position */ 145331577Shselasky int ypos; /* current Y position */ 146331577Shselasky int saved_xpos; /* saved X position */ 147331577Shselasky int saved_ypos; /* saved Y position */ 148331577Shselasky int xsize; /* X text size */ 149331577Shselasky int ysize; /* Y text size */ 150331577Shselasky int xpixel; /* X graphics size */ 151331577Shselasky int ypixel; /* Y graphics size */ 152331577Shselasky int font_size; /* fontsize in Y direction */ 153331577Shselasky int start; /* modified area start */ 154331577Shselasky int end; /* modified area end */ 155331577Shselasky term_stat term; /* terminal emulation stuff */ 156331577Shselasky int status; /* status (bitfield) */ 157331577Shselasky u_short *cursor_pos; /* cursor buffer position */ 158331577Shselasky u_short *cursor_oldpos; /* cursor old buffer position */ 159331577Shselasky u_short cursor_saveunder; /* saved chars under cursor */ 160331577Shselasky char cursor_start; /* cursor start line # */ 161331577Shselasky char cursor_end; /* cursor end line # */ 162331577Shselasky u_short *mouse_pos; /* mouse buffer position */ 163331577Shselasky u_short *mouse_oldpos; /* mouse old buffer position */ 164331577Shselasky short mouse_xpos; /* mouse x coordinate */ 165331577Shselasky short mouse_ypos; /* mouse y coordinate */ 166331577Shselasky short mouse_buttons; /* mouse buttons */ 167331577Shselasky u_char mouse_cursor[128]; /* mouse cursor bitmap store */ 168331577Shselasky u_short *mouse_cut_start; /* mouse cut start pos */ 169331577Shselasky u_short *mouse_cut_end; /* mouse cut end pos */ 170331577Shselasky struct proc *mouse_proc; /* proc* of controlling proc */ 171331577Shselasky pid_t mouse_pid; /* pid of controlling proc */ 172331577Shselasky int mouse_signal; /* signal # to report with */ 173331577Shselasky u_short bell_duration; 174331577Shselasky u_short bell_pitch; 175331577Shselasky u_char border; /* border color */ 176331577Shselasky u_char mode; /* mode */ 177331577Shselasky pid_t pid; /* pid of controlling proc */ 178331578Shselasky struct proc *proc; /* proc* of controlling proc */ 179331578Shselasky struct vt_mode smode; /* switch mode */ 180331578Shselasky u_short *history; /* circular history buffer */ 181331578Shselasky u_short *history_head; /* current head position */ 182331578Shselasky u_short *history_pos; /* position shown on screen */ 183331578Shselasky u_short *history_save; /* save area index */ 184331578Shselasky int history_size; /* size of history buffer */ 185331578Shselasky struct apmhook r_hook; /* reconfiguration support */ 186331578Shselasky} scr_stat; 187331578Shselasky 188331578Shselaskytypedef struct default_attr { 189331578Shselasky int std_color; /* normal hardware color */ 190331578Shselasky int rev_color; /* reverse hardware color */ 191331578Shselasky} default_attr; 192331578Shselasky 193331578Shselasky/* misc prototypes used by different syscons related LKM's */ 194331578Shselaskyvoid set_border(u_char color); 195331578Shselaskyvoid set_mode(scr_stat *scp); 196331578Shselaskyvoid copy_font(int operation, int font_type, char* font_image); 197331578Shselaskyvoid load_palette(char *palette); 198331578Shselaskyint add_scrn_saver(void (*this)(int)); 199331578Shselaskyint remove_scrn_saver(void (*this)(int)); 200331578Shselasky 201331578Shselasky#endif /* !_I386_ISA_SYSCONS_H_ */ 202331578Shselasky