2 aten.c (c) 1997-8 Grant R. Guenther <grant@torque.net>
3 Under the terms of the GNU General Public License.
5 aten.c is a low-level protocol driver for the ATEN EH-100
6 parallel port adapter. The EH-100 supports 4-bit and 8-bit
7 modes only. There is also an EH-132 which supports EPP mode
8 transfers. The EH-132 is not yet supported.
14 1.01 GRG 1998.05.05 init_proto, release_proto
18 #define ATEN_VERSION "1.01"
20 #include <linux/module.h>
21 #include <linux/delay.h>
22 #include <linux/kernel.h>
23 #include <linux/wait.h>
24 #include <linux/types.h>
29 #define j44(a,b) ((((a>>4)&0x0f)|(b&0xf0))^0x88)
31 /* cont = 0 - access the IDE register file
32 cont = 1 - access the IDE command set
35 static int cont_map[2] = { 0x08, 0x20 };
37 static void aten_write_regr( PIA *pi, int cont, int regr, int val)
41 r = regr + cont_map[cont] + 0x80;
43 w0(r); w2(0xe); w2(6); w0(val); w2(7); w2(6); w2(0xc);
46 static int aten_read_regr( PIA *pi, int cont, int regr )
50 r = regr + cont_map[cont] + 0x40;
54 case 0: w0(r); w2(0xe); w2(6);
56 a = r1(); w0(0x10); b = r1(); w2(0xc);
60 w0(r); w2(0xe); w2(6); w0(0xff);
61 w2(0x27); w2(0x26); w2(0x20);
69 static void aten_read_block( PIA *pi, char * buf, int count )
75 case 0: w0(0x48); w2(0xe); w2(6);
76 for (k=0;k<count/2;k++) {
78 a = r1(); w0(0x58); b = r1();
79 w2(0); d = r1(); w0(0x48); c = r1();
81 buf[2*k+1] = j44(a,b);
86 case 1: w0(0x58); w2(0xe); w2(6);
87 for (k=0;k<count/2;k++) {
88 w2(0x27); w2(0x26); w2(0x22);
89 a = r0(); w2(0x20); b = r0();
90 buf[2*k] = b; buf[2*k+1] = a;
97 static void aten_write_block( PIA *pi, char * buf, int count )
101 w0(0x88); w2(0xe); w2(6);
102 for (k=0;k<count/2;k++) {
103 w0(buf[2*k+1]); w2(0xe); w2(6);
104 w0(buf[2*k]); w2(7); w2(6);
109 static void aten_connect ( PIA *pi )
111 { pi->saved_r0 = r0();
116 static void aten_disconnect ( PIA *pi )
122 static void aten_log_adapter( PIA *pi, char * scratch, int verbose )
124 { char *mode_string[2] = {"4-bit","8-bit"};
126 printk("%s: aten %s, ATEN EH-100 at 0x%x, ",
127 pi->device,ATEN_VERSION,pi->port);
128 printk("mode %d (%s), delay %d\n",pi->mode,
129 mode_string[pi->mode],pi->delay);
133 static void aten_init_proto( PIA *pi )
138 static void aten_release_proto( PIA *pi )
143 struct pi_protocol aten = {"aten",0,2,2,1,1,
161 int init_module(void)
163 { return pi_register( &aten ) - 1;
166 void cleanup_module(void)
168 { pi_unregister( &aten );
174 MODULE_LICENSE("GPL");