Subversion Repositories shark

Rev

Rev 54 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
54 pj 1
/* VGAlib version 1.2 - (c) 1993 Tommy Frandsen                    */
2
/*                                                                 */
3
/* This library is free software; you can redistribute it and/or   */
4
/* modify it without any restrictions. This library is distributed */
5
/* in the hope that it will be useful, but without any warranty.   */
6
 
7
/* Multi-chipset support Copyright (c) 1993 Harm Hanemaayer */
8
/* partially copyrighted (C) 1993 by Hartmut Schirmer */
9
 
10
#ifndef _DRIVER_H
11
#define _DRIVER_H
12
 
13
#include <stdio.h>
14
#include <stdarg.h>
15
#include "vga.h"
16
#include "libvga.h"
17
#include "timing.h"
18
#include "accel.h"
19
#include "io.h"
80 pj 20
#include "ll/sys/cdefs.h"
54 pj 21
 
80 pj 22
__BEGIN_DECLS
23
 
54 pj 24
#define MAX_REGS 5000 /* VESA needs a lot of storage space */
25
 
26
extern int inrestore;
27
 
28
typedef struct {
29
    void (*savepalette)(unsigned char *red, unsigned char *green, unsigned char *blue);
30
    void (*restorepalette)(const unsigned char *red,
31
            const unsigned char *green, const unsigned char *blue);
32
    int  (*setpalette)(int index, int red, int green, int blue);
33
    void (*getpalette)(int index, int *red, int *green, int *blue);
34
    void (*savefont)(void);
35
    void (*restorefont)(void);
36
    int (*screenoff)(void);
37
    int (*screenon)(void);
38
    void (*waitretrace)(void);
39
    } Emulation;
40
 
41
typedef struct {
42
/* Basic functions. */
43
    int (*saveregs) (unsigned char regs[]);
44
    void (*setregs) (const unsigned char regs[], int mode);
45
    void (*unlock) (void);
46
    void (*lock) (void);
47
    int (*test) (void);
48
    int (*init) (int force, int par1, int par2);
49
    void (*__svgalib_setpage) (int page);
50
    void (*__svgalib_setrdpage) (int page);
51
    void (*__svgalib_setwrpage) (int page);
52
    int (*setmode) (int mode, int prv_mode);
53
    int (*modeavailable) (int mode);
54
    void (*setdisplaystart) (int address);
55
    void (*setlogicalwidth) (int width);
56
    void (*getmodeinfo) (int mode, vga_modeinfo * modeinfo);
57
/* Obsolete blit functions. */
58
    void (*bitblt) (int srcaddr, int destaddr, int w, int h, int pitch);
59
    void (*imageblt) (void *srcaddr, int destaddr, int w, int h, int pitch);
60
    void (*fillblt) (int destaddr, int w, int h, int pitch, int c);
61
    void (*hlinelistblt) (int ymin, int n, int *xmin, int *xmax, int pitch, int c);
62
    void (*bltwait) (void);
63
/* Other functions. */
64
    int (*ext_set) (unsigned what, va_list params);
65
    int (*accel) (unsigned operation, va_list params);
66
    int (*linear) (int op, int param);
67
    AccelSpecs *accelspecs;
68
    Emulation *emul;
69
    int (*cursor)(int cmd, int p1, int p2, int p3, int p4, void *p5);
70
} DriverSpecs;
71
 
72
extern DriverSpecs __svgalib_vga_driverspecs;
73
extern DriverSpecs __svgalib_neo_driverspecs;
74
extern DriverSpecs __svgalib_cirrus_driverspecs;
75
extern DriverSpecs __svgalib_et4000_driverspecs;
76
extern DriverSpecs __svgalib_tvga8900_driverspecs;
77
extern DriverSpecs __svgalib_oak_driverspecs;
78
extern DriverSpecs __svgalib_ega_driverspecs;
79
extern DriverSpecs __svgalib_s3_driverspecs;
80
extern DriverSpecs __svgalib_r128_driverspecs;
81
extern DriverSpecs __svgalib_mach32_driverspecs;
82
extern DriverSpecs __svgalib_et3000_driverspecs;
83
extern DriverSpecs __svgalib_gvga6400_driverspecs;
84
extern DriverSpecs __svgalib_ark_driverspecs;
85
extern DriverSpecs __svgalib_ati_driverspecs;
86
extern DriverSpecs __svgalib_ali_driverspecs;
87
extern DriverSpecs __svgalib_mach64_driverspecs;
88
extern DriverSpecs __svgalib_chips_driverspecs;
89
extern DriverSpecs __svgalib_apm_driverspecs;
90
extern DriverSpecs __svgalib_nv3_driverspecs;
91
extern DriverSpecs __svgalib_et6000_driverspecs;
92
extern DriverSpecs __svgalib_vesa_driverspecs;
93
extern DriverSpecs __svgalib_mx_driverspecs;
94
extern DriverSpecs __svgalib_paradise_driverspecs;
95
extern DriverSpecs __svgalib_rage_driverspecs;
96
extern DriverSpecs __svgalib_banshee_driverspecs;
97
extern DriverSpecs __svgalib_sis_driverspecs;
98
extern DriverSpecs __svgalib_i740_driverspecs;
99
extern DriverSpecs __svgalib_i810_driverspecs;
100
extern DriverSpecs __svgalib_laguna_driverspecs;
101
extern DriverSpecs __svgalib_fbdev_driverspecs;
102
extern DriverSpecs __svgalib_r128_driverspecs;
103
extern DriverSpecs __svgalib_g400_driverspecs;
104
extern DriverSpecs __svgalib_savage_driverspecs;
105
extern DriverSpecs __svgalib_mil_driverspecs;
106
extern DriverSpecs __svgalib_trident_driverspecs;
107
extern DriverSpecs __svgalib_rendition_driverspecs;
108
extern DriverSpecs __svgalib_g450c2_driverspecs;
109
extern DriverSpecs __svgalib_pm2_driverspecs;
110
 
