19 #include <linux/module.h>
21 #include <linux/parport.h>
23 #include <linux/kernel.h>
26 #include <linux/sched.h>
30 #ifdef CONFIG_LP_CONSOLE
35 #define DPRINTK(stuff...) printk (stuff)
37 #define DPRINTK(stuff...)
42 static void parport_ieee1284_wakeup (
struct parport *
port)
48 static void timeout_waiting_on_port (
unsigned long cookie)
50 parport_ieee1284_wakeup (port_from_cookie[cookie %
PARPORT_MAX]);
81 timer.
function = timeout_waiting_on_port;
91 destroy_timer_on_stack(&timer);
126 int count = usec / 5 + 2;
129 for (i = 0; i <
count; i++) {
131 if ((status & mask) == result)
175 unsigned long deadline;
211 if ((status & mask) == result)
225 #ifdef CONFIG_PARPORT_1284
227 static void parport_ieee1284_terminate (
struct parport *
port)
336 #ifndef CONFIG_PARPORT_1284
339 printk (
KERN_ERR "parport: IEEE1284 not supported in this kernel\n");
360 parport_ieee1284_terminate (port);
417 "%s: Peripheral not IEEE1284 compliant (0x%02X)\n",
441 "%s: Mode 0x%02x not supported? (0x%02x)\n",
442 port->
name, mode, port->
ops->read_status (port));
443 parport_ieee1284_terminate (port);
450 if (mode && !xflag) {
454 parport_ieee1284_terminate (port);
459 if (mode & IEEE1284_EXT_LINK) {
474 "%s: Event 52 didn't happen\n",
476 parport_ieee1284_terminate (port);
492 "%s: Mode 0x%02x not supported? (0x%02x)\n",
494 port->
ops->read_status (port));
495 parport_ieee1284_terminate (port);
506 "supported\n", port->
name, mode);
507 parport_ieee1284_terminate (port);
539 }
else switch (mode) {
559 #ifdef CONFIG_PARPORT_1284
560 static int parport_ieee1284_ack_data_avail (
struct parport *port)
577 parport_ieee1284_wakeup (port);
579 #ifdef CONFIG_PARPORT_1284
584 parport_ieee1284_ack_data_avail (port);
609 #ifndef CONFIG_PARPORT_1284
610 return port->
ops->compat_write_data (port, buffer, len, 0);
628 fn = port->
ops->compat_write_data;
634 fn = port->
ops->epp_write_addr;
636 fn = port->
ops->epp_write_data;
652 fn = port->
ops->ecp_write_addr;
654 fn = port->
ops->ecp_write_data;
702 #ifndef CONFIG_PARPORT_1284
703 printk (
KERN_ERR "parport: IEEE1284 not supported in this kernel\n");
725 fn = port->
ops->byte_read_data;
734 fn = port->
ops->nibble_read_data;
739 fn = port->
ops->byte_read_data;
745 fn = port->
ops->epp_read_addr;
747 fn = port->
ops->epp_read_data;
762 fn = port->
ops->ecp_read_data;
803 if (dev->
port->physport->cad == dev)
804 parport_ieee1284_wakeup (dev->
port);