3416b98f9ebccb27ce832ef549b8623d95ed982b
[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 struct saveBDAstate {
8     u8 video_mode;
9     u16 video_cols;
10     u16 video_pagesize;
11     u16 crtc_address;
12     u8 video_rows;
13     u16 char_height;
14     u8 video_ctl;
15     u8 video_switches;
16     u8 modeset_ctl;
17     u16 cursor_type;
18     u16 cursor_pos[8];
19     u16 video_pagestart;
20     u8 video_page;
21     /* current font */
22     struct segoff_s font0;
23     struct segoff_s font1;
24 };
25
26 // Mode flags
27 #define MF_GRAYSUM    0x0002
28 #define MF_NOPALETTE  0x0008
29 #define MF_CUSTOMCRTC 0x0800
30 #define MF_LINEARFB   0x4000
31 #define MF_NOCLEARMEM 0x8000
32
33 // Memory model types
34 #define MM_TEXT            0x00
35 #define MM_CGA             0x01
36 #define MM_HERCULES        0x02
37 #define MM_PLANAR          0x03
38 #define MM_PACKED          0x04
39 #define MM_NON_CHAIN_4_256 0x05
40 #define MM_DIRECT          0x06
41 #define MM_YUV             0x07
42
43 struct vgamode_s {
44     u8 memmodel;
45     u16 width;
46     u16 height;
47     u8 depth;
48     u8 cwidth;
49     u8 cheight;
50     u16 sstart;
51 };
52
53 // vgatables.c
54 void build_video_param(void);
55 extern struct VideoSavePointer_s video_save_pointer_table;
56 extern u8 static_functionality[];
57
58 // vgafonts.c
59 extern u8 vgafont8[];
60 extern u8 vgafont14[];
61 extern u8 vgafont16[];
62 extern u8 vgafont14alt[];
63 extern u8 vgafont16alt[];
64
65 // vgabios.c
66 extern u16 VgaBDF;
67 #define SET_VGA(var, val) SET_FARVAR(get_global_seg(), (var), (val))
68 struct carattr {
69     u8 car, attr, use_attr;
70 };
71 struct cursorpos {
72     u8 x, y, page;
73 };
74 u16 calc_page_size(u8 memmodel, u16 width, u16 height);
75 void modeswitch_set_bda(int mode, int flags, struct vgamode_s *vmode_g);
76
77 // vgafb.c
78 void vgafb_scroll(int nblines, int attr
79                   , struct cursorpos ul, struct cursorpos lr);
80 void vgafb_write_char(struct cursorpos cp, struct carattr ca);
81 struct carattr vgafb_read_char(struct cursorpos cp);
82 void vgafb_write_pixel(u8 color, u16 x, u16 y);
83 u8 vgafb_read_pixel(u16 x, u16 y);
84
85 // vbe.c
86 #define VBE_OEM_STRING "SeaBIOS VBE(C) 2011"
87 #define VBE_VENDOR_STRING "SeaBIOS Developers"
88 #define VBE_PRODUCT_STRING "SeaBIOS VBE Adapter"
89 #define VBE_REVISION_STRING "Rev. 1"
90
91 struct vbe_modeinfo
92 {
93     u16 width;
94     u16 height;
95     u8 depth;
96     u16 linesize;
97     u32 phys_base;
98     u32 vram_size;
99 };
100
101 struct bregs;
102 void handle_104f(struct bregs *regs);
103
104 #endif // vgabios.h