Subversion Repositories shark

Rev

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