This source file includes following definitions.
- pi_swab16
- pi_swab32
1 #ifndef __DRIVERS_PARIDE_H__
2 #define __DRIVERS_PARIDE_H__
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #define PARIDE_H_VERSION "1.01"
19
20
21
22
23
24
25 #define PI_PD 0
26 #define PI_PCD 1
27 #define PI_PF 2
28 #define PI_PT 3
29 #define PI_PG 4
30
31
32
33
34
35
36 struct pi_adapter {
37
38 struct pi_protocol *proto;
39 int port;
40 int mode;
41 int delay;
42 int devtype;
43 char *device;
44 int unit;
45 int saved_r0;
46 int saved_r2;
47 int reserved;
48 unsigned long private;
49
50 wait_queue_head_t parq;
51 void *pardev;
52 char *parname;
53 int claimed;
54 void (*claim_cont)(void);
55 };
56
57 typedef struct pi_adapter PIA;
58
59
60
61 extern int pi_init(PIA *pi,
62 int autoprobe,
63 int port,
64 int mode,
65 int unit,
66 int protocol,
67 int delay,
68 char * scratch,
69 int devtype,
70 int verbose,
71 char *device
72 );
73
74 extern void pi_release(PIA *pi);
75
76
77
78
79
80
81
82
83 extern void pi_write_regr(PIA *pi, int cont, int regr, int val);
84
85 extern int pi_read_regr(PIA *pi, int cont, int regr);
86
87 extern void pi_write_block(PIA *pi, char * buf, int count);
88
89 extern void pi_read_block(PIA *pi, char * buf, int count);
90
91 extern void pi_connect(PIA *pi);
92
93 extern void pi_disconnect(PIA *pi);
94
95 extern void pi_do_claimed(PIA *pi, void (*cont)(void));
96 extern int pi_schedule_claimed(PIA *pi, void (*cont)(void));
97
98
99
100 #define delay_p (pi->delay?udelay(pi->delay):(void)0)
101 #define out_p(offs,byte) outb(byte,pi->port+offs); delay_p;
102 #define in_p(offs) (delay_p,inb(pi->port+offs))
103
104 #define w0(byte) {out_p(0,byte);}
105 #define r0() (in_p(0) & 0xff)
106 #define w1(byte) {out_p(1,byte);}
107 #define r1() (in_p(1) & 0xff)
108 #define w2(byte) {out_p(2,byte);}
109 #define r2() (in_p(2) & 0xff)
110 #define w3(byte) {out_p(3,byte);}
111 #define w4(byte) {out_p(4,byte);}
112 #define r4() (in_p(4) & 0xff)
113 #define w4w(data) {outw(data,pi->port+4); delay_p;}
114 #define w4l(data) {outl(data,pi->port+4); delay_p;}
115 #define r4w() (delay_p,inw(pi->port+4)&0xffff)
116 #define r4l() (delay_p,inl(pi->port+4)&0xffffffff)
117
118 static inline u16 pi_swab16( char *b, int k)
119
120 { union { u16 u; char t[2]; } r;
121
122 r.t[0]=b[2*k+1]; r.t[1]=b[2*k];
123 return r.u;
124 }
125
126 static inline u32 pi_swab32( char *b, int k)
127
128 { union { u32 u; char f[4]; } r;
129
130 r.f[0]=b[4*k+1]; r.f[1]=b[4*k];
131 r.f[2]=b[4*k+3]; r.f[3]=b[4*k+2];
132 return r.u;
133 }
134
135 struct pi_protocol {
136
137 char name[8];
138 int index;
139
140 int max_mode;
141 int epp_first;
142
143 int default_delay;
144 int max_units;
145
146 void (*write_regr)(PIA *,int,int,int);
147 int (*read_regr)(PIA *,int,int);
148 void (*write_block)(PIA *,char *,int);
149 void (*read_block)(PIA *,char *,int);
150
151 void (*connect)(PIA *);
152 void (*disconnect)(PIA *);
153
154 int (*test_port)(PIA *);
155 int (*probe_unit)(PIA *);
156 int (*test_proto)(PIA *,char *,int);
157 void (*log_adapter)(PIA *,char *,int);
158
159 int (*init_proto)(PIA *);
160 void (*release_proto)(PIA *);
161 struct module *owner;
162 };
163
164 typedef struct pi_protocol PIP;
165
166 extern int paride_register( PIP * );
167 extern void paride_unregister ( PIP * );
168 void *pi_register_driver(char *);
169 void pi_unregister_driver(void *);
170
171 #endif
172