1 /* $Id: parport_ieee1284.c,v 1.4 1997/10/19 21:37:21 philip Exp $
2 * IEEE-1284 implementation for parport.
4 * Authors: Phil Blundell <philb@gnu.org>
5 * Carsten Gross <carsten@sol.wohnheim.uni-ulm.de>
6 * Jose Renau <renau@acm.org>
7 * Tim Waugh <tim@cyberelk.demon.co.uk> (largely rewritten)
9 * This file is responsible for IEEE 1284 negotiation, and for handing
10 * read/write requests to low-level drivers.
12 * Any part of this program may be used in documents licensed under
13 * the GNU Free Documentation License, Version 1.1 or any later version
14 * published by the Free Software Foundation.
16 * Various hacks, Fred Barnes <frmb2@ukc.ac.uk>, 04/2000
19 #include <linux/config.h>
20 #include <linux/module.h>
21 #include <linux/threads.h>
22 #include <linux/parport.h>
23 #include <linux/delay.h>
24 #include <linux/kernel.h>
25 #include <linux/interrupt.h>
26 #include <linux/timer.h>
27 #include <linux/sched.h>
29 #undef DEBUG /* undef me for production */
31 #ifdef CONFIG_LP_CONSOLE
32 #undef DEBUG /* Don't want a garbled console */
36 #define DPRINTK(stuff...) printk (stuff)
38 #define DPRINTK(stuff...)
41 /* Make parport_wait_peripheral wake up.
42 * It will be useful to call this from an interrupt handler. */
43 static void parport_ieee1284_wakeup (struct parport
*port
)
45 up (&port
->physport
->ieee1284
.irq
);
48 static struct parport
*port_from_cookie
[PARPORT_MAX
];
49 static void timeout_waiting_on_port (unsigned long cookie
)
51 parport_ieee1284_wakeup (port_from_cookie
[cookie
% PARPORT_MAX
]);
55 * parport_wait_event - wait for an event on a parallel port
56 * @port: port to wait on
57 * @timeout: time to wait (in jiffies)
59 * This function waits for up to @timeout jiffies for an
60 * interrupt to occur on a parallel port. If the port timeout is
61 * set to zero, it returns immediately.
63 * If an interrupt occurs before the timeout period elapses, this
64 * function returns one immediately. If it times out, it returns
65 * a value greater than zero. An error code less than zero
66 * indicates an error (most likely a pending signal), and the
67 * calling code should finish what it's doing as soon as it can.
70 int parport_wait_event (struct parport
*port
, signed long timeout
)
73 struct timer_list timer
;
75 if (!port
->physport
->cad
->timeout
)
76 /* Zero timeout is special, and we can't down() the
81 timer
.expires
= jiffies
+ timeout
;
82 timer
.function
= timeout_waiting_on_port
;
83 port_from_cookie
[port
->number
% PARPORT_MAX
] = port
;
84 timer
.data
= port
->number
;
87 ret
= down_interruptible (&port
->physport
->ieee1284
.irq
);
88 if (!del_timer (&timer
) && !ret
)
96 * parport_poll_peripheral - poll status lines
97 * @port: port to watch
98 * @mask: status lines to watch
99 * @result: desired values of chosen status lines
102 * This function busy-waits until the masked status lines have
103 * the desired values, or until the timeout period elapses. The
104 * @mask and @result parameters are bitmasks, with the bits
105 * defined by the constants in parport.h: %PARPORT_STATUS_BUSY,
108 * This function does not call schedule(); instead it busy-waits
109 * using udelay(). It currently has a resolution of 5usec.
111 * If the status lines take on the desired values before the
112 * timeout period elapses, parport_poll_peripheral() returns zero
113 * immediately. A zero return value greater than zero indicates
114 * a timeout. An error code (less than zero) indicates an error,
115 * most likely a signal that arrived, and the caller should
116 * finish what it is doing as soon as possible.
119 int parport_poll_peripheral(struct parport
*port
,
121 unsigned char result
,
124 /* Zero return code is success, >0 is timeout. */
125 int count
= usec
/ 5 + 2;
127 unsigned char status
;
128 for (i
= 0; i
< count
; i
++) {
129 status
= parport_read_status (port
);
130 if ((status
& mask
) == result
)
132 if (signal_pending (current
))
144 * parport_wait_peripheral - wait for status lines to change in 35ms
145 * @port: port to watch
146 * @mask: status lines to watch
147 * @result: desired values of chosen status lines
149 * This function waits until the masked status lines have the
150 * desired values, or until 35ms have elapsed (see IEEE 1284-1994
151 * page 24 to 25 for why this value in particular is hardcoded).
152 * The @mask and @result parameters are bitmasks, with the bits
153 * defined by the constants in parport.h: %PARPORT_STATUS_BUSY,
156 * The port is polled quickly to start off with, in anticipation
157 * of a fast response from the peripheral. This fast polling
158 * time is configurable (using /proc), and defaults to 500usec.
159 * If the timeout for this port (see parport_set_timeout()) is
160 * zero, the fast polling time is 35ms, and this function does
161 * not call schedule().
163 * If the timeout for this port is non-zero, after the fast
164 * polling fails it uses parport_wait_event() to wait for up to
165 * 10ms, waking up if an interrupt occurs.
168 int parport_wait_peripheral(struct parport
*port
,
170 unsigned char result
)
174 unsigned long deadline
;
175 unsigned char status
;
177 usec
= port
->physport
->spintime
; /* usecs of fast polling */
178 if (!port
->physport
->cad
->timeout
)
179 /* A zero timeout is "special": busy wait for the
185 * This should be adjustable.
186 * How about making a note (in the device structure) of how long
187 * it takes, so we know for next time?
189 ret
= parport_poll_peripheral (port
, mask
, result
, usec
);
193 if (!port
->physport
->cad
->timeout
)
194 /* We may be in an interrupt handler, so we can't poll
198 /* 40ms of slow polling. */
199 deadline
= jiffies
+ (HZ
+ 24) / 25;
200 while (time_before (jiffies
, deadline
)) {
203 if (signal_pending (current
))
206 /* Wait for 10ms (or until an interrupt occurs if
207 * the handler is set) */
208 if ((ret
= parport_wait_event (port
, (HZ
+ 99) / 100)) < 0)
211 status
= parport_read_status (port
);
212 if ((status
& mask
) == result
)
216 /* parport_wait_event didn't time out, but the
217 * peripheral wasn't actually ready either.
218 * Wait for another 10ms. */
219 __set_current_state (TASK_INTERRUPTIBLE
);
220 schedule_timeout ((HZ
+ 99) / 100);
227 #ifdef CONFIG_PARPORT_1284
228 /* Terminate a negotiated mode. */
229 static void parport_ieee1284_terminate (struct parport
*port
)
232 port
= port
->physport
;
234 /* EPP terminates differently. */
235 switch (port
->ieee1284
.mode
) {
236 case IEEE1284_MODE_EPP
:
237 case IEEE1284_MODE_EPPSL
:
238 case IEEE1284_MODE_EPPSWE
:
239 /* Terminate from EPP mode. */
241 /* Event 68: Set nInit low */
242 parport_frob_control (port
, PARPORT_CONTROL_INIT
, 0);
245 /* Event 69: Set nInit high, nSelectIn low */
246 parport_frob_control (port
,
247 PARPORT_CONTROL_SELECT
248 | PARPORT_CONTROL_INIT
,
249 PARPORT_CONTROL_SELECT
250 | PARPORT_CONTROL_INIT
);
253 case IEEE1284_MODE_ECP
:
254 case IEEE1284_MODE_ECPRLE
:
255 case IEEE1284_MODE_ECPSWE
:
256 /* In ECP we can only terminate from fwd idle phase. */
257 if (port
->ieee1284
.phase
!= IEEE1284_PH_FWD_IDLE
) {
258 /* Event 47: Set nInit high */
259 parport_frob_control (port
,
261 | PARPORT_CONTROL_AUTOFD
,
263 | PARPORT_CONTROL_AUTOFD
);
265 /* Event 49: PError goes high */
266 r
= parport_wait_peripheral (port
,
267 PARPORT_STATUS_PAPEROUT
,
268 PARPORT_STATUS_PAPEROUT
);
270 DPRINTK (KERN_INFO
"%s: Timeout at event 49\n",
273 parport_data_forward (port
);
274 DPRINTK (KERN_DEBUG
"%s: ECP direction: forward\n",
276 port
->ieee1284
.phase
= IEEE1284_PH_FWD_IDLE
;
282 /* Terminate from all other modes. */
284 /* Event 22: Set nSelectIn low, nAutoFd high */
285 parport_frob_control (port
,
286 PARPORT_CONTROL_SELECT
287 | PARPORT_CONTROL_AUTOFD
,
288 PARPORT_CONTROL_SELECT
);
290 /* Event 24: nAck goes low */
291 r
= parport_wait_peripheral (port
, PARPORT_STATUS_ACK
, 0);
293 DPRINTK (KERN_INFO
"%s: Timeout at event 24\n",
296 /* Event 25: Set nAutoFd low */
297 parport_frob_control (port
,
298 PARPORT_CONTROL_AUTOFD
,
299 PARPORT_CONTROL_AUTOFD
);
301 /* Event 27: nAck goes high */
302 r
= parport_wait_peripheral (port
,
306 DPRINTK (KERN_INFO
"%s: Timeout at event 27\n",
309 /* Event 29: Set nAutoFd high */
310 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
, 0);
313 port
->ieee1284
.mode
= IEEE1284_MODE_COMPAT
;
314 port
->ieee1284
.phase
= IEEE1284_PH_FWD_IDLE
;
316 DPRINTK (KERN_DEBUG
"%s: In compatibility (forward idle) mode\n",
319 #endif /* IEEE1284 support */
322 * parport_negotiate - negotiate an IEEE 1284 mode
324 * @mode: mode to negotiate to
326 * Use this to negotiate to a particular IEEE 1284 transfer mode.
327 * The @mode parameter should be one of the constants in
328 * parport.h starting %IEEE1284_MODE_xxx.
330 * The return value is 0 if the peripheral has accepted the
331 * negotiation to the mode specified, -1 if the peripheral is not
332 * IEEE 1284 compliant (or not present), or 1 if the peripheral
333 * has rejected the negotiation.
336 int parport_negotiate (struct parport
*port
, int mode
)
338 #ifndef CONFIG_PARPORT_1284
339 if (mode
== IEEE1284_MODE_COMPAT
)
341 printk (KERN_ERR
"parport: IEEE1284 not supported in this kernel\n");
344 int m
= mode
& ~IEEE1284_ADDR
;
348 port
= port
->physport
;
350 /* Is there anything to do? */
351 if (port
->ieee1284
.mode
== mode
)
354 /* Is the difference just an address-or-not bit? */
355 if ((port
->ieee1284
.mode
& ~IEEE1284_ADDR
) == (mode
& ~IEEE1284_ADDR
)){
356 port
->ieee1284
.mode
= mode
;
360 /* Go to compability forward idle mode */
361 if (port
->ieee1284
.mode
!= IEEE1284_MODE_COMPAT
)
362 parport_ieee1284_terminate (port
);
364 if (mode
== IEEE1284_MODE_COMPAT
)
365 /* Compatibility mode: no negotiation. */
369 case IEEE1284_MODE_ECPSWE
:
370 m
= IEEE1284_MODE_ECP
;
372 case IEEE1284_MODE_EPPSL
:
373 case IEEE1284_MODE_EPPSWE
:
374 m
= IEEE1284_MODE_EPP
;
376 case IEEE1284_MODE_BECP
:
377 return -ENOSYS
; /* FIXME (implement BECP) */
380 if (mode
& IEEE1284_EXT_LINK
)
381 m
= 1<<7; /* request extensibility link */
383 port
->ieee1284
.phase
= IEEE1284_PH_NEGOTIATION
;
385 /* Start off with nStrobe and nAutoFd high, and nSelectIn low */
386 parport_frob_control (port
,
387 PARPORT_CONTROL_STROBE
388 | PARPORT_CONTROL_AUTOFD
389 | PARPORT_CONTROL_SELECT
,
390 PARPORT_CONTROL_SELECT
);
393 /* Event 0: Set data */
394 parport_data_forward (port
);
395 parport_write_data (port
, m
);
396 udelay (400); /* Shouldn't need to wait this long. */
398 /* Event 1: Set nSelectIn high, nAutoFd low */
399 parport_frob_control (port
,
400 PARPORT_CONTROL_SELECT
401 | PARPORT_CONTROL_AUTOFD
,
402 PARPORT_CONTROL_AUTOFD
);
404 /* Event 2: PError, Select, nFault go high, nAck goes low */
405 if (parport_wait_peripheral (port
,
407 | PARPORT_STATUS_SELECT
408 | PARPORT_STATUS_PAPEROUT
409 | PARPORT_STATUS_ACK
,
411 | PARPORT_STATUS_SELECT
412 | PARPORT_STATUS_PAPEROUT
)) {
414 parport_frob_control (port
,
415 PARPORT_CONTROL_SELECT
416 | PARPORT_CONTROL_AUTOFD
,
417 PARPORT_CONTROL_SELECT
);
419 "%s: Peripheral not IEEE1284 compliant (0x%02X)\n",
420 port
->name
, parport_read_status (port
));
421 port
->ieee1284
.phase
= IEEE1284_PH_FWD_IDLE
;
422 return -1; /* Not IEEE1284 compliant */
425 /* Event 3: Set nStrobe low */
426 parport_frob_control (port
,
427 PARPORT_CONTROL_STROBE
,
428 PARPORT_CONTROL_STROBE
);
430 /* Event 4: Set nStrobe and nAutoFd high */
432 parport_frob_control (port
,
433 PARPORT_CONTROL_STROBE
434 | PARPORT_CONTROL_AUTOFD
,
437 /* Event 6: nAck goes high */
438 if (parport_wait_peripheral (port
,
440 PARPORT_STATUS_ACK
)) {
441 /* This shouldn't really happen with a compliant device. */
443 "%s: Mode 0x%02x not supported? (0x%02x)\n",
444 port
->name
, mode
, port
->ops
->read_status (port
));
445 parport_ieee1284_terminate (port
);
449 xflag
= parport_read_status (port
) & PARPORT_STATUS_SELECT
;
451 /* xflag should be high for all modes other than nibble (0). */
452 if (mode
&& !xflag
) {
453 /* Mode not supported. */
454 DPRINTK (KERN_DEBUG
"%s: Mode 0x%02x rejected by peripheral\n",
456 parport_ieee1284_terminate (port
);
460 /* More to do if we've requested extensibility link. */
461 if (mode
& IEEE1284_EXT_LINK
) {
464 parport_write_data (port
, m
);
467 /* Event 51: Set nStrobe low */
468 parport_frob_control (port
,
469 PARPORT_CONTROL_STROBE
,
470 PARPORT_CONTROL_STROBE
);
472 /* Event 52: nAck goes low */
473 if (parport_wait_peripheral (port
, PARPORT_STATUS_ACK
, 0)) {
474 /* This peripheral is _very_ slow. */
476 "%s: Event 52 didn't happen\n",
478 parport_ieee1284_terminate (port
);
482 /* Event 53: Set nStrobe high */
483 parport_frob_control (port
,
484 PARPORT_CONTROL_STROBE
,
487 /* Event 55: nAck goes high */
488 if (parport_wait_peripheral (port
,
490 PARPORT_STATUS_ACK
)) {
491 /* This shouldn't really happen with a compliant
494 "%s: Mode 0x%02x not supported? (0x%02x)\n",
496 port
->ops
->read_status (port
));
497 parport_ieee1284_terminate (port
);
501 /* Event 54: Peripheral sets XFlag to reflect support */
502 xflag
= parport_read_status (port
) & PARPORT_STATUS_SELECT
;
504 /* xflag should be high. */
506 /* Extended mode not supported. */
507 DPRINTK (KERN_DEBUG
"%s: Extended mode 0x%02x not "
508 "supported\n", port
->name
, mode
);
509 parport_ieee1284_terminate (port
);
513 /* Any further setup is left to the caller. */
516 /* Mode is supported */
517 DPRINTK (KERN_DEBUG
"%s: In mode 0x%02x\n", port
->name
, mode
);
518 port
->ieee1284
.mode
= mode
;
520 /* But ECP is special */
521 if (!(mode
& IEEE1284_EXT_LINK
) && (m
& IEEE1284_MODE_ECP
)) {
522 port
->ieee1284
.phase
= IEEE1284_PH_ECP_SETUP
;
524 /* Event 30: Set nAutoFd low */
525 parport_frob_control (port
,
526 PARPORT_CONTROL_AUTOFD
,
527 PARPORT_CONTROL_AUTOFD
);
529 /* Event 31: PError goes high. */
530 r
= parport_wait_peripheral (port
,
531 PARPORT_STATUS_PAPEROUT
,
532 PARPORT_STATUS_PAPEROUT
);
534 DPRINTK (KERN_INFO
"%s: Timeout at event 31\n",
538 port
->ieee1284
.phase
= IEEE1284_PH_FWD_IDLE
;
539 DPRINTK (KERN_DEBUG
"%s: ECP direction: forward\n",
541 } else switch (mode
) {
542 case IEEE1284_MODE_NIBBLE
:
543 case IEEE1284_MODE_BYTE
:
544 port
->ieee1284
.phase
= IEEE1284_PH_REV_IDLE
;
547 port
->ieee1284
.phase
= IEEE1284_PH_FWD_IDLE
;
552 #endif /* IEEE1284 support */
555 /* Acknowledge that the peripheral has data available.
556 * Events 18-20, in order to get from Reverse Idle phase
557 * to Host Busy Data Available.
558 * This will most likely be called from an interrupt.
559 * Returns zero if data was available.
561 #ifdef CONFIG_PARPORT_1284
562 static int parport_ieee1284_ack_data_avail (struct parport
*port
)
564 if (parport_read_status (port
) & PARPORT_STATUS_ERROR
)
565 /* Event 18 didn't happen. */
568 /* Event 20: nAutoFd goes high. */
569 port
->ops
->frob_control (port
, PARPORT_CONTROL_AUTOFD
, 0);
570 port
->ieee1284
.phase
= IEEE1284_PH_HBUSY_DAVAIL
;
573 #endif /* IEEE1284 support */
575 /* Handle an interrupt. */
576 void parport_ieee1284_interrupt (int which
, void *handle
, struct pt_regs
*regs
)
578 struct parport
*port
= handle
;
579 parport_ieee1284_wakeup (port
);
581 #ifdef CONFIG_PARPORT_1284
582 if (port
->ieee1284
.phase
== IEEE1284_PH_REV_IDLE
) {
583 /* An interrupt in this phase means that data
584 * is now available. */
585 DPRINTK (KERN_DEBUG
"%s: Data available\n", port
->name
);
586 parport_ieee1284_ack_data_avail (port
);
588 #endif /* IEEE1284 support */
592 * parport_write - write a block of data to a parallel port
593 * @port: port to write to
594 * @buffer: data buffer (in kernel space)
595 * @len: number of bytes of data to transfer
597 * This will write up to @len bytes of @buffer to the port
598 * specified, using the IEEE 1284 transfer mode most recently
599 * negotiated to (using parport_negotiate()), as long as that
600 * mode supports forward transfers (host to peripheral).
602 * It is the caller's responsibility to ensure that the first
603 * @len bytes of @buffer are valid.
605 * This function returns the number of bytes transferred (if zero
606 * or positive), or else an error code.
609 ssize_t
parport_write (struct parport
*port
, const void *buffer
, size_t len
)
611 #ifndef CONFIG_PARPORT_1284
612 return port
->ops
->compat_write_data (port
, buffer
, len
, 0);
615 int mode
= port
->ieee1284
.mode
;
616 int addr
= mode
& IEEE1284_ADDR
;
617 size_t (*fn
) (struct parport
*, const void *, size_t, int);
619 /* Ignore the device-ID-request bit and the address bit. */
620 mode
&= ~(IEEE1284_DEVICEID
| IEEE1284_ADDR
);
622 /* Use the mode we're in. */
624 case IEEE1284_MODE_NIBBLE
:
625 case IEEE1284_MODE_BYTE
:
626 parport_negotiate (port
, IEEE1284_MODE_COMPAT
);
627 case IEEE1284_MODE_COMPAT
:
628 DPRINTK (KERN_DEBUG
"%s: Using compatibility mode\n",
630 fn
= port
->ops
->compat_write_data
;
633 case IEEE1284_MODE_EPP
:
634 DPRINTK (KERN_DEBUG
"%s: Using EPP mode\n", port
->name
);
636 fn
= port
->ops
->epp_write_addr
;
638 fn
= port
->ops
->epp_write_data
;
641 case IEEE1284_MODE_EPPSWE
:
642 DPRINTK (KERN_DEBUG
"%s: Using software-emulated EPP mode\n",
645 fn
= parport_ieee1284_epp_write_addr
;
647 fn
= parport_ieee1284_epp_write_data
;
650 case IEEE1284_MODE_ECP
:
651 case IEEE1284_MODE_ECPRLE
:
652 DPRINTK (KERN_DEBUG
"%s: Using ECP mode\n", port
->name
);
654 fn
= port
->ops
->ecp_write_addr
;
656 fn
= port
->ops
->ecp_write_data
;
660 case IEEE1284_MODE_ECPSWE
:
661 DPRINTK (KERN_DEBUG
"%s: Using software-emulated ECP mode\n",
663 /* The caller has specified that it must be emulated,
664 * even if we have ECP hardware! */
666 fn
= parport_ieee1284_ecp_write_addr
;
668 fn
= parport_ieee1284_ecp_write_data
;
673 DPRINTK (KERN_DEBUG
"%s: Unknown mode 0x%02x\n", port
->name
,
674 port
->ieee1284
.mode
);
678 retval
= (*fn
) (port
, buffer
, len
, 0);
679 DPRINTK (KERN_DEBUG
"%s: wrote %d/%d bytes\n", port
->name
, retval
, len
);
681 #endif /* IEEE1284 support */
685 * parport_read - read a block of data from a parallel port
686 * @port: port to read from
687 * @buffer: data buffer (in kernel space)
688 * @len: number of bytes of data to transfer
690 * This will read up to @len bytes of @buffer to the port
691 * specified, using the IEEE 1284 transfer mode most recently
692 * negotiated to (using parport_negotiate()), as long as that
693 * mode supports reverse transfers (peripheral to host).
695 * It is the caller's responsibility to ensure that the first
696 * @len bytes of @buffer are available to write to.
698 * This function returns the number of bytes transferred (if zero
699 * or positive), or else an error code.
702 ssize_t
parport_read (struct parport
*port
, void *buffer
, size_t len
)
704 #ifndef CONFIG_PARPORT_1284
705 printk (KERN_ERR
"parport: IEEE1284 not supported in this kernel\n");
708 int mode
= port
->physport
->ieee1284
.mode
;
709 int addr
= mode
& IEEE1284_ADDR
;
710 size_t (*fn
) (struct parport
*, void *, size_t, int);
712 /* Ignore the device-ID-request bit and the address bit. */
713 mode
&= ~(IEEE1284_DEVICEID
| IEEE1284_ADDR
);
715 /* Use the mode we're in. */
717 case IEEE1284_MODE_COMPAT
:
718 /* if we can tri-state use BYTE mode instead of NIBBLE mode,
719 * if that fails, revert to NIBBLE mode -- ought to store somewhere
720 * the device's ability to do BYTE mode reverse transfers, so we don't
721 * end up needlessly calling negotiate(BYTE) repeately.. (fb)
723 if ((port
->physport
->modes
& PARPORT_MODE_TRISTATE
) &&
724 !parport_negotiate (port
, IEEE1284_MODE_BYTE
)) {
725 /* got into BYTE mode OK */
726 DPRINTK (KERN_DEBUG
"%s: Using byte mode\n", port
->name
);
727 fn
= port
->ops
->byte_read_data
;
730 if (parport_negotiate (port
, IEEE1284_MODE_NIBBLE
)) {
733 /* fall through to NIBBLE */
734 case IEEE1284_MODE_NIBBLE
:
735 DPRINTK (KERN_DEBUG
"%s: Using nibble mode\n", port
->name
);
736 fn
= port
->ops
->nibble_read_data
;
739 case IEEE1284_MODE_BYTE
:
740 DPRINTK (KERN_DEBUG
"%s: Using byte mode\n", port
->name
);
741 fn
= port
->ops
->byte_read_data
;
744 case IEEE1284_MODE_EPP
:
745 DPRINTK (KERN_DEBUG
"%s: Using EPP mode\n", port
->name
);
747 fn
= port
->ops
->epp_read_addr
;
749 fn
= port
->ops
->epp_read_data
;
752 case IEEE1284_MODE_EPPSWE
:
753 DPRINTK (KERN_DEBUG
"%s: Using software-emulated EPP mode\n",
756 fn
= parport_ieee1284_epp_read_addr
;
758 fn
= parport_ieee1284_epp_read_data
;
761 case IEEE1284_MODE_ECP
:
762 case IEEE1284_MODE_ECPRLE
:
763 DPRINTK (KERN_DEBUG
"%s: Using ECP mode\n", port
->name
);
764 fn
= port
->ops
->ecp_read_data
;
767 case IEEE1284_MODE_ECPSWE
:
768 DPRINTK (KERN_DEBUG
"%s: Using software-emulated ECP mode\n",
770 fn
= parport_ieee1284_ecp_read_data
;
774 DPRINTK (KERN_DEBUG
"%s: Unknown mode 0x%02x\n", port
->name
,
775 port
->physport
->ieee1284
.mode
);
779 return (*fn
) (port
, buffer
, len
, 0);
780 #endif /* IEEE1284 support */
784 * parport_set_timeout - set the inactivity timeout for a device
785 * @dev: device on a port
786 * @inactivity: inactivity timeout (in jiffies)
788 * This sets the inactivity timeout for a particular device on a
789 * port. This affects functions like parport_wait_peripheral().
790 * The special value 0 means not to call schedule() while dealing
793 * The return value is the previous inactivity timeout.
795 * Any callers of parport_wait_event() for this device are woken
799 long parport_set_timeout (struct pardevice
*dev
, long inactivity
)
801 long int old
= dev
->timeout
;
803 dev
->timeout
= inactivity
;
805 if (dev
->port
->physport
->cad
== dev
)
806 parport_ieee1284_wakeup (dev
->port
);
811 /* Exported symbols for modules. */
813 EXPORT_SYMBOL(parport_negotiate
);
814 EXPORT_SYMBOL(parport_write
);
815 EXPORT_SYMBOL(parport_read
);
816 EXPORT_SYMBOL(parport_wait_peripheral
);
817 EXPORT_SYMBOL(parport_wait_event
);
818 EXPORT_SYMBOL(parport_set_timeout
);
819 EXPORT_SYMBOL(parport_ieee1284_interrupt
);