syscons.h revision 21673
1100894Srwatson/*- 2100894Srwatson * Copyright (c) 1995-1996 S�ren Schmidt 3100894Srwatson * All rights reserved. 4100894Srwatson * 5100894Srwatson * Redistribution and use in source and binary forms, with or without 6100894Srwatson * modification, are permitted provided that the following conditions 7100894Srwatson * are met: 8100894Srwatson * 1. Redistributions of source code must retain the above copyright 9100894Srwatson * notice, this list of conditions and the following disclaimer 10100894Srwatson * in this position and unchanged. 11100894Srwatson * 2. Redistributions in binary form must reproduce the above copyright 12100894Srwatson * notice, this list of conditions and the following disclaimer in the 13100894Srwatson * documentation and/or other materials provided with the distribution. 14100894Srwatson * 3. The name of the author may not be used to endorse or promote products 15100894Srwatson * derived from this software without specific prior written permission 16100894Srwatson * 17100894Srwatson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18100894Srwatson * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19100894Srwatson * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20100894Srwatson * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21100894Srwatson * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22100894Srwatson * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23100894Srwatson * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24100894Srwatson * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25100894Srwatson * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26100894Srwatson * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27100894Srwatson * 28100894Srwatson * $FreeBSD: head/sys/dev/syscons/syscons.h 21673 1997-01-14 07:20:47Z jkh $ 29100894Srwatson */ 30100894Srwatson 31100894Srwatson#ifndef _I386_ISA_SYSCONS_H_ 32100894Srwatson#define _I386_ISA_SYSCONS_H_ 33100894Srwatson 34100894Srwatson/* vm things */ 35100894Srwatson#define ISMAPPED(pa, width) \ 36100894Srwatson (((pa) <= (u_long)0x1000 - (width)) \ 37100894Srwatson || ((pa) >= 0xa0000 && (pa) <= 0x100000 - (width))) 38100894Srwatson#define pa_to_va(pa) (KERNBASE + (pa)) /* works if ISMAPPED(pa...) */ 39100894Srwatson 40100894Srwatson/* printable chars */ 41100894Srwatson#define PRINTABLE(ch) ((ch) > 0x1b || ((ch) > 0x0d && (ch) < 0x1b) \ 42100894Srwatson || (ch) < 0x07) 43100894Srwatson 44100894Srwatson/* macros for "intelligent" screen update */ 45100894Srwatson#define mark_for_update(scp, x) {\ 46100894Srwatson if ((x) < scp->start) scp->start = (x);\ 47100894Srwatson else if ((x) > scp->end) scp->end = (x);\ 48100894Srwatson } 49101173Srwatson#define mark_all(scp) {\ 50100894Srwatson scp->start = 0;\ 51100979Srwatson scp->end = scp->xsize * scp->ysize;\ 52100979Srwatson } 53100979Srwatson 54100979Srwatson/* status flags */ 55100979Srwatson#define LOCK_KEY_MASK 0x0000F 56100979Srwatson#define LED_MASK 0x00007 57101712Srwatson#define UNKNOWN_MODE 0x00010 58100979Srwatson#define KBD_RAW_MODE 0x00020 59100979Srwatson#define SWITCH_WAIT_REL 0x00040 60100894Srwatson#define SWITCH_WAIT_ACQ 0x00080 61100894Srwatson#define BUFFER_SAVED 0x00100 62100979Srwatson#define CURSOR_ENABLED 0x00200 63100979Srwatson#define MOUSE_ENABLED 0x00400 64100979Srwatson#define MOUSE_MOVED 0x00800 65100979Srwatson#define MOUSE_CUTTING 0x01000 66100979Srwatson#define MOUSE_VISIBLE 0x02000 67100979Srwatson 68100979Srwatson/* configuration flags */ 69100979Srwatson#define VISUAL_BELL 0x00001 70100979Srwatson#define BLINK_CURSOR 0x00002 71100894Srwatson#define CHAR_CURSOR 0x00004 72100979Srwatson#define DETECT_KBD 0x00008 73100979Srwatson#define XT_KEYBD 0x00010 74100979Srwatson 75100979Srwatson/* attribute flags */ 76100979Srwatson#define NORMAL_ATTR 0x00 77100979Srwatson#define BLINK_ATTR 0x01 78100979Srwatson#define BOLD_ATTR 0x02 79100979Srwatson#define UNDERLINE_ATTR 0x04 80100979Srwatson#define REVERSE_ATTR 0x08 81100979Srwatson#define FOREGROUND_CHANGED 0x10 82100979Srwatson#define BACKGROUND_CHANGED 0x20 83100979Srwatson 84100979Srwatson/* video hardware memory addresses */ 85100979Srwatson#define VIDEOMEM 0x000A0000 86100979Srwatson 87100979Srwatson/* misc defines */ 88100979Srwatson#define FALSE 0 89100979Srwatson#define TRUE 1 90100979Srwatson#define MAX_ESC_PAR 5 91101712Srwatson#define LOAD 1 92101712Srwatson#define SAVE 0 93101712Srwatson#define COL 80 94101712Srwatson#define ROW 25 95101712Srwatson#define BELL_DURATION 5 96101712Srwatson#define BELL_PITCH 800 97101712Srwatson#define TIMER_FREQ 1193182 /* should be in isa.h */ 98100979Srwatson#define CONSOLE_BUFSIZE 1024 99100979Srwatson#define PCBURST 128 100100979Srwatson#define FONT_NONE 1 101100979Srwatson#define FONT_8 8 102100979Srwatson#define FONT_14 14 103100979Srwatson#define FONT_16 16 104100979Srwatson#define HISTORY_SIZE 100*80 105100979Srwatson 106100979Srwatson/* defines related to hardware addresses */ 107100979Srwatson#define MONO_BASE 0x3B4 /* crt controller base mono */ 108100979Srwatson#define COLOR_BASE 0x3D4 /* crt controller base color */ 109100979Srwatson#define MISC 0x3C2 /* misc output register */ 110100979Srwatson#define ATC IO_VGA+0x00 /* attribute controller */ 111100979Srwatson#define TSIDX IO_VGA+0x04 /* timing sequencer idx */ 112100979Srwatson#define TSREG IO_VGA+0x05 /* timing sequencer data */ 113100979Srwatson#define PIXMASK IO_VGA+0x06 /* pixel write mask */ 114100979Srwatson#define PALRADR IO_VGA+0x07 /* palette read address */ 115100979Srwatson#define PALWADR IO_VGA+0x08 /* palette write address */ 116100979Srwatson#define PALDATA IO_VGA+0x09 /* palette data register */ 117100979Srwatson#define GDCIDX IO_VGA+0x0E /* graph data controller idx */ 118100979Srwatson#define GDCREG IO_VGA+0x0F /* graph data controller data */ 119100979Srwatson 120100979Srwatson/* special characters */ 121100979Srwatson#define cntlc 0x03 122100979Srwatson#define cntld 0x04 123100979Srwatson#define bs 0x08 124100979Srwatson#define lf 0x0a 125100979Srwatson#define cr 0x0d 126100979Srwatson#define del 0x7f 127100979Srwatson 128100979Srwatson#define DEAD_CHAR 0x07 /* char used for cursor */ 129100979Srwatson 130100979Srwatsontypedef struct term_stat { 131100979Srwatson int esc; /* processing escape sequence */ 132100979Srwatson int num_param; /* # of parameters to ESC */ 133100979Srwatson int last_param; /* last parameter # */ 134100979Srwatson int param[MAX_ESC_PAR]; /* contains ESC parameters */ 135100979Srwatson int cur_attr; /* current hardware attr word */ 136100979Srwatson int attr_mask; /* current logical attr mask */ 137100979Srwatson int cur_color; /* current hardware color */ 138100979Srwatson int std_color; /* normal hardware color */ 139100979Srwatson int rev_color; /* reverse hardware color */ 140100979Srwatson} term_stat; 141100979Srwatson 142100979Srwatsontypedef struct scr_stat { 143100979Srwatson u_short *scr_buf; /* buffer when off screen */ 144100979Srwatson int xpos; /* current X position */ 145100979Srwatson int ypos; /* current Y position */ 146100979Srwatson int xsize; /* X text size */ 147100979Srwatson int ysize; /* Y text size */ 148100979Srwatson int xpixel; /* X graphics size */ 149100979Srwatson int ypixel; /* Y graphics size */ 150100979Srwatson int font_size; /* fontsize in Y direction */ 151100979Srwatson int start; /* modified area start */ 152100979Srwatson int end; /* modified area end */ 153100979Srwatson term_stat term; /* terminal emulation stuff */ 154100979Srwatson int status; /* status (bitfield) */ 155100979Srwatson u_short *cursor_pos; /* cursor buffer position */ 156100979Srwatson u_short *cursor_oldpos; /* cursor old buffer position */ 157100979Srwatson u_short cursor_saveunder; /* saved chars under cursor */ 158100979Srwatson char cursor_start; /* cursor start line # */ 159100979Srwatson char cursor_end; /* cursor end line # */ 160100979Srwatson u_short *mouse_pos; /* mouse buffer position */ 161100979Srwatson u_short *mouse_oldpos; /* mouse old buffer position */ 162100979Srwatson short mouse_xpos; /* mouse x coordinate */ 163100979Srwatson short mouse_ypos; /* mouse y coordinate */ 164100979Srwatson short mouse_buttons; /* mouse buttons */ 165101892Srwatson u_char mouse_cursor[128]; /* mouse cursor bitmap store */ 166100979Srwatson u_short *mouse_cut_start; /* mouse cut start pos */ 167100979Srwatson u_short *mouse_cut_end; /* mouse cut end pos */ 168100979Srwatson struct proc *mouse_proc; /* proc* of controlling proc */ 169100979Srwatson pid_t mouse_pid; /* pid of controlling proc */ 170101988Srwatson int mouse_signal; /* signal # to report with */ 171100979Srwatson u_short bell_duration; 172100979Srwatson u_short bell_pitch; 173100979Srwatson u_char border; /* border color */ 174100979Srwatson u_char mode; /* mode */ 175100979Srwatson pid_t pid; /* pid of controlling proc */ 176100979Srwatson struct proc *proc; /* proc* of controlling proc */ 177100979Srwatson struct vt_mode smode; /* switch mode */ 178100979Srwatson u_short *history; /* circular history buffer */ 179100979Srwatson u_short *history_head; /* current head position */ 180100979Srwatson u_short *history_pos; /* position shown on screen */ 181100979Srwatson u_short *history_save; /* save area index */ 182100979Srwatson int history_size; /* size of history buffer */ 183100979Srwatson struct apmhook r_hook; /* reconfiguration support */ 184100979Srwatson} scr_stat; 185100979Srwatson 186100979Srwatsontypedef struct default_attr { 187100979Srwatson int std_color; /* normal hardware color */ 188100979Srwatson int rev_color; /* reverse hardware color */ 189100979Srwatson} default_attr; 190100979Srwatson 191100979Srwatson/* misc prototypes used by different syscons related LKM's */ 192100979Srwatsonvoid set_border(u_char color); 193100979Srwatsonvoid set_mode(scr_stat *scp); 194100979Srwatsonvoid copy_font(int operation, int font_type, char* font_image); 195100979Srwatsonvoid load_palette(void); 196101988Srwatson 197100979Srwatson#endif /* !_I386_ISA_SYSCONS_H_ */ 198100979Srwatson