17 #include <linux/module.h>
18 #include <linux/parport.h>
20 #include <linux/sched.h>
21 #include <asm/uaccess.h>
25 #ifdef CONFIG_LP_CONSOLE
30 #define DPRINTK(stuff...) printk (stuff)
32 #define DPRINTK(stuff...)
41 const void *
buffer,
size_t len,
97 if (count && no_irq) {
138 if (!parport_yield_blocking (dev)
153 #ifndef CONFIG_PARPORT_1284
158 unsigned char byte = 0;
161 for (i=0; i < len; i++) {
162 unsigned char nibble;
165 if (((i & 1) == 0) &&
181 "%s: Nibble timeout at event 9 (%d bytes)\n",
191 if ((nibble & 0x10) == 0)
204 "%s: Nibble timeout at event 11\n",
222 "%s: No more nibble data (%d bytes)\n",
244 #ifndef CONFIG_PARPORT_1284
250 for (count = 0; count < len; count++) {
310 "%s: No more byte data (%Zd bytes)\n",
331 #ifdef CONFIG_PARPORT_1284
368 int ecp_reverse_to_forward (
struct parport *port)
391 "%s: ECP direction: failed to switch forward\n",
404 const void *
buffer,
size_t len,
407 #ifndef CONFIG_PARPORT_1284
417 if (ecp_reverse_to_forward (port))
428 for (written = 0; written < len; written++, buf++) {
429 unsigned long expire =
jiffies + port->
cad->timeout;
438 for (retry = 0; retry < 100; retry++) {
443 if (signal_pending (
current)) {
493 #ifndef CONFIG_PARPORT_1284
506 if (ecp_forward_to_reverse (port))
517 while (count < len) {
568 "channel command (%02x)\n",
574 "using RLE; accepting anyway\n",
577 rle_count = byte + 1;
580 if (rle_count > (len - count)) {
582 "for next time\n", port->
name,
602 "%s: command ignored (%02x)\n",
619 memset (buf, byte, rle_count);
623 port->
name, rle_count);
639 const void *
buffer,
size_t len,
642 #ifndef CONFIG_PARPORT_1284
652 if (ecp_reverse_to_forward (port))
664 for (written = 0; written < len; written++, buf++) {
665 unsigned long expire =
jiffies + port->
cad->timeout;
674 for (retry = 0; retry < 100; retry++) {
679 if (signal_pending (
current)) {
731 const void *
buffer,
size_t len,
734 unsigned char *bp = (
unsigned char *) buffer;
745 port->
ops->data_forward (port);
746 for (; len > 0; len--, bp++) {
778 unsigned char *bp = (
unsigned char *) buffer;
788 port->
ops->data_reverse (port);
789 for (; len > 0; len--, bp++) {
812 port->
ops->data_forward (port);
819 const void *
buffer,
size_t len,
822 unsigned char *bp = (
unsigned char *) buffer;
833 port->
ops->data_forward (port);
834 for (; len > 0; len--, bp++) {
866 unsigned char *bp = (
unsigned char *) buffer;
876 port->
ops->data_reverse (port);
877 for (; len > 0; len--, bp++) {
900 port->
ops->data_forward (port);