blob: 033a711604b7c0adf29e7a0075e479ea5d99db55 [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
Kevin O'Connor10dff3d2012-01-09 19:19:44 -05005#include "vgabios.h" // struct vgamode_s
Kevin O'Connored68e5b2011-12-31 04:15:12 -05006
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
Kevin O'Connor10dff3d2012-01-09 19:19:44 -050048struct stdvga_mode_s {
Kevin O'Connor80da87d2012-01-02 11:13:14 -050049 u16 mode;
Kevin O'Connor10dff3d2012-01-09 19:19:44 -050050 struct vgamode_s info;
Kevin O'Connored68e5b2011-12-31 04:15:12 -050051
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
62struct 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
77struct saveDACcolors {
78 u8 rwmode;
79 u8 peladdr;
80 u8 pelmask;
81 u8 dac[768];
82 u8 color_select;
83};
84
Kevin O'Connor10dff3d2012-01-09 19:19:44 -050085// vgatables.c
86struct vgamode_s *stdvga_find_mode(int mode);
87
88// stdvga.c
Kevin O'Connor88ca7412011-12-31 04:24:20 -050089void stdvga_set_border_color(u8 color);
90void stdvga_set_overscan_border_color(u8 color);
91u8 stdvga_get_overscan_border_color(void);
92void stdvga_set_palette(u8 palid);
93void stdvga_set_single_palette_reg(u8 reg, u8 val);
94u8 stdvga_get_single_palette_reg(u8 reg);
95void stdvga_set_all_palette_reg(u16 seg, u8 *data_far);
96void stdvga_get_all_palette_reg(u16 seg, u8 *data_far);
97void stdvga_toggle_intensity(u8 flag);
98void stdvga_select_video_dac_color_page(u8 flag, u8 data);
99void stdvga_read_video_dac_state(u8 *pmode, u8 *curpage);
100void stdvga_set_dac_regs(u16 seg, u8 *data_far, u8 start, int count);
101void stdvga_get_dac_regs(u16 seg, u8 *data_far, u8 start, int count);
102void stdvga_set_pel_mask(u8 val);
103u8 stdvga_get_pel_mask(void);
104void stdvga_save_dac_state(u16 seg, struct saveDACcolors *info);
105void stdvga_restore_dac_state(u16 seg, struct saveDACcolors *info);
Kevin O'Connor821d6b42011-12-31 18:19:22 -0500106void stdvga_perform_gray_scale_summing(u16 start, u16 count);
Kevin O'Connor88ca7412011-12-31 04:24:20 -0500107void stdvga_sequ_write(u8 index, u8 value);
108void stdvga_grdc_write(u8 index, u8 value);
109void stdvga_set_text_block_specifier(u8 spec);
Kevin O'Connor2bec7d62011-12-31 04:31:16 -0500110void stdvga_load_font(u16 seg, void *src_far, u16 count
111 , u16 start, u8 destflags, u8 fontsize);
Kevin O'Connorc990f272011-12-31 16:00:54 -0500112u16 stdvga_get_crtc(void);
Kevin O'Connor88ca7412011-12-31 04:24:20 -0500113void stdvga_set_cursor_shape(u8 start, u8 end);
114void stdvga_set_active_page(u16 address);
115void stdvga_set_cursor_pos(u16 address);
116void stdvga_set_scan_lines(u8 lines);
117u16 stdvga_get_vde(void);
118void stdvga_save_state(u16 seg, struct saveVideoHardware *info);
119void stdvga_restore_state(u16 seg, struct saveVideoHardware *info);
Kevin O'Connor5108c692011-12-31 19:13:45 -0500120int stdvga_set_mode(int mode, int flags);
Kevin O'Connor88ca7412011-12-31 04:24:20 -0500121void stdvga_enable_video_addressing(u8 disable);
Kevin O'Connor34203cd2012-01-09 20:55:31 -0500122void stdvga_list_modes(u16 seg, u16 *dest, u16 *last);
Kevin O'Connor161d2012011-12-31 19:42:21 -0500123int stdvga_init(void);
Kevin O'Connored68e5b2011-12-31 04:15:12 -0500124
125#endif // stdvga.h