console_struct.h 4.7 KB

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