blob: 4fbfb90cb3ea932cd3fd5ffb2efa6f12880c0351 [file] [log] [blame]
Kevin O'Connor05c32dc2009-05-14 19:29:37 -04001#ifndef __VGATABLES_H
2#define __VGATABLES_H
Kevin O'Connor1f2c3072009-05-06 23:35:59 -04003
4#include "types.h" // u8
5
6/*
7 *
8 * VGA registers
9 *
10 */
11#define VGAREG_ACTL_ADDRESS 0x3c0
12#define VGAREG_ACTL_WRITE_DATA 0x3c0
13#define VGAREG_ACTL_READ_DATA 0x3c1
14
15#define VGAREG_INPUT_STATUS 0x3c2
16#define VGAREG_WRITE_MISC_OUTPUT 0x3c2
17#define VGAREG_VIDEO_ENABLE 0x3c3
18#define VGAREG_SEQU_ADDRESS 0x3c4
19#define VGAREG_SEQU_DATA 0x3c5
20
21#define VGAREG_PEL_MASK 0x3c6
22#define VGAREG_DAC_STATE 0x3c7
23#define VGAREG_DAC_READ_ADDRESS 0x3c7
24#define VGAREG_DAC_WRITE_ADDRESS 0x3c8
25#define VGAREG_DAC_DATA 0x3c9
26
27#define VGAREG_READ_FEATURE_CTL 0x3ca
28#define VGAREG_READ_MISC_OUTPUT 0x3cc
29
30#define VGAREG_GRDC_ADDRESS 0x3ce
31#define VGAREG_GRDC_DATA 0x3cf
32
33#define VGAREG_MDA_CRTC_ADDRESS 0x3b4
34#define VGAREG_MDA_CRTC_DATA 0x3b5
35#define VGAREG_VGA_CRTC_ADDRESS 0x3d4
36#define VGAREG_VGA_CRTC_DATA 0x3d5
37
38#define VGAREG_MDA_WRITE_FEATURE_CTL 0x3ba
39#define VGAREG_VGA_WRITE_FEATURE_CTL 0x3da
40#define VGAREG_ACTL_RESET 0x3da
41
42#define VGAREG_MDA_MODECTL 0x3b8
43#define VGAREG_CGA_MODECTL 0x3d8
44#define VGAREG_CGA_PALETTE 0x3d9
45
46/* Video memory */
Kevin O'Connord113a992009-05-16 21:05:02 -040047#define SEG_GRAPH 0xA000
48#define SEG_CTEXT 0xB800
49#define SEG_MTEXT 0xB000
Kevin O'Connor1f2c3072009-05-06 23:35:59 -040050
51/*
52 *
53 * Tables of default values for each mode
54 *
55 */
Kevin O'Connor1f2c3072009-05-06 23:35:59 -040056#define TEXT 0x00
57#define GRAPH 0x01
58
59#define CTEXT 0x00
60#define MTEXT 0x01
61#define CGA 0x02
62#define PLANAR1 0x03
63#define PLANAR4 0x04
64#define LINEAR8 0x05
65
66// for SVGA
67#define LINEAR15 0x10
68#define LINEAR16 0x11
69#define LINEAR24 0x12
70#define LINEAR32 0x13
71
72#define SCROLL_DOWN 0
73#define SCROLL_UP 1
74#define NO_ATTR 2
75#define WITH_ATTR 3
76
77#define SCREEN_SIZE(x,y) (((x*y*2)|0x00ff)+1)
78#define SCREEN_MEM_START(x,y,p) ((((x*y*2)|0x00ff)+1)*p)
79#define SCREEN_IO_START(x,y,p) ((((x*y)|0x00ff)+1)*p)
80
Kevin O'Connor1f2c3072009-05-06 23:35:59 -040081/* standard BIOS Video Parameter Table */
Kevin O'Connor5727c292009-05-16 17:29:32 -040082struct VideoParam_s {
Kevin O'Connor1f2c3072009-05-06 23:35:59 -040083 u8 twidth;
84 u8 theightm1;
85 u8 cheight;
86 u16 slength;
87 u8 sequ_regs[4];
88 u8 miscreg;
89 u8 crtc_regs[25];
90 u8 actl_regs[20];
91 u8 grdc_regs[9];
92} PACKED;
93
Kevin O'Connor5727c292009-05-16 17:29:32 -040094struct vgamode_s {
95 u8 svgamode;
96 struct VideoParam_s *vparam;
97 u8 class; /* TEXT, GRAPH */
98 u8 memmodel; /* CTEXT,MTEXT,CGA,PL1,PL2,PL4,P8,P15,P16,P24,P32 */
99 u8 pixbits;
100 u16 sstart;
101 u8 pelmask;
102 u8 *dac;
103 u16 dacsize;
104};
105
106// vgatables.c
107struct vgamode_s *find_vga_entry(u8 mode);
108extern u16 video_save_pointer_table[];
109extern struct VideoParam_s video_param_table[];
Kevin O'Connor1f2c3072009-05-06 23:35:59 -0400110extern u8 static_functionality[];
111
112// vgafonts.c
113extern u8 vgafont8[];
114extern u8 vgafont14[];
115extern u8 vgafont16[];
116extern u8 vgafont14alt[];
117extern u8 vgafont16alt[];
118
119// vga.c
120void biosfn_set_single_palette_reg(u8 reg, u8 val);
121u8 biosfn_get_single_palette_reg(u8 reg);
122
123// clext.c
124void cirrus_set_video_mode(u8 mode);
125void cirrus_init();
Kevin O'Connor05c32dc2009-05-14 19:29:37 -0400126
Kevin O'Connor21079f42009-05-16 21:30:10 -0400127// vbe.c -- not implemented yet.
128#define VBE_DISPI_DISABLED 0x00
129void dispi_set_enable(int enable);
130void vbe_init();
131int vbe_has_vbe_display();
132
Kevin O'Connor05c32dc2009-05-14 19:29:37 -0400133#endif // vgatables.h