Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

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