vb_util.c revision 84c7603c3888da8ee69802ad4f4647f94d18e2c5
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 12void XGINew_SetReg1( ULONG , USHORT , USHORT ) ; 13void XGINew_SetReg2( ULONG , USHORT , USHORT ) ; 14void XGINew_SetReg3( ULONG , USHORT ) ; 15void XGINew_SetReg4( ULONG , ULONG ) ; 16UCHAR XGINew_GetReg1( ULONG , USHORT) ; 17UCHAR XGINew_GetReg2( ULONG ) ; 18ULONG XGINew_GetReg3( ULONG ) ; 19void XGINew_ClearDAC( PUCHAR ) ; 20void XGINew_SetRegANDOR(ULONG Port,USHORT Index,USHORT DataAND,USHORT DataOR); 21void XGINew_SetRegOR(ULONG Port,USHORT Index,USHORT DataOR); 22void 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/* --------------------------------------------------------------------- */ 31void 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/* --------------------------------------------------------------------- */ 59void 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/* --------------------------------------------------------------------- */ 71void 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/* --------------------------------------------------------------------- */ 83UCHAR 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/* --------------------------------------------------------------------- */ 100UCHAR 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/* --------------------------------------------------------------------- */ 116ULONG 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/* --------------------------------------------------------------------- */ 133void 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/* --------------------------------------------------------------------- */ 149void 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/* --------------------------------------------------------------------- */ 165void 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/* --------------------------------------------------------------------- */ 181void 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/* --------------------------------------------------------------------- */ 203void Newdebugcode( UCHAR code ) 204{ 205// OutPortByte ( 0x80 , code ) ; 206 /* OutPortByte ( 0x300 , code ) ; */ 207 /* NewDelaySeconds( 0x3 ) ; */ 208} 209 210 211 212