Rev 80 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
54 | pj | 1 | |
2 | #ifndef TIMING_H |
||
3 | #define TIMING_H |
||
4 | |||
5 | /* |
||
6 | * Generic mode timing module. |
||
7 | */ |
||
8 | |||
9 | /* This is the type of a basic (monitor-oriented) mode timing. */ |
||
10 | typedef struct _MMT_S MonitorModeTiming; |
||
11 | struct _MMT_S { |
||
12 | int pixelClock; /* Pixel clock in kHz. */ |
||
13 | int HDisplay; /* Horizontal Timing. */ |
||
14 | int HSyncStart; |
||
15 | int HSyncEnd; |
||
16 | int HTotal; |
||
17 | int VDisplay; /* Vertical Timing. */ |
||
18 | int VSyncStart; |
||
19 | int VSyncEnd; |
||
20 | int VTotal; |
||
21 | int flags; |
||
22 | MonitorModeTiming *next; |
||
23 | }; |
||
24 | |||
25 | /* This is for the hardware (card)-adjusted mode timing. */ |
||
26 | typedef struct { |
||
27 | int pixelClock; /* Pixel clock in kHz. */ |
||
28 | int HDisplay; /* Horizontal Timing. */ |
||
29 | int HSyncStart; |
||
30 | int HSyncEnd; |
||
31 | int HTotal; |
||
32 | int VDisplay; /* Vertical Timing. */ |
||
33 | int VSyncStart; |
||
34 | int VSyncEnd; |
||
35 | int VTotal; |
||
36 | int flags; |
||
37 | /* The following field are optionally filled in according to card */ |
||
38 | /* specific parameters. */ |
||
39 | int programmedClock; /* Actual clock to be programmed. */ |
||
40 | int selectedClockNo; /* Index number of fixed clock used. */ |
||
41 | int CrtcHDisplay; /* Actual programmed horizontal CRTC timing. */ |
||
42 | int CrtcHSyncStart; |
||
43 | int CrtcHSyncEnd; |
||
44 | int CrtcHTotal; |
||
45 | int CrtcVDisplay; /* Actual programmed vertical CRTC timing. */ |
||
46 | int CrtcVSyncStart; |
||
47 | int CrtcVSyncEnd; |
||
48 | int CrtcVTotal; |
||
49 | } ModeTiming; |
||
50 | |||
51 | /* Flags in ModeTiming. */ |
||
52 | #define PHSYNC 0x1 /* Positive hsync polarity. */ |
||
53 | #define NHSYNC 0x2 /* Negative hsync polarity. */ |
||
54 | #define PVSYNC 0x4 /* Positive vsync polarity. */ |
||
55 | #define NVSYNC 0x8 /* Negative vsync polarity. */ |
||
56 | #define INTERLACED 0x10 /* Mode has interlaced timing. */ |
||
57 | #define DOUBLESCAN 0x20 /* Mode uses VGA doublescan (see note). */ |
||
58 | #define HADJUSTED 0x40 /* Horizontal CRTC timing adjusted. */ |
||
59 | #define VADJUSTED 0x80 /* Vertical CRTC timing adjusted. */ |
||
60 | #define USEPROGRCLOCK 0x100 /* A programmable clock is used. */ |
||
61 | #define TVMODE 0x200 |
||
62 | #define TVPAL 0x400 |
||
63 | #define TVNTSC 0x800 |
||
64 | |||
65 | /* |
||
66 | * Note: Double scan implies that each scanline is displayed twice. The |
||
67 | * vertical CRTC timings are programmed to double the effective vertical |
||
68 | * resolution (the CRT still displays 400 scanlines for a 200 line |
||
69 | * resolution). |
||
70 | */ |
||
71 | |||
72 | /* Cards specifications. */ |
||
73 | typedef struct { |
||
74 | int videoMemory; /* Video memory in kilobytes. */ |
||
75 | int maxPixelClock4bpp; /* Maximum pixel clocks in kHz for each depth. */ |
||
76 | int maxPixelClock8bpp; |
||
77 | int maxPixelClock16bpp; |
||
78 | int maxPixelClock24bpp; |
||
79 | int maxPixelClock32bpp; |
||
80 | int flags; /* Flags (e.g. programmable clocks). */ |
||
81 | int nClocks; /* Number of fixed clocks. */ |
||
82 | int *clocks; /* Pointer to array of fixed clock values. */ |
||
83 | int maxHorizontalCrtc; |
||
84 | /* |
||
85 | * The following function maps from a pixel clock and depth to |
||
86 | * the raw clock frequency required. |
||
87 | */ |
||
88 | int (*mapClock) (int bpp, int pixelclock); |
||
89 | /* |
||
90 | * The following function maps from a requested clock value |
||
91 | * to the closest clock that the programmable clock device |
||
92 | * can produce. |
||
93 | */ |
||
94 | int (*matchProgrammableClock) (int desiredclock); |
||
95 | /* |
||
96 | * The following function maps from a pixel clock, depth and |
||
97 | * horizontal CRTC timing parameter to the horizontal timing |
||
98 | * that has to be programmed. |
||
99 | */ |
||
100 | int (*mapHorizontalCrtc) (int bpp, int pixelclock, int htiming); |
||
101 | } CardSpecs; |
||
102 | |||
103 | /* Card flags. */ |
||
104 | /* The card has programmable clocks (matchProgrammableClock is valid). */ |
||
105 | #define CLOCK_PROGRAMMABLE 0x1 |
||
106 | /* For interlaced modes, the vertical timing must be divided by two. */ |
||
107 | #define INTERLACE_DIVIDE_VERT 0x2 |
||
108 | /* For modes with vertical timing greater or equal to 1024, vertical */ |
||
109 | /* timing must be divided by two. */ |
||
110 | #define GREATER_1024_DIVIDE_VERT 0x4 |
||
111 | /* The DAC doesn't support 64K colors (5-6-5) at 16bpp, just 5-5-5. */ |
||
112 | #define NO_RGB16_565 0x8 |
||
113 | /* Card (or driver) can't do interlaced modes */ |
||
114 | #define NO_INTERLACE 0x10 |
||
115 | /* Don't have banked memory - emulated with mmap from linear memory */ |
||
116 | #define EMULATE_BANK 0x20 |
||
117 | |||
118 | /* Mode info. */ |
||
119 | typedef struct { |
||
120 | /* Basic properties. */ |
||
121 | short width; /* Width of the screen in pixels. */ |
||
122 | short height; /* Height of the screen in pixels. */ |
||
123 | char bytesPerPixel; /* Number of bytes per pixel. */ |
||
124 | char bitsPerPixel; /* Number of bits per pixel. */ |
||
125 | char colorBits; /* Number of significant bits in pixel. */ |
||
126 | char __padding1; |
||
127 | /* Truecolor pixel specification. */ |
||
128 | char redWeight; /* Number of significant red bits. */ |
||
129 | char greenWeight; /* Number of significant green bits. */ |
||
130 | char blueWeight; /* Number of significant blue bits. */ |
||
131 | char __padding2; |
||
132 | char redOffset; /* Offset in bits of red value into pixel. */ |
||
133 | char blueOffset; /* Offset of green value. */ |
||
134 | char greenOffset; /* Offset of blue value. */ |
||
135 | char __padding3; |
||
136 | unsigned redMask; /* Pixel mask of read value. */ |
||
137 | unsigned blueMask; /* Pixel mask of green value. */ |
||
138 | unsigned greenMask; /* Pixel mask of blue value. */ |
||
139 | /* Structural properties of the mode. */ |
||
140 | int lineWidth; /* Offset in bytes between scanlines. */ |
||
141 | short realWidth; /* Real on-screen resolution. */ |
||
142 | short realHeight; /* Real on-screen resolution. */ |
||
143 | int flags; |
||
144 | } ModeInfo; |
||
145 | |||
146 | |||
147 | /* Prototypes of functions defined in timing.c. */ |
||
148 | |||
149 | /* |
||
150 | * This function will look up mode timings for a mode matching ModeInfo |
||
151 | * that is within monitor spec and matches the capabilities (clocks etc.) |
||
152 | * of the card. |
||
153 | */ |
||
154 | |||
155 | int __svgalib_getmodetiming( |
||
156 | ModeTiming *, /* Resulting mode timing. */ |
||
157 | ModeInfo *, /* Structural mode info. */ |
||
158 | CardSpecs * /* Card specs (dot clocks etc.). */ |
||
159 | ); |
||
160 | |||
161 | void __svgalib_addusertiming( |
||
162 | MonitorModeTiming * |
||
163 | ); |
||
164 | |||
165 | /* GTF constants */ |
||
166 | #define GTF_lockVF 1 /* Lock to vertical frequency */ |
||
167 | #define GTF_lockHF 2 /* Lock to horizontal frequency */ |
||
168 | #define GTF_lockPF 3 /* Lock to pixel clock frequency*/ |
||
169 | |||
170 | #endif |