vgabios: Add support for vbe get/set line length function.
[seabios.git] / vgasrc / stdvga.h
1 #ifndef __STDVGA_H
2 #define __STDVGA_H
3
4 #include "types.h" // u8
5 #include "vgabios.h" // struct vgamode_s
6
7 // VGA registers
8 #define VGAREG_ACTL_ADDRESS            0x3c0
9 #define VGAREG_ACTL_WRITE_DATA         0x3c0
10 #define VGAREG_ACTL_READ_DATA          0x3c1
11
12 #define VGAREG_INPUT_STATUS            0x3c2
13 #define VGAREG_WRITE_MISC_OUTPUT       0x3c2
14 #define VGAREG_VIDEO_ENABLE            0x3c3
15 #define VGAREG_SEQU_ADDRESS            0x3c4
16 #define VGAREG_SEQU_DATA               0x3c5
17
18 #define VGAREG_PEL_MASK                0x3c6
19 #define VGAREG_DAC_STATE               0x3c7
20 #define VGAREG_DAC_READ_ADDRESS        0x3c7
21 #define VGAREG_DAC_WRITE_ADDRESS       0x3c8
22 #define VGAREG_DAC_DATA                0x3c9
23
24 #define VGAREG_READ_FEATURE_CTL        0x3ca
25 #define VGAREG_READ_MISC_OUTPUT        0x3cc
26
27 #define VGAREG_GRDC_ADDRESS            0x3ce
28 #define VGAREG_GRDC_DATA               0x3cf
29
30 #define VGAREG_MDA_CRTC_ADDRESS        0x3b4
31 #define VGAREG_MDA_CRTC_DATA           0x3b5
32 #define VGAREG_VGA_CRTC_ADDRESS        0x3d4
33 #define VGAREG_VGA_CRTC_DATA           0x3d5
34
35 #define VGAREG_MDA_WRITE_FEATURE_CTL   0x3ba
36 #define VGAREG_VGA_WRITE_FEATURE_CTL   0x3da
37 #define VGAREG_ACTL_RESET              0x3da
38
39 #define VGAREG_MDA_MODECTL             0x3b8
40 #define VGAREG_CGA_MODECTL             0x3d8
41 #define VGAREG_CGA_PALETTE             0x3d9
42
43 /* Video memory */
44 #define SEG_GRAPH 0xA000
45 #define SEG_CTEXT 0xB800
46 #define SEG_MTEXT 0xB000
47
48 struct stdvga_mode_s {
49     u16 mode;
50     struct vgamode_s info;
51
52     u8 pelmask;
53     u8 *dac;
54     u16 dacsize;
55     u8 *sequ_regs;
56     u8 miscreg;
57     u8 *crtc_regs;
58     u8 *actl_regs;
59     u8 *grdc_regs;
60 };
61
62 struct saveVideoHardware {
63     u8 sequ_index;
64     u8 crtc_index;
65     u8 grdc_index;
66     u8 actl_index;
67     u8 feature;
68     u8 sequ_regs[4];
69     u8 sequ0;
70     u8 crtc_regs[25];
71     u8 actl_regs[20];
72     u8 grdc_regs[9];
73     u16 crtc_addr;
74     u8 plane_latch[4];
75 };
76
77 struct saveDACcolors {
78     u8 rwmode;
79     u8 peladdr;
80     u8 pelmask;
81     u8 dac[768];
82     u8 color_select;
83 };
84
85 // stdvgamodes.c
86 struct vgamode_s *stdvga_find_mode(int mode);
87 int stdvga_is_mode(struct vgamode_s *vmode_g);
88 void stdvga_build_video_param(void);
89 void stdvga_override_crtc(int mode, u8 *crtc);
90
91 // stdvgaio.c
92 u8 stdvga_pelmask_read(void);
93 void stdvga_pelmask_write(u8 val);
94 u8 stdvga_misc_read(void);
95 void stdvga_misc_write(u8 value);
96 void stdvga_misc_mask(u8 off, u8 on);
97 u8 stdvga_sequ_read(u8 index);
98 void stdvga_sequ_write(u8 index, u8 value);
99 void stdvga_sequ_mask(u8 index, u8 off, u8 on);
100 u8 stdvga_grdc_read(u8 index);
101 void stdvga_grdc_write(u8 index, u8 value);
102 void stdvga_grdc_mask(u8 index, u8 off, u8 on);
103 u8 stdvga_crtc_read(u16 crtc_addr, u8 index);
104 void stdvga_crtc_write(u16 crtc_addr, u8 index, u8 value);
105 void stdvga_crtc_mask(u16 crtc_addr, u8 index, u8 off, u8 on);
106 u8 stdvga_attr_read(u8 index);
107 void stdvga_attr_write(u8 index, u8 value);
108 void stdvga_attr_mask(u8 index, u8 off, u8 on);
109 u8 stdvga_attrindex_read(void);
110 void stdvga_attrindex_write(u8 value);
111 void stdvga_dac_read(u16 seg, u8 *data_far, u8 start, int count);
112 void stdvga_dac_write(u16 seg, u8 *data_far, u8 start, int count);
113
114 // stdvga.c
115 void stdvga_set_border_color(u8 color);
116 void stdvga_set_overscan_border_color(u8 color);
117 u8 stdvga_get_overscan_border_color(void);
118 void stdvga_set_palette(u8 palid);
119 void stdvga_set_all_palette_reg(u16 seg, u8 *data_far);
120 void stdvga_get_all_palette_reg(u16 seg, u8 *data_far);
121 void stdvga_toggle_intensity(u8 flag);
122 void stdvga_select_video_dac_color_page(u8 flag, u8 data);
123 void stdvga_read_video_dac_state(u8 *pmode, u8 *curpage);
124 void stdvga_save_dac_state(u16 seg, struct saveDACcolors *info);
125 void stdvga_restore_dac_state(u16 seg, struct saveDACcolors *info);
126 void stdvga_perform_gray_scale_summing(u16 start, u16 count);
127 void stdvga_set_text_block_specifier(u8 spec);
128 void stdvga_planar4_plane(int plane);
129 void stdvga_load_font(u16 seg, void *src_far, u16 count
130                       , u16 start, u8 destflags, u8 fontsize);
131 u16 stdvga_get_crtc(void);
132 int stdvga_bpp_factor(struct vgamode_s *vmode_g);
133 void stdvga_set_cursor_shape(u8 start, u8 end);
134 void stdvga_set_active_page(u16 address);
135 void stdvga_set_cursor_pos(u16 address);
136 void stdvga_set_scan_lines(u8 lines);
137 u16 stdvga_get_vde(void);
138 int stdvga_get_window(struct vgamode_s *vmode_g, int window);
139 int stdvga_set_window(struct vgamode_s *vmode_g, int window, int val);
140 int stdvga_get_linelength(struct vgamode_s *vmode_g);
141 int stdvga_set_linelength(struct vgamode_s *vmode_g, int val);
142 void stdvga_save_state(u16 seg, struct saveVideoHardware *info);
143 void stdvga_restore_state(u16 seg, struct saveVideoHardware *info);
144 int stdvga_set_mode(struct vgamode_s *vmode_g, int flags);
145 void stdvga_enable_video_addressing(u8 disable);
146 void stdvga_list_modes(u16 seg, u16 *dest, u16 *last);
147 int stdvga_init(void);
148
149 #endif // stdvga.h