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