Home | History | Annotate | Download | only in linux
      1 /*
      2  * console_struct.h
      3  *
      4  * Data structure describing single virtual console except for data
      5  * used by vt.c.
      6  *
      7  * Fields marked with [#] must be set by the low-level driver.
      8  * Fields marked with [!] can be changed by the low-level driver
      9  * to achieve effects such as fast scrolling by changing the origin.
     10  */
     11 
     12 #include <linux/wait.h>
     13 #include <linux/vt.h>
     14 
     15 struct vt_struct;
     16 
     17 #define NPAR 16
     18 
     19 struct vc_data {
     20 	unsigned short	vc_num;			/* Console number */
     21 	unsigned int	vc_cols;		/* [#] Console size */
     22 	unsigned int	vc_rows;
     23 	unsigned int	vc_size_row;		/* Bytes per row */
     24 	unsigned int	vc_scan_lines;		/* # of scan lines */
     25 	unsigned long	vc_origin;		/* [!] Start of real screen */
     26 	unsigned long	vc_scr_end;		/* [!] End of real screen */
     27 	unsigned long	vc_visible_origin;	/* [!] Top of visible window */
     28 	unsigned int	vc_top, vc_bottom;	/* Scrolling region */
     29 	const struct consw *vc_sw;
     30 	unsigned short	*vc_screenbuf;		/* In-memory character/attribute buffer */
     31 	unsigned int	vc_screenbuf_size;
     32 	unsigned char	vc_mode;		/* KD_TEXT, ... */
     33 	/* attributes for all characters on screen */
     34 	unsigned char	vc_attr;		/* Current attributes */
     35 	unsigned char	vc_def_color;		/* Default colors */
     36 	unsigned char	vc_color;		/* Foreground & background */
     37 	unsigned char	vc_s_color;		/* Saved foreground & background */
     38 	unsigned char	vc_ulcolor;		/* Color for underline mode */
     39 	unsigned char	vc_halfcolor;		/* Color for half intensity mode */
     40 	/* cursor */
     41 	unsigned int	vc_cursor_type;
     42 	unsigned short	vc_complement_mask;	/* [#] Xor mask for mouse pointer */
     43 	unsigned short	vc_s_complement_mask;	/* Saved mouse pointer mask */
     44 	unsigned int	vc_x, vc_y;		/* Cursor position */
     45 	unsigned int	vc_saved_x, vc_saved_y;
     46 	unsigned long	vc_pos;			/* Cursor address */
     47 	/* fonts */
     48 	unsigned short	vc_hi_font_mask;	/* [#] Attribute set for upper 256 chars of font or 0 if not supported */
     49 	struct console_font vc_font;		/* Current VC font set */
     50 	unsigned short	vc_video_erase_char;	/* Background erase character */
     51 	/* VT terminal data */
     52 	unsigned int	vc_state;		/* Escape sequence parser state */
     53 	unsigned int	vc_npar,vc_par[NPAR];	/* Parameters of current escape sequence */
     54 	struct tty_struct *vc_tty;		/* TTY we are attached to */
     55 	/* data for manual vt switching */
     56 	struct vt_mode	vt_mode;
     57 	int		vt_pid;
     58 	int		vt_newvt;
     59 	wait_queue_head_t paste_wait;
     60 	/* mode flags */
     61 	unsigned int	vc_charset	: 1;	/* Character set G0 / G1 */
     62 	unsigned int	vc_s_charset	: 1;	/* Saved character set */
     63 	unsigned int	vc_disp_ctrl	: 1;	/* Display chars < 32? */
     64 	unsigned int	vc_toggle_meta	: 1;	/* Toggle high bit? */
     65 	unsigned int	vc_decscnm	: 1;	/* Screen Mode */
     66 	unsigned int	vc_decom	: 1;	/* Origin Mode */
     67 	unsigned int	vc_decawm	: 1;	/* Autowrap Mode */
     68 	unsigned int	vc_deccm	: 1;	/* Cursor Visible */
     69 	unsigned int	vc_decim	: 1;	/* Insert Mode */
     70 	unsigned int	vc_deccolm	: 1;	/* 80/132 Column Mode */
     71 	/* attribute flags */
     72 	unsigned int	vc_intensity	: 2;	/* 0=half-bright, 1=normal, 2=bold */
     73 	unsigned int	vc_underline	: 1;
     74 	unsigned int	vc_blink	: 1;
     75 	unsigned int	vc_reverse	: 1;
     76 	unsigned int	vc_s_intensity	: 2;	/* saved rendition */
     77 	unsigned int	vc_s_underline	: 1;
     78 	unsigned int	vc_s_blink	: 1;
     79 	unsigned int	vc_s_reverse	: 1;
     80 	/* misc */
     81 	unsigned int	vc_ques		: 1;
     82 	unsigned int	vc_need_wrap	: 1;
     83 	unsigned int	vc_can_do_color	: 1;
     84 	unsigned int	vc_report_mouse : 2;
     85 	unsigned int	vc_kmalloced	: 1;
     86 	unsigned char	vc_utf		: 1;	/* Unicode UTF-8 encoding */
     87 	unsigned char	vc_utf_count;
     88 		 int	vc_utf_char;
     89 	unsigned int	vc_tab_stop[8];		/* Tab stops. 256 columns. */
     90 	unsigned char   vc_palette[16*3];       /* Colour palette for VGA+ */
     91 	unsigned short * vc_translate;
     92 	unsigned char 	vc_G0_charset;
     93 	unsigned char 	vc_G1_charset;
     94 	unsigned char 	vc_saved_G0;
     95 	unsigned char 	vc_saved_G1;
     96 	unsigned int	vc_bell_pitch;		/* Console bell pitch */
     97 	unsigned int	vc_bell_duration;	/* Console bell duration */
     98 	struct vc_data **vc_display_fg;		/* [!] Ptr to var holding fg console for this display */
     99 	unsigned long	vc_uni_pagedir;
    100 	unsigned long	*vc_uni_pagedir_loc;  /* [!] Location of uni_pagedir variable for this console */
    101 	/* additional information is in vt_kern.h */
    102 };
    103 
    104 struct vc {
    105 	struct vc_data *d;
    106 
    107 	/* might add  scrmem, vt_struct, kbd  at some time,
    108 	   to have everything in one place - the disadvantage
    109 	   would be that vc_cons etc can no longer be static */
    110 };
    111 
    112 extern struct vc vc_cons [MAX_NR_CONSOLES];
    113 
    114 #define CUR_DEF		0
    115 #define CUR_NONE	1
    116 #define CUR_UNDERLINE	2
    117 #define CUR_LOWER_THIRD	3
    118 #define CUR_LOWER_HALF	4
    119 #define CUR_TWO_THIRDS	5
    120 #define CUR_BLOCK	6
    121 #define CUR_HWMASK	0x0f
    122 #define CUR_SWMASK	0xfff0
    123 
    124 #define CUR_DEFAULT CUR_UNDERLINE
    125 
    126 #define CON_IS_VISIBLE(conp) (*conp->vc_display_fg == conp)
    127