Make vga fonts const
[qemu-palcode.git] / vgatables.h
blob52cbd921d7dab293b4f2d2a49122b90ee58a834b
1 /* VGA register definitions
3 This file is copied (somewhat) intact from SeaBIOS.
4 It is covered by the GNU Lesser General Public License, v3.
6 You should have received a copy of the GNU Lesser General Public License
7 along with this program; see the file COPYING. If not see
8 <http://www.gnu.org/licenses/>. */
10 #ifndef VGATABLES_H
11 #define VGATABLES_H
13 typedef uint8_t u8;
14 typedef uint16_t u16;
19 * VGA registers
22 #define VGAREG_ACTL_ADDRESS 0x3c0
23 #define VGAREG_ACTL_WRITE_DATA 0x3c0
24 #define VGAREG_ACTL_READ_DATA 0x3c1
26 #define VGAREG_INPUT_STATUS 0x3c2
27 #define VGAREG_WRITE_MISC_OUTPUT 0x3c2
28 #define VGAREG_VIDEO_ENABLE 0x3c3
29 #define VGAREG_SEQU_ADDRESS 0x3c4
30 #define VGAREG_SEQU_DATA 0x3c5
32 #define VGAREG_PEL_MASK 0x3c6
33 #define VGAREG_DAC_STATE 0x3c7
34 #define VGAREG_DAC_READ_ADDRESS 0x3c7
35 #define VGAREG_DAC_WRITE_ADDRESS 0x3c8
36 #define VGAREG_DAC_DATA 0x3c9
38 #define VGAREG_READ_FEATURE_CTL 0x3ca
39 #define VGAREG_READ_MISC_OUTPUT 0x3cc
41 #define VGAREG_GRDC_ADDRESS 0x3ce
42 #define VGAREG_GRDC_DATA 0x3cf
44 #define VGAREG_MDA_CRTC_ADDRESS 0x3b4
45 #define VGAREG_MDA_CRTC_DATA 0x3b5
46 #define VGAREG_VGA_CRTC_ADDRESS 0x3d4
47 #define VGAREG_VGA_CRTC_DATA 0x3d5
49 #define VGAREG_MDA_WRITE_FEATURE_CTL 0x3ba
50 #define VGAREG_VGA_WRITE_FEATURE_CTL 0x3da
51 #define VGAREG_ACTL_RESET 0x3da
53 #define VGAREG_MDA_MODECTL 0x3b8
54 #define VGAREG_CGA_MODECTL 0x3d8
55 #define VGAREG_CGA_PALETTE 0x3d9
57 /* Video memory */
58 #define SEG_GRAPH 0xA000
59 #define SEG_CTEXT 0xB800
60 #define SEG_MTEXT 0xB000
63 * Tables of default values for each mode
65 #define TEXT 0x80
67 #define CTEXT (0x00 | TEXT)
68 #define MTEXT (0x01 | TEXT)
69 #define CGA 0x02
70 #define PLANAR1 0x03
71 #define PLANAR4 0x04
72 #define LINEAR8 0x05
74 // for SVGA
75 #define LINEAR15 0x10
76 #define LINEAR16 0x11
77 #define LINEAR24 0x12
78 #define LINEAR32 0x13
80 #define SCREEN_IO_START(x,y,p) (((((x)*(y)) | 0x00ff) + 1) * (p))
81 #define SCREEN_MEM_START(x,y,p) SCREEN_IO_START(((x)*2),(y),(p))
83 /* standard BIOS Video Parameter Table */
84 struct VideoParam_s {
85 u8 twidth;
86 u8 theightm1;
87 u8 cheight;
88 u16 slength;
89 u8 sequ_regs[4];
90 u8 miscreg;
91 u8 crtc_regs[25];
92 u8 actl_regs[20];
93 u8 grdc_regs[9];
94 } PACKED;
96 struct vgamode_s {
97 u8 svgamode;
98 struct VideoParam_s *vparam;
99 u8 memmodel; /* CTEXT,MTEXT,CGA,PL1,PL2,PL4,P8,P15,P16,P24,P32 */
100 u8 pixbits;
101 u16 sstart;
102 u8 pelmask;
103 u8 *dac;
104 u16 dacsize;
107 struct saveVideoHardware {
108 u8 sequ_index;
109 u8 crtc_index;
110 u8 grdc_index;
111 u8 actl_index;
112 u8 feature;
113 u8 sequ_regs[4];
114 u8 sequ0;
115 u8 crtc_regs[25];
116 u8 actl_regs[20];
117 u8 grdc_regs[9];
118 u16 crtc_addr;
119 u8 plane_latch[4];
122 struct saveBDAstate {
123 u8 video_mode;
124 u16 video_cols;
125 u16 video_pagesize;
126 u16 crtc_address;
127 u8 video_rows;
128 u16 char_height;
129 u8 video_ctl;
130 u8 video_switches;
131 u8 modeset_ctl;
132 u16 cursor_type;
133 u16 cursor_pos[8];
134 u16 video_pagestart;
135 u8 video_page;
136 #if 0
137 /* current font */
138 struct segoff_s font0;
139 struct segoff_s font1;
140 #endif
143 struct saveDACcolors {
144 u8 rwmode;
145 u8 peladdr;
146 u8 pelmask;
147 u8 dac[768];
148 u8 color_select;
151 // vgatables.c
152 struct vgamode_s *find_vga_entry(u8 mode);
153 extern u16 video_save_pointer_table[];
154 extern struct VideoParam_s video_param_table[];
155 extern u8 static_functionality[];
157 // vgafonts.c
158 extern const u8 vgafont8[];
159 extern const u8 vgafont14[];
160 extern const u8 vgafont16[];
161 extern const u8 vgafont14alt[];
162 extern const u8 vgafont16alt[];
164 // vga.c
165 struct carattr {
166 u8 car, attr, use_attr;
168 struct cursorpos {
169 u8 x, y, page;
172 // vgafb.c
173 void clear_screen(struct vgamode_s *vmode_g);
174 void vgafb_scroll(int nblines, int attr
175 , struct cursorpos ul, struct cursorpos lr);
176 void vgafb_write_char(struct cursorpos cp, struct carattr ca);
177 struct carattr vgafb_read_char(struct cursorpos cp);
178 void vgafb_write_pixel(u8 color, u16 x, u16 y);
179 u8 vgafb_read_pixel(u16 x, u16 y);
180 void vgafb_load_font(u16 seg, void *src_far, u16 count
181 , u16 start, u8 destflags, u8 fontsize);
183 // vgaio.c
184 void vgahw_screen_disable(void);
185 void vgahw_screen_enable(void);
186 void vgahw_set_border_color(u8 color);
187 void vgahw_set_overscan_border_color(u8 color);
188 u8 vgahw_get_overscan_border_color(void);
189 void vgahw_set_palette(u8 palid);
190 void vgahw_set_single_palette_reg(u8 reg, u8 val);
191 u8 vgahw_get_single_palette_reg(u8 reg);
192 void vgahw_set_all_palette_reg(u8 *data);
193 void vgahw_get_all_palette_reg(u8 *data);
194 void vgahw_toggle_intensity(u8 flag);
195 void vgahw_select_video_dac_color_page(u8 flag, u8 data);
196 void vgahw_read_video_dac_state(u8 *pmode, u8 *curpage);
197 void vgahw_set_dac_regs(u8 *data, u8 start, int count);
198 void vgahw_get_dac_regs(u8 *data, u8 start, int count);
199 void vgahw_set_pel_mask(u8 val);
200 u8 vgahw_get_pel_mask(void);
201 void vgahw_save_dac_state(struct saveDACcolors *info);
202 void vgahw_restore_dac_state(struct saveDACcolors *info);
203 void vgahw_sequ_write(u8 index, u8 value);
204 void vgahw_grdc_write(u8 index, u8 value);
205 void vgahw_set_text_block_specifier(u8 spec);
206 void get_font_access(void);
207 void release_font_access(void);
208 void vgahw_set_cursor_shape(u8 start, u8 end);
209 void vgahw_set_active_page(u16 address);
210 void vgahw_set_cursor_pos(u16 address);
211 void vgahw_set_scan_lines(u8 lines);
212 u16 vgahw_get_vde(void);
213 void vgahw_save_state(struct saveVideoHardware *info);
214 void vgahw_restore_state(struct saveVideoHardware *info);
215 void vgahw_set_mode(struct VideoParam_s *vparam_g);
216 void vgahw_enable_video_addressing(u8 disable);
217 void vgahw_init(void);
219 // clext.c
220 void cirrus_set_video_mode(u8 mode);
221 void cirrus_init(void);
223 #endif // vgatables.h