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