[SeaBIOS] [PATCH 1/5] vgafb: Move header definitions from vgabios.h to new file vgafb.h

Kevin O'Connor kevin at koconnor.net
Fri Aug 5 18:23:16 CEST 2016


Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 vgasrc/cbvga.c    |  1 +
 vgasrc/swcursor.c |  3 ++-
 vgasrc/vgabios.c  |  1 +
 vgasrc/vgabios.h  | 36 ------------------------------------
 vgasrc/vgafb.c    |  1 +
 vgasrc/vgafb.h    | 42 ++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 47 insertions(+), 37 deletions(-)
 create mode 100644 vgasrc/vgafb.h

diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c
index 1cfb9d3..b4d7d36 100644
--- a/vgasrc/cbvga.c
+++ b/vgasrc/cbvga.c
@@ -11,6 +11,7 @@
 #include "string.h" // memset16_far
 #include "util.h" // find_cb_table
 #include "vgabios.h" // VGAREG_*
+#include "vgafb.h" // handle_gfx_op
 
 static int CBmode VAR16;
 static struct vgamode_s CBmodeinfo VAR16;
diff --git a/vgasrc/swcursor.c b/vgasrc/swcursor.c
index 83f4822..b7b3250 100644
--- a/vgasrc/swcursor.c
+++ b/vgasrc/swcursor.c
@@ -6,7 +6,8 @@
 
 #include "biosvar.h" // GET_BDA
 #include "bregs.h" // struct bregs
-#include "vgabios.h" // handle_gfx_op
+#include "vgabios.h" // get_cursor_pos
+#include "vgafb.h" // handle_gfx_op
 
 // Draw/undraw a cursor on the framebuffer by xor'ing the cursor cell
 static void
diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c
index 4e897c4..44ce312 100644
--- a/vgasrc/vgabios.c
+++ b/vgasrc/vgabios.c
@@ -14,6 +14,7 @@
 #include "stdvga.h" // stdvga_set_cursor_shape
 #include "string.h" // memset_far
 #include "vgabios.h" // calc_page_size
+#include "vgafb.h" // vgafb_write_char
 #include "vgahw.h" // vgahw_set_mode
 
 
diff --git a/vgasrc/vgabios.h b/vgasrc/vgabios.h
index ffbb729..0e988bd 100644
--- a/vgasrc/vgabios.h
+++ b/vgasrc/vgabios.h
@@ -43,25 +43,6 @@ struct vgamode_s {
     u16 sstart;
 };
 
-// Graphics pixel operations.
-struct gfx_op {
-    struct vgamode_s *vmode_g;
-    u32 linelength;
-    u32 displaystart;
-
-    u8 op;
-    u16 x, y;
-
-    u8 pixels[8];
-    u16 xlen, ylen;
-    u16 srcy;
-};
-
-#define GO_READ8   1
-#define GO_WRITE8  2
-#define GO_MEMSET  3
-#define GO_MEMMOVE 4
-
 // Custom internal storage in BDA (don't change here without also
 // updating vgaentry.S)
 #define VGA_CUSTOM_BDA 0xb9
@@ -107,12 +88,6 @@ extern struct video_param_s video_param_table[29];
 extern int VgaBDF;
 extern int HaveRunInit;
 #define SET_VGA(var, val) SET_FARVAR(get_global_seg(), (var), (val))
-struct carattr {
-    u8 car, attr, use_attr, pad;
-};
-struct cursorpos {
-    u8 x, y, page, pad;
-};
 int vga_bpp(struct vgamode_s *vmode_g);
 u16 calc_page_size(u8 memmodel, u16 width, u16 height);
 u16 get_cursor_shape(void);
@@ -122,17 +97,6 @@ struct vgamode_s *get_current_mode(void);
 int vga_set_mode(int mode, int flags);
 extern struct video_func_static static_functionality;
 
-// vgafb.c
-void init_gfx_op(struct gfx_op *op, struct vgamode_s *vmode_g);
-void handle_gfx_op(struct gfx_op *op);
-void *text_address(struct cursorpos cp);
-void vgafb_scroll(struct cursorpos win, struct cursorpos winsize
-                  , int lines, struct carattr ca);
-void vgafb_write_char(struct cursorpos cp, struct carattr ca);
-struct carattr vgafb_read_char(struct cursorpos cp);
-void vgafb_write_pixel(u8 color, u16 x, u16 y);
-u8 vgafb_read_pixel(u16 x, u16 y);
-
 // swcursor.c
 struct bregs;
 void swcursor_pre_handle10(struct bregs *regs);
diff --git a/vgasrc/vgafb.c b/vgasrc/vgafb.c
index 57ecc9b..04d543e 100644
--- a/vgasrc/vgafb.c
+++ b/vgasrc/vgafb.c
@@ -11,6 +11,7 @@
 #include "stdvga.h" // stdvga_planar4_plane
 #include "string.h" // memset_far
 #include "vgabios.h" // vgafb_scroll
+#include "vgafb.h" // vgafb_write_char
 #include "vgahw.h" // vgahw_get_linelength
 
 static inline void
diff --git a/vgasrc/vgafb.h b/vgasrc/vgafb.h
new file mode 100644
index 0000000..ccdc703
--- /dev/null
+++ b/vgasrc/vgafb.h
@@ -0,0 +1,42 @@
+#ifndef __VGAFB_H
+#define __VGAFB_H
+
+// Graphics pixel operations.
+struct gfx_op {
+    struct vgamode_s *vmode_g;
+    u32 linelength;
+    u32 displaystart;
+
+    u8 op;
+    u16 x, y;
+
+    u8 pixels[8];
+    u16 xlen, ylen;
+    u16 srcy;
+};
+
+#define GO_READ8   1
+#define GO_WRITE8  2
+#define GO_MEMSET  3
+#define GO_MEMMOVE 4
+
+struct cursorpos {
+    u8 x, y, page, pad;
+};
+
+struct carattr {
+    u8 car, attr, use_attr, pad;
+};
+
+// vgafb.c
+void init_gfx_op(struct gfx_op *op, struct vgamode_s *vmode_g);
+void handle_gfx_op(struct gfx_op *op);
+void *text_address(struct cursorpos cp);
+void vgafb_scroll(struct cursorpos win, struct cursorpos winsize
+                  , int lines, struct carattr ca);
+void vgafb_write_char(struct cursorpos cp, struct carattr ca);
+struct carattr vgafb_read_char(struct cursorpos cp);
+void vgafb_write_pixel(u8 color, u16 x, u16 y);
+u8 vgafb_read_pixel(u16 x, u16 y);
+
+#endif // vgafb.h
-- 
2.5.5




More information about the SeaBIOS mailing list