17 #define COMM_VERSION "1.01"
19 #include <linux/module.h>
22 #include <linux/kernel.h>
23 #include <linux/types.h>
24 #include <linux/wait.h>
34 #define j44(a,b) (((a>>3)&0x0f)|((b<<1)&0xf0))
36 #define P1 w2(5);w2(0xd);w2(0xd);w2(5);w2(4);
37 #define P2 w2(5);w2(7);w2(7);w2(5);w2(4);
43 static int cont_map[2] = { 0x08, 0x10 };
45 static int comm_read_regr(
PIA *pi,
int cont,
int regr )
49 r = regr + cont_map[
cont];
57 case 1:
w0(r+0x20);
P1;
71 static void comm_write_regr(
PIA *pi,
int cont,
int regr,
int val )
75 r = regr + cont_map[
cont];
90 static void comm_connect (
PIA *pi )
101 static void comm_disconnect (
PIA *pi )
108 static void comm_read_block(
PIA *pi,
char *
buf,
int count )
114 case 0:
w0(0x48);
P1;
115 for(i=0;i<
count;i++) {
117 w0(0x80); h =
r1();
w2(4);
122 case 1:
w0(0x68);
P1;
w0(0);
123 for(i=0;i<
count;i++) {
124 w2(0x26); buf[
i] =
r0();
w2(0x24);
130 for (i=0;i<
count;i++) buf[i] =
r4();
135 for (i=0;i<count/2;i++) ((
u16 *)buf)[
i] =
r4w();
140 for (i=0;i<count/4;i++) ((
u32 *)buf)[
i] =
r4l();
149 static void comm_write_block(
PIA *pi,
char * buf,
int count )
156 case 1:
w0(0x68);
P1;
157 for (k=0;k<
count;k++) {
158 w2(5);
w0(buf[k^1]);
w2(7);
164 for (k=0;k<
count;k++)
w4(buf[k^1]);
168 for (k=0;k<count/2;k++)
w4w(pi_swab16(buf,k));
172 for (k=0;k<count/4;k++)
w4l(pi_swab32(buf,k));
181 {
char *mode_string[5] = {
"4-bit",
"8-bit",
"EPP-8",
"EPP-16",
"EPP-32"};
183 printk(
"%s: comm %s, DataStor Commuter at 0x%x, ",
197 .write_regr = comm_write_regr,
198 .read_regr = comm_read_regr,
199 .write_block = comm_write_block,
200 .read_block = comm_read_block,
201 .connect = comm_connect,
202 .disconnect = comm_disconnect,
203 .log_adapter = comm_log_adapter,
206 static int __init comm_init(
void)
211 static void __exit comm_exit(
void)