Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
54 | pj | 1 | /* |
2 | * ramdac.h: |
||
3 | * |
||
4 | * Structures and functions for programmable ramdac support. |
||
5 | */ |
||
6 | |||
7 | /* DacMethods type. */ |
||
8 | |||
9 | typedef struct { |
||
10 | int id; |
||
11 | char *name; |
||
12 | int flags; |
||
13 | /* |
||
14 | * The following function tries to detect the DAC; |
||
15 | * returns nonzero if succesful. |
||
16 | */ |
||
17 | int (*probe) (void); |
||
18 | /* |
||
19 | * The following function initializes the DAC; it is usually |
||
20 | * called once after detection. |
||
21 | */ |
||
22 | void (*initialize) (void); |
||
23 | /* |
||
24 | * The following function fills in dot clock limits, and |
||
25 | * mapping functions for the raw clock and horizontal |
||
26 | * CRTC timing, in the cardspecs structure. |
||
27 | * |
||
28 | * dacspeed is the max pixel clock in kHz the dac can handle, |
||
29 | * or 0 for default. |
||
30 | */ |
||
31 | void (*qualifyCardSpecs) (CardSpecs * cardspecs, int dacspeed); |
||
32 | /* |
||
33 | * The following function saves RAMDAC registers into regs. |
||
34 | */ |
||
35 | void (*saveState) (unsigned char *regs); |
||
36 | /* |
||
37 | * The following function sets the RAMDAC registers with the |
||
38 | * values from regs. |
||
39 | */ |
||
40 | void (*restoreState) (const unsigned char *regs); |
||
41 | /* |
||
42 | * The following function sets up the RAMDAC register values |
||
43 | * for the desired color operating mode. If the DAC has |
||
44 | * programmable clocks, it should also program the clock. |
||
45 | */ |
||
46 | void (*initializeState) (unsigned char *regs, int bpp, int colormode, |
||
47 | int pixelclock); |
||
48 | int stateSize; /* Size in bytes of the state (saved registers). */ |
||
49 | } DacMethods; |
||
50 | |||
51 | /* IDs */ |
||
52 | |||
53 | #define NORMAL_DAC 1 |
||
54 | #define S3_GENDAC 2 /* S3-GenDAC (8-bit DAC). */ |
||
55 | #define S3_SDAC 3 /* S3-SDAC (16-bit DAC). */ |
||
56 | #define TRIO64 4 /* Trio64 internal DAC. */ |
||
57 | #define SIERRA_32K 5 /* Basic DAC with 32K color mode support. */ |
||
58 | #define ATT20C490 6 /* Standard AT&T 8-bit DAC with truecolor. */ |
||
59 | #define ATT20C498 7 /* Standard AT&T 16-bit DAC. */ |
||
60 | #define IC_WORKS 8 /* IC Works DAC (16-bit ZoomDac). */ |
||
61 | #define SIERRA_15025 9 /* Sierra SC15025/26 DAC. */ |
||
62 | #define IBMRGB52x 10 /* IBM RGB52x Palette DAC. */ |
||
63 | #define SIERRA_1148X 11 /* Sierra SC1148x DAC. */ |
||
64 | |||
65 | /* Flags. */ |
||
66 | |||
67 | #define DAC_HAS_PROGRAMMABLE_CLOCKS 0x1 |
||
68 | |||
69 | /* Color modes. */ |
||
70 | |||
71 | #define CLUT8_6 0 |
||
72 | #define CLUT8_8 1 |
||
73 | #define RGB16_555 2 |
||
74 | #define RGB16_565 3 |
||
75 | #define RGB24_888_B 4 /* 3 bytes per pixel, blue byte first. */ |
||
76 | #define RGB32_888_B 5 /* 4 bytes per pixel. */ |
||
77 | |||
78 | /* State size */ |
||
79 | #define MAX_DAC_STATE 0x101 /* IBMRGB has this many */ |
||
80 | |||
81 | /* RAMDAC methods */ |
||
82 | |||
83 | #ifdef INCLUDE_NORMAL_DAC |
||
84 | extern DacMethods __svgalib_normal_dac_methods; |
||
85 | #endif |
||
86 | #ifdef INCLUDE_S3_SDAC_DAC |
||
87 | extern DacMethods __svgalib_S3_SDAC_methods; |
||
88 | #endif |
||
89 | #ifdef INCLUDE_S3_GENDAC_DAC |
||
90 | extern DacMethods __svgalib_S3_GENDAC_methods; |
||
91 | #endif |
||
92 | #ifdef INCLUDE_S3_TRIO64_DAC |
||
93 | extern DacMethods __svgalib_Trio64_methods; |
||
94 | #endif |
||
95 | #ifdef INCLUDE_SIERRA_DAC |
||
96 | extern DacMethods __svgalib_Sierra_32K_methods; |
||
97 | #endif |
||
98 | #ifdef INCLUDE_SC15025_DAC |
||
99 | extern DacMethods __svgalib_SC15025_methods; |
||
100 | #endif |
||
101 | #ifdef INCLUDE_ATT20C490_DAC |
||
102 | extern DacMethods __svgalib_ATT20C490_methods; |
||
103 | #endif |
||
104 | #ifdef INCLUDE_ATT20C498_DAC |
||
105 | extern DacMethods __svgalib_ATT20C498_methods; |
||
106 | #endif |
||
107 | #ifdef INCLUDE_ICW_DAC |
||
108 | extern DacMethods __svgalib_ICW_methods; |
||
109 | #endif |
||
110 | #ifdef INCLUDE_IBMRGB52x_DAC |
||
111 | extern DacMethods __svgalib_IBMRGB52x_methods; |
||
112 | #endif |
||
113 | #ifdef INCLUDE_SC1148X_DAC |
||
114 | extern DacMethods __svgalib_SC1148X_methods; |
||
115 | #endif |
||
116 | #ifdef INCLUDE_ICS_GENDAC_DAC |
||
117 | extern DacMethods __svgalib_ICS_GENDAC_methods; |
||
118 | #endif |
||
119 | |||
120 | extern DacMethods *__svgalib_all_dacs[]; /* List of all defined DACs. */ |
||
121 | |||
122 | /* Functions defined in ramdac.c. */ |
||
123 | |||
124 | /* |
||
125 | * The following function probes the DACs in daclist, which must be |
||
126 | * terminated by NULL. It returns the detected DAC if succesful, NULL |
||
127 | * otherwise. The detected DAC is also initialized. |
||
128 | */ |
||
129 | |||
130 | DacMethods *__svgalib_probeDacs(DacMethods ** daclist); |
||
131 | |||
132 | /* |
||
133 | * Internal functions (not meant for export, but no such mechanism in C) |
||
134 | */ |
||
135 | int __svgalib_setDacSpeed(int dacspeed, int defspeed); |
||
136 | |||
137 | void __svgalib_Sierra_32K_savestate(unsigned char *regs); |
||
138 | void __svgalib_Sierra_32K_restorestate(const unsigned char *regs); |
||
139 | |||
140 | #ifdef __OPTIMIZE__ |
||
141 | static __inline__ void _ramdac_dactocomm(void) |
||
142 | { |
||
143 | inb(PEL_IW); |
||
144 | inb(PEL_MSK); |
||
145 | inb(PEL_MSK); |
||
146 | inb(PEL_MSK); |
||
147 | inb(PEL_MSK); |
||
148 | } |
||
149 | |||
150 | static __inline__ void _ramdac_dactopel(void) |
||
151 | { |
||
152 | inb(PEL_IW); |
||
153 | } |
||
154 | |||
155 | static __inline__ unsigned char _ramdac_setcomm(unsigned char data) |
||
156 | { |
||
157 | _ramdac_dactocomm(); |
||
158 | outb(PEL_MSK, data); |
||
159 | _ramdac_dactocomm(); |
||
160 | return inb(PEL_MSK); |
||
161 | } |
||
162 | #else |
||
163 | void _ramdac_dactocomm(void); |
||
164 | void _ramdac_dactopel(void); |
||
165 | unsigned char _ramdac_setcomm(unsigned char data); |
||
166 | #endif |