| 1 |
|
| 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/vt.h>
|
| 17 | #include <linux/wait.h>
|
| 18 | #include <linux/workqueue.h>
|
| 19 |
|
| 20 | struct uni_pagedict;
|
| 21 |
|
| 22 | #define NPAR 16
|
| 23 | #define VC_TABSTOPS_COUNT 256U
|
| 24 |
|
| 25 | enum vc_intensity {
|
| 26 | VCI_HALF_BRIGHT,
|
| 27 | VCI_NORMAL,
|
| 28 | VCI_BOLD,
|
| 29 | VCI_MASK = 0x3,
|
| 30 | };
|
| 31 |
|
| 32 | |
| 33 | * struct vc_state -- state of a VC
|
| 34 | * @x: cursor's x-position
|
| 35 | * @y: cursor's y-position
|
| 36 | * @color: foreground & background colors
|
| 37 | * @Gx_charset: what's G0/G1 slot set to (like GRAF_MAP, LAT1_MAP)
|
| 38 | * @charset: what character set to use (0=G0 or 1=G1)
|
| 39 | * @intensity: see enum vc_intensity for values
|
| 40 | * @reverse: reversed foreground/background colors
|
| 41 | *
|
| 42 | * These members are defined separately from struct vc_data as we save &
|
| 43 | * restore them at times.
|
| 44 |
|
| 45 | struct vc_state {
|
| 46 | unsigned int x, y;
|
| 47 |
|
| 48 | unsigned char color;
|
| 49 |
|
| 50 | unsigned char Gx_charset[2];
|
| 51 | unsigned int charset : 1;
|
| 52 |
|
| 53 |
|
| 54 | enum vc_intensity intensity;
|
| 55 | bool italic;
|
| 56 | bool underline;
|
| 57 | bool blink;
|
| 58 | bool reverse;
|
| 59 | };
|
| 60 |
|
| 61 | |
| 62 | * struct vc_font - Describes a font
|
| 63 | * @width: The width of a single glyph in bits
|
| 64 | * @height: The height of a single glyph in scanlines
|
| 65 | * @charcount: The number of glyphs in the font
|
| 66 | * @data: The raw font data
|
| 67 | *
|
| 68 | * Font data is organized as an array of glyphs. Each glyph is a bitmap with
|
| 69 | * set bits indicating the foreground color. Unset bits indicate background
|
| 70 | * color. The fields @width and @height store a single glyph's number of
|
| 71 | * horizontal bits and vertical scanlines. If width is not a multiple of 8,
|
| 72 | * there are trailing bits to fill up the byte. These bits should not be drawn.
|
| 73 | *
|
| 74 | * The field @data points to the first glyph's first byte. The value @charcount
|
| 75 | * gives the number of glyphs in the font. There are no empty scanlines between
|
| 76 | * two adjacent glyphs.
|
| 77 |
|
| 78 | struct vc_font {
|
| 79 | unsigned int width;
|
| 80 | unsigned int height;
|
| 81 | unsigned int charcount;
|
| 82 | const unsigned char *data;
|
| 83 | };
|
| 84 |
|
| 85 | unsigned int vc_font_pitch(const struct vc_font *font);
|
| 86 | unsigned int vc_font_size(const struct vc_font *font);
|
| 87 |
|
| 88 | |
| 89 | * Example: vc_data of a console that was scrolled 3 lines down.
|
| 90 | *
|
| 91 | * Console buffer
|
| 92 | * vc_screenbuf ---------> +----------------------+-.
|
| 93 | * | initializing W | \
|
| 94 | * | initializing X | |
|
| 95 | * | initializing Y | > scroll-back area
|
| 96 | * | initializing Z | |
|
| 97 | * | | /
|
| 98 | * vc_visible_origin ---> ^+----------------------+-:
|
| 99 | * (changes by scroll) || Welcome to linux | \
|
| 100 | * || | |
|
| 101 | * vc_rows --->< | login: root | | visible on console
|
| 102 | * || password: | > (vc_screenbuf_size is
|
| 103 | * vc_origin -----------> || | | vc_size_row * vc_rows)
|
| 104 | * (start when no scroll) || Last login: 12:28 | /
|
| 105 | * v+----------------------+-:
|
| 106 | * | Have a lot of fun... | \
|
| 107 | * vc_pos -----------------|--------v | > scroll-front area
|
| 108 | * | ~ # cat_ | /
|
| 109 | * vc_scr_end -----------> +----------------------+-:
|
| 110 | * (vc_origin + | | \ EMPTY, to be filled by
|
| 111 | * vc_screenbuf_size) | | / vc_video_erase_char
|
| 112 | * +----------------------+-'
|
| 113 | * <---- 2 * vc_cols ----->
|
| 114 | * <---- vc_size_row ----->
|
| 115 | *
|
| 116 | * Note that every character in the console buffer is accompanied with an
|
| 117 | * attribute in the buffer right after the character. This is not depicted
|
| 118 | * in the figure.
|
| 119 |
|
| 120 | struct vc_data {
|
| 121 | struct tty_port port;
|
| 122 |
|
| 123 | struct vc_state state, saved_state;
|
| 124 |
|
| 125 | unsigned short vc_num;
|
| 126 | unsigned int vc_cols;
|
| 127 | unsigned int vc_rows;
|
| 128 | unsigned int vc_size_row;
|
| 129 | unsigned int vc_scan_lines;
|
| 130 | unsigned int vc_cell_height;
|
| 131 | unsigned long vc_origin;
|
| 132 | unsigned long vc_scr_end;
|
| 133 | unsigned long vc_visible_origin;
|
| 134 | unsigned int vc_top, vc_bottom;
|
| 135 | const struct consw *vc_sw;
|
| 136 | unsigned short *vc_screenbuf;
|
| 137 | unsigned int vc_screenbuf_size;
|
| 138 | unsigned char vc_mode;
|
| 139 |
|
| 140 | unsigned char vc_attr;
|
| 141 | unsigned char vc_def_color;
|
| 142 | unsigned char vc_ulcolor;
|
| 143 | unsigned char vc_itcolor;
|
| 144 | unsigned char vc_halfcolor;
|
| 145 |
|
| 146 | unsigned int vc_cursor_type;
|
| 147 | unsigned short vc_complement_mask;
|
| 148 | unsigned short vc_s_complement_mask;
|
| 149 | unsigned long vc_pos;
|
| 150 |
|
| 151 | unsigned short vc_hi_font_mask;
|
| 152 | struct vc_font vc_font;
|
| 153 | unsigned short vc_video_erase_char;
|
| 154 |
|
| 155 | unsigned int vc_state;
|
| 156 | unsigned int vc_npar,vc_par[NPAR];
|
| 157 |
|
| 158 | struct vt_mode vt_mode;
|
| 159 | struct pid *vt_pid;
|
| 160 | int vt_newvt;
|
| 161 | wait_queue_head_t paste_wait;
|
| 162 |
|
| 163 | unsigned int vc_disp_ctrl : 1;
|
| 164 | unsigned int vc_toggle_meta : 1;
|
| 165 | unsigned int vc_decscnm : 1;
|
| 166 | unsigned int vc_decom : 1;
|
| 167 | unsigned int vc_decawm : 1;
|
| 168 | unsigned int vc_deccm : 1;
|
| 169 | unsigned int vc_decim : 1;
|
| 170 |
|
| 171 | unsigned int vc_priv : 3;
|
| 172 | unsigned int vc_need_wrap : 1;
|
| 173 | unsigned int vc_can_do_color : 1;
|
| 174 | unsigned int vc_report_mouse : 2;
|
| 175 | unsigned int vc_bracketed_paste : 1;
|
| 176 | unsigned char vc_utf : 1;
|
| 177 | unsigned char vc_utf_count;
|
| 178 | int vc_utf_char;
|
| 179 | DECLARE_BITMAP(vc_tab_stop, VC_TABSTOPS_COUNT);
|
| 180 | unsigned char vc_palette[16*3];
|
| 181 | unsigned short * vc_translate;
|
| 182 | unsigned int vc_bell_pitch;
|
| 183 | unsigned int vc_bell_duration;
|
| 184 | unsigned short vc_cur_blink_ms;
|
| 185 | struct vc_data **vc_display_fg;
|
| 186 | struct uni_pagedict *uni_pagedict;
|
| 187 | struct uni_pagedict **uni_pagedict_loc;
|
| 188 | u32 **vc_uni_lines;
|
| 189 | u16 *vc_saved_screen;
|
| 190 | u32 **vc_saved_uni_lines;
|
| 191 | unsigned int vc_saved_cols;
|
| 192 | unsigned int vc_saved_rows;
|
| 193 |
|
| 194 | };
|
| 195 |
|
| 196 | struct vc {
|
| 197 | struct vc_data *d;
|
| 198 | struct work_struct SAK_work;
|
| 199 |
|
| 200 | |
| 201 | to have everything in one place
|
| 202 | };
|
| 203 |
|
| 204 | extern struct vc vc_cons [MAX_NR_CONSOLES];
|
| 205 | extern void vc_SAK(struct work_struct *work);
|
| 206 |
|
| 207 | #define CUR_MAKE(size, change, set) ((size) | ((change) << 8) | \
|
| 208 | ((set) << 16))
|
| 209 | #define CUR_SIZE(c) ((c) & 0x00000f)
|
| 210 | # define CUR_DEF 0
|
| 211 | # define CUR_NONE 1
|
| 212 | # define CUR_UNDERLINE 2
|
| 213 | # define CUR_LOWER_THIRD 3
|
| 214 | # define CUR_LOWER_HALF 4
|
| 215 | # define CUR_TWO_THIRDS 5
|
| 216 | # define CUR_BLOCK 6
|
| 217 | #define CUR_SW 0x000010
|
| 218 | #define CUR_ALWAYS_BG 0x000020
|
| 219 | #define CUR_INVERT_FG_BG 0x000040
|
| 220 | #define CUR_FG 0x000700
|
| 221 | #define CUR_BG 0x007000
|
| 222 | #define CUR_CHANGE(c) ((c) & 0x00ff00)
|
| 223 | #define CUR_SET(c) (((c) & 0xff0000) >> 8)
|
| 224 |
|
| 225 | bool con_is_visible(const struct vc_data *vc);
|
| 226 |
|
| 227 | #endif
|