vb_util.c revision b649c827a90969f586a6595af9b9040b1f6b75b4
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#include "vb_util.h" 10 11/* --------------------------------------------------------------------- */ 12/* Function : XGINew_SetReg1 */ 13/* Input : */ 14/* Output : */ 15/* Description : SR CRTC GR */ 16/* --------------------------------------------------------------------- */ 17void XGINew_SetReg1(unsigned long port, unsigned short index, 18 unsigned short data) 19{ 20 outb(index, port); 21 outb(data, port + 1); 22} 23 24void XGINew_SetReg3(unsigned long port, unsigned short data) 25{ 26 outb(data, port); 27} 28 29void XGINew_SetReg4(unsigned long port, unsigned long data) 30{ 31 outl(data, port); 32} 33 34unsigned char XGINew_GetReg1(unsigned long port, unsigned short index) 35{ 36 unsigned char data; 37 38 outb(index, port); 39 data = inb(port + 1); 40 return data; 41} 42 43unsigned char XGINew_GetReg2(unsigned long port) 44{ 45 unsigned char data; 46 47 data = inb(port); 48 49 return data; 50} 51 52unsigned long XGINew_GetReg3(unsigned long port) 53{ 54 unsigned long data; 55 56 data = inl(port); 57 58 return data; 59} 60 61void XGINew_SetRegANDOR(unsigned long Port, unsigned short Index, 62 unsigned short DataAND, unsigned short DataOR) 63{ 64 unsigned short temp; 65 66 temp = XGINew_GetReg1(Port, Index); /* XGINew_Part1Port index 02 */ 67 temp = (temp & (DataAND)) | DataOR; 68 XGINew_SetReg1(Port, Index, temp); 69} 70 71void XGINew_SetRegAND(unsigned long Port, unsigned short Index, 72 unsigned short DataAND) 73{ 74 unsigned short temp; 75 76 temp = XGINew_GetReg1(Port, Index); /* XGINew_Part1Port index 02 */ 77 temp &= DataAND; 78 XGINew_SetReg1(Port, Index, temp); 79} 80 81void XGINew_SetRegOR(unsigned long Port, unsigned short Index, 82 unsigned short DataOR) 83{ 84 unsigned short temp; 85 86 temp = XGINew_GetReg1(Port, Index); /* XGINew_Part1Port index 02 */ 87 temp |= DataOR; 88 XGINew_SetReg1(Port, Index, temp); 89} 90