upload tizen1.0 source
[kernel/linux-2.6.36.git] / drivers / staging / xgifb / vb_util.c
1 #include "vb_def.h"
2 #include "vgatypes.h"
3 #include "vb_struct.h"
4
5 #include "XGIfb.h"
6 #include <asm/io.h>
7 #include <linux/types.h>
8
9 void XGINew_SetReg1(unsigned long,unsigned short,unsigned short);
10 void XGINew_SetReg2(unsigned long,unsigned short,unsigned short);
11 void XGINew_SetReg3(unsigned long,unsigned short);
12 void XGINew_SetReg4(unsigned long,unsigned long);
13 unsigned char XGINew_GetReg1(unsigned long, unsigned short);
14 unsigned char XGINew_GetReg2(unsigned long);
15 unsigned long XGINew_GetReg3(unsigned long);
16 void XGINew_ClearDAC(unsigned char *);
17 void XGINew_SetRegANDOR(unsigned long Port,unsigned short Index,
18                         unsigned short DataAND,unsigned short DataOR);
19 void XGINew_SetRegOR(unsigned long Port,unsigned short Index,
20                      unsigned short DataOR);
21 void XGINew_SetRegAND(unsigned long Port,unsigned short Index,
22                       unsigned short DataAND);
23
24
25 /* --------------------------------------------------------------------- */
26 /* Function : XGINew_SetReg1 */
27 /* Input : */
28 /* Output : */
29 /* Description : SR CRTC GR */
30 /* --------------------------------------------------------------------- */
31 void XGINew_SetReg1( unsigned long port , unsigned short index , unsigned short data )
32 {
33         outb(index, port);
34         outb(data, port + 1);
35 }
36
37
38 /* --------------------------------------------------------------------- */
39 /* Function : XGINew_SetReg2 */
40 /* Input : */
41 /* Output : */
42 /* Description : AR( 3C0 ) */
43 /* --------------------------------------------------------------------- */
44 /*void XGINew_SetReg2( unsigned long port , unsigned short index , unsigned short data )
45 {
46     InPortByte((P unsigned char )port + 0x3da - 0x3c0) ;
47     OutPortByte( XGINew_P3c0 , index ) ;
48     OutPortByte( XGINew_P3c0 , data ) ;
49     OutPortByte( XGINew_P3c0 , 0x20 ) ;
50 }*/
51
52
53 /* --------------------------------------------------------------------- */
54 /* Function : */
55 /* Input : */
56 /* Output : */
57 /* Description : */
58 /* --------------------------------------------------------------------- */
59 void XGINew_SetReg3( unsigned long port , unsigned short data )
60 {
61         outb(data, port);
62 }
63
64
65 /* --------------------------------------------------------------------- */
66 /* Function : XGINew_SetReg4 */
67 /* Input : */
68 /* Output : */
69 /* Description : */
70 /* --------------------------------------------------------------------- */
71 void XGINew_SetReg4( unsigned long port , unsigned long data )
72 {
73         outl(data, port);
74 }
75
76
77 /* --------------------------------------------------------------------- */
78 /* Function : XGINew_GetReg1 */
79 /* Input : */
80 /* Output : */
81 /* Description : */
82 /* --------------------------------------------------------------------- */
83 unsigned char XGINew_GetReg1(unsigned long port, unsigned short index)
84 {
85     unsigned char data ;
86
87     outb(index, port);
88     data = inb(port + 1) ;
89     return( data ) ;
90 }
91
92
93 /* --------------------------------------------------------------------- */
94 /* Function : XGINew_GetReg2 */
95 /* Input : */
96 /* Output : */
97 /* Description : */
98 /* --------------------------------------------------------------------- */
99 unsigned char XGINew_GetReg2(unsigned long port)
100 {
101     unsigned char data ;
102
103     data = inb(port) ;
104
105     return( data ) ;
106 }
107
108
109 /* --------------------------------------------------------------------- */
110 /* Function : XGINew_GetReg3 */
111 /* Input : */
112 /* Output : */
113 /* Description : */
114 /* --------------------------------------------------------------------- */
115 unsigned long XGINew_GetReg3( unsigned long port )
116 {
117     unsigned long data ;
118
119     data = inl(port) ;
120
121     return( data ) ;
122 }
123
124
125
126 /* --------------------------------------------------------------------- */
127 /* Function : XGINew_SetRegANDOR */
128 /* Input : */
129 /* Output : */
130 /* Description : */
131 /* --------------------------------------------------------------------- */
132 void XGINew_SetRegANDOR( unsigned long Port , unsigned short Index , unsigned short DataAND , unsigned short DataOR )
133 {
134     unsigned short temp ;
135
136     temp = XGINew_GetReg1( Port , Index ) ;             /* XGINew_Part1Port index 02 */
137     temp = ( temp & ( DataAND ) ) | DataOR ;
138     XGINew_SetReg1( Port , Index , temp ) ;
139 }
140
141
142 /* --------------------------------------------------------------------- */
143 /* Function : XGINew_SetRegAND */
144 /* Input : */
145 /* Output : */
146 /* Description : */
147 /* --------------------------------------------------------------------- */
148 void XGINew_SetRegAND(unsigned long Port,unsigned short Index,unsigned short DataAND)
149 {
150     unsigned short temp ;
151
152     temp = XGINew_GetReg1( Port , Index ) ;     /* XGINew_Part1Port index 02 */
153     temp &= DataAND ;
154     XGINew_SetReg1( Port , Index , temp ) ;
155 }
156
157
158 /* --------------------------------------------------------------------- */
159 /* Function : XGINew_SetRegOR */
160 /* Input : */
161 /* Output : */
162 /* Description : */
163 /* --------------------------------------------------------------------- */
164 void XGINew_SetRegOR( unsigned long Port , unsigned short Index , unsigned short DataOR )
165 {
166     unsigned short temp ;
167
168     temp = XGINew_GetReg1( Port , Index ) ;     /* XGINew_Part1Port index 02 */
169     temp |= DataOR ;
170     XGINew_SetReg1( Port , Index , temp ) ;
171 }
172
173
174 /* --------------------------------------------------------------------- */
175 /* Function : NewDelaySecond */
176 /* Input : */
177 /* Output : */
178 /* Description : */
179 /* --------------------------------------------------------------------- */
180 void NewDelaySeconds( int seconds )
181 {
182     int i ;
183
184
185     for( i = 0 ; i < seconds ; i++ )
186     {
187
188
189
190     }
191 }
192
193
194 /* --------------------------------------------------------------------- */
195 /* Function : Newdebugcode */
196 /* Input : */
197 /* Output : */
198 /* Description : */
199 /* --------------------------------------------------------------------- */
200 void Newdebugcode(unsigned char code)
201 {
202 //    OutPortByte ( 0x80 , code ) ;
203     /* OutPortByte ( 0x300 , code ) ; */
204     /* NewDelaySeconds( 0x3 ) ; */
205 }
206
207
208