blob: af6b06896bf280e2ce3ef92b49a9748519275f9e [file] [log] [blame]
Kevin O'Connor5108c692011-12-31 19:13:45 -05001#ifndef __VGAHW_H
2#define __VGAHW_H
3
4#include "types.h" // u8
5#include "config.h" // CONFIG_*
6
7#include "clext.h" // clext_set_mode
8#include "bochsvga.h" // bochsvga_set_mode
9#include "stdvga.h" // stdvga_set_mode
Nils31eabf92012-01-14 12:11:41 -050010#include "geodevga.h" // geodevga_init
Kevin O'Connor5108c692011-12-31 19:13:45 -050011
Kevin O'Connor10dff3d2012-01-09 19:19:44 -050012static inline struct vgamode_s *vgahw_find_mode(int mode) {
Kevin O'Connorc4a0b972012-01-09 20:21:31 -050013 if (CONFIG_VGA_CIRRUS)
14 return clext_find_mode(mode);
15 if (CONFIG_VGA_BOCHS)
16 return bochsvga_find_mode(mode);
Kevin O'Connor10dff3d2012-01-09 19:19:44 -050017 return stdvga_find_mode(mode);
18}
19
Kevin O'Connore6bc4c12012-01-21 11:26:37 -050020static inline int vgahw_set_mode(struct vgamode_s *vmode_g, int flags) {
Kevin O'Connor5108c692011-12-31 19:13:45 -050021 if (CONFIG_VGA_CIRRUS)
Kevin O'Connore6bc4c12012-01-21 11:26:37 -050022 return clext_set_mode(vmode_g, flags);
Kevin O'Connor5108c692011-12-31 19:13:45 -050023 if (CONFIG_VGA_BOCHS)
Kevin O'Connore6bc4c12012-01-21 11:26:37 -050024 return bochsvga_set_mode(vmode_g, flags);
25 return stdvga_set_mode(vmode_g, flags);
Kevin O'Connor5108c692011-12-31 19:13:45 -050026}
27
Kevin O'Connor34203cd2012-01-09 20:55:31 -050028static 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);
33 else
34 stdvga_list_modes(seg, dest, last);
35}
36
Kevin O'Connor161d2012011-12-31 19:42:21 -050037static inline int vgahw_init(void) {
38 if (CONFIG_VGA_CIRRUS)
39 return clext_init();
40 if (CONFIG_VGA_BOCHS)
41 return bochsvga_init();
Nils24ddd862012-01-14 12:15:14 -050042 if (CONFIG_VGA_GEODEGX2 || CONFIG_VGA_GEODELX)
Nils31eabf92012-01-14 12:11:41 -050043 return geodevga_init();
Kevin O'Connor161d2012011-12-31 19:42:21 -050044 return stdvga_init();
45}
46
Kevin O'Connor9961f992012-01-21 11:53:44 -050047static 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);
50 if (CONFIG_VGA_BOCHS)
51 return bochsvga_get_window(vmode_g, window);
52 return stdvga_get_window(vmode_g, window);
53}
54
55static inline int vgahw_set_window(struct vgamode_s *vmode_g, int window
56 , int val) {
57 if (CONFIG_VGA_CIRRUS)
58 return clext_set_window(vmode_g, window, val);
59 if (CONFIG_VGA_BOCHS)
60 return bochsvga_set_window(vmode_g, window, val);
61 return stdvga_set_window(vmode_g, window, val);
62}
63
Kevin O'Connor3876b532012-01-24 00:07:44 -050064static inline int vgahw_get_linelength(struct vgamode_s *vmode_g) {
65 if (CONFIG_VGA_CIRRUS)
66 return clext_get_linelength(vmode_g);
67 if (CONFIG_VGA_BOCHS)
68 return bochsvga_get_linelength(vmode_g);
69 return stdvga_get_linelength(vmode_g);
70}
71
72static 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);
75 if (CONFIG_VGA_BOCHS)
76 return bochsvga_set_linelength(vmode_g, val);
77 return stdvga_set_linelength(vmode_g, val);
78}
79
Kevin O'Connord61fc532012-01-27 20:37:45 -050080static inline int vgahw_get_displaystart(struct vgamode_s *vmode_g) {
81 if (CONFIG_VGA_CIRRUS)
82 return clext_get_displaystart(vmode_g);
83 if (CONFIG_VGA_BOCHS)
84 return bochsvga_get_displaystart(vmode_g);
85 return stdvga_get_displaystart(vmode_g);
86}
87
88static 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);
91 if (CONFIG_VGA_BOCHS)
92 return bochsvga_set_displaystart(vmode_g, val);
93 return stdvga_set_displaystart(vmode_g, val);
94}
95
Kevin O'Connor5108c692011-12-31 19:13:45 -050096#endif // vgahw.h