Blame view

include/linux/console_struct.h 6.77 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
  /*
   * console_struct.h
   *
   * Data structure describing single virtual console except for data
   * used by vt.c.
   *
   * Fields marked with [#] must be set by the low-level driver.
   * Fields marked with [!] can be changed by the low-level driver
   * to achieve effects such as fast scrolling by changing the origin.
   */
217397d7d   Robert P. J. Day   Protect <linux/co...
11
12
  #ifndef _LINUX_CONSOLE_STRUCT_H
  #define _LINUX_CONSOLE_STRUCT_H
a8f340e39   Jon Smirl   [PATCH] vt: Remov...
13
  #include <linux/wait.h>
e07dea987   Antonino A. Daplas   [PATCH] console: ...
14
  #include <linux/vt.h>
8b6312f4d   Eric W. Biederman   [PATCH] vt: refac...
15
  #include <linux/workqueue.h>
e07dea987   Antonino A. Daplas   [PATCH] console: ...
16

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
17
  struct vt_struct;
e4bdab70d   Takashi Iwai   console: Use expl...
18
  struct uni_pagedir;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
19
20
  
  #define NPAR 16
a4bedd019   Jiri Slaby   vt: document vc_d...
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
  /*
   * Example: vc_data of a console that was scrolled 3 lines down.
   *
   *                              Console buffer
   * vc_screenbuf ---------> +----------------------+-.
   *                         | initializing W       |  \
   *                         | initializing X       |   |
   *                         | initializing Y       |    > scroll-back area
   *                         | initializing Z       |   |
   *                         |                      |  /
   * vc_visible_origin ---> ^+----------------------+-:
   * (changes by scroll)    || Welcome to linux     |  \
   *                        ||                      |   |
   *           vc_rows --->< | login: root          |   |  visible on console
   *                        || password:            |    > (vc_screenbuf_size is
   * vc_origin -----------> ||                      |   |   vc_size_row * vc_rows)
   * (start when no scroll) || Last login: 12:28    |  /
   *                        v+----------------------+-:
   *                         | Have a lot of fun... |  \
   * vc_pos -----------------|--------v             |   > scroll-front area
   *                         | ~ # cat_             |  /
   * vc_scr_end -----------> +----------------------+-:
   * (vc_origin +            |                      |  \ EMPTY, to be filled by
   *  vc_screenbuf_size)     |                      |  / vc_video_erase_char
   *                         +----------------------+-'
   *                         <---- 2 * vc_cols ----->
   *                         <---- vc_size_row ----->
   *
   * Note that every character in the console buffer is accompanied with an
   * attribute in the buffer right after the character. This is not depicted
   * in the figure.
   */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
