This source file includes following definitions.
- parport_ieee1284_write_compat
- parport_ieee1284_read_nibble
- parport_ieee1284_read_byte
- ecp_forward_to_reverse
- ecp_reverse_to_forward
- parport_ieee1284_ecp_write_data
- parport_ieee1284_ecp_read_data
- parport_ieee1284_ecp_write_addr
- parport_ieee1284_epp_write_data
- parport_ieee1284_epp_read_data
- parport_ieee1284_epp_write_addr
- parport_ieee1284_epp_read_addr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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>
23
24 #undef DEBUG
25
26 #ifdef CONFIG_LP_CONSOLE
27 #undef DEBUG
28 #endif
29
30 #ifdef DEBUG
31 #define DPRINTK(stuff...) printk (stuff)
32 #else
33 #define DPRINTK(stuff...)
34 #endif
35
36
37
38
39
40
41 size_t parport_ieee1284_write_compat (struct parport *port,
42 const void *buffer, size_t len,
43 int flags)
44 {
45 int no_irq = 1;
46 ssize_t count = 0;
47 const unsigned char *addr = buffer;
48 unsigned char byte;
49 struct pardevice *dev = port->physport->cad;
50 unsigned char ctl = (PARPORT_CONTROL_SELECT
51 | PARPORT_CONTROL_INIT);
52
53 if (port->irq != PARPORT_IRQ_NONE) {
54 parport_enable_irq (port);
55 no_irq = 0;
56 }
57
58 port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA;
59 parport_write_control (port, ctl);
60 parport_data_forward (port);
61 while (count < len) {
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);
68
69
70 do {
71
72 if (!parport_wait_peripheral (port, mask, val))
73
74 goto ready;
75
76
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
84
85
86
87
88 goto stop;
89
90
91 if (!time_before (jiffies, expire))
92 break;
93
94
95
96
97
98 if (count && no_irq) {
99 parport_release (dev);
100 schedule_timeout_interruptible(wait);
101 parport_claim_or_block (dev);
102 }
103 else
104
105 parport_wait_event (port, wait);
106
107
108 if (signal_pending (current))
109 break;
110
111
112 wait *= 2;
113 } while (time_before (jiffies, expire));
114
115 if (signal_pending (current))
116 break;
117
118 DPRINTK (KERN_DEBUG "%s: Timed out\n", port->name);
119 break;
120
121 ready:
122
123 byte = *addr++;
124 parport_write_data (port, byte);
125 udelay (1);
126
127
128 parport_write_control (port, ctl | PARPORT_CONTROL_STROBE);
129 udelay (1);
130
131 parport_write_control (port, ctl);
132 udelay (1);
133
134
135 count++;
136
137
138 if (time_before (jiffies, expire))
139 if (!parport_yield_blocking (dev)
140 && need_resched())
141 schedule ();
142 }
143 stop:
144 port->physport->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
145
146 return count;
147 }
148
149
150 size_t parport_ieee1284_read_nibble (struct parport *port,
151 void *buffer, size_t len,
152 int flags)
153 {
154 #ifndef CONFIG_PARPORT_1284
155 return 0;
156 #else
157 unsigned char *buf = buffer;
158 int i;
159 unsigned char byte = 0;
160
161 len *= 2;
162 for (i=0; i < len; i++) {
163 unsigned char nibble;
164
165
166 if (((i & 1) == 0) &&
167 (parport_read_status(port) & PARPORT_STATUS_ERROR)) {
168 goto end_of_data;
169 }
170
171
172 parport_frob_control (port,
173 PARPORT_CONTROL_AUTOFD,
174 PARPORT_CONTROL_AUTOFD);
175
176
177 port->ieee1284.phase = IEEE1284_PH_REV_DATA;
178 if (parport_wait_peripheral (port,
179 PARPORT_STATUS_ACK, 0)) {
180
181 DPRINTK (KERN_DEBUG
182 "%s: Nibble timeout at event 9 (%d bytes)\n",
183 port->name, i/2);
184 parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0);
185 break;
186 }
187
188
189
190 nibble = parport_read_status (port) >> 3;
191 nibble &= ~8;
192 if ((nibble & 0x10) == 0)
193 nibble |= 8;
194 nibble &= 0xf;
195
196
197 parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0);
198
199
200 if (parport_wait_peripheral (port,
201 PARPORT_STATUS_ACK,
202 PARPORT_STATUS_ACK)) {
203
204 DPRINTK (KERN_DEBUG
205 "%s: Nibble timeout at event 11\n",
206 port->name);
207 break;
208 }
209
210 if (i & 1) {
211
212 byte |= nibble << 4;
213 *buf++ = byte;
214 } else
215 byte = nibble;
216 }
217
218 if (i == len) {
219
220 if (parport_read_status (port) & PARPORT_STATUS_ERROR) {
221 end_of_data:
222 DPRINTK (KERN_DEBUG
223 "%s: No more nibble data (%d bytes)\n",
224 port->name, i/2);
225
226
227 parport_frob_control (port,
228 PARPORT_CONTROL_AUTOFD,
229 PARPORT_CONTROL_AUTOFD);
230 port->physport->ieee1284.phase = IEEE1284_PH_REV_IDLE;
231 }
232 else
233 port->physport->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL;
234 }
235
236 return i/2;
237 #endif
238 }
239
240
241 size_t parport_ieee1284_read_byte (struct parport *port,
242 void *buffer, size_t len,
243 int flags)
244 {
245 #ifndef CONFIG_PARPORT_1284
246 return 0;
247 #else
248 unsigned char *buf = buffer;
249 ssize_t count = 0;
250
251 for (count = 0; count < len; count++) {
252 unsigned char byte;
253
254
255 if (parport_read_status (port) & PARPORT_STATUS_ERROR) {
256 goto end_of_data;
257 }
258
259
260 parport_data_reverse (port);
261
262
263 parport_frob_control (port,
264 PARPORT_CONTROL_AUTOFD,
265 PARPORT_CONTROL_AUTOFD);
266
267
268 port->physport->ieee1284.phase = IEEE1284_PH_REV_DATA;
269 if (parport_wait_peripheral (port,
270 PARPORT_STATUS_ACK,
271 0)) {
272
273 parport_frob_control (port, PARPORT_CONTROL_AUTOFD,
274 0);
275 DPRINTK (KERN_DEBUG "%s: Byte timeout at event 9\n",
276 port->name);
277 break;
278 }
279
280 byte = parport_read_data (port);
281 *buf++ = byte;
282
283
284 parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0);
285
286
287 if (parport_wait_peripheral (port,
288 PARPORT_STATUS_ACK,
289 PARPORT_STATUS_ACK)) {
290
291 DPRINTK (KERN_DEBUG "%s: Byte timeout at event 11\n",
292 port->name);
293 break;
294 }
295
296
297 parport_frob_control (port,
298 PARPORT_CONTROL_STROBE,
299 PARPORT_CONTROL_STROBE);
300 udelay (5);
301
302
303 parport_frob_control (port, PARPORT_CONTROL_STROBE, 0);
304 }
305
306 if (count == len) {
307
308 if (parport_read_status (port) & PARPORT_STATUS_ERROR) {
309 end_of_data:
310 DPRINTK (KERN_DEBUG
311 "%s: No more byte data (%zd bytes)\n",
312 port->name, count);
313
314
315 parport_frob_control (port,
316 PARPORT_CONTROL_AUTOFD,
317 PARPORT_CONTROL_AUTOFD);
318 port->physport->ieee1284.phase = IEEE1284_PH_REV_IDLE;
319 }
320 else
321 port->physport->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL;
322 }
323
324 return count;
325 #endif
326 }
327
328
329
330
331
332 #ifdef CONFIG_PARPORT_1284
333
334 static inline
335 int ecp_forward_to_reverse (struct parport *port)
336 {
337 int retval;
338
339
340 parport_frob_control (port,
341 PARPORT_CONTROL_AUTOFD,
342 PARPORT_CONTROL_AUTOFD);
343 parport_data_reverse (port);
344 udelay (5);
345
346
347 parport_frob_control (port,
348 PARPORT_CONTROL_INIT,
349 0);
350
351
352 retval = parport_wait_peripheral (port,
353 PARPORT_STATUS_PAPEROUT, 0);
354
355 if (!retval) {
356 DPRINTK (KERN_DEBUG "%s: ECP direction: reverse\n",
357 port->name);
358 port->ieee1284.phase = IEEE1284_PH_REV_IDLE;
359 } else {
360 DPRINTK (KERN_DEBUG "%s: ECP direction: failed to reverse\n",
361 port->name);
362 port->ieee1284.phase = IEEE1284_PH_ECP_DIR_UNKNOWN;
363 }
364
365 return retval;
366 }
367
368 static inline
369 int ecp_reverse_to_forward (struct parport *port)
370 {
371 int retval;
372
373
374 parport_frob_control (port,
375 PARPORT_CONTROL_INIT
376 | PARPORT_CONTROL_AUTOFD,
377 PARPORT_CONTROL_INIT
378 | PARPORT_CONTROL_AUTOFD);
379
380
381 retval = parport_wait_peripheral (port,
382 PARPORT_STATUS_PAPEROUT,
383 PARPORT_STATUS_PAPEROUT);
384
385 if (!retval) {
386 parport_data_forward (port);
387 DPRINTK (KERN_DEBUG "%s: ECP direction: forward\n",
388 port->name);
389 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
390 } else {
391 DPRINTK (KERN_DEBUG
392 "%s: ECP direction: failed to switch forward\n",
393 port->name);
394 port->ieee1284.phase = IEEE1284_PH_ECP_DIR_UNKNOWN;
395 }
396
397
398 return retval;
399 }
400
401 #endif
402
403
404 size_t parport_ieee1284_ecp_write_data (struct parport *port,
405 const void *buffer, size_t len,
406 int flags)
407 {
408 #ifndef CONFIG_PARPORT_1284
409 return 0;
410 #else
411 const unsigned char *buf = buffer;
412 size_t written;
413 int retry;
414
415 port = port->physport;
416
417 if (port->ieee1284.phase != IEEE1284_PH_FWD_IDLE)
418 if (ecp_reverse_to_forward (port))
419 return 0;
420
421 port->ieee1284.phase = IEEE1284_PH_FWD_DATA;
422
423
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;
431 unsigned char byte;
432
433 byte = *buf;
434 try_again:
435 parport_write_data (port, byte);
436 parport_frob_control (port, PARPORT_CONTROL_STROBE,
437 PARPORT_CONTROL_STROBE);
438 udelay (5);
439 for (retry = 0; retry < 100; retry++) {
440 if (!parport_wait_peripheral (port,
441 PARPORT_STATUS_BUSY, 0))
442 goto success;
443
444 if (signal_pending (current)) {
445 parport_frob_control (port,
446 PARPORT_CONTROL_STROBE,
447 0);
448 break;
449 }
450 }
451
452
453 DPRINTK (KERN_DEBUG "%s: ECP transfer stalled!\n", port->name);
454
455 parport_frob_control (port, PARPORT_CONTROL_INIT,
456 PARPORT_CONTROL_INIT);
457 udelay (50);
458 if (parport_read_status (port) & PARPORT_STATUS_PAPEROUT) {
459
460 parport_frob_control (port, PARPORT_CONTROL_INIT, 0);
461 break;
462 }
463
464 parport_frob_control (port, PARPORT_CONTROL_INIT, 0);
465 udelay (50);
466 if (!(parport_read_status (port) & PARPORT_STATUS_PAPEROUT))
467 break;
468
469 DPRINTK (KERN_DEBUG "%s: Host transfer recovered\n",
470 port->name);
471
472 if (time_after_eq (jiffies, expire)) break;
473 goto try_again;
474 success:
475 parport_frob_control (port, PARPORT_CONTROL_STROBE, 0);
476 udelay (5);
477 if (parport_wait_peripheral (port,
478 PARPORT_STATUS_BUSY,
479 PARPORT_STATUS_BUSY))
480
481 break;
482 }
483
484 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
485
486 return written;
487 #endif
488 }
489
490
491 size_t parport_ieee1284_ecp_read_data (struct parport *port,
492 void *buffer, size_t len, int flags)
493 {
494 #ifndef CONFIG_PARPORT_1284
495 return 0;
496 #else
497 struct pardevice *dev = port->cad;
498 unsigned char *buf = buffer;
499 int rle_count = 0;
500 unsigned char ctl;
501 int rle = 0;
502 ssize_t count = 0;
503
504 port = port->physport;
505
506 if (port->ieee1284.phase != IEEE1284_PH_REV_IDLE)
507 if (ecp_forward_to_reverse (port))
508 return 0;
509
510 port->ieee1284.phase = IEEE1284_PH_REV_DATA;
511
512
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;
520 unsigned char byte;
521 int command;
522
523
524
525 while (parport_wait_peripheral (port, PARPORT_STATUS_ACK, 0)) {
526
527
528
529 if (count)
530 goto out;
531
532
533
534 if (!time_before (jiffies, expire))
535 goto out;
536
537
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);
542 }
543 else
544
545 parport_wait_event (port, msecs_to_jiffies(40));
546
547
548 if (signal_pending (current))
549 goto out;
550 }
551
552
553 if (rle)
554
555
556 command = 0;
557 else
558 command = (parport_read_status (port) &
559 PARPORT_STATUS_BUSY) ? 1 : 0;
560
561
562 byte = parport_read_data (port);
563
564
565
566 if (command) {
567 if (byte & 0x80) {
568 DPRINTK (KERN_DEBUG "%s: stopping short at "
569 "channel command (%02x)\n",
570 port->name, byte);
571 goto out;
572 }
573 else if (port->ieee1284.mode != IEEE1284_MODE_ECPRLE)
574 DPRINTK (KERN_DEBUG "%s: device illegally "
575 "using RLE; accepting anyway\n",
576 port->name);
577
578 rle_count = byte + 1;
579
580
581 if (rle_count > (len - count)) {
582 DPRINTK (KERN_DEBUG "%s: leaving %d RLE bytes "
583 "for next time\n", port->name,
584 rle_count);
585 break;
586 }
587
588 rle = 1;
589 }
590
591
592 parport_write_control (port, ctl);
593
594
595 if (parport_wait_peripheral (port, PARPORT_STATUS_ACK,
596 PARPORT_STATUS_ACK)) {
597
598
599 DPRINTK (KERN_DEBUG "ECP read timed out at 45\n");
600
601 if (command)
602 printk (KERN_WARNING
603 "%s: command ignored (%02x)\n",
604 port->name, byte);
605
606 break;
607 }
608
609
610 parport_write_control (port,
611 ctl | PARPORT_CONTROL_AUTOFD);
612
613
614 if (command)
615 continue;
616
617
618 if (rle) {
619 rle = 0;
620 memset (buf, byte, rle_count);
621 buf += rle_count;
622 count += rle_count;
623 DPRINTK (KERN_DEBUG "%s: decompressed to %d bytes\n",
624 port->name, rle_count);
625 } else {
626
627 *buf = byte;
628 buf++, count++;
629 }
630 }
631
632 out:
633 port->ieee1284.phase = IEEE1284_PH_REV_IDLE;
634 return count;
635 #endif
636 }
637
638
639 size_t parport_ieee1284_ecp_write_addr (struct parport *port,
640 const void *buffer, size_t len,
641 int flags)
642 {
643 #ifndef CONFIG_PARPORT_1284
644 return 0;
645 #else
646 const unsigned char *buf = buffer;
647 size_t written;
648 int retry;
649
650 port = port->physport;
651
652 if (port->ieee1284.phase != IEEE1284_PH_FWD_IDLE)
653 if (ecp_reverse_to_forward (port))
654 return 0;
655
656 port->ieee1284.phase = IEEE1284_PH_FWD_DATA;
657
658
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;
667 unsigned char byte;
668
669 byte = *buf;
670 try_again:
671 parport_write_data (port, byte);
672 parport_frob_control (port, PARPORT_CONTROL_STROBE,
673 PARPORT_CONTROL_STROBE);
674 udelay (5);
675 for (retry = 0; retry < 100; retry++) {
676 if (!parport_wait_peripheral (port,
677 PARPORT_STATUS_BUSY, 0))
678 goto success;
679
680 if (signal_pending (current)) {
681 parport_frob_control (port,
682 PARPORT_CONTROL_STROBE,
683 0);
684 break;
685 }
686 }
687
688
689 DPRINTK (KERN_DEBUG "%s: ECP transfer stalled!\n", port->name);
690
691 parport_frob_control (port, PARPORT_CONTROL_INIT,
692 PARPORT_CONTROL_INIT);
693 udelay (50);
694 if (parport_read_status (port) & PARPORT_STATUS_PAPEROUT) {
695
696 parport_frob_control (port, PARPORT_CONTROL_INIT, 0);
697 break;
698 }
699
700 parport_frob_control (port, PARPORT_CONTROL_INIT, 0);
701 udelay (50);
702 if (!(parport_read_status (port) & PARPORT_STATUS_PAPEROUT))
703 break;
704
705 DPRINTK (KERN_DEBUG "%s: Host transfer recovered\n",
706 port->name);
707
708 if (time_after_eq (jiffies, expire)) break;
709 goto try_again;
710 success:
711 parport_frob_control (port, PARPORT_CONTROL_STROBE, 0);
712 udelay (5);
713 if (parport_wait_peripheral (port,
714 PARPORT_STATUS_BUSY,
715 PARPORT_STATUS_BUSY))
716
717 break;
718 }
719
720 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
721
722 return written;
723 #endif
724 }
725
726
727
728
729
730
731 size_t parport_ieee1284_epp_write_data (struct parport *port,
732 const void *buffer, size_t len,
733 int flags)
734 {
735 unsigned char *bp = (unsigned char *) buffer;
736 size_t ret = 0;
737
738
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
749 parport_write_data (port, *bp);
750 parport_frob_control (port, PARPORT_CONTROL_AUTOFD,
751 PARPORT_CONTROL_AUTOFD);
752
753
754 if (parport_poll_peripheral (port, PARPORT_STATUS_BUSY, 0, 10))
755 break;
756
757
758 parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0);
759
760
761 if (parport_poll_peripheral (port, PARPORT_STATUS_BUSY,
762 PARPORT_STATUS_BUSY, 5))
763 break;
764
765 ret++;
766 }
767
768
769 parport_frob_control (port, PARPORT_CONTROL_STROBE, 0);
770
771 return ret;
772 }
773
774
775 size_t parport_ieee1284_epp_read_data (struct parport *port,
776 void *buffer, size_t len,
777 int flags)
778 {
779 unsigned char *bp = (unsigned char *) buffer;
780 unsigned ret = 0;
781
782
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
792 parport_frob_control (port,
793 PARPORT_CONTROL_AUTOFD,
794 PARPORT_CONTROL_AUTOFD);
795
796 if (parport_wait_peripheral (port, PARPORT_STATUS_BUSY, 0)) {
797 break;
798 }
799
800 *bp = parport_read_data (port);
801
802
803 parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0);
804
805
806 if (parport_poll_peripheral (port, PARPORT_STATUS_BUSY,
807 PARPORT_STATUS_BUSY, 5)) {
808 break;
809 }
810
811 ret++;
812 }
813 port->ops->data_forward (port);
814
815 return ret;
816 }
817
818
819 size_t parport_ieee1284_epp_write_addr (struct parport *port,
820 const void *buffer, size_t len,
821 int flags)
822 {
823 unsigned char *bp = (unsigned char *) buffer;
824 size_t ret = 0;
825
826
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
837 parport_write_data (port, *bp);
838 parport_frob_control (port, PARPORT_CONTROL_SELECT,
839 PARPORT_CONTROL_SELECT);
840
841
842 if (parport_poll_peripheral (port, PARPORT_STATUS_BUSY, 0, 10))
843 break;
844
845
846 parport_frob_control (port, PARPORT_CONTROL_SELECT, 0);
847
848
849 if (parport_poll_peripheral (port, PARPORT_STATUS_BUSY,
850 PARPORT_STATUS_BUSY, 5))
851 break;
852
853 ret++;
854 }
855
856
857 parport_frob_control (port, PARPORT_CONTROL_STROBE, 0);
858
859 return ret;
860 }
861
862
863 size_t parport_ieee1284_epp_read_addr (struct parport *port,
864 void *buffer, size_t len,
865 int flags)
866 {
867 unsigned char *bp = (unsigned char *) buffer;
868 unsigned ret = 0;
869
870
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
880 parport_frob_control (port, PARPORT_CONTROL_SELECT,
881 PARPORT_CONTROL_SELECT);
882
883
884 if (parport_wait_peripheral (port, PARPORT_STATUS_BUSY, 0)) {
885 break;
886 }
887
888 *bp = parport_read_data (port);
889
890
891 parport_frob_control (port, PARPORT_CONTROL_SELECT,
892 0);
893
894
895 if (parport_poll_peripheral (port, PARPORT_STATUS_BUSY,
896 PARPORT_STATUS_BUSY, 5))
897 break;
898
899 ret++;
900 }
901 port->ops->data_forward (port);
902
903 return ret;
904 }
905
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);