1 // SPDX-License-Identifier: GPL-2.0
2 /* IEEE-1284 operations for parport.
4 * This file is for generic IEEE 1284 operations. The idea is that
5 * they are used by the low-level drivers. If they have a special way
6 * of doing something, they can provide their own routines (and put
7 * the function pointers in port->ops); if not, they can just use these
10 * Note: Make no assumptions about hardware or architecture in this file!
12 * Author: Tim Waugh <tim@cyberelk.demon.co.uk>
13 * Fixed AUTOFD polarity in ecp_forward_to_reverse(). Fred Barnes, 1999
14 * Software emulated EPP fixes, Fred Barnes, 04/2001.
18 #include <linux/module.h>
19 #include <linux/parport.h>
20 #include <linux/delay.h>
21 #include <linux/sched/signal.h>
22 #include <linux/uaccess.h>
24 #undef DEBUG /* undef me for production */
26 #ifdef CONFIG_LP_CONSOLE
27 #undef DEBUG /* Don't want a garbled console */
31 #define DPRINTK(stuff...) printk (stuff)
33 #define DPRINTK(stuff...)
37 * One-way data transfer functions. *
40 /* Compatibility mode. */
41 size_t parport_ieee1284_write_compat (struct parport
*port
,
42 const void *buffer
, size_t len
,
47 const unsigned char *addr
= buffer
;
49 struct pardevice
*dev
= port
->physport
->cad
;
50 unsigned char ctl
= (PARPORT_CONTROL_SELECT
51 | PARPORT_CONTROL_INIT
);
53 if (port
->irq
!= PARPORT_IRQ_NONE
) {
54 parport_enable_irq (port
);
58 port
->physport
->ieee1284
.phase
= IEEE1284_PH_FWD_DATA
;
59 parport_write_control (port
, ctl
);
60 parport_data_forward (port
);
62 unsigned long expire
= jiffies
+ dev
->timeout
;
63 long wait
= msecs_to_jiffies(10);
64 unsigned char mask
= (PARPORT_STATUS_ERROR
65 | PARPORT_STATUS_BUSY
);
66 unsigned char val
= (PARPORT_STATUS_ERROR
67 | PARPORT_STATUS_BUSY
);
69 /* Wait until the peripheral's ready */
71 /* Is the peripheral ready yet? */
72 if (!parport_wait_peripheral (port
, mask
, val
))
76 /* Is the peripheral upset? */
77 if ((parport_read_status (port
) &
78 (PARPORT_STATUS_PAPEROUT
|
79 PARPORT_STATUS_SELECT
|
80 PARPORT_STATUS_ERROR
))
81 != (PARPORT_STATUS_SELECT
|
82 PARPORT_STATUS_ERROR
))
83 /* If nFault is asserted (i.e. no
84 * error) and PAPEROUT and SELECT are
85 * just red herrings, give the driver
86 * a chance to check it's happy with
87 * that before continuing. */
90 /* Have we run out of time? */
91 if (!time_before (jiffies
, expire
))
94 /* Yield the port for a while. If this is the
95 first time around the loop, don't let go of
96 the port. This way, we find out if we have
97 our interrupt handler called. */
98 if (count
&& no_irq
) {
99 parport_release (dev
);
100 schedule_timeout_interruptible(wait
);
101 parport_claim_or_block (dev
);
104 /* We must have the device claimed here */
105 parport_wait_event (port
, wait
);
107 /* Is there a signal pending? */
108 if (signal_pending (current
))
111 /* Wait longer next time. */
113 } while (time_before (jiffies
, expire
));
115 if (signal_pending (current
))
118 DPRINTK (KERN_DEBUG
"%s: Timed out\n", port
->name
);
122 /* Write the character to the data lines. */
124 parport_write_data (port
, byte
);
128 parport_write_control (port
, ctl
| PARPORT_CONTROL_STROBE
);
129 udelay (1); /* strobe */
131 parport_write_control (port
, ctl
);
132 udelay (1); /* hold */
134 /* Assume the peripheral received it. */
137 /* Let another process run if it needs to. */
138 if (time_before (jiffies
, expire
))
139 if (!parport_yield_blocking (dev
)
144 port
->physport
->ieee1284
.phase
= IEEE1284_PH_FWD_IDLE
;
150 size_t parport_ieee1284_read_nibble (struct parport
*port
,
151 void *buffer
, size_t len
,
154 #ifndef CONFIG_PARPORT_1284
157 unsigned char *buf
= buffer
;
159 unsigned char byte
= 0;
161 len
*= 2; /* in nibbles */
162 for (i
=0; i
< len
; i
++) {
163 unsigned char nibble
;
165 /* Does the error line indicate end of data? */
166 if (((i
& 1) == 0) &&
167 (parport_read_status(port
) & PARPORT_STATUS_ERROR
)) {
171 /* Event 7: Set nAutoFd low. */
172 parport_frob_control (port
,
173 PARPORT_CONTROL_AUTOFD
,
174 PARPORT_CONTROL_AUTOFD
);
176 /* Event 9: nAck goes low. */
177 port
->ieee1284
.phase
= IEEE1284_PH_REV_DATA
;
178 if (parport_wait_peripheral (port
,
179 PARPORT_STATUS_ACK
, 0)) {
180 /* Timeout -- no more data? */
182 "%s: Nibble timeout at event 9 (%d bytes)\n",
184 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
, 0);
190 nibble
= parport_read_status (port
) >> 3;
192 if ((nibble
& 0x10) == 0)
196 /* Event 10: Set nAutoFd high. */
197 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
, 0);
199 /* Event 11: nAck goes high. */
200 if (parport_wait_peripheral (port
,
202 PARPORT_STATUS_ACK
)) {
203 /* Timeout -- no more data? */
205 "%s: Nibble timeout at event 11\n",
219 /* Read the last nibble without checking data avail. */
220 if (parport_read_status (port
) & PARPORT_STATUS_ERROR
) {
223 "%s: No more nibble data (%d bytes)\n",
226 /* Go to reverse idle phase. */
227 parport_frob_control (port
,
228 PARPORT_CONTROL_AUTOFD
,
229 PARPORT_CONTROL_AUTOFD
);
230 port
->physport
->ieee1284
.phase
= IEEE1284_PH_REV_IDLE
;
233 port
->physport
->ieee1284
.phase
= IEEE1284_PH_HBUSY_DAVAIL
;
237 #endif /* IEEE1284 support */
241 size_t parport_ieee1284_read_byte (struct parport
*port
,
242 void *buffer
, size_t len
,
245 #ifndef CONFIG_PARPORT_1284
248 unsigned char *buf
= buffer
;
251 for (count
= 0; count
< len
; count
++) {
254 /* Data available? */
255 if (parport_read_status (port
) & PARPORT_STATUS_ERROR
) {
259 /* Event 14: Place data bus in high impedance state. */
260 parport_data_reverse (port
);
262 /* Event 7: Set nAutoFd low. */
263 parport_frob_control (port
,
264 PARPORT_CONTROL_AUTOFD
,
265 PARPORT_CONTROL_AUTOFD
);
267 /* Event 9: nAck goes low. */
268 port
->physport
->ieee1284
.phase
= IEEE1284_PH_REV_DATA
;
269 if (parport_wait_peripheral (port
,
272 /* Timeout -- no more data? */
273 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
,
275 DPRINTK (KERN_DEBUG
"%s: Byte timeout at event 9\n",
280 byte
= parport_read_data (port
);
283 /* Event 10: Set nAutoFd high */
284 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
, 0);
286 /* Event 11: nAck goes high. */
287 if (parport_wait_peripheral (port
,
289 PARPORT_STATUS_ACK
)) {
290 /* Timeout -- no more data? */
291 DPRINTK (KERN_DEBUG
"%s: Byte timeout at event 11\n",
296 /* Event 16: Set nStrobe low. */
297 parport_frob_control (port
,
298 PARPORT_CONTROL_STROBE
,
299 PARPORT_CONTROL_STROBE
);
302 /* Event 17: Set nStrobe high. */
303 parport_frob_control (port
, PARPORT_CONTROL_STROBE
, 0);
307 /* Read the last byte without checking data avail. */
308 if (parport_read_status (port
) & PARPORT_STATUS_ERROR
) {
311 "%s: No more byte data (%zd bytes)\n",
314 /* Go to reverse idle phase. */
315 parport_frob_control (port
,
316 PARPORT_CONTROL_AUTOFD
,
317 PARPORT_CONTROL_AUTOFD
);
318 port
->physport
->ieee1284
.phase
= IEEE1284_PH_REV_IDLE
;
321 port
->physport
->ieee1284
.phase
= IEEE1284_PH_HBUSY_DAVAIL
;
325 #endif /* IEEE1284 support */
332 #ifdef CONFIG_PARPORT_1284
335 int ecp_forward_to_reverse (struct parport
*port
)
339 /* Event 38: Set nAutoFd low */
340 parport_frob_control (port
,
341 PARPORT_CONTROL_AUTOFD
,
342 PARPORT_CONTROL_AUTOFD
);
343 parport_data_reverse (port
);
346 /* Event 39: Set nInit low to initiate bus reversal */
347 parport_frob_control (port
,
348 PARPORT_CONTROL_INIT
,
351 /* Event 40: PError goes low */
352 retval
= parport_wait_peripheral (port
,
353 PARPORT_STATUS_PAPEROUT
, 0);
356 DPRINTK (KERN_DEBUG
"%s: ECP direction: reverse\n",
358 port
->ieee1284
.phase
= IEEE1284_PH_REV_IDLE
;
360 DPRINTK (KERN_DEBUG
"%s: ECP direction: failed to reverse\n",
362 port
->ieee1284
.phase
= IEEE1284_PH_ECP_DIR_UNKNOWN
;
369 int ecp_reverse_to_forward (struct parport
*port
)
373 /* Event 47: Set nInit high */
374 parport_frob_control (port
,
376 | PARPORT_CONTROL_AUTOFD
,
378 | PARPORT_CONTROL_AUTOFD
);
380 /* Event 49: PError goes high */
381 retval
= parport_wait_peripheral (port
,
382 PARPORT_STATUS_PAPEROUT
,
383 PARPORT_STATUS_PAPEROUT
);
386 parport_data_forward (port
);
387 DPRINTK (KERN_DEBUG
"%s: ECP direction: forward\n",
389 port
->ieee1284
.phase
= IEEE1284_PH_FWD_IDLE
;
392 "%s: ECP direction: failed to switch forward\n",
394 port
->ieee1284
.phase
= IEEE1284_PH_ECP_DIR_UNKNOWN
;
401 #endif /* IEEE1284 support */
403 /* ECP mode, forward channel, data. */
404 size_t parport_ieee1284_ecp_write_data (struct parport
*port
,
405 const void *buffer
, size_t len
,
408 #ifndef CONFIG_PARPORT_1284
411 const unsigned char *buf
= buffer
;
415 port
= port
->physport
;
417 if (port
->ieee1284
.phase
!= IEEE1284_PH_FWD_IDLE
)
418 if (ecp_reverse_to_forward (port
))
421 port
->ieee1284
.phase
= IEEE1284_PH_FWD_DATA
;
423 /* HostAck high (data, not command) */
424 parport_frob_control (port
,
425 PARPORT_CONTROL_AUTOFD
426 | PARPORT_CONTROL_STROBE
427 | PARPORT_CONTROL_INIT
,
428 PARPORT_CONTROL_INIT
);
429 for (written
= 0; written
< len
; written
++, buf
++) {
430 unsigned long expire
= jiffies
+ port
->cad
->timeout
;
435 parport_write_data (port
, byte
);
436 parport_frob_control (port
, PARPORT_CONTROL_STROBE
,
437 PARPORT_CONTROL_STROBE
);
439 for (retry
= 0; retry
< 100; retry
++) {
440 if (!parport_wait_peripheral (port
,
441 PARPORT_STATUS_BUSY
, 0))
444 if (signal_pending (current
)) {
445 parport_frob_control (port
,
446 PARPORT_CONTROL_STROBE
,
452 /* Time for Host Transfer Recovery (page 41 of IEEE1284) */
453 DPRINTK (KERN_DEBUG
"%s: ECP transfer stalled!\n", port
->name
);
455 parport_frob_control (port
, PARPORT_CONTROL_INIT
,
456 PARPORT_CONTROL_INIT
);
458 if (parport_read_status (port
) & PARPORT_STATUS_PAPEROUT
) {
460 parport_frob_control (port
, PARPORT_CONTROL_INIT
, 0);
464 parport_frob_control (port
, PARPORT_CONTROL_INIT
, 0);
466 if (!(parport_read_status (port
) & PARPORT_STATUS_PAPEROUT
))
469 DPRINTK (KERN_DEBUG
"%s: Host transfer recovered\n",
472 if (time_after_eq (jiffies
, expire
)) break;
475 parport_frob_control (port
, PARPORT_CONTROL_STROBE
, 0);
477 if (parport_wait_peripheral (port
,
479 PARPORT_STATUS_BUSY
))
480 /* Peripheral hasn't accepted the data. */
484 port
->ieee1284
.phase
= IEEE1284_PH_FWD_IDLE
;
487 #endif /* IEEE1284 support */
490 /* ECP mode, reverse channel, data. */
491 size_t parport_ieee1284_ecp_read_data (struct parport
*port
,
492 void *buffer
, size_t len
, int flags
)
494 #ifndef CONFIG_PARPORT_1284
497 struct pardevice
*dev
= port
->cad
;
498 unsigned char *buf
= buffer
;
499 int rle_count
= 0; /* shut gcc up */
504 port
= port
->physport
;
506 if (port
->ieee1284
.phase
!= IEEE1284_PH_REV_IDLE
)
507 if (ecp_forward_to_reverse (port
))
510 port
->ieee1284
.phase
= IEEE1284_PH_REV_DATA
;
512 /* Set HostAck low to start accepting data. */
513 ctl
= parport_read_control (port
);
514 ctl
&= ~(PARPORT_CONTROL_STROBE
| PARPORT_CONTROL_INIT
|
515 PARPORT_CONTROL_AUTOFD
);
516 parport_write_control (port
,
517 ctl
| PARPORT_CONTROL_AUTOFD
);
518 while (count
< len
) {
519 unsigned long expire
= jiffies
+ dev
->timeout
;
523 /* Event 43: Peripheral sets nAck low. It can take as
525 while (parport_wait_peripheral (port
, PARPORT_STATUS_ACK
, 0)) {
526 /* The peripheral hasn't given us data in
527 35ms. If we have data to give back to the
528 caller, do it now. */
532 /* If we've used up all the time we were allowed,
533 give up altogether. */
534 if (!time_before (jiffies
, expire
))
537 /* Yield the port for a while. */
538 if (count
&& dev
->port
->irq
!= PARPORT_IRQ_NONE
) {
539 parport_release (dev
);
540 schedule_timeout_interruptible(msecs_to_jiffies(40));
541 parport_claim_or_block (dev
);
544 /* We must have the device claimed here. */
545 parport_wait_event (port
, msecs_to_jiffies(40));
547 /* Is there a signal pending? */
548 if (signal_pending (current
))
552 /* Is this a command? */
554 /* The last byte was a run-length count, so
555 this can't be as well. */
558 command
= (parport_read_status (port
) &
559 PARPORT_STATUS_BUSY
) ? 1 : 0;
562 byte
= parport_read_data (port
);
564 /* If this is a channel command, rather than an RLE
565 command or a normal data byte, don't accept it. */
568 DPRINTK (KERN_DEBUG
"%s: stopping short at "
569 "channel command (%02x)\n",
573 else if (port
->ieee1284
.mode
!= IEEE1284_MODE_ECPRLE
)
574 DPRINTK (KERN_DEBUG
"%s: device illegally "
575 "using RLE; accepting anyway\n",
578 rle_count
= byte
+ 1;
580 /* Are we allowed to read that many bytes? */
581 if (rle_count
> (len
- count
)) {
582 DPRINTK (KERN_DEBUG
"%s: leaving %d RLE bytes "
583 "for next time\n", port
->name
,
591 /* Event 44: Set HostAck high, acknowledging handshake. */
592 parport_write_control (port
, ctl
);
594 /* Event 45: The peripheral has 35ms to set nAck high. */
595 if (parport_wait_peripheral (port
, PARPORT_STATUS_ACK
,
596 PARPORT_STATUS_ACK
)) {
597 /* It's gone wrong. Return what data we have
599 DPRINTK (KERN_DEBUG
"ECP read timed out at 45\n");
603 "%s: command ignored (%02x)\n",
609 /* Event 46: Set HostAck low and accept the data. */
610 parport_write_control (port
,
611 ctl
| PARPORT_CONTROL_AUTOFD
);
613 /* If we just read a run-length count, fetch the data. */
617 /* If this is the byte after a run-length count, decompress. */
620 memset (buf
, byte
, rle_count
);
623 DPRINTK (KERN_DEBUG
"%s: decompressed to %d bytes\n",
624 port
->name
, rle_count
);
626 /* Normal data byte. */
633 port
->ieee1284
.phase
= IEEE1284_PH_REV_IDLE
;
635 #endif /* IEEE1284 support */
638 /* ECP mode, forward channel, commands. */
639 size_t parport_ieee1284_ecp_write_addr (struct parport
*port
,
640 const void *buffer
, size_t len
,
643 #ifndef CONFIG_PARPORT_1284
646 const unsigned char *buf
= buffer
;
650 port
= port
->physport
;
652 if (port
->ieee1284
.phase
!= IEEE1284_PH_FWD_IDLE
)
653 if (ecp_reverse_to_forward (port
))
656 port
->ieee1284
.phase
= IEEE1284_PH_FWD_DATA
;
658 /* HostAck low (command, not data) */
659 parport_frob_control (port
,
660 PARPORT_CONTROL_AUTOFD
661 | PARPORT_CONTROL_STROBE
662 | PARPORT_CONTROL_INIT
,
663 PARPORT_CONTROL_AUTOFD
664 | PARPORT_CONTROL_INIT
);
665 for (written
= 0; written
< len
; written
++, buf
++) {
666 unsigned long expire
= jiffies
+ port
->cad
->timeout
;
671 parport_write_data (port
, byte
);
672 parport_frob_control (port
, PARPORT_CONTROL_STROBE
,
673 PARPORT_CONTROL_STROBE
);
675 for (retry
= 0; retry
< 100; retry
++) {
676 if (!parport_wait_peripheral (port
,
677 PARPORT_STATUS_BUSY
, 0))
680 if (signal_pending (current
)) {
681 parport_frob_control (port
,
682 PARPORT_CONTROL_STROBE
,
688 /* Time for Host Transfer Recovery (page 41 of IEEE1284) */
689 DPRINTK (KERN_DEBUG
"%s: ECP transfer stalled!\n", port
->name
);
691 parport_frob_control (port
, PARPORT_CONTROL_INIT
,
692 PARPORT_CONTROL_INIT
);
694 if (parport_read_status (port
) & PARPORT_STATUS_PAPEROUT
) {
696 parport_frob_control (port
, PARPORT_CONTROL_INIT
, 0);
700 parport_frob_control (port
, PARPORT_CONTROL_INIT
, 0);
702 if (!(parport_read_status (port
) & PARPORT_STATUS_PAPEROUT
))
705 DPRINTK (KERN_DEBUG
"%s: Host transfer recovered\n",
708 if (time_after_eq (jiffies
, expire
)) break;
711 parport_frob_control (port
, PARPORT_CONTROL_STROBE
, 0);
713 if (parport_wait_peripheral (port
,
715 PARPORT_STATUS_BUSY
))
716 /* Peripheral hasn't accepted the data. */
720 port
->ieee1284
.phase
= IEEE1284_PH_FWD_IDLE
;
723 #endif /* IEEE1284 support */
730 /* EPP mode, forward channel, data. */
731 size_t parport_ieee1284_epp_write_data (struct parport
*port
,
732 const void *buffer
, size_t len
,
735 unsigned char *bp
= (unsigned char *) buffer
;
738 /* set EPP idle state (just to make sure) with strobe low */
739 parport_frob_control (port
,
740 PARPORT_CONTROL_STROBE
|
741 PARPORT_CONTROL_AUTOFD
|
742 PARPORT_CONTROL_SELECT
|
743 PARPORT_CONTROL_INIT
,
744 PARPORT_CONTROL_STROBE
|
745 PARPORT_CONTROL_INIT
);
746 port
->ops
->data_forward (port
);
747 for (; len
> 0; len
--, bp
++) {
748 /* Event 62: Write data and set autofd low */
749 parport_write_data (port
, *bp
);
750 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
,
751 PARPORT_CONTROL_AUTOFD
);
753 /* Event 58: wait for busy (nWait) to go high */
754 if (parport_poll_peripheral (port
, PARPORT_STATUS_BUSY
, 0, 10))
757 /* Event 63: set nAutoFd (nDStrb) high */
758 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
, 0);
760 /* Event 60: wait for busy (nWait) to go low */
761 if (parport_poll_peripheral (port
, PARPORT_STATUS_BUSY
,
762 PARPORT_STATUS_BUSY
, 5))
768 /* Event 61: set strobe (nWrite) high */
769 parport_frob_control (port
, PARPORT_CONTROL_STROBE
, 0);
774 /* EPP mode, reverse channel, data. */
775 size_t parport_ieee1284_epp_read_data (struct parport
*port
,
776 void *buffer
, size_t len
,
779 unsigned char *bp
= (unsigned char *) buffer
;
782 /* set EPP idle state (just to make sure) with strobe high */
783 parport_frob_control (port
,
784 PARPORT_CONTROL_STROBE
|
785 PARPORT_CONTROL_AUTOFD
|
786 PARPORT_CONTROL_SELECT
|
787 PARPORT_CONTROL_INIT
,
788 PARPORT_CONTROL_INIT
);
789 port
->ops
->data_reverse (port
);
790 for (; len
> 0; len
--, bp
++) {
791 /* Event 67: set nAutoFd (nDStrb) low */
792 parport_frob_control (port
,
793 PARPORT_CONTROL_AUTOFD
,
794 PARPORT_CONTROL_AUTOFD
);
795 /* Event 58: wait for Busy to go high */
796 if (parport_wait_peripheral (port
, PARPORT_STATUS_BUSY
, 0)) {
800 *bp
= parport_read_data (port
);
802 /* Event 63: set nAutoFd (nDStrb) high */
803 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
, 0);
805 /* Event 60: wait for Busy to go low */
806 if (parport_poll_peripheral (port
, PARPORT_STATUS_BUSY
,
807 PARPORT_STATUS_BUSY
, 5)) {
813 port
->ops
->data_forward (port
);
818 /* EPP mode, forward channel, addresses. */
819 size_t parport_ieee1284_epp_write_addr (struct parport
*port
,
820 const void *buffer
, size_t len
,
823 unsigned char *bp
= (unsigned char *) buffer
;
826 /* set EPP idle state (just to make sure) with strobe low */
827 parport_frob_control (port
,
828 PARPORT_CONTROL_STROBE
|
829 PARPORT_CONTROL_AUTOFD
|
830 PARPORT_CONTROL_SELECT
|
831 PARPORT_CONTROL_INIT
,
832 PARPORT_CONTROL_STROBE
|
833 PARPORT_CONTROL_INIT
);
834 port
->ops
->data_forward (port
);
835 for (; len
> 0; len
--, bp
++) {
836 /* Event 56: Write data and set nAStrb low. */
837 parport_write_data (port
, *bp
);
838 parport_frob_control (port
, PARPORT_CONTROL_SELECT
,
839 PARPORT_CONTROL_SELECT
);
841 /* Event 58: wait for busy (nWait) to go high */
842 if (parport_poll_peripheral (port
, PARPORT_STATUS_BUSY
, 0, 10))
845 /* Event 59: set nAStrb high */
846 parport_frob_control (port
, PARPORT_CONTROL_SELECT
, 0);
848 /* Event 60: wait for busy (nWait) to go low */
849 if (parport_poll_peripheral (port
, PARPORT_STATUS_BUSY
,
850 PARPORT_STATUS_BUSY
, 5))
856 /* Event 61: set strobe (nWrite) high */
857 parport_frob_control (port
, PARPORT_CONTROL_STROBE
, 0);
862 /* EPP mode, reverse channel, addresses. */
863 size_t parport_ieee1284_epp_read_addr (struct parport
*port
,
864 void *buffer
, size_t len
,
867 unsigned char *bp
= (unsigned char *) buffer
;
870 /* Set EPP idle state (just to make sure) with strobe high */
871 parport_frob_control (port
,
872 PARPORT_CONTROL_STROBE
|
873 PARPORT_CONTROL_AUTOFD
|
874 PARPORT_CONTROL_SELECT
|
875 PARPORT_CONTROL_INIT
,
876 PARPORT_CONTROL_INIT
);
877 port
->ops
->data_reverse (port
);
878 for (; len
> 0; len
--, bp
++) {
879 /* Event 64: set nSelectIn (nAStrb) low */
880 parport_frob_control (port
, PARPORT_CONTROL_SELECT
,
881 PARPORT_CONTROL_SELECT
);
883 /* Event 58: wait for Busy to go high */
884 if (parport_wait_peripheral (port
, PARPORT_STATUS_BUSY
, 0)) {
888 *bp
= parport_read_data (port
);
890 /* Event 59: set nSelectIn (nAStrb) high */
891 parport_frob_control (port
, PARPORT_CONTROL_SELECT
,
894 /* Event 60: wait for Busy to go low */
895 if (parport_poll_peripheral (port
, PARPORT_STATUS_BUSY
,
896 PARPORT_STATUS_BUSY
, 5))
901 port
->ops
->data_forward (port
);
906 EXPORT_SYMBOL(parport_ieee1284_ecp_write_data
);
907 EXPORT_SYMBOL(parport_ieee1284_ecp_read_data
);
908 EXPORT_SYMBOL(parport_ieee1284_ecp_write_addr
);
909 EXPORT_SYMBOL(parport_ieee1284_write_compat
);
910 EXPORT_SYMBOL(parport_ieee1284_read_nibble
);
911 EXPORT_SYMBOL(parport_ieee1284_read_byte
);
912 EXPORT_SYMBOL(parport_ieee1284_epp_write_data
);
913 EXPORT_SYMBOL(parport_ieee1284_epp_read_data
);
914 EXPORT_SYMBOL(parport_ieee1284_epp_write_addr
);
915 EXPORT_SYMBOL(parport_ieee1284_epp_read_addr
);