53
  struct vc_data {
ff917ba4f   Alan Cox   tty: Make vt's ha...
54
  	struct tty_port port;			/* Upper level data */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
  	unsigned short	vc_num;			/* Console number */
  	unsigned int	vc_cols;		/* [#] Console size */
  	unsigned int	vc_rows;
  	unsigned int	vc_size_row;		/* Bytes per row */
  	unsigned int	vc_scan_lines;		/* # of scan lines */
  	unsigned long	vc_origin;		/* [!] Start of real screen */
  	unsigned long	vc_scr_end;		/* [!] End of real screen */
  	unsigned long	vc_visible_origin;	/* [!] Top of visible window */
  	unsigned int	vc_top, vc_bottom;	/* Scrolling region */
  	const struct consw *vc_sw;
  	unsigned short	*vc_screenbuf;		/* In-memory character/attribute buffer */
  	unsigned int	vc_screenbuf_size;
  	unsigned char	vc_mode;		/* KD_TEXT, ... */
  	/* attributes for all characters on screen */
  	unsigned char	vc_attr;		/* Current attributes */
  	unsigned char	vc_def_color;		/* Default colors */
  	unsigned char	vc_color;		/* Foreground & background */
  	unsigned char	vc_s_color;		/* Saved foreground & background */
  	unsigned char	vc_ulcolor;		/* Color for underline mode */
fa6ce9ab5   Jan Engelhardt   vt: add color sup...
74
  	unsigned char   vc_itcolor;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
  	unsigned char	vc_halfcolor;		/* Color for half intensity mode */
  	/* cursor */
  	unsigned int	vc_cursor_type;
  	unsigned short	vc_complement_mask;	/* [#] Xor mask for mouse pointer */
  	unsigned short	vc_s_complement_mask;	/* Saved mouse pointer mask */
  	unsigned int	vc_x, vc_y;		/* Cursor position */
  	unsigned int	vc_saved_x, vc_saved_y;
  	unsigned long	vc_pos;			/* Cursor address */
  	/* fonts */	
  	unsigned short	vc_hi_font_mask;	/* [#] Attribute set for upper 256 chars of font or 0 if not supported */
  	struct console_font vc_font;		/* Current VC font set */
  	unsigned short	vc_video_erase_char;	/* Background erase character */
  	/* VT terminal data */
  	unsigned int	vc_state;		/* Escape sequence parser state */
  	unsigned int	vc_npar,vc_par[NPAR];	/* Parameters of current escape sequence */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
90
91
  	/* data for manual vt switching */
  	struct vt_mode	vt_mode;
bde0d2c98   Eric W. Biederman   [PATCH] vt: Make ...
92
  	struct pid 	*vt_pid;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
93
94
95
96
97
98
99
100
101
102
103
104
  	int		vt_newvt;
  	wait_queue_head_t paste_wait;
  	/* mode flags */
  	unsigned int	vc_charset	: 1;	/* Character set G0 / G1 */
  	unsigned int	vc_s_charset	: 1;	/* Saved character set */
  	unsigned int	vc_disp_ctrl	: 1;	/* Display chars < 32? */
  	unsigned int	vc_toggle_meta	: 1;	/* Toggle high bit? */
  	unsigned int	vc_decscnm	: 1;	/* Screen Mode */
  	unsigned int	vc_decom	: 1;	/* Origin Mode */
  	unsigned int	vc_decawm	: 1;	/* Autowrap Mode */
  	unsigned int	vc_deccm	: 1;	/* Cursor Visible */
  	unsigned int	vc_decim	: 1;	/* Insert Mode */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
105
106
  	/* attribute flags */
  	unsigned int	vc_intensity	: 2;	/* 0=half-bright, 1=normal, 2=bold */
fa6ce9ab5   Jan Engelhardt   vt: add color sup...
107
  	unsigned int    vc_italic:1;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
108
109
110
111
  	unsigned int	vc_underline	: 1;
  	unsigned int	vc_blink	: 1;
  	unsigned int	vc_reverse	: 1;
  	unsigned int	vc_s_intensity	: 2;	/* saved rendition */
fa6ce9ab5   Jan Engelhardt   vt: add color sup...
112
  	unsigned int    vc_s_italic:1;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
113
114
115
116
117
118
119
120
  	unsigned int	vc_s_underline	: 1;
  	unsigned int	vc_s_blink	: 1;
  	unsigned int	vc_s_reverse	: 1;
  	/* misc */
  	unsigned int	vc_ques		: 1;
  	unsigned int	vc_need_wrap	: 1;
  	unsigned int	vc_can_do_color	: 1;
  	unsigned int	vc_report_mouse : 2;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
121
122
123
124
125
126
127
128
129
130
  	unsigned char	vc_utf		: 1;	/* Unicode UTF-8 encoding */
  	unsigned char	vc_utf_count;
  		 int	vc_utf_char;
  	unsigned int	vc_tab_stop[8];		/* Tab stops. 256 columns. */
  	unsigned char   vc_palette[16*3];       /* Colour palette for VGA+ */
  	unsigned short * vc_translate;
  	unsigned char 	vc_G0_charset;
  	unsigned char 	vc_G1_charset;
  	unsigned char 	vc_saved_G0;
  	unsigned char 	vc_saved_G1;
e400b6ec4   Antonino A. Daplas   vt/vgacon: Check ...
131
  	unsigned int    vc_resize_user;         /* resize request from user */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
132
133
  	unsigned int	vc_bell_pitch;		/* Console bell pitch */
  	unsigned int	vc_bell_duration;	/* Console bell duration */
bd63364ca   Scot Doyle   vt: add cursor bl...
134
  	unsigned short	vc_cur_blink_ms;	/* Cursor blink duration */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
135
  	struct vc_data **vc_display_fg;		/* [!] Ptr to var holding fg console for this display */
e4bdab70d   Takashi Iwai   console: Use expl...
136
137
  	struct uni_pagedir *vc_uni_pagedir;
  	struct uni_pagedir **vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
8fd4bd223   Jesse Barnes   vt/console: try h...
138
  	bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
139
140
141
142
143
  	/* additional information is in vt_kern.h */
  };
  
  struct vc {
  	struct vc_data *d;
8b6312f4d   Eric W. Biederman   [PATCH] vt: refac...
144
  	struct work_struct SAK_work;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
145
146
147
148
149
150
151
  
  	/* might add  scrmem, vt_struct, kbd  at some time,
  	   to have everything in one place - the disadvantage
  	   would be that vc_cons etc can no longer be static */
  };
  
  extern struct vc vc_cons [MAX_NR_CONSOLES];
8b6312f4d   Eric W. Biederman   [PATCH] vt: refac...
152
  extern void vc_SAK(struct work_struct *work);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
153
154
155
156
157
158
159
160
161
162
163
164
  
  #define CUR_DEF		0
  #define CUR_NONE	1
  #define CUR_UNDERLINE	2
  #define CUR_LOWER_THIRD	3
  #define CUR_LOWER_HALF	4
  #define CUR_TWO_THIRDS	5
  #define CUR_BLOCK	6
  #define CUR_HWMASK	0x0f
  #define CUR_SWMASK	0xfff0
  
  #define CUR_DEFAULT CUR_UNDERLINE
6ca8dfd78   Jiri Slaby   tty: vt, convert ...
165
166
167
168
  static inline bool con_is_visible(const struct vc_data *vc)
  {
  	return *vc->vc_display_fg == vc;
  }
217397d7d   Robert P. J. Day   Protect <linux/co...
169
170
  
  #endif /* _LINUX_CONSOLE_STRUCT_H */