111
extern DriverSpecs *__svgalib_driverspecs;
112
extern DriverSpecs *__svgalib_driverspecslist[];
113
 
114
enum {
115
    CHIPSET_SAVEREGS = 0, CHIPSET_SETREGS, CHIPSET_UNLOCK, CHIPSET_LOCK,
116
    CHIPSET_TEST, CHIPSET_INIT, CHIPSET_SETPAGE, CHIPSET_SETRDPAGE,
117
    CHIPSET_SETWRPAGE, CHIPSET_SETMODE,
118
    CHIPSET_MODEAVAILABLE, CHIPSET_SETDISPLAYSTART,
119
    CHIPSET_SETLOGICALWIDTH, CHIPSET_GETMODEINFO,
120
    CHIPSET_BITBLT, CHIPSET_IMAGEBLT, CHIPSET_FILLBLT,
121
    CHIPSET_HLINELISTBLT, CHIPSET_BLTWAIT,
122
    CHIPSET_EXT_SET, CHIPSET_ACCEL, CHIPSET_LINEAR
123
};
124
 
125
enum {
126
    LINEAR_QUERY_BASE, LINEAR_QUERY_GRANULARITY, LINEAR_QUERY_RANGE,
127
    LINEAR_ENABLE, LINEAR_DISABLE
128
};
129
 
130
enum { CURSOR_INIT, CURSOR_HIDE, CURSOR_SHOW, CURSOR_POSITION,
131
       CURSOR_SELECT, CURSOR_IMAGE, CURSOR_SAVE
132
};
133
 
134
typedef struct {
135
/* refresh ranges in Hz */
136
    unsigned min;
137
    unsigned max;
138
} RefreshRange;
139
 
140
extern int __svgalib_CRT_I;
141
extern int __svgalib_CRT_D;
142
extern int __svgalib_IS1_R;
143
extern int __svgalib_driver_report;     /* driverreport */
144
extern int __svgalib_videomemoryused;   /* videomemoryused */
145
extern int __svgalib_critical;
146
extern int __svgalib_chipset;
147
extern RefreshRange __svgalib_horizsync;
148
extern RefreshRange __svgalib_vertrefresh;
149
extern int __svgalib_bandwidth;
150
extern int __svgalib_grayscale;
151
extern int __svgalib_modeinfo_linearset;
152
extern const int __svgalib_max_modes;
153
 
154
void __svgalib_read_options(char **commands, char *(*func) (int ind, int mode, char **nptr));
155
char *__svgalib_token(char **nptr);
156
/* ----------------------------------------------------------------------
157
   ** A modetable holds a pair of values
158
   ** for each mode :
159
   **
160
   **    <mode number> <pointer to registers>
161
   **
162
   ** the last entry is marked by
163
   **  
164
   **    <any number>  <NULL>
165
*/
166
 
167
typedef struct {
168
    unsigned short mode_number;
169
    const unsigned char *regs;
170
} ModeTable;
171
 
172
#define DISABLE_MODE      ((unsigned char *)1)
173
#define OneModeEntry(res) {G##res,g##res##_regs}
174
#define DisableEntry(res) {G##res,DISABLE_MODE}
175
#define END_OF_MODE_TABLE { 0, NULL }
176
 
177
extern const unsigned char *__svgalib_mode_in_table(const ModeTable * modes, int mode);
178
#define LOOKUPMODE __svgalib_mode_in_table
179
 
180
/* ---------------------------------------------------------------------- */
181
 
182
extern int __svgalib_hicolor(int dac_type, int mode);
183
/* Enters hicolor mode - 0 for no hi, 1 for 15 bit, 2 for 16, 3 for 24 */
184
/* For any modes it doesn't know about, etc, it attempts to turn hicolor off. */
185
 
186
#define STD_DAC         0
187
#define HI15_DAC        1
188
#define HI16_DAC        2
189
#define TC24_DAC        3
190
 
191
/* ----------------------------------------------------------------------
192
   ** regextr.h  -  extract graphics modes and register information
193
   **               from C source file
194
 */
195
 
196
extern void __svgalib_readmodes(FILE * inp, ModeTable ** modes, int *dac, unsigned *clocks);
197
 
80 pj 198
__END_DECLS
54 pj 199
#endif