Lines Matching +full:- +full:- +full:mode +full:- +full:-

2  * IEEE-1284 implementation for parport.
5 * Carsten Gross <carsten@sol.wohnheim.uni-ulm.de>
10 * read/write requests to low-level drivers.
38 up (&port->physport->ieee1284.irq); in parport_ieee1284_wakeup()
49 * parport_wait_event - wait for an event on a parallel port
68 if (!port->physport->cad->timeout) in parport_wait_event()
73 timer_setup(&port->timer, timeout_waiting_on_port, 0); in parport_wait_event()
74 mod_timer(&port->timer, jiffies + timeout); in parport_wait_event()
75 ret = down_interruptible (&port->physport->ieee1284.irq); in parport_wait_event()
76 if (!del_timer_sync(&port->timer) && !ret) in parport_wait_event()
84 * parport_poll_peripheral - poll status lines
90 * This function busy-waits until the masked status lines have
96 * This function does not call schedule(); instead it busy-waits
121 return -EINTR; in parport_poll_peripheral()
132 * parport_wait_peripheral - wait for status lines to change in 35ms
138 * desired values, or until 35ms have elapsed (see IEEE 1284-1994
151 * If the timeout for this port is non-zero, after the fast
165 usec = port->physport->spintime; /* usecs of fast polling */ in parport_wait_peripheral()
166 if (!port->physport->cad->timeout) in parport_wait_peripheral()
181 if (!port->physport->cad->timeout) in parport_wait_peripheral()
190 return -EINTR; in parport_wait_peripheral()
213 /* Terminate a negotiated mode. */
217 port = port->physport; in parport_ieee1284_terminate()
220 switch (port->ieee1284.mode) { in parport_ieee1284_terminate()
224 /* Terminate from EPP mode. */ in parport_ieee1284_terminate()
242 if (port->ieee1284.phase != IEEE1284_PH_FWD_IDLE) { in parport_ieee1284_terminate()
256 port->name); in parport_ieee1284_terminate()
259 pr_debug("%s: ECP direction: forward\n", port->name); in parport_ieee1284_terminate()
260 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; in parport_ieee1284_terminate()
277 pr_debug("%s: Timeout at event 24\n", port->name); in parport_ieee1284_terminate()
289 pr_debug("%s: Timeout at event 27\n", port->name); in parport_ieee1284_terminate()
295 port->ieee1284.mode = IEEE1284_MODE_COMPAT; in parport_ieee1284_terminate()
296 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; in parport_ieee1284_terminate()
298 pr_debug("%s: In compatibility (forward idle) mode\n", port->name); in parport_ieee1284_terminate()
303 * parport_negotiate - negotiate an IEEE 1284 mode
305 * @mode: mode to negotiate to
307 * Use this to negotiate to a particular IEEE 1284 transfer mode.
308 * The @mode parameter should be one of the constants in
312 * negotiation to the mode specified, -1 if the peripheral is not
317 int parport_negotiate (struct parport *port, int mode) in parport_negotiate() argument
320 if (mode == IEEE1284_MODE_COMPAT) in parport_negotiate()
323 return -1; in parport_negotiate()
325 int m = mode & ~IEEE1284_ADDR; in parport_negotiate()
329 port = port->physport; in parport_negotiate()
332 if (port->ieee1284.mode == mode) in parport_negotiate()
335 /* Is the difference just an address-or-not bit? */ in parport_negotiate()
336 if ((port->ieee1284.mode & ~IEEE1284_ADDR) == (mode & ~IEEE1284_ADDR)){ in parport_negotiate()
337 port->ieee1284.mode = mode; in parport_negotiate()
341 /* Go to compatibility forward idle mode */ in parport_negotiate()
342 if (port->ieee1284.mode != IEEE1284_MODE_COMPAT) in parport_negotiate()
345 if (mode == IEEE1284_MODE_COMPAT) in parport_negotiate()
346 /* Compatibility mode: no negotiation. */ in parport_negotiate()
349 switch (mode) { in parport_negotiate()
358 return -ENOSYS; /* FIXME (implement BECP) */ in parport_negotiate()
361 if (mode & IEEE1284_EXT_LINK) in parport_negotiate()
364 port->ieee1284.phase = IEEE1284_PH_NEGOTIATION; in parport_negotiate()
400 port->name, parport_read_status (port)); in parport_negotiate()
401 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; in parport_negotiate()
402 return -1; /* Not IEEE1284 compliant */ in parport_negotiate()
422 pr_debug("%s: Mode 0x%02x not supported? (0x%02x)\n", in parport_negotiate()
423 port->name, mode, port->ops->read_status (port)); in parport_negotiate()
431 if (mode && !xflag) { in parport_negotiate()
432 /* Mode not supported. */ in parport_negotiate()
433 pr_debug("%s: Mode 0x%02x rejected by peripheral\n", in parport_negotiate()
434 port->name, mode); in parport_negotiate()
440 if (mode & IEEE1284_EXT_LINK) { in parport_negotiate()
441 m = mode & 0x7f; in parport_negotiate()
454 pr_debug("%s: Event 52 didn't happen\n", port->name); in parport_negotiate()
470 pr_debug("%s: Mode 0x%02x not supported? (0x%02x)\n", in parport_negotiate()
471 port->name, mode, in parport_negotiate()
472 port->ops->read_status(port)); in parport_negotiate()
482 /* Extended mode not supported. */ in parport_negotiate()
483 pr_debug("%s: Extended mode 0x%02x not supported\n", in parport_negotiate()
484 port->name, mode); in parport_negotiate()
492 /* Mode is supported */ in parport_negotiate()
493 pr_debug("%s: In mode 0x%02x\n", port->name, mode); in parport_negotiate()
494 port->ieee1284.mode = mode; in parport_negotiate()
497 if (!(mode & IEEE1284_EXT_LINK) && (m & IEEE1284_MODE_ECP)) { in parport_negotiate()
498 port->ieee1284.phase = IEEE1284_PH_ECP_SETUP; in parport_negotiate()
510 pr_debug("%s: Timeout at event 31\n", port->name); in parport_negotiate()
513 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; in parport_negotiate()
514 pr_debug("%s: ECP direction: forward\n", port->name); in parport_negotiate()
515 } else switch (mode) { in parport_negotiate()
518 port->ieee1284.phase = IEEE1284_PH_REV_IDLE; in parport_negotiate()
521 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; in parport_negotiate()
530 * Events 18-20, in order to get from Reverse Idle phase
540 return -1; in parport_ieee1284_ack_data_avail()
543 port->ops->frob_control (port, PARPORT_CONTROL_AUTOFD, 0); in parport_ieee1284_ack_data_avail()
544 port->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL; in parport_ieee1284_ack_data_avail()
556 if (port->ieee1284.phase == IEEE1284_PH_REV_IDLE) { in parport_ieee1284_interrupt()
559 pr_debug("%s: Data available\n", port->name); in parport_ieee1284_interrupt()
566 * parport_write - write a block of data to a parallel port
572 * specified, using the IEEE 1284 transfer mode most recently
574 * mode supports forward transfers (host to peripheral).
586 return port->ops->compat_write_data (port, buffer, len, 0); in parport_write()
589 int mode = port->ieee1284.mode; in parport_write()
590 int addr = mode & IEEE1284_ADDR; in parport_write()
593 /* Ignore the device-ID-request bit and the address bit. */ in parport_write()
594 mode &= ~(IEEE1284_DEVICEID | IEEE1284_ADDR); in parport_write()
596 /* Use the mode we're in. */ in parport_write()
597 switch (mode) { in parport_write()
603 pr_debug("%s: Using compatibility mode\n", port->name); in parport_write()
604 fn = port->ops->compat_write_data; in parport_write()
608 pr_debug("%s: Using EPP mode\n", port->name); in parport_write()
610 fn = port->ops->epp_write_addr; in parport_write()
612 fn = port->ops->epp_write_data; in parport_write()
616 pr_debug("%s: Using software-emulated EPP mode\n", port->name); in parport_write()
625 pr_debug("%s: Using ECP mode\n", port->name); in parport_write()
627 fn = port->ops->ecp_write_addr; in parport_write()
629 fn = port->ops->ecp_write_data; in parport_write()
634 pr_debug("%s: Using software-emulated ECP mode\n", port->name); in parport_write()
645 pr_debug("%s: Unknown mode 0x%02x\n", in parport_write()
646 port->name, port->ieee1284.mode); in parport_write()
647 return -ENOSYS; in parport_write()
651 pr_debug("%s: wrote %zd/%zu bytes\n", port->name, retval, len); in parport_write()
657 * parport_read - read a block of data from a parallel port
663 * specified, using the IEEE 1284 transfer mode most recently
665 * mode supports reverse transfers (peripheral to host).
678 return -ENODEV; in parport_read()
680 int mode = port->physport->ieee1284.mode; in parport_read()
681 int addr = mode & IEEE1284_ADDR; in parport_read()
684 /* Ignore the device-ID-request bit and the address bit. */ in parport_read()
685 mode &= ~(IEEE1284_DEVICEID | IEEE1284_ADDR); in parport_read()
687 /* Use the mode we're in. */ in parport_read()
688 switch (mode) { in parport_read()
690 /* if we can tri-state use BYTE mode instead of NIBBLE mode, in parport_read()
691 * if that fails, revert to NIBBLE mode -- ought to store somewhere in parport_read()
692 * the device's ability to do BYTE mode reverse transfers, so we don't in parport_read()
695 if ((port->physport->modes & PARPORT_MODE_TRISTATE) && in parport_read()
697 /* got into BYTE mode OK */ in parport_read()
698 pr_debug("%s: Using byte mode\n", port->name); in parport_read()
699 fn = port->ops->byte_read_data; in parport_read()
703 return -EIO; in parport_read()
707 pr_debug("%s: Using nibble mode\n", port->name); in parport_read()
708 fn = port->ops->nibble_read_data; in parport_read()
712 pr_debug("%s: Using byte mode\n", port->name); in parport_read()
713 fn = port->ops->byte_read_data; in parport_read()
717 pr_debug("%s: Using EPP mode\n", port->name); in parport_read()
719 fn = port->ops->epp_read_addr; in parport_read()
721 fn = port->ops->epp_read_data; in parport_read()
725 pr_debug("%s: Using software-emulated EPP mode\n", port->name); in parport_read()
734 pr_debug("%s: Using ECP mode\n", port->name); in parport_read()
735 fn = port->ops->ecp_read_data; in parport_read()
739 pr_debug("%s: Using software-emulated ECP mode\n", port->name); in parport_read()
744 pr_debug("%s: Unknown mode 0x%02x\n", in parport_read()
745 port->name, port->physport->ieee1284.mode); in parport_read()
746 return -ENOSYS; in parport_read()
754 * parport_set_timeout - set the inactivity timeout for a device
771 long int old = dev->timeout; in parport_set_timeout()
773 dev->timeout = inactivity; in parport_set_timeout()
775 if (dev->port->physport->cad == dev) in parport_set_timeout()
776 parport_ieee1284_wakeup (dev->port); in parport_set_timeout()