4 #include "types.h" // u8
5 #include "config.h" // CONFIG_*
7 #include "clext.h" // clext_set_mode
8 #include "bochsvga.h" // bochsvga_set_mode
9 #include "stdvga.h" // stdvga_set_mode
10 #include "geodevga.h" // geodevga_init
12 static inline struct vgamode_s *vgahw_find_mode(int mode) {
13 if (CONFIG_VGA_CIRRUS)
14 return clext_find_mode(mode);
16 return bochsvga_find_mode(mode);
17 return stdvga_find_mode(mode);
20 static inline int vgahw_set_mode(struct vgamode_s *vmode_g, int flags) {
21 if (CONFIG_VGA_CIRRUS)
22 return clext_set_mode(vmode_g, flags);
24 return bochsvga_set_mode(vmode_g, flags);
25 return stdvga_set_mode(vmode_g, flags);
28 static inline void vgahw_list_modes(u16 seg, u16 *dest, u16 *last) {
29 if (CONFIG_VGA_CIRRUS)
30 clext_list_modes(seg, dest, last);
31 else if (CONFIG_VGA_BOCHS)
32 bochsvga_list_modes(seg, dest, last);
34 stdvga_list_modes(seg, dest, last);
37 static inline int vgahw_init(void) {
38 if (CONFIG_VGA_CIRRUS)
41 return bochsvga_init();
42 if (CONFIG_VGA_GEODEGX2 || CONFIG_VGA_GEODELX)
43 return geodevga_init();
47 static inline int vgahw_get_window(struct vgamode_s *vmode_g, int window) {
48 if (CONFIG_VGA_CIRRUS)
49 return clext_get_window(vmode_g, window);
51 return bochsvga_get_window(vmode_g, window);
52 return stdvga_get_window(vmode_g, window);
55 static inline int vgahw_set_window(struct vgamode_s *vmode_g, int window
57 if (CONFIG_VGA_CIRRUS)
58 return clext_set_window(vmode_g, window, val);
60 return bochsvga_set_window(vmode_g, window, val);
61 return stdvga_set_window(vmode_g, window, val);
64 static inline int vgahw_get_linelength(struct vgamode_s *vmode_g) {
65 if (CONFIG_VGA_CIRRUS)
66 return clext_get_linelength(vmode_g);
68 return bochsvga_get_linelength(vmode_g);
69 return stdvga_get_linelength(vmode_g);
72 static inline int vgahw_set_linelength(struct vgamode_s *vmode_g, int val) {
73 if (CONFIG_VGA_CIRRUS)
74 return clext_set_linelength(vmode_g, val);
76 return bochsvga_set_linelength(vmode_g, val);
77 return stdvga_set_linelength(vmode_g, val);
80 static inline int vgahw_get_displaystart(struct vgamode_s *vmode_g) {
81 if (CONFIG_VGA_CIRRUS)
82 return clext_get_displaystart(vmode_g);
84 return bochsvga_get_displaystart(vmode_g);
85 return stdvga_get_displaystart(vmode_g);
88 static inline int vgahw_set_displaystart(struct vgamode_s *vmode_g, int val) {
89 if (CONFIG_VGA_CIRRUS)
90 return clext_set_displaystart(vmode_g, val);
92 return bochsvga_set_displaystart(vmode_g, val);
93 return stdvga_set_displaystart(vmode_g, val);