blob: 4933723b6f062089c867f9147a862ee782f5d0cf [file] [log] [blame]
Kevin O'Connored68e5b2011-12-31 04:15:12 -05001#ifndef __STDVGA_H
2#define __STDVGA_H
3
4#include "types.h" // u8
5
6// VGA registers
7#define VGAREG_ACTL_ADDRESS 0x3c0
8#define VGAREG_ACTL_WRITE_DATA 0x3c0
9#define VGAREG_ACTL_READ_DATA 0x3c1
10
11#define VGAREG_INPUT_STATUS 0x3c2
12#define VGAREG_WRITE_MISC_OUTPUT 0x3c2
13#define VGAREG_VIDEO_ENABLE 0x3c3
14#define VGAREG_SEQU_ADDRESS 0x3c4
15#define VGAREG_SEQU_DATA 0x3c5
16
17#define VGAREG_PEL_MASK 0x3c6
18#define VGAREG_DAC_STATE 0x3c7
19#define VGAREG_DAC_READ_ADDRESS 0x3c7
20#define VGAREG_DAC_WRITE_ADDRESS 0x3c8
21#define VGAREG_DAC_DATA 0x3c9
22
23#define VGAREG_READ_FEATURE_CTL 0x3ca
24#define VGAREG_READ_MISC_OUTPUT 0x3cc
25
26#define VGAREG_GRDC_ADDRESS 0x3ce
27#define VGAREG_GRDC_DATA 0x3cf
28
29#define VGAREG_MDA_CRTC_ADDRESS 0x3b4
30#define VGAREG_MDA_CRTC_DATA 0x3b5
31#define VGAREG_VGA_CRTC_ADDRESS 0x3d4
32#define VGAREG_VGA_CRTC_DATA 0x3d5
33
34#define VGAREG_MDA_WRITE_FEATURE_CTL 0x3ba
35#define VGAREG_VGA_WRITE_FEATURE_CTL 0x3da
36#define VGAREG_ACTL_RESET 0x3da
37
38#define VGAREG_MDA_MODECTL 0x3b8
39#define VGAREG_CGA_MODECTL 0x3d8
40#define VGAREG_CGA_PALETTE 0x3d9
41
42/* Video memory */
43#define SEG_GRAPH 0xA000
44#define SEG_CTEXT 0xB800
45#define SEG_MTEXT 0xB000
46
Kevin O'Connored68e5b2011-12-31 04:15:12 -050047struct saveVideoHardware {
48 u8 sequ_index;
49 u8 crtc_index;
50 u8 grdc_index;
51 u8 actl_index;
52 u8 feature;
53 u8 sequ_regs[4];
54 u8 sequ0;
55 u8 crtc_regs[25];
56 u8 actl_regs[20];
57 u8 grdc_regs[9];
58 u16 crtc_addr;
59 u8 plane_latch[4];
60};
61
62struct saveDACcolors {
63 u8 rwmode;
64 u8 peladdr;
65 u8 pelmask;
66 u8 dac[768];
67 u8 color_select;
68};
69
Kevin O'Connor4ad2d102012-01-14 23:20:05 -050070// stdvgamodes.c
Kevin O'Connor10dff3d2012-01-09 19:19:44 -050071struct vgamode_s *stdvga_find_mode(int mode);
Kevin O'Connorf98bbf02012-01-27 23:09:02 -050072void stdvga_list_modes(u16 seg, u16 *dest, u16 *last);
Kevin O'Connoraad3b692012-01-14 23:15:40 -050073void stdvga_build_video_param(void);
Kevin O'Connor69b01cb2012-01-14 23:25:24 -050074void stdvga_override_crtc(int mode, u8 *crtc);
Kevin O'Connorf98bbf02012-01-27 23:09:02 -050075int stdvga_set_mode(struct vgamode_s *vmode_g, int flags);
Kevin O'Connor10dff3d2012-01-09 19:19:44 -050076
Kevin O'Connor3471fdb2012-01-14 19:02:43 -050077// stdvgaio.c
78u8 stdvga_pelmask_read(void);
79void stdvga_pelmask_write(u8 val);
80u8 stdvga_misc_read(void);
81void stdvga_misc_write(u8 value);
82void stdvga_misc_mask(u8 off, u8 on);
83u8 stdvga_sequ_read(u8 index);
84void stdvga_sequ_write(u8 index, u8 value);
85void stdvga_sequ_mask(u8 index, u8 off, u8 on);
86u8 stdvga_grdc_read(u8 index);
87void stdvga_grdc_write(u8 index, u8 value);
88void stdvga_grdc_mask(u8 index, u8 off, u8 on);
89u8 stdvga_crtc_read(u16 crtc_addr, u8 index);
90void stdvga_crtc_write(u16 crtc_addr, u8 index, u8 value);
91void stdvga_crtc_mask(u16 crtc_addr, u8 index, u8 off, u8 on);
92u8 stdvga_attr_read(u8 index);
93void stdvga_attr_write(u8 index, u8 value);
94void stdvga_attr_mask(u8 index, u8 off, u8 on);
95u8 stdvga_attrindex_read(void);
96void stdvga_attrindex_write(u8 value);
97void stdvga_dac_read(u16 seg, u8 *data_far, u8 start, int count);
98void stdvga_dac_write(u16 seg, u8 *data_far, u8 start, int count);
99
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500100// stdvga.c
Kevin O'Connor88ca7412011-12-31 04:24:20 -0500101void stdvga_set_border_color(u8 color);
102void stdvga_set_overscan_border_color(u8 color);
103u8 stdvga_get_overscan_border_color(void);
104void stdvga_set_palette(u8 palid);
Kevin O'Connor88ca7412011-12-31 04:24:20 -0500105void stdvga_set_all_palette_reg(u16 seg, u8 *data_far);
106void stdvga_get_all_palette_reg(u16 seg, u8 *data_far);
107void stdvga_toggle_intensity(u8 flag);
108void stdvga_select_video_dac_color_page(u8 flag, u8 data);
109void stdvga_read_video_dac_state(u8 *pmode, u8 *curpage);
Kevin O'Connor88ca7412011-12-31 04:24:20 -0500110void stdvga_save_dac_state(u16 seg, struct saveDACcolors *info);
111void stdvga_restore_dac_state(u16 seg, struct saveDACcolors *info);
Kevin O'Connor821d6b42011-12-31 18:19:22 -0500112void stdvga_perform_gray_scale_summing(u16 start, u16 count);
Kevin O'Connor88ca7412011-12-31 04:24:20 -0500113void stdvga_set_text_block_specifier(u8 spec);
Kevin O'Connor160d34a2012-01-16 18:48:26 -0500114void stdvga_planar4_plane(int plane);
Kevin O'Connor2bec7d62011-12-31 04:31:16 -0500115void stdvga_load_font(u16 seg, void *src_far, u16 count
116 , u16 start, u8 destflags, u8 fontsize);
Kevin O'Connorc990f272011-12-31 16:00:54 -0500117u16 stdvga_get_crtc(void);
Kevin O'Connor3876b532012-01-24 00:07:44 -0500118int stdvga_bpp_factor(struct vgamode_s *vmode_g);
Kevin O'Connor88ca7412011-12-31 04:24:20 -0500119void stdvga_set_cursor_shape(u8 start, u8 end);
Kevin O'Connor16920072012-01-27 22:59:46 -0500120void stdvga_set_cursor_pos(int address);
Kevin O'Connor88ca7412011-12-31 04:24:20 -0500121void stdvga_set_scan_lines(u8 lines);
122u16 stdvga_get_vde(void);
Kevin O'Connor9961f992012-01-21 11:53:44 -0500123int stdvga_get_window(struct vgamode_s *vmode_g, int window);
124int stdvga_set_window(struct vgamode_s *vmode_g, int window, int val);
Kevin O'Connor3876b532012-01-24 00:07:44 -0500125int stdvga_get_linelength(struct vgamode_s *vmode_g);
126int stdvga_set_linelength(struct vgamode_s *vmode_g, int val);
Kevin O'Connord61fc532012-01-27 20:37:45 -0500127int stdvga_get_displaystart(struct vgamode_s *vmode_g);
128int stdvga_set_displaystart(struct vgamode_s *vmode_g, int val);
Kevin O'Connor88ca7412011-12-31 04:24:20 -0500129void stdvga_save_state(u16 seg, struct saveVideoHardware *info);
130void stdvga_restore_state(u16 seg, struct saveVideoHardware *info);
Kevin O'Connor88ca7412011-12-31 04:24:20 -0500131void stdvga_enable_video_addressing(u8 disable);
Kevin O'Connor161d2012011-12-31 19:42:21 -0500132int stdvga_init(void);
Kevin O'Connored68e5b2011-12-31 04:15:12 -0500133
134#endif // stdvga.h