Kevin O'Connor | e1e000b | 2011-12-31 03:30:40 -0500 | [diff] [blame] | 1 | #ifndef __VGABIOS_H |
| 2 | #define __VGABIOS_H |
Kevin O'Connor | 1f2c307 | 2009-05-06 23:35:59 -0400 | [diff] [blame] | 3 | |
| 4 | #include "types.h" // u8 |
Kevin O'Connor | 9f98542 | 2009-09-09 11:34:39 -0400 | [diff] [blame] | 5 | #include "farptr.h" // struct segoff_s |
Kevin O'Connor | 1f2c307 | 2009-05-06 23:35:59 -0400 | [diff] [blame] | 6 | |
Kevin O'Connor | aad3b69 | 2012-01-14 23:15:40 -0500 | [diff] [blame] | 7 | // standard BIOS Video Parameter Table |
| 8 | struct VideoParam_s { |
| 9 | u8 twidth; |
| 10 | u8 theightm1; |
| 11 | u8 cheight; |
| 12 | u16 slength; |
| 13 | u8 sequ_regs[4]; |
| 14 | u8 miscreg; |
| 15 | u8 crtc_regs[25]; |
| 16 | u8 actl_regs[20]; |
| 17 | u8 grdc_regs[9]; |
| 18 | } PACKED; |
| 19 | |
| 20 | extern struct VideoParam_s video_param_table[29]; |
| 21 | |
Kevin O'Connor | ca66864 | 2009-05-21 23:06:08 -0400 | [diff] [blame] | 22 | struct saveBDAstate { |
| 23 | u8 video_mode; |
| 24 | u16 video_cols; |
| 25 | u16 video_pagesize; |
| 26 | u16 crtc_address; |
| 27 | u8 video_rows; |
| 28 | u16 char_height; |
| 29 | u8 video_ctl; |
| 30 | u8 video_switches; |
| 31 | u8 modeset_ctl; |
| 32 | u16 cursor_type; |
| 33 | u16 cursor_pos[8]; |
| 34 | u16 video_pagestart; |
| 35 | u8 video_page; |
| 36 | /* current font */ |
Kevin O'Connor | 9f98542 | 2009-09-09 11:34:39 -0400 | [diff] [blame] | 37 | struct segoff_s font0; |
| 38 | struct segoff_s font1; |
Kevin O'Connor | ca66864 | 2009-05-21 23:06:08 -0400 | [diff] [blame] | 39 | }; |
| 40 | |
Kevin O'Connor | 821d6b4 | 2011-12-31 18:19:22 -0500 | [diff] [blame] | 41 | // Mode flags |
| 42 | #define MF_GRAYSUM 0x0002 |
| 43 | #define MF_NOPALETTE 0x0008 |
| 44 | #define MF_CUSTOMCRTC 0x0800 |
| 45 | #define MF_LINEARFB 0x4000 |
| 46 | #define MF_NOCLEARMEM 0x8000 |
| 47 | |
Kevin O'Connor | d4398ad | 2012-01-01 12:32:53 -0500 | [diff] [blame] | 48 | // Memory model types |
| 49 | #define MM_TEXT 0x00 |
| 50 | #define MM_CGA 0x01 |
| 51 | #define MM_HERCULES 0x02 |
| 52 | #define MM_PLANAR 0x03 |
| 53 | #define MM_PACKED 0x04 |
| 54 | #define MM_NON_CHAIN_4_256 0x05 |
| 55 | #define MM_DIRECT 0x06 |
| 56 | #define MM_YUV 0x07 |
| 57 | |
Kevin O'Connor | 10dff3d | 2012-01-09 19:19:44 -0500 | [diff] [blame] | 58 | struct vgamode_s { |
| 59 | u8 memmodel; |
| 60 | u16 width; |
| 61 | u16 height; |
| 62 | u8 depth; |
| 63 | u8 cwidth; |
| 64 | u8 cheight; |
| 65 | u16 sstart; |
| 66 | }; |
| 67 | |
Kevin O'Connor | 1f2c307 | 2009-05-06 23:35:59 -0400 | [diff] [blame] | 68 | // vgafonts.c |
| 69 | extern u8 vgafont8[]; |
| 70 | extern u8 vgafont14[]; |
| 71 | extern u8 vgafont16[]; |
| 72 | extern u8 vgafont14alt[]; |
| 73 | extern u8 vgafont16alt[]; |
| 74 | |
Kevin O'Connor | e1e000b | 2011-12-31 03:30:40 -0500 | [diff] [blame] | 75 | // vgabios.c |
Kevin O'Connor | 8cf8f8e | 2012-01-16 19:05:27 -0500 | [diff] [blame] | 76 | extern int VgaBDF; |
Kevin O'Connor | f376037 | 2011-12-23 22:41:08 -0500 | [diff] [blame] | 77 | #define SET_VGA(var, val) SET_FARVAR(get_global_seg(), (var), (val)) |
Kevin O'Connor | 0926241 | 2009-05-25 11:44:11 -0400 | [diff] [blame] | 78 | struct carattr { |
Kevin O'Connor | 0ad77f0 | 2009-05-31 20:46:43 -0400 | [diff] [blame] | 79 | u8 car, attr, use_attr; |
Kevin O'Connor | 0926241 | 2009-05-25 11:44:11 -0400 | [diff] [blame] | 80 | }; |
Kevin O'Connor | 918b156 | 2009-05-25 11:05:18 -0400 | [diff] [blame] | 81 | struct cursorpos { |
| 82 | u8 x, y, page; |
| 83 | }; |
Kevin O'Connor | 83047be | 2012-01-07 18:27:19 -0500 | [diff] [blame] | 84 | u16 calc_page_size(u8 memmodel, u16 width, u16 height); |
Kevin O'Connor | 4a73f93 | 2012-01-21 11:08:35 -0500 | [diff] [blame^] | 85 | struct vgamode_s *get_current_mode(void); |
Kevin O'Connor | 821d6b4 | 2011-12-31 18:19:22 -0500 | [diff] [blame] | 86 | void modeswitch_set_bda(int mode, int flags, struct vgamode_s *vmode_g); |
Kevin O'Connor | c0c7df6 | 2009-05-17 18:11:33 -0400 | [diff] [blame] | 87 | |
| 88 | // vgafb.c |
Kevin O'Connor | 217f2bc | 2009-05-31 00:46:47 -0400 | [diff] [blame] | 89 | void vgafb_scroll(int nblines, int attr |
| 90 | , struct cursorpos ul, struct cursorpos lr); |
Kevin O'Connor | d3b3815 | 2009-05-26 00:05:37 -0400 | [diff] [blame] | 91 | void vgafb_write_char(struct cursorpos cp, struct carattr ca); |
| 92 | struct carattr vgafb_read_char(struct cursorpos cp); |
Kevin O'Connor | 227a2bb | 2009-05-31 22:00:20 -0400 | [diff] [blame] | 93 | void vgafb_write_pixel(u8 color, u16 x, u16 y); |
| 94 | u8 vgafb_read_pixel(u16 x, u16 y); |
Kevin O'Connor | c0c7df6 | 2009-05-17 18:11:33 -0400 | [diff] [blame] | 95 | |
Julian Pidancet | 87879e2 | 2011-12-19 05:08:00 +0000 | [diff] [blame] | 96 | // vbe.c |
Kevin O'Connor | 3339c05 | 2012-01-13 20:00:35 -0500 | [diff] [blame] | 97 | u32 VBE_total_memory; |
| 98 | u32 VBE_capabilities; |
| 99 | u32 VBE_framebuffer; |
Kevin O'Connor | 643290f | 2012-01-13 22:08:52 -0500 | [diff] [blame] | 100 | u16 VBE_win_granularity; |
Julian Pidancet | 87879e2 | 2011-12-19 05:08:00 +0000 | [diff] [blame] | 101 | #define VBE_OEM_STRING "SeaBIOS VBE(C) 2011" |
| 102 | #define VBE_VENDOR_STRING "SeaBIOS Developers" |
| 103 | #define VBE_PRODUCT_STRING "SeaBIOS VBE Adapter" |
| 104 | #define VBE_REVISION_STRING "Rev. 1" |
Kevin O'Connor | 4040195 | 2011-12-31 03:43:12 -0500 | [diff] [blame] | 105 | struct bregs; |
| 106 | void handle_104f(struct bregs *regs); |
| 107 | |
Kevin O'Connor | e1e000b | 2011-12-31 03:30:40 -0500 | [diff] [blame] | 108 | #endif // vgabios.h |