]> git.karo-electronics.de Git - mv-sheeva.git/blob - drivers/staging/xgifb/vb_util.c
MIPS: Replace deprecated spinlock initialization
[mv-sheeva.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 /* Function : XGINew_SetReg1 */
26 /* Input : */
27 /* Output : */
28 /* Description : SR CRTC GR */
29 /* --------------------------------------------------------------------- */
30 void XGINew_SetReg1(unsigned long port, unsigned short index,
31                 unsigned short data)
32 {
33         outb(index, port);
34         outb(data, port + 1);
35 }
36
37 /* --------------------------------------------------------------------- */
38 /* Function : XGINew_SetReg2 */
39 /* Input : */
40 /* Output : */
41 /* Description : AR( 3C0 ) */
42 /* --------------------------------------------------------------------- */
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 void XGINew_SetReg3(unsigned long port, unsigned short data)
54 {
55         outb(data, port);
56 }
57
58 void XGINew_SetReg4(unsigned long port, unsigned long data)
59 {
60         outl(data, port);
61 }
62
63 unsigned char XGINew_GetReg1(unsigned long port, unsigned short index)
64 {
65         unsigned char data;
66
67         outb(index, port);
68         data = inb(port + 1);
69         return data;
70 }
71
72 unsigned char XGINew_GetReg2(unsigned long port)
73 {
74         unsigned char data;
75
76         data = inb(port);
77
78         return data;
79 }
80
81 unsigned long XGINew_GetReg3(unsigned long port)
82 {
83         unsigned long data;
84
85         data = inl(port);
86
87         return data;
88 }
89
90 void XGINew_SetRegANDOR(unsigned long Port, unsigned short Index,
91                 unsigned short DataAND, unsigned short DataOR)
92 {
93         unsigned short temp;
94
95         temp = XGINew_GetReg1(Port, Index); /* XGINew_Part1Port index 02 */
96         temp = (temp & (DataAND)) | DataOR;
97         XGINew_SetReg1(Port, Index, temp);
98 }
99
100 void XGINew_SetRegAND(unsigned long Port, unsigned short Index,
101                 unsigned short DataAND)
102 {
103         unsigned short temp;
104
105         temp = XGINew_GetReg1(Port, Index); /* XGINew_Part1Port index 02 */
106         temp &= DataAND;
107         XGINew_SetReg1(Port, Index, temp);
108 }
109
110 void XGINew_SetRegOR(unsigned long Port, unsigned short Index,
111                 unsigned short DataOR)
112 {
113         unsigned short temp;
114
115         temp = XGINew_GetReg1(Port, Index); /* XGINew_Part1Port index 02 */
116         temp |= DataOR;
117         XGINew_SetReg1(Port, Index, temp);
118 }
119
120 #if 0
121 void NewDelaySeconds(int seconds)
122 {
123         int i;
124
125         for (i = 0; i < seconds; i++) {
126
127         }
128 }
129
130 void Newdebugcode(unsigned char code)
131 {
132         /* OutPortByte(0x80, code); */
133         /* OutPortByte(0x300, code); */
134         /* NewDelaySeconds(0x3); */
135 }
136 #endif