vgabios: Refactor vga_set_mode and stdvga_set_mode.
[seabios.git] / vgasrc / vgabios.h
1 #ifndef __VGABIOS_H
2 #define __VGABIOS_H
3
4 #include "types.h" // u8
5 #include "farptr.h" // struct segoff_s
6
7 #define SCREEN_IO_START(x,y,p) (((((x)*(y)) | 0x00ff) + 1) * (p))
8 #define SCREEN_MEM_START(x,y,p) SCREEN_IO_START(((x)*2),(y),(p))
9
10 struct saveBDAstate {
11     u8 video_mode;
12     u16 video_cols;
13     u16 video_pagesize;
14     u16 crtc_address;
15     u8 video_rows;
16     u16 char_height;
17     u8 video_ctl;
18     u8 video_switches;
19     u8 modeset_ctl;
20     u16 cursor_type;
21     u16 cursor_pos[8];
22     u16 video_pagestart;
23     u8 video_page;
24     /* current font */
25     struct segoff_s font0;
26     struct segoff_s font1;
27 };
28
29 // Mode flags
30 #define MF_GRAYSUM    0x0002
31 #define MF_NOPALETTE  0x0008
32 #define MF_CUSTOMCRTC 0x0800
33 #define MF_LINEARFB   0x4000
34 #define MF_NOCLEARMEM 0x8000
35
36 // vgatables.c
37 struct vgamode_s;
38 struct vgamode_s *find_vga_entry(u8 mode);
39 void build_video_param(void);
40 extern struct VideoSavePointer_s video_save_pointer_table;
41 extern u8 static_functionality[];
42
43 // vgafonts.c
44 extern u8 vgafont8[];
45 extern u8 vgafont14[];
46 extern u8 vgafont16[];
47 extern u8 vgafont14alt[];
48 extern u8 vgafont16alt[];
49
50 // vgabios.c
51 #define SET_VGA(var, val) SET_FARVAR(get_global_seg(), (var), (val))
52 struct carattr {
53     u8 car, attr, use_attr;
54 };
55 struct cursorpos {
56     u8 x, y, page;
57 };
58 void modeswitch_set_bda(int mode, int flags, struct vgamode_s *vmode_g);
59
60 // vgafb.c
61 void vgafb_scroll(int nblines, int attr
62                   , struct cursorpos ul, struct cursorpos lr);
63 void vgafb_write_char(struct cursorpos cp, struct carattr ca);
64 struct carattr vgafb_read_char(struct cursorpos cp);
65 void vgafb_write_pixel(u8 color, u16 x, u16 y);
66 u8 vgafb_read_pixel(u16 x, u16 y);
67
68 // clext.c
69 int cirrus_set_video_mode(u8 mode, u8 noclearmem);
70 void cirrus_init(void);
71
72 // vbe.c
73 #define VBE_OEM_STRING "SeaBIOS VBE(C) 2011"
74 #define VBE_VENDOR_STRING "SeaBIOS Developers"
75 #define VBE_PRODUCT_STRING "SeaBIOS VBE Adapter"
76 #define VBE_REVISION_STRING "Rev. 1"
77
78 struct vbe_modeinfo
79 {
80     u16 width;
81     u16 height;
82     u8 depth;
83     u16 linesize;
84     u32 phys_base;
85     u32 vram_size;
86 };
87
88 struct bregs;
89 void handle_104f(struct bregs *regs);
90
91 #endif // vgabios.h