[PARPORT] ppdev ECP addr ops


Tim Waugh (tim@cyberelk.demon.co.uk)
Wed, 21 Jul 1999 20:00:20 +0100 (GMT)


How does this look for supporting ECP/EPP address transfers with ppdev?
Note that no actual ppdev changes are needed -- an extra bit in port->mode
specifies whether or not parport_read and parport_write should use address
operations.

The bit doesn't actually act as advertised with this patch; this is just
to demonstrate the idea.

Tim.
*/

--- linux/include/linux/parport.h~ Wed Jul 21 19:38:04 1999
+++ linux/include/linux/parport.h Wed Jul 21 19:48:24 1999
@@ -70,6 +70,11 @@
 #define IEEE1284_MODE_EPPSWE (1<<12) /* Software-emulated */
 #define IEEE1284_DEVICEID (1<<2) /* This is a flag */
 
+/* For the benefit of parport_read/write, you can use these with
+ * parport_negotiate to use address operations. They have no effect
+ * other than to make parport_read/write use address transfers. */
+#define IEEE1284_ADDR (1<<13) /* This is a flag */
+
 /* The rest is for the kernel only */
 #ifdef __KERNEL__
 
--- linux/drivers/misc/parport_ieee1284.c~ Wed Jul 21 19:45:42 1999
+++ linux/drivers/misc/parport_ieee1284.c Wed Jul 21 19:54:44 1999
@@ -220,7 +220,7 @@
         printk (KERN_ERR "parport: IEEE1284 not supported in this kernel\n");
         return -1;
 #else
- int m = mode;
+ int m = mode & ~IEEE1284_ADDR;
         unsigned char xflag;
 
         port = port->physport;
@@ -229,6 +229,12 @@
         if (port->ieee1284.mode == mode)
                 return 0;
 
+ /* Is the difference just an address-or-not bit? */
+ if ((port->ieee1284.mode & ~IEEE1284_ADDR) == (mode & ~IEEE1284_ADDR)){
+ port->ieee1284.mode = mode;
+ return 0;
+ }
+
         /* Go to compability forward idle mode */
         if (port->ieee1284.mode != IEEE1284_MODE_COMPAT)
                 parport_ieee1284_terminate (port);
@@ -411,8 +417,8 @@
         int mode = port->ieee1284.mode;
         size_t (*fn) (struct parport *, const void *, size_t, int);
 
- /* Ignore the device-ID-request bit. */
- mode &= ~IEEE1284_DEVICEID;
+ /* Ignore the device-ID-request bit and the address bit. */
+ mode &= ~(IEEE1284_DEVICEID | IEEE1284_ADDR);
 
         /* Use the mode we're in. */
         switch (mode) {
@@ -466,8 +472,8 @@
         int mode = port->physport->ieee1284.mode;
         size_t (*fn) (struct parport *, void *, size_t, int);
 
- /* Ignore the device-ID-request bit. */
- mode &= ~IEEE1284_DEVICEID;
+ /* Ignore the device-ID-request bit and the address bit. */
+ mode &= ~(IEEE1284_DEVICEID | IEEE1284_ADDR);
 
         /* Use the mode we're in. */
         switch (mode) {

-- To unsubscribe, send mail to: linux-parport-request@torque.net --
-- with the single word "unsubscribe" in the body of the message. --



This archive was generated by hypermail 2.0b3 on Wed 21 Jul 1999 - 15:05:10 EDT