16 #define DSTR_VERSION "1.01"
18 #include <linux/module.h>
21 #include <linux/kernel.h>
22 #include <linux/types.h>
23 #include <linux/wait.h>
35 #define j44(a,b) (((a>>3)&0x07)|((~a>>4)&0x08)|((b<<1)&0x70)|((~b)&0x80))
37 #define P1 w2(5);w2(0xd);w2(5);w2(4);
38 #define P2 w2(5);w2(7);w2(5);w2(4);
39 #define P3 w2(6);w2(4);w2(6);w2(4);
45 static int cont_map[2] = { 0x20, 0x40 };
47 static int dstr_read_regr(
PIA *pi,
int cont,
int regr )
51 r = regr + cont_map[
cont];
54 if (pi->
mode) {
w0(0x11); }
else {
w0(1); }
62 case 1:
w0(0);
w2(0x26); a =
r0();
w2(4);
67 case 4:
w2(0x24); a =
r4();
w2(4);
74 static void dstr_write_regr(
PIA *pi,
int cont,
int regr,
int val )
78 r = regr + cont_map[
cont];
81 if (pi->
mode >= 2) {
w0(0x11); }
else {
w0(1); }
97 #define CCP(x) w0(0xff);w2(0xc);w2(4);\
98 w0(0xaa);w0(0x55);w0(0);w0(0xff);w0(0x87);w0(0x78);\
101 static void dstr_connect (
PIA *pi )
108 static void dstr_disconnect (
PIA *pi )
115 static void dstr_read_block(
PIA *pi,
char *
buf,
int count )
120 if (pi->
mode) {
w0(0x19); }
else {
w0(9); }
125 case 0:
for (k=0;k<
count;k++) {
133 for (k=0;k<
count;k++) {
134 w2(0x26); buf[
k] =
r0();
w2(0x24);
140 for (k=0;k<
count;k++) buf[k] =
r4();
145 for (k=0;k<count/2;k++) ((
u16 *)buf)[
k] =
r4w();
150 for (k=0;k<count/4;k++) ((
u32 *)buf)[
k] =
r4l();
157 static void dstr_write_block(
PIA *pi,
char * buf,
int count )
162 if (pi->
mode) {
w0(0x19); }
else {
w0(9); }
168 case 1:
for (k=0;k<
count;k++) {
175 for (k=0;k<
count;k++)
w4(buf[k]);
180 for (k=0;k<count/2;k++)
w4w(((
u16 *)buf)[k]);
185 for (k=0;k<count/4;k++)
w4l(((
u32 *)buf)[k]);
195 {
char *mode_string[5] = {
"4-bit",
"8-bit",
"EPP-8",
198 printk(
"%s: dstr %s, DataStor EP2000 at 0x%x, ",
212 .write_regr = dstr_write_regr,
213 .read_regr = dstr_read_regr,
214 .write_block = dstr_write_block,
215 .read_block = dstr_read_block,
216 .connect = dstr_connect,
217 .disconnect = dstr_disconnect,
218 .log_adapter = dstr_log_adapter,
221 static int __init dstr_init(
void)
226 static void __exit dstr_exit(
void)