Rev 80 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
80 | pj | 1 | #include "ll/sys/cdefs.h" |
54 | pj | 2 | |
80 | pj | 3 | __BEGIN_DECLS |
54 | pj | 4 | |
80 | pj | 5 | |
54 | pj | 6 | /* Register indices into mode state array. */ |
7 | |||
8 | #define VGA_CRTC_COUNT 24 |
||
9 | #define VGA_ATC_COUNT 21 |
||
10 | #define VGA_GRAPHICS_COUNT 9 |
||
11 | #define VGA_SEQUENCER_COUNT 5 |
||
12 | |||
13 | #define VGA_CRTC_OFFSET 0 /* 24 registers */ |
||
14 | #define VGA_ATC_OFFSET 24 /* 21 registers */ |
||
15 | #define VGA_GRAPHICS_OFFSET 45 /* 9 registers. */ |
||
16 | #define VGA_SEQUENCER_OFFSET 54 /* 5 registers. */ |
||
17 | #define VGA_MISCOUTPUT 59 /* (single register) */ |
||
18 | #define VGA_TOTAL_REGS 60 |
||
19 | |||
20 | /* Total of 60 registers. */ |
||
21 | |||
22 | #define VGAREG_CR(i) (i) |
||
23 | #define VGAREG_AR(i) (i + VGA_ATC_OFFSET) |
||
24 | #define VGAREG_GR(i) (i + VGA_GRAPHICS_OFFSET) |
||
25 | #define VGAREG_SR(i) (i + VGA_SEQUENCER_OFFSET) |
||
26 | |||
27 | #define VGA_CR0 VGAREG_CR(0x00) |
||
28 | #define VGA_CR1 VGAREG_CR(0x01) |
||
29 | #define VGA_CR2 VGAREG_CR(0x02) |
||
30 | #define VGA_CR3 VGAREG_CR(0x03) |
||
31 | #define VGA_CR4 VGAREG_CR(0x04) |
||
32 | #define VGA_CR5 VGAREG_CR(0x05) |
||
33 | #define VGA_CR6 VGAREG_CR(0x06) |
||
34 | #define VGA_CR7 VGAREG_CR(0x07) |
||
35 | #define VGA_CR8 VGAREG_CR(0x08) |
||
36 | #define VGA_CR9 VGAREG_CR(0x09) |
||
37 | #define VGA_CRA VGAREG_CR(0x0A) |
||
38 | #define VGA_CRB VGAREG_CR(0x0B) |
||
39 | #define VGA_CRC VGAREG_CR(0x0C) |
||
40 | #define VGA_CRD VGAREG_CR(0x0D) |
||
41 | #define VGA_CRE VGAREG_CR(0x0E) |
||
42 | #define VGA_CRF VGAREG_CR(0x0F) |
||
43 | #define VGA_CR10 VGAREG_CR(0x10) |
||
44 | #define VGA_CR11 VGAREG_CR(0x11) |
||
45 | #define VGA_CR12 VGAREG_CR(0x12) |
||
46 | #define VGA_CR13 VGAREG_CR(0x13) |
||
47 | #define VGA_SCANLINEOFFSET VGAREG_CR(0x13) |
||
48 | #define VGA_CR14 VGAREG_CR(0x14) |
||
49 | #define VGA_CR15 VGAREG_CR(0x15) |
||
50 | #define VGA_CR16 VGAREG_CR(0x16) |
||
51 | #define VGA_CR17 VGAREG_CR(0x17) |
||
52 | #define VGA_CR18 VGAREG_CR(0x18) |
||
53 | |||
54 | #define VGA_AR0 VGAREG_AR(0x00) |
||
55 | #define VGA_AR10 VGAREG_AR(0x10) |
||
56 | #define VGA_AR11 VGAREG_AR(0x11) |
||
57 | #define VGA_AR12 VGAREG_AR(0x12) |
||
58 | #define VGA_AR13 VGAREG_AR(0x13) |
||
59 | #define VGA_AR14 VGAREG_AR(0x14) |
||
60 | |||
61 | #define VGA_GR0 VGAREG_GR(0x00) |
||
62 | #define VGA_GR1 VGAREG_GR(0x01) |
||
63 | #define VGA_GR2 VGAREG_GR(0x02) |
||
64 | #define VGA_GR3 VGAREG_GR(0x03) |
||
65 | #define VGA_GR4 VGAREG_GR(0x04) |
||
66 | #define VGA_GR5 VGAREG_GR(0x05) |
||
67 | #define VGA_GR6 VGAREG_GR(0x06) |
||
68 | #define VGA_GR7 VGAREG_GR(0x07) |
||
69 | #define VGA_GR8 VGAREG_GR(0x08) |
||
70 | |||
71 | #define VGA_SR0 VGAREG_SR(0x00) |
||
72 | #define VGA_SR1 VGAREG_SR(0x01) |
||
73 | #define VGA_SR2 VGAREG_SR(0x02) |
||
74 | #define VGA_SR3 VGAREG_SR(0x03) |
||
75 | #define VGA_SR4 VGAREG_SR(0x04) |
||
76 | |||
77 | |||
78 | /* |
||
79 | * Set the bits bytemask in variable bytevar with the value of bits |
||
80 | * valuemask in value (masks must match, but may be shifted relative |
||
81 | * to eachother). With proper masks, should optimize into shifts. |
||
82 | */ |
||
83 | |||
84 | #define SETBITSFROMVALUE(bytevar, bytemask, value, valuemask) \ |
||
85 | if (valuemask > bytemask) \ |
||
86 | bytevar = (bytevar & (~(unsigned char)bytemask)) \ |
||
87 | | (((value) & valuemask) / (valuemask / bytemask)); \ |
||
88 | else \ |
||
89 | bytevar = (bytevar & (~(unsigned char)bytemask)) \ |
||
90 | | (((value) & valuemask) * (bytemask / valuemask)); |
||
91 | |||
92 | /* |
||
93 | * Set bits bytemask in bytevar, with value bits (no shifting). |
||
94 | */ |
||
95 | |||
96 | #define SETBITS(bytevar, bytemask, bits) \ |
||
97 | bytevar = (bytevar & (~(unsigned char)bytemask)) + bits; |
||
98 | |||
85 | giacomo | 99 | #ifdef min |
100 | #undef min |
||
101 | #endif |
||
54 | pj | 102 | #define min(x, y) ((x) < (y) ? (x) : (y)) |
103 | #define LIMIT(var, lim) if (var > lim) var = lim; |
||
104 | |||
105 | |||
106 | /* Prototypes of functions defined in vgaregs.c. */ |
||
107 | |||
108 | void __svgalib_setup_VGA_registers( |
||
109 | unsigned char *moderegs, |
||
110 | ModeTiming * modetiming, |
||
111 | ModeInfo * modeinfo |
||
112 | ); |
||
113 | |||
114 | #define __svgalib_inGR __svgalib_ingra |
||
115 | #define __svgalib_outGR __svgalib_outgra |
||
116 | #define __svgalib_outbGR __svgalib_outgra |
||
117 | #define __svgalib_inSR __svgalib_inseq |
||
118 | #define __svgalib_outSR __svgalib_outseq |
||
119 | #define __svgalib_outbSR __svgalib_outseq |
||
120 | #define __svgalib_inCR __svgalib_incrtc |
||
121 | #define __svgalib_outCR __svgalib_outcrtc |
||
122 | #define __svgalib_outbCR __svgalib_outcrtc |
||
80 | pj | 123 | |
124 | __END_DECLS |