1 /* IEEE-1284 operations for parport.
3 * This file is for generic IEEE 1284 operations. The idea is that
4 * they are used by the low-level drivers. If they have a special way
5 * of doing something, they can provide their own routines (and put
6 * the function pointers in port->ops); if not, they can just use these
9 * Note: Make no assumptions about hardware or architecture in this file!
11 * Author: Tim Waugh <tim@cyberelk.demon.co.uk>
12 * Fixed AUTOFD polarity in ecp_forward_to_reverse(). Fred Barnes, 1999
13 * Software emulated EPP fixes, Fred Barnes, 04/2001.
17 #include <linux/module.h>
18 #include <linux/parport.h>
19 #include <linux/delay.h>
20 #include <linux/sched.h>
21 #include <linux/uaccess.h>
23 #undef DEBUG /* undef me for production */
25 #ifdef CONFIG_LP_CONSOLE
26 #undef DEBUG /* Don't want a garbled console */
30 #define DPRINTK(stuff...) printk (stuff)
32 #define DPRINTK(stuff...)
36 * One-way data transfer functions. *
39 /* Compatibility mode. */
40 size_t parport_ieee1284_write_compat (struct parport
*port
,
41 const void *buffer
, size_t len
,
46 const unsigned char *addr
= buffer
;
48 struct pardevice
*dev
= port
->physport
->cad
;
49 unsigned char ctl
= (PARPORT_CONTROL_SELECT
50 | PARPORT_CONTROL_INIT
);
52 if (port
->irq
!= PARPORT_IRQ_NONE
) {
53 parport_enable_irq (port
);
57 port
->physport
->ieee1284
.phase
= IEEE1284_PH_FWD_DATA
;
58 parport_write_control (port
, ctl
);
59 parport_data_forward (port
);
61 unsigned long expire
= jiffies
+ dev
->timeout
;
62 long wait
= msecs_to_jiffies(10);
63 unsigned char mask
= (PARPORT_STATUS_ERROR
64 | PARPORT_STATUS_BUSY
);
65 unsigned char val
= (PARPORT_STATUS_ERROR
66 | PARPORT_STATUS_BUSY
);
68 /* Wait until the peripheral's ready */
70 /* Is the peripheral ready yet? */
71 if (!parport_wait_peripheral (port
, mask
, val
))
75 /* Is the peripheral upset? */
76 if ((parport_read_status (port
) &
77 (PARPORT_STATUS_PAPEROUT
|
78 PARPORT_STATUS_SELECT
|
79 PARPORT_STATUS_ERROR
))
80 != (PARPORT_STATUS_SELECT
|
81 PARPORT_STATUS_ERROR
))
82 /* If nFault is asserted (i.e. no
83 * error) and PAPEROUT and SELECT are
84 * just red herrings, give the driver
85 * a chance to check it's happy with
86 * that before continuing. */
89 /* Have we run out of time? */
90 if (!time_before (jiffies
, expire
))
93 /* Yield the port for a while. If this is the
94 first time around the loop, don't let go of
95 the port. This way, we find out if we have
96 our interrupt handler called. */
97 if (count
&& no_irq
) {
98 parport_release (dev
);
99 schedule_timeout_interruptible(wait
);
100 parport_claim_or_block (dev
);
103 /* We must have the device claimed here */
104 parport_wait_event (port
, wait
);
106 /* Is there a signal pending? */
107 if (signal_pending (current
))
110 /* Wait longer next time. */
112 } while (time_before (jiffies
, expire
));
114 if (signal_pending (current
))
117 DPRINTK (KERN_DEBUG
"%s: Timed out\n", port
->name
);
121 /* Write the character to the data lines. */
123 parport_write_data (port
, byte
);
127 parport_write_control (port
, ctl
| PARPORT_CONTROL_STROBE
);
128 udelay (1); /* strobe */
130 parport_write_control (port
, ctl
);
131 udelay (1); /* hold */
133 /* Assume the peripheral received it. */
136 /* Let another process run if it needs to. */
137 if (time_before (jiffies
, expire
))
138 if (!parport_yield_blocking (dev
)
143 port
->physport
->ieee1284
.phase
= IEEE1284_PH_FWD_IDLE
;
149 size_t parport_ieee1284_read_nibble (struct parport
*port
,
150 void *buffer
, size_t len
,
153 #ifndef CONFIG_PARPORT_1284
156 unsigned char *buf
= buffer
;
158 unsigned char byte
= 0;
160 len
*= 2; /* in nibbles */
161 for (i
=0; i
< len
; i
++) {
162 unsigned char nibble
;
164 /* Does the error line indicate end of data? */
165 if (((i
& 1) == 0) &&
166 (parport_read_status(port
) & PARPORT_STATUS_ERROR
)) {
170 /* Event 7: Set nAutoFd low. */
171 parport_frob_control (port
,
172 PARPORT_CONTROL_AUTOFD
,
173 PARPORT_CONTROL_AUTOFD
);
175 /* Event 9: nAck goes low. */
176 port
->ieee1284
.phase
= IEEE1284_PH_REV_DATA
;
177 if (parport_wait_peripheral (port
,
178 PARPORT_STATUS_ACK
, 0)) {
179 /* Timeout -- no more data? */
181 "%s: Nibble timeout at event 9 (%d bytes)\n",
183 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
, 0);
189 nibble
= parport_read_status (port
) >> 3;
191 if ((nibble
& 0x10) == 0)
195 /* Event 10: Set nAutoFd high. */
196 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
, 0);
198 /* Event 11: nAck goes high. */
199 if (parport_wait_peripheral (port
,
201 PARPORT_STATUS_ACK
)) {
202 /* Timeout -- no more data? */
204 "%s: Nibble timeout at event 11\n",
218 /* Read the last nibble without checking data avail. */
219 if (parport_read_status (port
) & PARPORT_STATUS_ERROR
) {
222 "%s: No more nibble data (%d bytes)\n",
225 /* Go to reverse idle phase. */
226 parport_frob_control (port
,
227 PARPORT_CONTROL_AUTOFD
,
228 PARPORT_CONTROL_AUTOFD
);
229 port
->physport
->ieee1284
.phase
= IEEE1284_PH_REV_IDLE
;
232 port
->physport
->ieee1284
.phase
= IEEE1284_PH_HBUSY_DAVAIL
;
236 #endif /* IEEE1284 support */
240 size_t parport_ieee1284_read_byte (struct parport
*port
,
241 void *buffer
, size_t len
,
244 #ifndef CONFIG_PARPORT_1284
247 unsigned char *buf
= buffer
;
250 for (count
= 0; count
< len
; count
++) {
253 /* Data available? */
254 if (parport_read_status (port
) & PARPORT_STATUS_ERROR
) {
258 /* Event 14: Place data bus in high impedance state. */
259 parport_data_reverse (port
);
261 /* Event 7: Set nAutoFd low. */
262 parport_frob_control (port
,
263 PARPORT_CONTROL_AUTOFD
,
264 PARPORT_CONTROL_AUTOFD
);
266 /* Event 9: nAck goes low. */
267 port
->physport
->ieee1284
.phase
= IEEE1284_PH_REV_DATA
;
268 if (parport_wait_peripheral (port
,
271 /* Timeout -- no more data? */
272 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
,
274 DPRINTK (KERN_DEBUG
"%s: Byte timeout at event 9\n",
279 byte
= parport_read_data (port
);
282 /* Event 10: Set nAutoFd high */
283 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
, 0);
285 /* Event 11: nAck goes high. */
286 if (parport_wait_peripheral (port
,
288 PARPORT_STATUS_ACK
)) {
289 /* Timeout -- no more data? */
290 DPRINTK (KERN_DEBUG
"%s: Byte timeout at event 11\n",
295 /* Event 16: Set nStrobe low. */
296 parport_frob_control (port
,
297 PARPORT_CONTROL_STROBE
,
298 PARPORT_CONTROL_STROBE
);
301 /* Event 17: Set nStrobe high. */
302 parport_frob_control (port
, PARPORT_CONTROL_STROBE
, 0);
306 /* Read the last byte without checking data avail. */
307 if (parport_read_status (port
) & PARPORT_STATUS_ERROR
) {
310 "%s: No more byte data (%Zd bytes)\n",
313 /* Go to reverse idle phase. */
314 parport_frob_control (port
,
315 PARPORT_CONTROL_AUTOFD
,
316 PARPORT_CONTROL_AUTOFD
);
317 port
->physport
->ieee1284
.phase
= IEEE1284_PH_REV_IDLE
;
320 port
->physport
->ieee1284
.phase
= IEEE1284_PH_HBUSY_DAVAIL
;
324 #endif /* IEEE1284 support */
331 #ifdef CONFIG_PARPORT_1284
334 int ecp_forward_to_reverse (struct parport
*port
)
338 /* Event 38: Set nAutoFd low */
339 parport_frob_control (port
,
340 PARPORT_CONTROL_AUTOFD
,
341 PARPORT_CONTROL_AUTOFD
);
342 parport_data_reverse (port
);
345 /* Event 39: Set nInit low to initiate bus reversal */
346 parport_frob_control (port
,
347 PARPORT_CONTROL_INIT
,
350 /* Event 40: PError goes low */
351 retval
= parport_wait_peripheral (port
,
352 PARPORT_STATUS_PAPEROUT
, 0);
355 DPRINTK (KERN_DEBUG
"%s: ECP direction: reverse\n",
357 port
->ieee1284
.phase
= IEEE1284_PH_REV_IDLE
;
359 DPRINTK (KERN_DEBUG
"%s: ECP direction: failed to reverse\n",
361 port
->ieee1284
.phase
= IEEE1284_PH_ECP_DIR_UNKNOWN
;
368 int ecp_reverse_to_forward (struct parport
*port
)
372 /* Event 47: Set nInit high */
373 parport_frob_control (port
,
375 | PARPORT_CONTROL_AUTOFD
,
377 | PARPORT_CONTROL_AUTOFD
);
379 /* Event 49: PError goes high */
380 retval
= parport_wait_peripheral (port
,
381 PARPORT_STATUS_PAPEROUT
,
382 PARPORT_STATUS_PAPEROUT
);
385 parport_data_forward (port
);
386 DPRINTK (KERN_DEBUG
"%s: ECP direction: forward\n",
388 port
->ieee1284
.phase
= IEEE1284_PH_FWD_IDLE
;
391 "%s: ECP direction: failed to switch forward\n",
393 port
->ieee1284
.phase
= IEEE1284_PH_ECP_DIR_UNKNOWN
;
400 #endif /* IEEE1284 support */
402 /* ECP mode, forward channel, data. */
403 size_t parport_ieee1284_ecp_write_data (struct parport
*port
,
404 const void *buffer
, size_t len
,
407 #ifndef CONFIG_PARPORT_1284
410 const unsigned char *buf
= buffer
;
414 port
= port
->physport
;
416 if (port
->ieee1284
.phase
!= IEEE1284_PH_FWD_IDLE
)
417 if (ecp_reverse_to_forward (port
))
420 port
->ieee1284
.phase
= IEEE1284_PH_FWD_DATA
;
422 /* HostAck high (data, not command) */
423 parport_frob_control (port
,
424 PARPORT_CONTROL_AUTOFD
425 | PARPORT_CONTROL_STROBE
426 | PARPORT_CONTROL_INIT
,
427 PARPORT_CONTROL_INIT
);
428 for (written
= 0; written
< len
; written
++, buf
++) {
429 unsigned long expire
= jiffies
+ port
->cad
->timeout
;
434 parport_write_data (port
, byte
);
435 parport_frob_control (port
, PARPORT_CONTROL_STROBE
,
436 PARPORT_CONTROL_STROBE
);
438 for (retry
= 0; retry
< 100; retry
++) {
439 if (!parport_wait_peripheral (port
,
440 PARPORT_STATUS_BUSY
, 0))
443 if (signal_pending (current
)) {
444 parport_frob_control (port
,
445 PARPORT_CONTROL_STROBE
,
451 /* Time for Host Transfer Recovery (page 41 of IEEE1284) */
452 DPRINTK (KERN_DEBUG
"%s: ECP transfer stalled!\n", port
->name
);
454 parport_frob_control (port
, PARPORT_CONTROL_INIT
,
455 PARPORT_CONTROL_INIT
);
457 if (parport_read_status (port
) & PARPORT_STATUS_PAPEROUT
) {
459 parport_frob_control (port
, PARPORT_CONTROL_INIT
, 0);
463 parport_frob_control (port
, PARPORT_CONTROL_INIT
, 0);
465 if (!(parport_read_status (port
) & PARPORT_STATUS_PAPEROUT
))
468 DPRINTK (KERN_DEBUG
"%s: Host transfer recovered\n",
471 if (time_after_eq (jiffies
, expire
)) break;
474 parport_frob_control (port
, PARPORT_CONTROL_STROBE
, 0);
476 if (parport_wait_peripheral (port
,
478 PARPORT_STATUS_BUSY
))
479 /* Peripheral hasn't accepted the data. */
483 port
->ieee1284
.phase
= IEEE1284_PH_FWD_IDLE
;
486 #endif /* IEEE1284 support */
489 /* ECP mode, reverse channel, data. */
490 size_t parport_ieee1284_ecp_read_data (struct parport
*port
,
491 void *buffer
, size_t len
, int flags
)
493 #ifndef CONFIG_PARPORT_1284
496 struct pardevice
*dev
= port
->cad
;
497 unsigned char *buf
= buffer
;
498 int rle_count
= 0; /* shut gcc up */
503 port
= port
->physport
;
505 if (port
->ieee1284
.phase
!= IEEE1284_PH_REV_IDLE
)
506 if (ecp_forward_to_reverse (port
))
509 port
->ieee1284
.phase
= IEEE1284_PH_REV_DATA
;
511 /* Set HostAck low to start accepting data. */
512 ctl
= parport_read_control (port
);
513 ctl
&= ~(PARPORT_CONTROL_STROBE
| PARPORT_CONTROL_INIT
|
514 PARPORT_CONTROL_AUTOFD
);
515 parport_write_control (port
,
516 ctl
| PARPORT_CONTROL_AUTOFD
);
517 while (count
< len
) {
518 unsigned long expire
= jiffies
+ dev
->timeout
;
522 /* Event 43: Peripheral sets nAck low. It can take as
524 while (parport_wait_peripheral (port
, PARPORT_STATUS_ACK
, 0)) {
525 /* The peripheral hasn't given us data in
526 35ms. If we have data to give back to the
527 caller, do it now. */
531 /* If we've used up all the time we were allowed,
532 give up altogether. */
533 if (!time_before (jiffies
, expire
))
536 /* Yield the port for a while. */
537 if (count
&& dev
->port
->irq
!= PARPORT_IRQ_NONE
) {
538 parport_release (dev
);
539 schedule_timeout_interruptible(msecs_to_jiffies(40));
540 parport_claim_or_block (dev
);
543 /* We must have the device claimed here. */
544 parport_wait_event (port
, msecs_to_jiffies(40));
546 /* Is there a signal pending? */
547 if (signal_pending (current
))
551 /* Is this a command? */
553 /* The last byte was a run-length count, so
554 this can't be as well. */
557 command
= (parport_read_status (port
) &
558 PARPORT_STATUS_BUSY
) ? 1 : 0;
561 byte
= parport_read_data (port
);
563 /* If this is a channel command, rather than an RLE
564 command or a normal data byte, don't accept it. */
567 DPRINTK (KERN_DEBUG
"%s: stopping short at "
568 "channel command (%02x)\n",
572 else if (port
->ieee1284
.mode
!= IEEE1284_MODE_ECPRLE
)
573 DPRINTK (KERN_DEBUG
"%s: device illegally "
574 "using RLE; accepting anyway\n",
577 rle_count
= byte
+ 1;
579 /* Are we allowed to read that many bytes? */
580 if (rle_count
> (len
- count
)) {
581 DPRINTK (KERN_DEBUG
"%s: leaving %d RLE bytes "
582 "for next time\n", port
->name
,
590 /* Event 44: Set HostAck high, acknowledging handshake. */
591 parport_write_control (port
, ctl
);
593 /* Event 45: The peripheral has 35ms to set nAck high. */
594 if (parport_wait_peripheral (port
, PARPORT_STATUS_ACK
,
595 PARPORT_STATUS_ACK
)) {
596 /* It's gone wrong. Return what data we have
598 DPRINTK (KERN_DEBUG
"ECP read timed out at 45\n");
602 "%s: command ignored (%02x)\n",
608 /* Event 46: Set HostAck low and accept the data. */
609 parport_write_control (port
,
610 ctl
| PARPORT_CONTROL_AUTOFD
);
612 /* If we just read a run-length count, fetch the data. */
616 /* If this is the byte after a run-length count, decompress. */
619 memset (buf
, byte
, rle_count
);
622 DPRINTK (KERN_DEBUG
"%s: decompressed to %d bytes\n",
623 port
->name
, rle_count
);
625 /* Normal data byte. */
632 port
->ieee1284
.phase
= IEEE1284_PH_REV_IDLE
;
634 #endif /* IEEE1284 support */
637 /* ECP mode, forward channel, commands. */
638 size_t parport_ieee1284_ecp_write_addr (struct parport
*port
,
639 const void *buffer
, size_t len
,
642 #ifndef CONFIG_PARPORT_1284
645 const unsigned char *buf
= buffer
;
649 port
= port
->physport
;
651 if (port
->ieee1284
.phase
!= IEEE1284_PH_FWD_IDLE
)
652 if (ecp_reverse_to_forward (port
))
655 port
->ieee1284
.phase
= IEEE1284_PH_FWD_DATA
;
657 /* HostAck low (command, not data) */
658 parport_frob_control (port
,
659 PARPORT_CONTROL_AUTOFD
660 | PARPORT_CONTROL_STROBE
661 | PARPORT_CONTROL_INIT
,
662 PARPORT_CONTROL_AUTOFD
663 | PARPORT_CONTROL_INIT
);
664 for (written
= 0; written
< len
; written
++, buf
++) {
665 unsigned long expire
= jiffies
+ port
->cad
->timeout
;
670 parport_write_data (port
, byte
);
671 parport_frob_control (port
, PARPORT_CONTROL_STROBE
,
672 PARPORT_CONTROL_STROBE
);
674 for (retry
= 0; retry
< 100; retry
++) {
675 if (!parport_wait_peripheral (port
,
676 PARPORT_STATUS_BUSY
, 0))
679 if (signal_pending (current
)) {
680 parport_frob_control (port
,
681 PARPORT_CONTROL_STROBE
,
687 /* Time for Host Transfer Recovery (page 41 of IEEE1284) */
688 DPRINTK (KERN_DEBUG
"%s: ECP transfer stalled!\n", port
->name
);
690 parport_frob_control (port
, PARPORT_CONTROL_INIT
,
691 PARPORT_CONTROL_INIT
);
693 if (parport_read_status (port
) & PARPORT_STATUS_PAPEROUT
) {
695 parport_frob_control (port
, PARPORT_CONTROL_INIT
, 0);
699 parport_frob_control (port
, PARPORT_CONTROL_INIT
, 0);
701 if (!(parport_read_status (port
) & PARPORT_STATUS_PAPEROUT
))
704 DPRINTK (KERN_DEBUG
"%s: Host transfer recovered\n",
707 if (time_after_eq (jiffies
, expire
)) break;
710 parport_frob_control (port
, PARPORT_CONTROL_STROBE
, 0);
712 if (parport_wait_peripheral (port
,
714 PARPORT_STATUS_BUSY
))
715 /* Peripheral hasn't accepted the data. */
719 port
->ieee1284
.phase
= IEEE1284_PH_FWD_IDLE
;
722 #endif /* IEEE1284 support */
729 /* EPP mode, forward channel, data. */
730 size_t parport_ieee1284_epp_write_data (struct parport
*port
,
731 const void *buffer
, size_t len
,
734 unsigned char *bp
= (unsigned char *) buffer
;
737 /* set EPP idle state (just to make sure) with strobe low */
738 parport_frob_control (port
,
739 PARPORT_CONTROL_STROBE
|
740 PARPORT_CONTROL_AUTOFD
|
741 PARPORT_CONTROL_SELECT
|
742 PARPORT_CONTROL_INIT
,
743 PARPORT_CONTROL_STROBE
|
744 PARPORT_CONTROL_INIT
);
745 port
->ops
->data_forward (port
);
746 for (; len
> 0; len
--, bp
++) {
747 /* Event 62: Write data and set autofd low */
748 parport_write_data (port
, *bp
);
749 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
,
750 PARPORT_CONTROL_AUTOFD
);
752 /* Event 58: wait for busy (nWait) to go high */
753 if (parport_poll_peripheral (port
, PARPORT_STATUS_BUSY
, 0, 10))
756 /* Event 63: set nAutoFd (nDStrb) high */
757 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
, 0);
759 /* Event 60: wait for busy (nWait) to go low */
760 if (parport_poll_peripheral (port
, PARPORT_STATUS_BUSY
,
761 PARPORT_STATUS_BUSY
, 5))
767 /* Event 61: set strobe (nWrite) high */
768 parport_frob_control (port
, PARPORT_CONTROL_STROBE
, 0);
773 /* EPP mode, reverse channel, data. */
774 size_t parport_ieee1284_epp_read_data (struct parport
*port
,
775 void *buffer
, size_t len
,
778 unsigned char *bp
= (unsigned char *) buffer
;
781 /* set EPP idle state (just to make sure) with strobe high */
782 parport_frob_control (port
,
783 PARPORT_CONTROL_STROBE
|
784 PARPORT_CONTROL_AUTOFD
|
785 PARPORT_CONTROL_SELECT
|
786 PARPORT_CONTROL_INIT
,
787 PARPORT_CONTROL_INIT
);
788 port
->ops
->data_reverse (port
);
789 for (; len
> 0; len
--, bp
++) {
790 /* Event 67: set nAutoFd (nDStrb) low */
791 parport_frob_control (port
,
792 PARPORT_CONTROL_AUTOFD
,
793 PARPORT_CONTROL_AUTOFD
);
794 /* Event 58: wait for Busy to go high */
795 if (parport_wait_peripheral (port
, PARPORT_STATUS_BUSY
, 0)) {
799 *bp
= parport_read_data (port
);
801 /* Event 63: set nAutoFd (nDStrb) high */
802 parport_frob_control (port
, PARPORT_CONTROL_AUTOFD
, 0);
804 /* Event 60: wait for Busy to go low */
805 if (parport_poll_peripheral (port
, PARPORT_STATUS_BUSY
,
806 PARPORT_STATUS_BUSY
, 5)) {
812 port
->ops
->data_forward (port
);
817 /* EPP mode, forward channel, addresses. */
818 size_t parport_ieee1284_epp_write_addr (struct parport
*port
,
819 const void *buffer
, size_t len
,
822 unsigned char *bp
= (unsigned char *) buffer
;
825 /* set EPP idle state (just to make sure) with strobe low */
826 parport_frob_control (port
,
827 PARPORT_CONTROL_STROBE
|
828 PARPORT_CONTROL_AUTOFD
|
829 PARPORT_CONTROL_SELECT
|
830 PARPORT_CONTROL_INIT
,
831 PARPORT_CONTROL_STROBE
|
832 PARPORT_CONTROL_INIT
);
833 port
->ops
->data_forward (port
);
834 for (; len
> 0; len
--, bp
++) {
835 /* Event 56: Write data and set nAStrb low. */
836 parport_write_data (port
, *bp
);
837 parport_frob_control (port
, PARPORT_CONTROL_SELECT
,
838 PARPORT_CONTROL_SELECT
);
840 /* Event 58: wait for busy (nWait) to go high */
841 if (parport_poll_peripheral (port
, PARPORT_STATUS_BUSY
, 0, 10))
844 /* Event 59: set nAStrb high */
845 parport_frob_control (port
, PARPORT_CONTROL_SELECT
, 0);
847 /* Event 60: wait for busy (nWait) to go low */
848 if (parport_poll_peripheral (port
, PARPORT_STATUS_BUSY
,
849 PARPORT_STATUS_BUSY
, 5))
855 /* Event 61: set strobe (nWrite) high */
856 parport_frob_control (port
, PARPORT_CONTROL_STROBE
, 0);
861 /* EPP mode, reverse channel, addresses. */
862 size_t parport_ieee1284_epp_read_addr (struct parport
*port
,
863 void *buffer
, size_t len
,
866 unsigned char *bp
= (unsigned char *) buffer
;
869 /* Set EPP idle state (just to make sure) with strobe high */
870 parport_frob_control (port
,
871 PARPORT_CONTROL_STROBE
|
872 PARPORT_CONTROL_AUTOFD
|
873 PARPORT_CONTROL_SELECT
|
874 PARPORT_CONTROL_INIT
,
875 PARPORT_CONTROL_INIT
);
876 port
->ops
->data_reverse (port
);
877 for (; len
> 0; len
--, bp
++) {
878 /* Event 64: set nSelectIn (nAStrb) low */
879 parport_frob_control (port
, PARPORT_CONTROL_SELECT
,
880 PARPORT_CONTROL_SELECT
);
882 /* Event 58: wait for Busy to go high */
883 if (parport_wait_peripheral (port
, PARPORT_STATUS_BUSY
, 0)) {
887 *bp
= parport_read_data (port
);
889 /* Event 59: set nSelectIn (nAStrb) high */
890 parport_frob_control (port
, PARPORT_CONTROL_SELECT
,
893 /* Event 60: wait for Busy to go low */
894 if (parport_poll_peripheral (port
, PARPORT_STATUS_BUSY
,
895 PARPORT_STATUS_BUSY
, 5))
900 port
->ops
->data_forward (port
);
905 EXPORT_SYMBOL(parport_ieee1284_ecp_write_data
);
906 EXPORT_SYMBOL(parport_ieee1284_ecp_read_data
);
907 EXPORT_SYMBOL(parport_ieee1284_ecp_write_addr
);
908 EXPORT_SYMBOL(parport_ieee1284_write_compat
);
909 EXPORT_SYMBOL(parport_ieee1284_read_nibble
);
910 EXPORT_SYMBOL(parport_ieee1284_read_byte
);
911 EXPORT_SYMBOL(parport_ieee1284_epp_write_data
);
912 EXPORT_SYMBOL(parport_ieee1284_epp_read_data
);
913 EXPORT_SYMBOL(parport_ieee1284_epp_write_addr
);
914 EXPORT_SYMBOL(parport_ieee1284_epp_read_addr
);