vgabios: Unify X_init() functions.
[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 extern u16 VgaBDF;
52 #define SET_VGA(var, val) SET_FARVAR(get_global_seg(), (var), (val))
53 struct carattr {
54     u8 car, attr, use_attr;
55 };
56 struct cursorpos {
57     u8 x, y, page;
58 };
59 void modeswitch_set_bda(int mode, int flags, struct vgamode_s *vmode_g);
60
61 // vgafb.c
62 void vgafb_scroll(int nblines, int attr
63                   , struct cursorpos ul, struct cursorpos lr);
64 void vgafb_write_char(struct cursorpos cp, struct carattr ca);
65 struct carattr vgafb_read_char(struct cursorpos cp);
66 void vgafb_write_pixel(u8 color, u16 x, u16 y);
67 u8 vgafb_read_pixel(u16 x, u16 y);
68
69 // vbe.c
70 #define VBE_OEM_STRING "SeaBIOS VBE(C) 2011"
71 #define VBE_VENDOR_STRING "SeaBIOS Developers"
72 #define VBE_PRODUCT_STRING "SeaBIOS VBE Adapter"
73 #define VBE_REVISION_STRING "Rev. 1"
74
75 struct vbe_modeinfo
76 {
77     u16 width;
78     u16 height;
79     u8 depth;
80     u16 linesize;
81     u32 phys_base;
82     u32 vram_size;
83 };
84
85 struct bregs;
86 void handle_104f(struct bregs *regs);
87
88 #endif // vgabios.h