Statistics
| Branch: | Revision:

root / hw / vga.h @ a1e47211

History | View | Annotate | Download (6.5 kB)

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