1 /* Copyright (C) 1989, 1995, 1998 artofcode LLC. All rights reserved. 2 3 This program is free software; you can redistribute it and/or modify it 4 under the terms of the GNU General Public License as published by the 5 Free Software Foundation; either version 2 of the License, or (at your 6 option) any later version. 7 8 This program is distributed in the hope that it will be useful, but 9 WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 General Public License for more details. 12 13 You should have received a copy of the GNU General Public License along 14 with this program; if not, write to the Free Software Foundation, Inc., 15 59 Temple Place, Suite 330, Boston, MA, 02111-1307. 16 17 */ 18 19 /*$Id: gdevsvga.h,v 1.2.6.1.2.1 2003/01/17 00:49:01 giles Exp $ */ 20 /* Common definitions and procedures for SuperVGA drivers */ 21 /* Requires gdevpcfb.h */ 22 23 #ifndef gdevsvga_INCLUDED 24 # define gdevsvga_INCLUDED 25 26 /* Common procedures */ 27 28 /* See gxdevice.h for the definitions of the procedures. */ 29 30 dev_proc_close_device(svga_close); 31 dev_proc_map_rgb_color(svga_map_rgb_color); 32 dev_proc_map_color_rgb(svga_map_color_rgb); 33 dev_proc_fill_rectangle(svga_fill_rectangle); 34 dev_proc_copy_mono(svga_copy_mono); 35 dev_proc_copy_color(svga_copy_color); 36 dev_proc_get_params(svga_get_params); 37 dev_proc_put_params(svga_put_params); 38 dev_proc_get_bits(svga_get_bits); 39 dev_proc_copy_alpha(svga_copy_alpha); 40 41 /* Table structure for looking up graphics modes. */ 42 typedef struct { 43 int width, height; /* "key" */ 44 int mode; /* "value" */ 45 } mode_info; 46 47 /* The device descriptor structure */ 48 typedef struct gx_device_svga_s gx_device_svga; 49 struct gx_device_svga_s { 50 gx_device_common; 51 int (*get_mode) (P0()); 52 void (*set_mode) (P1(int)); 53 void (*set_page) (P3(gx_device_svga * fbdev, int pnum, int wnum)); 54 bool fixed_colors; /* if true, used a fixed palette */ 55 const mode_info *mode; /* BIOS display mode info */ 56 uint raster; /* frame buffer bytes per line */ 57 int current_page; /* current page */ 58 int wnum_read, wnum_write; /* window #s for read vs. write */ 59 /* Following are device-specific. */ 60 union { 61 struct { 62 void (*bios_set_page) (P2(int, int)); /* set-page function */ 63 int pn_shift; /* log2(64K/granularity) */ 64 } vesa; 65 struct { 66 int select_reg; /* page-select register */ 67 } atiw; 68 struct { 69 int et_model; /* 4 for ET4000, */ 70 /* 3 for ET3000 */ 71 } tseng; 72 } info; 73 }; 74 75 /* The initial parameters map an appropriate fraction of */ 76 /* the screen to a full-page coordinate space. */ 77 /* This may or may not be what is desired! */ 78 #define svga_color_device(procs, name, depth, maxv, dither, get_mode, set_mode, set_page) {\ 79 std_device_color_body(gx_device_svga, &procs, name,\ 80 640, 480,\ 81 480 / PAGE_HEIGHT_INCHES, 480 / PAGE_HEIGHT_INCHES,\ 82 /*dci_color(*/depth, maxv, dither/*)*/),\ 83 { 0 }, /* std_procs */\ 84 get_mode, set_mode, set_page,\ 85 0 /*fixed_colors*/\ 86 } 87 #define svga_device(procs, name, get_mode, set_mode, set_page)\ 88 svga_color_device(procs, name, 8, 31, 4, get_mode, set_mode, set_page) 89 90 /* Utility procedures */ 91 void svga_init_colors(P1(gx_device *)); 92 int svga_find_mode(P2(gx_device *, const mode_info *)); 93 int svga_open(P1(gx_device *)); 94 95 #endif /* gdevsvga_INCLUDED */ 96