vgabios: Use vesa style memory model flags in stdvga code.
[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 // Memory model types
37 #define MM_TEXT            0x00
38 #define MM_CGA             0x01
39 #define MM_HERCULES        0x02
40 #define MM_PLANAR          0x03
41 #define MM_PACKED          0x04
42 #define MM_NON_CHAIN_4_256 0x05
43 #define MM_DIRECT          0x06
44 #define MM_YUV             0x07
45
46 // vgatables.c
47 struct vgamode_s;
48 struct vgamode_s *find_vga_entry(u8 mode);
49 void build_video_param(void);
50 extern struct VideoSavePointer_s video_save_pointer_table;
51 extern u8 static_functionality[];
52
53 // vgafonts.c
54 extern u8 vgafont8[];
55 extern u8 vgafont14[];
56 extern u8 vgafont16[];
57 extern u8 vgafont14alt[];
58 extern u8 vgafont16alt[];
59
60 // vgabios.c
61 extern u16 VgaBDF;
62 #define SET_VGA(var, val) SET_FARVAR(get_global_seg(), (var), (val))
63 struct carattr {
64     u8 car, attr, use_attr;
65 };
66 struct cursorpos {
67     u8 x, y, page;
68 };
69 void modeswitch_set_bda(int mode, int flags, struct vgamode_s *vmode_g);
70
71 // vgafb.c
72 void vgafb_scroll(int nblines, int attr
73                   , struct cursorpos ul, struct cursorpos lr);
74 void vgafb_write_char(struct cursorpos cp, struct carattr ca);
75 struct carattr vgafb_read_char(struct cursorpos cp);
76 void vgafb_write_pixel(u8 color, u16 x, u16 y);
77 u8 vgafb_read_pixel(u16 x, u16 y);
78
79 // vbe.c
80 #define VBE_OEM_STRING "SeaBIOS VBE(C) 2011"
81 #define VBE_VENDOR_STRING "SeaBIOS Developers"
82 #define VBE_PRODUCT_STRING "SeaBIOS VBE Adapter"
83 #define VBE_REVISION_STRING "Rev. 1"
84
85 struct vbe_modeinfo
86 {
87     u16 width;
88     u16 height;
89     u8 depth;
90     u16 linesize;
91     u32 phys_base;
92     u32 vram_size;
93 };
94
95 struct bregs;
96 void handle_104f(struct bregs *regs);
97
98 #endif // vgabios.h