vga.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*
  2. * linux/include/video/vga.h -- standard VGA chipset interaction
  3. *
  4. * Copyright 1999 Jeff Garzik <jgarzik@pobox.com>
  5. *
  6. * Copyright history from vga16fb.c:
  7. * Copyright 1999 Ben Pfaff and Petr Vandrovec
  8. * Based on VGA info at http://www.osdever.net/FreeVGA/home.htm
  9. * Based on VESA framebuffer (c) 1998 Gerd Knorr
  10. *
  11. * This file is subject to the terms and conditions of the GNU General
  12. * Public License. See the file COPYING in the main directory of this
  13. * archive for more details.
  14. *
  15. */
  16. #ifndef __linux_video_vga_h__
  17. #define __linux_video_vga_h__
  18. /* Some of the code below is taken from SVGAlib. The original,
  19. unmodified copyright notice for that code is below. */
  20. /* VGAlib version 1.2 - (c) 1993 Tommy Frandsen */
  21. /* */
  22. /* This library is free software; you can redistribute it and/or */
  23. /* modify it without any restrictions. This library is distributed */
  24. /* in the hope that it will be useful, but without any warranty. */
  25. /* Multi-chipset support Copyright 1993 Harm Hanemaayer */
  26. /* partially copyrighted (C) 1993 by Hartmut Schirmer */
  27. /* VGA data register ports */
  28. #define VGA_CRT_DC 0x3D5 /* CRT Controller Data Register - color emulation */
  29. #define VGA_CRT_DM 0x3B5 /* CRT Controller Data Register - mono emulation */
  30. #define VGA_ATT_R 0x3C1 /* Attribute Controller Data Read Register */
  31. #define VGA_ATT_W 0x3C0 /* Attribute Controller Data Write Register */
  32. #define VGA_GFX_D 0x3CF /* Graphics Controller Data Register */
  33. #define VGA_SEQ_D 0x3C5 /* Sequencer Data Register */
  34. #define VGA_MIS_R 0x3CC /* Misc Output Read Register */
  35. #define VGA_MIS_W 0x3C2 /* Misc Output Write Register */
  36. #define VGA_FTC_R 0x3CA /* Feature Control Read Register */
  37. #define VGA_IS1_RC 0x3DA /* Input Status Register 1 - color emulation */
  38. #define VGA_IS1_RM 0x3BA /* Input Status Register 1 - mono emulation */
  39. #define VGA_PEL_D 0x3C9 /* PEL Data Register */
  40. #define VGA_PEL_MSK 0x3C6 /* PEL mask register */
  41. /* EGA-specific registers */
  42. #define EGA_GFX_E0 0x3CC /* Graphics enable processor 0 */
  43. #define EGA_GFX_E1 0x3CA /* Graphics enable processor 1 */
  44. /* VGA index register ports */
  45. #define VGA_CRT_IC 0x3D4 /* CRT Controller Index - color emulation */
  46. #define VGA_CRT_IM 0x3B4 /* CRT Controller Index - mono emulation */
  47. #define VGA_ATT_IW 0x3C0 /* Attribute Controller Index & Data Write Register */
  48. #define VGA_GFX_I 0x3CE /* Graphics Controller Index */
  49. #define VGA_SEQ_I 0x3C4 /* Sequencer Index */
  50. #define VGA_PEL_IW 0x3C8 /* PEL Write Index */
  51. #define VGA_PEL_IR 0x3C7 /* PEL Read Index */
  52. /* standard VGA indexes max counts */
  53. #define VGA_CRT_C 0x19 /* Number of CRT Controller Registers */
  54. #define VGA_ATT_C 0x15 /* Number of Attribute Controller Registers */
  55. #define VGA_GFX_C 0x09 /* Number of Graphics Controller Registers */
  56. #define VGA_SEQ_C 0x05 /* Number of Sequencer Registers */
  57. #define VGA_MIS_C 0x01 /* Number of Misc Output Register */
  58. /* VGA misc register bit masks */
  59. #define VGA_MIS_COLOR 0x01
  60. #define VGA_MIS_ENB_MEM_ACCESS 0x02
  61. #define VGA_MIS_DCLK_28322_720 0x04
  62. #define VGA_MIS_ENB_PLL_LOAD (0x04 | 0x08)
  63. #define VGA_MIS_SEL_HIGH_PAGE 0x20
  64. /* VGA CRT controller register indices */
  65. #define VGA_CRTC_H_TOTAL 0
  66. #define VGA_CRTC_H_DISP 1
  67. #define VGA_CRTC_H_BLANK_START 2
  68. #define VGA_CRTC_H_BLANK_END 3
  69. #define VGA_CRTC_H_SYNC_START 4
  70. #define VGA_CRTC_H_SYNC_END 5
  71. #define VGA_CRTC_V_TOTAL 6
  72. #define VGA_CRTC_OVERFLOW 7
  73. #define VGA_CRTC_PRESET_ROW 8
  74. #define VGA_CRTC_MAX_SCAN 9
  75. #define VGA_CRTC_CURSOR_START 0x0A
  76. #define VGA_CRTC_CURSOR_END 0x0B
  77. #define VGA_CRTC_START_HI 0x0C
  78. #define VGA_CRTC_START_LO 0x0D
  79. #define VGA_CRTC_CURSOR_HI 0x0E
  80. #define VGA_CRTC_CURSOR_LO 0x0F
  81. #define VGA_CRTC_V_SYNC_START 0x10
  82. #define VGA_CRTC_V_SYNC_END 0x11
  83. #define VGA_CRTC_V_DISP_END 0x12
  84. #define VGA_CRTC_OFFSET 0x13
  85. #define VGA_CRTC_UNDERLINE 0x14
  86. #define VGA_CRTC_V_BLANK_START 0x15
  87. #define VGA_CRTC_V_BLANK_END 0x16
  88. #define VGA_CRTC_MODE 0x17
  89. #define VGA_CRTC_LINE_COMPARE 0x18
  90. #define VGA_CRTC_REGS VGA_CRT_C
  91. /* VGA CRT controller bit masks */
  92. #define VGA_CR11_LOCK_CR0_CR7 0x80 /* lock writes to CR0 - CR7 */
  93. #define VGA_CR17_H_V_SIGNALS_ENABLED 0x80
  94. /* VGA attribute controller register indices */
  95. #define VGA_ATC_PALETTE0 0x00
  96. #define VGA_ATC_PALETTE1 0x01
  97. #define VGA_ATC_PALETTE2 0x02
  98. #define VGA_ATC_PALETTE3 0x03
  99. #define VGA_ATC_PALETTE4 0x04
  100. #define VGA_ATC_PALETTE5 0x05
  101. #define VGA_ATC_PALETTE6 0x06
  102. #define VGA_ATC_PALETTE7 0x07
  103. #define VGA_ATC_PALETTE8 0x08
  104. #define VGA_ATC_PALETTE9 0x09
  105. #define VGA_ATC_PALETTEA 0x0A
  106. #define VGA_ATC_PALETTEB 0x0B
  107. #define VGA_ATC_PALETTEC 0x0C
  108. #define VGA_ATC_PALETTED 0x0D
  109. #define VGA_ATC_PALETTEE 0x0E
  110. #define VGA_ATC_PALETTEF 0x0F
  111. #define VGA_ATC_MODE 0x10
  112. #define VGA_ATC_OVERSCAN 0x11
  113. #define VGA_ATC_PLANE_ENABLE 0x12
  114. #define VGA_ATC_PEL 0x13
  115. #define VGA_ATC_COLOR_PAGE 0x14
  116. #define VGA_AR_ENABLE_DISPLAY 0x20
  117. /* VGA sequencer register indices */
  118. #define VGA_SEQ_RESET 0x00
  119. #define VGA_SEQ_CLOCK_MODE 0x01
  120. #define VGA_SEQ_PLANE_WRITE 0x02
  121. #define VGA_SEQ_CHARACTER_MAP 0x03
  122. #define VGA_SEQ_MEMORY_MODE 0x04
  123. /* VGA sequencer register bit masks */
  124. #define VGA_SR01_CHAR_CLK_8DOTS 0x01 /* bit 0: character clocks 8 dots wide are generated */
  125. #define VGA_SR01_SCREEN_OFF 0x20 /* bit 5: Screen is off */
  126. #define VGA_SR02_ALL_PLANES 0x0F /* bits 3-0: enable access to all planes */
  127. #define VGA_SR04_EXT_MEM 0x02 /* bit 1: allows complete mem access to 256K */
  128. #define VGA_SR04_SEQ_MODE 0x04 /* bit 2: directs system to use a sequential addressing mode */
  129. #define VGA_SR04_CHN_4M 0x08 /* bit 3: selects modulo 4 addressing for CPU access to display memory */
  130. /* VGA graphics controller register indices */
  131. #define VGA_GFX_SR_VALUE 0x00
  132. #define VGA_GFX_SR_ENABLE 0x01
  133. #define VGA_GFX_COMPARE_VALUE 0x02
  134. #define VGA_GFX_DATA_ROTATE 0x03
  135. #define VGA_GFX_PLANE_READ 0x04
  136. #define VGA_GFX_MODE 0x05
  137. #define VGA_GFX_MISC 0x06
  138. #define VGA_GFX_COMPARE_MASK 0x07
  139. #define VGA_GFX_BIT_MASK 0x08
  140. /* VGA graphics controller bit masks */
  141. #define VGA_GR06_GRAPHICS_MODE 0x01
  142. #endif /* __linux_video_vga_h__ */