vgautil: Add new header file with misc function and variable definitions

Move the generic function and variable definitions from vgabios.h to a
new file vgautil.h.  This reduces the size and complexity of
vgabios.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2016-08-05 11:14:58 -04:00
parent 536129ac3a
commit 2f2ec113be
13 changed files with 57 additions and 37 deletions

View File

@ -14,7 +14,8 @@
#include "output.h" // dprintf
#include "std/vbe.h" // VBE_CAPABILITY_8BIT_DAC
#include "stdvga.h" // VGAREG_SEQU_ADDRESS
#include "vgabios.h" // struct vbe_modeinfo
#include "vgabios.h" // SET_VGA
#include "vgautil.h" // VBE_total_memory
#include "x86.h" // outw

View File

@ -10,8 +10,9 @@
#include "stdvga.h" // SEG_CTEXT
#include "string.h" // memset16_far
#include "util.h" // find_cb_table
#include "vgabios.h" // VGAREG_*
#include "vgabios.h" // SET_VGA
#include "vgafb.h" // handle_gfx_op
#include "vgautil.h" // VBE_total_memory
static int CBmode VAR16;
static struct vgamode_s CBmodeinfo VAR16;

View File

@ -13,7 +13,8 @@
#include "output.h" // dprintf
#include "stdvga.h" // VGAREG_SEQU_ADDRESS
#include "string.h" // memset16_far
#include "vgabios.h" // VBE_VENDOR_STRING
#include "vgabios.h" // SET_VGA
#include "vgautil.h" // VBE_total_memory
/****************************************************************

View File

@ -13,7 +13,8 @@
#include "hw/pci_regs.h" // PCI_BASE_ADDRESS_0
#include "output.h" // dprintf
#include "stdvga.h" // stdvga_crtc_write
#include "vgabios.h" // VGAREG_*
#include "vgabios.h" // SET_VGA
#include "vgautil.h" // VBE_total_memory
/****************************************************************

View File

@ -10,7 +10,8 @@
#include "std/vga.h" // struct video_param_s
#include "stdvga.h" // stdvga_find_mode
#include "string.h" // memcpy_far
#include "vgabios.h" // video_param_table
#include "vgabios.h" // SET_VGA
#include "vgautil.h" // vgafont16
/****************************************************************

View File

@ -8,6 +8,7 @@
#include "bregs.h" // struct bregs
#include "vgabios.h" // get_cursor_pos
#include "vgafb.h" // handle_gfx_op
#include "vgautil.h" // swcursor_check_event
// Draw/undraw a cursor on the framebuffer by xor'ing the cursor cell
static void

View File

@ -12,8 +12,14 @@
#include "output.h" // dprintf
#include "std/vbe.h" // struct vbe_info
#include "string.h" // memset_far
#include "vgabios.h" // handle_104f
#include "vgabios.h" // get_current_mode
#include "vgahw.h" // vgahw_set_mode
#include "vgautil.h" // handle_104f
#define VBE_OEM_STRING "SeaBIOS VBE(C) 2011"
#define VBE_VENDOR_STRING "SeaBIOS Developers"
#define VBE_PRODUCT_STRING "SeaBIOS VBE Adapter"
#define VBE_REVISION_STRING "Rev. 1"
u32 VBE_total_memory VAR16 = 256 * 1024;
u32 VBE_capabilities VAR16;

View File

@ -17,6 +17,7 @@
#include "vgabios.h" // calc_page_size
#include "vgafb.h" // vgafb_write_char
#include "vgahw.h" // vgahw_set_mode
#include "vgautil.h" // swcursor_pre_handle10
/****************************************************************

View File

@ -68,23 +68,14 @@ static inline int vga_emulate_text(void) {
return CONFIG_VGA_EMULATE_TEXT && GET_BDA_EXT(flags) & BF_EMULATE_TEXT;
}
// Write to global variables (during "post" phase only)
#define SET_VGA(var, val) SET_FARVAR(get_global_seg(), (var), (val))
// Debug settings
#define DEBUG_VGA_POST 1
#define DEBUG_VGA_10 3
// vgafonts.c
extern u8 vgafont8[];
extern u8 vgafont14[];
extern u8 vgafont16[];
extern u8 vgafont14alt[];
extern u8 vgafont16alt[];
// vgainit.c
extern int VgaBDF;
extern int HaveRunInit;
// vgabios.c
#define SET_VGA(var, val) SET_FARVAR(get_global_seg(), (var), (val))
int vga_bpp(struct vgamode_s *vmode_g);
u16 calc_page_size(u8 memmodel, u16 width, u16 height);
u16 get_cursor_shape(void);
@ -94,20 +85,4 @@ struct vgamode_s *get_current_mode(void);
int vga_set_mode(int mode, int flags);
extern struct video_func_static static_functionality;
// swcursor.c
struct bregs;
void swcursor_pre_handle10(struct bregs *regs);
void swcursor_check_event(void);
// vbe.c
extern u32 VBE_total_memory;
extern u32 VBE_capabilities;
extern u32 VBE_framebuffer;
extern u16 VBE_win_granularity;
#define VBE_OEM_STRING "SeaBIOS VBE(C) 2011"
#define VBE_VENDOR_STRING "SeaBIOS Developers"
#define VBE_PRODUCT_STRING "SeaBIOS VBE Adapter"
#define VBE_REVISION_STRING "Rev. 1"
void handle_104f(struct bregs *regs);
#endif // vgabios.h

View File

@ -10,9 +10,10 @@
#include "output.h" // dprintf
#include "stdvga.h" // stdvga_planar4_plane
#include "string.h" // memset_far
#include "vgabios.h" // vgafb_scroll
#include "vgabios.h" // get_current_mode
#include "vgafb.h" // vgafb_write_char
#include "vgahw.h" // vgahw_get_linelength
#include "vgautil.h" // VBE_framebuffer
static inline void
memmove_stride(u16 seg, void *dst, void *src, int copylen, int stride, int lines)

View File

@ -1,4 +1,4 @@
#include "vgabios.h" // vgafont8
#include "vgautil.h" // vgafont8
/*
* These fonts come from ftp://ftp.simtel.net/pub/simtelnet/msdos/screen/fntcol16.zip

View File

@ -15,8 +15,9 @@
#include "std/pmm.h" // struct pmmheader
#include "string.h" // checksum_far
#include "util.h" // VERSION
#include "vgabios.h" // video_save_pointer_table
#include "vgabios.h" // SET_VGA
#include "vgahw.h" // vgahw_setup
#include "vgautil.h" // swcursor_check_event
// Type of emulator platform - for dprintf with certain compile options.
int PlatformRunningOn VAR16;

30
vgasrc/vgautil.h Normal file
View File

@ -0,0 +1,30 @@
// Misc function and variable declarations.
#ifndef __VGAUTIL_H
#define __VGAUTIL_H
#include "types.h" // u8
// swcursor.c
struct bregs;
void swcursor_pre_handle10(struct bregs *regs);
void swcursor_check_event(void);
// vbe.c
extern u32 VBE_total_memory;
extern u32 VBE_capabilities;
extern u32 VBE_framebuffer;
extern u16 VBE_win_granularity;
void handle_104f(struct bregs *regs);
// vgafonts.c
extern u8 vgafont8[];
extern u8 vgafont14[];
extern u8 vgafont16[];
extern u8 vgafont14alt[];
extern u8 vgafont16alt[];
// vgainit.c
extern int VgaBDF;
extern int HaveRunInit;
#endif // vgautil.h