syscons.h revision 19123
1237448Spfg/*- 226926Smsmith * Copyright (c) 1995-1996 S�ren Schmidt 384260Sobrien * All rights reserved. 426926Smsmith * 526926Smsmith * Redistribution and use in source and binary forms, with or without 626926Smsmith * modification, are permitted provided that the following conditions 726926Smsmith * are met: 826926Smsmith * 1. Redistributions of source code must retain the above copyright 926926Smsmith * notice, this list of conditions and the following disclaimer 1026926Smsmith * in this position and unchanged. 1126926Smsmith * 2. Redistributions in binary form must reproduce the above copyright 1226926Smsmith * notice, this list of conditions and the following disclaimer in the 1326926Smsmith * documentation and/or other materials provided with the distribution. 1426926Smsmith * 3. The name of the author may not be used to endorse or promote products 1526926Smsmith * derived from this software without specific prior written permission 1626926Smsmith * 1726926Smsmith * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1826926Smsmith * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1926926Smsmith * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2084260Sobrien * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2184260Sobrien * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2226926Smsmith * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2326926Smsmith * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2426926Smsmith * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2526926Smsmith * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2626926Smsmith * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2726926Smsmith * 2826926Smsmith * $Id: syscons.h,v 1.22 1996/10/18 18:51:37 sos Exp $ 2986735Sru */ 3086735Sru 31148834Sstefanf#ifndef _I386_ISA_SYSCONS_H_ 32206622Suqs#define _I386_ISA_SYSCONS_H_ 3379531Sru 3426926Smsmith/* vm things */ 3526926Smsmith#define ISMAPPED(pa, width) \ 3626926Smsmith (((pa) <= (u_long)0x1000 - (width)) \ 3726926Smsmith || ((pa) >= 0xa0000 && (pa) <= 0x100000 - (width))) 3826926Smsmith#define pa_to_va(pa) (KERNBASE + (pa)) /* works if ISMAPPED(pa...) */ 3926926Smsmith 4026926Smsmith/* printable chars */ 4126926Smsmith#define PRINTABLE(ch) ((ch) > 0x1b || ((ch) > 0x0d && (ch) < 0x1b) \ 4226926Smsmith || (ch) < 0x07) 4326926Smsmith 4426926Smsmith/* macros for "intelligent" screen update */ 4526926Smsmith#define mark_for_update(scp, x) {\ 4684260Sobrien if ((x) < scp->start) scp->start = (x);\ 4784260Sobrien else if ((x) > scp->end) scp->end = (x);\ 4826926Smsmith } 4926926Smsmith#define mark_all(scp) {\ 5026926Smsmith scp->start = 0;\ 5126926Smsmith scp->end = scp->xsize * scp->ysize;\ 5226926Smsmith } 5326926Smsmith 5426926Smsmith/* status flags */ 5526926Smsmith#define LOCK_KEY_MASK 0x0000F 5626926Smsmith#define LED_MASK 0x00007 5779754Sdd#define UNKNOWN_MODE 0x00010 5826926Smsmith#define KBD_RAW_MODE 0x00020 5926926Smsmith#define SWITCH_WAIT_REL 0x00040 60148834Sstefanf#define SWITCH_WAIT_ACQ 0x00080 6126926Smsmith#define BUFFER_SAVED 0x00100 6226926Smsmith#define CURSOR_ENABLED 0x00200 6326926Smsmith#define MOUSE_ENABLED 0x00400 6426926Smsmith#define MOUSE_MOVED 0x00800 6526926Smsmith#define MOUSE_CUTTING 0x01000 6626926Smsmith#define MOUSE_VISIBLE 0x02000 6726926Smsmith 6826926Smsmith/* configuration flags */ 6926926Smsmith#define VISUAL_BELL 0x00001 7026926Smsmith#define BLINK_CURSOR 0x00002 7126926Smsmith#define CHAR_CURSOR 0x00004 7226926Smsmith#define DETECT_KBD 0x00008 7326926Smsmith 7426926Smsmith/* attribute flags */ 7584260Sobrien#define NORMAL_ATTR 0x00 7684260Sobrien#define BLINK_ATTR 0x01 7784260Sobrien#define BOLD_ATTR 0x02 7884260Sobrien#define UNDERLINE_ATTR 0x04 7984260Sobrien#define REVERSE_ATTR 0x08 8084260Sobrien#define FOREGROUND_CHANGED 0x10 8126926Smsmith#define BACKGROUND_CHANGED 0x20 8226926Smsmith 8326926Smsmith/* video hardware memory addresses */ 8426926Smsmith#define VIDEOMEM 0x000A0000 8526926Smsmith 8626926Smsmith/* misc defines */ 8726926Smsmith#define FALSE 0 8826926Smsmith#define TRUE 1 8926926Smsmith#define MAX_ESC_PAR 5 9026926Smsmith#define LOAD 1 9126926Smsmith#define SAVE 0 92237448Spfg#define COL 80 93237525Sjoel#define ROW 25 9426926Smsmith#define BELL_DURATION 5 9526926Smsmith#define BELL_PITCH 800 9626926Smsmith#define TIMER_FREQ 1193182 /* should be in isa.h */ 9726926Smsmith#define CONSOLE_BUFSIZE 1024 9826926Smsmith#define PCBURST 128 9926926Smsmith#define FONT_NONE 1 10026926Smsmith#define FONT_8 8 10126926Smsmith#define FONT_14 14 10226926Smsmith#define FONT_16 16 10326926Smsmith#define HISTORY_SIZE 100*80 10426926Smsmith 10526926Smsmith/* defines related to hardware addresses */ 10626926Smsmith#define MONO_BASE 0x3B4 /* crt controller base mono */ 10726926Smsmith#define COLOR_BASE 0x3D4 /* crt controller base color */ 10826926Smsmith#define MISC 0x3C2 /* misc output register */ 10926926Smsmith#define ATC IO_VGA+0x00 /* attribute controller */ 11026926Smsmith#define TSIDX IO_VGA+0x04 /* timing sequencer idx */ 11179754Sdd#define TSREG IO_VGA+0x05 /* timing sequencer data */ 11286735Sru#define PIXMASK IO_VGA+0x06 /* pixel write mask */ 11326926Smsmith#define PALRADR IO_VGA+0x07 /* palette read address */ 11426926Smsmith#define PALWADR IO_VGA+0x08 /* palette write address */ 11579754Sdd#define PALDATA IO_VGA+0x09 /* palette data register */ 11626926Smsmith#define GDCIDX IO_VGA+0x0E /* graph data controller idx */ 11726926Smsmith#define GDCREG IO_VGA+0x0F /* graph data controller data */ 11826926Smsmith 11926926Smsmith/* special characters */ 12026926Smsmith#define cntlc 0x03 12126926Smsmith#define cntld 0x04 12226926Smsmith#define bs 0x08 12326926Smsmith#define lf 0x0a 12426926Smsmith#define cr 0x0d 12526926Smsmith#define del 0x7f 12626926Smsmith 12726926Smsmith#define DEAD_CHAR 0x07 /* char used for cursor */ 12826926Smsmith 12926926Smsmithtypedef struct term_stat { 13026926Smsmith int esc; /* processing escape sequence */ 13126926Smsmith int num_param; /* # of parameters to ESC */ 13226926Smsmith int last_param; /* last parameter # */ 13326926Smsmith int param[MAX_ESC_PAR]; /* contains ESC parameters */ 13426926Smsmith int cur_attr; /* current hardware attr word */ 13526926Smsmith int attr_mask; /* current logical attr mask */ 13626926Smsmith int cur_color; /* current hardware color */ 13726926Smsmith int std_color; /* normal hardware color */ 13826926Smsmith int rev_color; /* reverse hardware color */ 13926926Smsmith} term_stat; 14026926Smsmith 14184260Sobrientypedef struct scr_stat { 14284260Sobrien u_short *scr_buf; /* buffer when off screen */ 14384260Sobrien int xpos; /* current X position */ 14484260Sobrien int ypos; /* current Y position */ 14584260Sobrien int xsize; /* X text size */ 14626926Smsmith int ysize; /* Y text size */ 14726926Smsmith int xpixel; /* X graphics size */ 14826926Smsmith int ypixel; /* Y graphics size */ 14926926Smsmith int font_size; /* fontsize in Y direction */ 15026926Smsmith int start; /* modified area start */ 15126926Smsmith int end; /* modified area end */ 15226926Smsmith term_stat term; /* terminal emulation stuff */ 15386735Sru int status; /* status (bitfield) */ 15486735Sru u_short *cursor_pos; /* cursor buffer position */ 15526926Smsmith u_short *cursor_oldpos; /* cursor old buffer position */ 15626926Smsmith u_short cursor_saveunder; /* saved chars under cursor */ 15726926Smsmith char cursor_start; /* cursor start line # */ 15826926Smsmith char cursor_end; /* cursor end line # */ 15926926Smsmith u_short *mouse_pos; /* mouse buffer position */ 16026926Smsmith u_short *mouse_oldpos; /* mouse old buffer position */ 16126926Smsmith short mouse_xpos; /* mouse x coordinate */ 16226926Smsmith short mouse_ypos; /* mouse y coordinate */ 16326926Smsmith short mouse_buttons; /* mouse buttons */ 16426926Smsmith u_char mouse_cursor[128]; /* mouse cursor bitmap store */ 16526926Smsmith u_short *mouse_cut_start; /* mouse cut start pos */ 16626926Smsmith u_short *mouse_cut_end; /* mouse cut end pos */ 16726926Smsmith struct proc *mouse_proc; /* proc* of controlling proc */ 16826926Smsmith pid_t mouse_pid; /* pid of controlling proc */ 16926926Smsmith int mouse_signal; /* signal # to report with */ 17026926Smsmith u_short bell_duration; 17126926Smsmith u_short bell_pitch; 17226926Smsmith u_char border; /* border color */ 17326926Smsmith u_char mode; /* mode */ 17426926Smsmith pid_t pid; /* pid of controlling proc */ 17526926Smsmith struct proc *proc; /* proc* of controlling proc */ 17626926Smsmith struct vt_mode smode; /* switch mode */ 17726926Smsmith u_short *history; /* circular history buffer */ 17826926Smsmith u_short *history_head; /* current head position */ 17926926Smsmith u_short *history_pos; /* position shown on screen */ 18026926Smsmith u_short *history_save; /* save area index */ 18126926Smsmith int history_size; /* size of history buffer */ 18226926Smsmith struct apmhook r_hook; /* reconfiguration support */ 18326926Smsmith} scr_stat; 18426926Smsmith 18526926Smsmithtypedef struct default_attr { 18626926Smsmith int std_color; /* normal hardware color */ 187237448Spfg int rev_color; /* reverse hardware color */ 18826926Smsmith} default_attr; 18926926Smsmith 19026926Smsmith/* misc prototypes used by different syscons related LKM's */ 19126926Smsmithvoid set_border(u_char color); 19226926Smsmithvoid set_mode(scr_stat *scp); 19326926Smsmithvoid copy_font(int operation, int font_type, char* font_image); 19426926Smsmithvoid load_palette(void); 19526926Smsmith 19626926Smsmith#endif /* !_I386_ISA_SYSCONS_H_ */ 19726926Smsmith