Linux Audio

Check our new training course

Loading...
v5.9
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/*
  3 * console_struct.h
  4 *
  5 * Data structure describing single virtual console except for data
  6 * used by vt.c.
  7 *
  8 * Fields marked with [#] must be set by the low-level driver.
  9 * Fields marked with [!] can be changed by the low-level driver
 10 * to achieve effects such as fast scrolling by changing the origin.
 11 */
 12
 13#ifndef _LINUX_CONSOLE_STRUCT_H
 14#define _LINUX_CONSOLE_STRUCT_H
 15
 16#include <linux/wait.h>
 17#include <linux/vt.h>
 18#include <linux/workqueue.h>
 19
 20struct uni_pagedir;
 21struct uni_screen;
 22
 23#define NPAR 16
 24#define VC_TABSTOPS_COUNT	256U
 25
 26enum vc_intensity {
 27	VCI_HALF_BRIGHT,
 28	VCI_NORMAL,
 29	VCI_BOLD,
 30	VCI_MASK = 0x3,
 31};
 32
 33/**
 34 * struct vc_state -- state of a VC
 35 * @x: cursor's x-position
 36 * @y: cursor's y-position
 37 * @color: foreground & background colors
 38 * @Gx_charset: what's G0/G1 slot set to (like GRAF_MAP, LAT1_MAP)
 39 * @charset: what character set to use (0=G0 or 1=G1)
 40 * @intensity: see enum vc_intensity for values
 41 * @reverse: reversed foreground/background colors
 42 *
 43 * These members are defined separately from struct vc_data as we save &
 44 * restore them at times.
 45 */
 46struct vc_state {
 47	unsigned int	x, y;
 48
 49	unsigned char	color;
 50
 51	unsigned char	Gx_charset[2];
 52	unsigned int	charset		: 1;
 53
 54	/* attribute flags */
 55	enum vc_intensity intensity;
 56	bool		italic;
 57	bool		underline;
 58	bool		blink;
 59	bool		reverse;
 60};
 61
 62/*
 63 * Example: vc_data of a console that was scrolled 3 lines down.
 64 *
 65 *                              Console buffer
 66 * vc_screenbuf ---------> +----------------------+-.
 67 *                         | initializing W       |  \
 68 *                         | initializing X       |   |
 69 *                         | initializing Y       |    > scroll-back area
 70 *                         | initializing Z       |   |
 71 *                         |                      |  /
 72 * vc_visible_origin ---> ^+----------------------+-:
 73 * (changes by scroll)    || Welcome to linux     |  \
 74 *                        ||                      |   |
 75 *           vc_rows --->< | login: root          |   |  visible on console
 76 *                        || password:            |    > (vc_screenbuf_size is
 77 * vc_origin -----------> ||                      |   |   vc_size_row * vc_rows)
 78 * (start when no scroll) || Last login: 12:28    |  /
 79 *                        v+----------------------+-:
 80 *                         | Have a lot of fun... |  \
 81 * vc_pos -----------------|--------v             |   > scroll-front area
 82 *                         | ~ # cat_             |  /
 83 * vc_scr_end -----------> +----------------------+-:
 84 * (vc_origin +            |                      |  \ EMPTY, to be filled by
 85 *  vc_screenbuf_size)     |                      |  / vc_video_erase_char
 86 *                         +----------------------+-'
 87 *                         <---- 2 * vc_cols ----->
 88 *                         <---- vc_size_row ----->
 89 *
 90 * Note that every character in the console buffer is accompanied with an
 91 * attribute in the buffer right after the character. This is not depicted
 92 * in the figure.
 93 */
 94struct vc_data {
 95	struct tty_port port;			/* Upper level data */
 96
 97	struct vc_state state, saved_state;
 98
 99	unsigned short	vc_num;			/* Console number */
100	unsigned int	vc_cols;		/* [#] Console size */
101	unsigned int	vc_rows;
102	unsigned int	vc_size_row;		/* Bytes per row */
103	unsigned int	vc_scan_lines;		/* # of scan lines */
104	unsigned long	vc_origin;		/* [!] Start of real screen */
105	unsigned long	vc_scr_end;		/* [!] End of real screen */
106	unsigned long	vc_visible_origin;	/* [!] Top of visible window */
107	unsigned int	vc_top, vc_bottom;	/* Scrolling region */
108	const struct consw *vc_sw;
109	unsigned short	*vc_screenbuf;		/* In-memory character/attribute buffer */
110	unsigned int	vc_screenbuf_size;
111	unsigned char	vc_mode;		/* KD_TEXT, ... */
112	/* attributes for all characters on screen */
113	unsigned char	vc_attr;		/* Current attributes */
114	unsigned char	vc_def_color;		/* Default colors */
 
 
115	unsigned char	vc_ulcolor;		/* Color for underline mode */
116	unsigned char   vc_itcolor;
117	unsigned char	vc_halfcolor;		/* Color for half intensity mode */
118	/* cursor */
119	unsigned int	vc_cursor_type;
120	unsigned short	vc_complement_mask;	/* [#] Xor mask for mouse pointer */
121	unsigned short	vc_s_complement_mask;	/* Saved mouse pointer mask */
 
 
122	unsigned long	vc_pos;			/* Cursor address */
123	/* fonts */	
124	unsigned short	vc_hi_font_mask;	/* [#] Attribute set for upper 256 chars of font or 0 if not supported */
125	struct console_font vc_font;		/* Current VC font set */
126	unsigned short	vc_video_erase_char;	/* Background erase character */
127	/* VT terminal data */
128	unsigned int	vc_state;		/* Escape sequence parser state */
129	unsigned int	vc_npar,vc_par[NPAR];	/* Parameters of current escape sequence */
130	/* data for manual vt switching */
131	struct vt_mode	vt_mode;
132	struct pid 	*vt_pid;
133	int		vt_newvt;
134	wait_queue_head_t paste_wait;
135	/* mode flags */
 
 
136	unsigned int	vc_disp_ctrl	: 1;	/* Display chars < 32? */
137	unsigned int	vc_toggle_meta	: 1;	/* Toggle high bit? */
138	unsigned int	vc_decscnm	: 1;	/* Screen Mode */
139	unsigned int	vc_decom	: 1;	/* Origin Mode */
140	unsigned int	vc_decawm	: 1;	/* Autowrap Mode */
141	unsigned int	vc_deccm	: 1;	/* Cursor Visible */
142	unsigned int	vc_decim	: 1;	/* Insert Mode */
 
 
 
 
 
 
 
 
 
 
 
 
143	/* misc */
144	unsigned int	vc_priv		: 3;
145	unsigned int	vc_need_wrap	: 1;
146	unsigned int	vc_can_do_color	: 1;
147	unsigned int	vc_report_mouse : 2;
148	unsigned char	vc_utf		: 1;	/* Unicode UTF-8 encoding */
149	unsigned char	vc_utf_count;
150		 int	vc_utf_char;
151	DECLARE_BITMAP(vc_tab_stop, VC_TABSTOPS_COUNT);	/* Tab stops. 256 columns. */
152	unsigned char   vc_palette[16*3];       /* Colour palette for VGA+ */
153	unsigned short * vc_translate;
 
 
 
 
154	unsigned int    vc_resize_user;         /* resize request from user */
155	unsigned int	vc_bell_pitch;		/* Console bell pitch */
156	unsigned int	vc_bell_duration;	/* Console bell duration */
157	unsigned short	vc_cur_blink_ms;	/* Cursor blink duration */
158	struct vc_data **vc_display_fg;		/* [!] Ptr to var holding fg console for this display */
159	struct uni_pagedir *vc_uni_pagedir;
160	struct uni_pagedir **vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
161	struct uni_screen *vc_uni_screen;	/* unicode screen content */
162	/* additional information is in vt_kern.h */
163};
164
165struct vc {
166	struct vc_data *d;
167	struct work_struct SAK_work;
168
169	/* might add  scrmem, kbd  at some time,
170	   to have everything in one place */
 
171};
172
173extern struct vc vc_cons [MAX_NR_CONSOLES];
174extern void vc_SAK(struct work_struct *work);
175
176#define CUR_MAKE(size, change, set)	((size) | ((change) << 8) |	\
177		((set) << 16))
178#define CUR_SIZE(c)		 ((c) & 0x00000f)
179# define CUR_DEF			       0
180# define CUR_NONE			       1
181# define CUR_UNDERLINE			       2
182# define CUR_LOWER_THIRD		       3
183# define CUR_LOWER_HALF			       4
184# define CUR_TWO_THIRDS			       5
185# define CUR_BLOCK			       6
186#define CUR_SW				0x000010
187#define CUR_ALWAYS_BG			0x000020
188#define CUR_INVERT_FG_BG		0x000040
189#define CUR_FG				0x000700
190#define CUR_BG				0x007000
191#define CUR_CHANGE(c)		 ((c) & 0x00ff00)
192#define CUR_SET(c)		(((c) & 0xff0000) >> 8)
193
194bool con_is_visible(const struct vc_data *vc);
195
196#endif /* _LINUX_CONSOLE_STRUCT_H */
v3.5.6
 
  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
 19struct vt_struct;
 
 20
 21#define NPAR 16
 
 22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 23struct vc_data {
 24	struct tty_port port;			/* Upper level data */
 25
 
 
 26	unsigned short	vc_num;			/* Console number */
 27	unsigned int	vc_cols;		/* [#] Console size */
 28	unsigned int	vc_rows;
 29	unsigned int	vc_size_row;		/* Bytes per row */
 30	unsigned int	vc_scan_lines;		/* # of scan lines */
 31	unsigned long	vc_origin;		/* [!] Start of real screen */
 32	unsigned long	vc_scr_end;		/* [!] End of real screen */
 33	unsigned long	vc_visible_origin;	/* [!] Top of visible window */
 34	unsigned int	vc_top, vc_bottom;	/* Scrolling region */
 35	const struct consw *vc_sw;
 36	unsigned short	*vc_screenbuf;		/* In-memory character/attribute buffer */
 37	unsigned int	vc_screenbuf_size;
 38	unsigned char	vc_mode;		/* KD_TEXT, ... */
 39	/* attributes for all characters on screen */
 40	unsigned char	vc_attr;		/* Current attributes */
 41	unsigned char	vc_def_color;		/* Default colors */
 42	unsigned char	vc_color;		/* Foreground & background */
 43	unsigned char	vc_s_color;		/* Saved foreground & background */
 44	unsigned char	vc_ulcolor;		/* Color for underline mode */
 45	unsigned char   vc_itcolor;
 46	unsigned char	vc_halfcolor;		/* Color for half intensity mode */
 47	/* cursor */
 48	unsigned int	vc_cursor_type;
 49	unsigned short	vc_complement_mask;	/* [#] Xor mask for mouse pointer */
 50	unsigned short	vc_s_complement_mask;	/* Saved mouse pointer mask */
 51	unsigned int	vc_x, vc_y;		/* Cursor position */
 52	unsigned int	vc_saved_x, vc_saved_y;
 53	unsigned long	vc_pos;			/* Cursor address */
 54	/* fonts */	
 55	unsigned short	vc_hi_font_mask;	/* [#] Attribute set for upper 256 chars of font or 0 if not supported */
 56	struct console_font vc_font;		/* Current VC font set */
 57	unsigned short	vc_video_erase_char;	/* Background erase character */
 58	/* VT terminal data */
 59	unsigned int	vc_state;		/* Escape sequence parser state */
 60	unsigned int	vc_npar,vc_par[NPAR];	/* Parameters of current escape sequence */
 61	/* data for manual vt switching */
 62	struct vt_mode	vt_mode;
 63	struct pid 	*vt_pid;
 64	int		vt_newvt;
 65	wait_queue_head_t paste_wait;
 66	/* mode flags */
 67	unsigned int	vc_charset	: 1;	/* Character set G0 / G1 */
 68	unsigned int	vc_s_charset	: 1;	/* Saved character set */
 69	unsigned int	vc_disp_ctrl	: 1;	/* Display chars < 32? */
 70	unsigned int	vc_toggle_meta	: 1;	/* Toggle high bit? */
 71	unsigned int	vc_decscnm	: 1;	/* Screen Mode */
 72	unsigned int	vc_decom	: 1;	/* Origin Mode */
 73	unsigned int	vc_decawm	: 1;	/* Autowrap Mode */
 74	unsigned int	vc_deccm	: 1;	/* Cursor Visible */
 75	unsigned int	vc_decim	: 1;	/* Insert Mode */
 76	unsigned int	vc_deccolm	: 1;	/* 80/132 Column Mode */
 77	/* attribute flags */
 78	unsigned int	vc_intensity	: 2;	/* 0=half-bright, 1=normal, 2=bold */
 79	unsigned int    vc_italic:1;
 80	unsigned int	vc_underline	: 1;
 81	unsigned int	vc_blink	: 1;
 82	unsigned int	vc_reverse	: 1;
 83	unsigned int	vc_s_intensity	: 2;	/* saved rendition */
 84	unsigned int    vc_s_italic:1;
 85	unsigned int	vc_s_underline	: 1;
 86	unsigned int	vc_s_blink	: 1;
 87	unsigned int	vc_s_reverse	: 1;
 88	/* misc */
 89	unsigned int	vc_ques		: 1;
 90	unsigned int	vc_need_wrap	: 1;
 91	unsigned int	vc_can_do_color	: 1;
 92	unsigned int	vc_report_mouse : 2;
 93	unsigned char	vc_utf		: 1;	/* Unicode UTF-8 encoding */
 94	unsigned char	vc_utf_count;
 95		 int	vc_utf_char;
 96	unsigned int	vc_tab_stop[8];		/* Tab stops. 256 columns. */
 97	unsigned char   vc_palette[16*3];       /* Colour palette for VGA+ */
 98	unsigned short * vc_translate;
 99	unsigned char 	vc_G0_charset;
100	unsigned char 	vc_G1_charset;
101	unsigned char 	vc_saved_G0;
102	unsigned char 	vc_saved_G1;
103	unsigned int    vc_resize_user;         /* resize request from user */
104	unsigned int	vc_bell_pitch;		/* Console bell pitch */
105	unsigned int	vc_bell_duration;	/* Console bell duration */
 
106	struct vc_data **vc_display_fg;		/* [!] Ptr to var holding fg console for this display */
107	unsigned long	vc_uni_pagedir;
108	unsigned long	*vc_uni_pagedir_loc;  /* [!] Location of uni_pagedir variable for this console */
109	bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */
110	/* additional information is in vt_kern.h */
111};
112
113struct vc {
114	struct vc_data *d;
115	struct work_struct SAK_work;
116
117	/* might add  scrmem, vt_struct, kbd  at some time,
118	   to have everything in one place - the disadvantage
119	   would be that vc_cons etc can no longer be static */
120};
121
122extern struct vc vc_cons [MAX_NR_CONSOLES];
123extern void vc_SAK(struct work_struct *work);
124
125#define CUR_DEF		0
126#define CUR_NONE	1
127#define CUR_UNDERLINE	2
128#define CUR_LOWER_THIRD	3
129#define CUR_LOWER_HALF	4
130#define CUR_TWO_THIRDS	5
131#define CUR_BLOCK	6
132#define CUR_HWMASK	0x0f
133#define CUR_SWMASK	0xfff0
134
135#define CUR_DEFAULT CUR_UNDERLINE
 
 
 
 
 
 
136
137#define CON_IS_VISIBLE(conp) (*conp->vc_display_fg == conp)
138
139#endif /* _LINUX_CONSOLE_STRUCT_H */