summaryrefslogtreecommitdiff
path: root/src/rdc_vgatool.h
blob: f80d5a269443de16d0119522130abb0827fb1f21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* 
 * Copyright (C) 2009 RDC Semiconductor Co.,Ltd
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * For technical support : 
 *     <jason.lin@rdc.com.tw>
 */



#define NoneDevice                  0x0
#define LCDINDEX                    0x1
#define DVIINDEX                    0x2
#define CRTINDEX                    0x3
#define HDMIINDEX                   0x4
#define HDTVINDEX                   0x5
#define TVINDEX                     0x6
#define LCD2INDEX                   0x7
#define DVI2INDEX                   0x8
#define CRT2INDEX                   0x9
#define HDMI2INDEX                  0xA
#define HDTV2INDEX                  0xB
#define TV2INDEX                    0xC


#define LCDBIT                      0x0001
#define DVIBIT                      0x0002
#define CRTBIT                      0x0004
#define HDMIBIT                     0x0008
#define HDTVBIT                     0x0010
#define TVBIT                       0x0020
#define LCD2BIT                     0x0040
#define DVI2BIT                     0x0080
#define CRT2BIT                     0x0100
#define HDMI2BIT                    0x0200
#define HDTV2BIT                    0x0400
#define TV2BIT                      0x0800


#define VIDEOMEM_SIZE_08M       0x00800000
#define VIDEOMEM_SIZE_16M       0x01000000
#define VIDEOMEM_SIZE_32M       0x02000000
#define VIDEOMEM_SIZE_64M       0x04000000
#define VIDEOMEM_SIZE_128M      0x08000000

#define AR_PORT_WRITE           (pRDC->RelocateIO + 0x40)
#define MISC_PORT_WRITE         (pRDC->RelocateIO + 0x42)
#define SEQ_PORT                (pRDC->RelocateIO + 0x44)
#define DAC_INDEX_WRITE         (pRDC->RelocateIO + 0x48)
#define DAC_DATA                (pRDC->RelocateIO + 0x49)
#define GR_PORT                 (pRDC->RelocateIO + 0x4E)
#define CRTC_PORT               (pRDC->RelocateIO + 0x54)
#define INPUT_STATUS1_READ      (pRDC->RelocateIO + 0x5A)
#define MISC_PORT_READ          (pRDC->RelocateIO + 0x4C)

#define GetReg(base)                    inb(base)
#define SetReg(base,val)                outb(base,val)

#define GetIndexReg(base,index,val)     \
    do {                                \
        outb(base,index);               \
        val = inb(base+1);              \
    } while (0)
                                        
#define SetIndexReg(base,index, val)    \
    do {                                \
        outb(base,index);               \
        outb(base+1,val);                 \
    } while (0)
                                        
#define GetIndexRegMask(base,index, and, val)   \
    do {                                        \
        outb(base,index);                       \
        val = (inb(base+1) & and);              \
    } while (0)
    
#define SetIndexRegMask(base,index, and, val)   \
    do {                                        \
        UCHAR __Temp;                           \
        outb(base,index);                       \
         __Temp = (inb((base)+1)&(and))|(val);  \
        SetIndexReg(base,index,__Temp);         \
    } while (0)

#define VGA_LOAD_PALETTE_INDEX(index, red, green, blue)     \
    {                                                       \
        UCHAR __junk;                                       \
        SetReg(DAC_INDEX_WRITE,(UCHAR)(index));             \
        __junk = GetReg(SEQ_PORT);                          \
        SetReg(DAC_DATA,(UCHAR)(red));                      \
        __junk = GetReg(SEQ_PORT);                          \
        SetReg(DAC_DATA,(UCHAR)(green));                    \
        __junk = GetReg(SEQ_PORT);                          \
        SetReg(DAC_DATA,(UCHAR)(blue));                     \
        __junk = GetReg(SEQ_PORT);                          \
    }