[PARPORT] v2 of my proposed parport and bitops additions


Thomas Sailer (sailer@ife.ee.ethz.ch)
Wed, 13 May 1998 13:04:27 +0200


The following patch does:

* parport
  - add a few EPP functions
  - before parport SPP probe, blindly try to reset an EPP timeout
    condition. I have an SMC chip that apparently does not even
    respond to SPP cycles when there's an EPP timeout pending.
    Therefore it sometimes isn't detected.

* bitops
  - add functions for computing the number of bits set in
    a word. As per suggestion from Pavel Machek, there
    is now a single generic implentation plus eventually
    arch specific faster implementations.

Tom

diff -u -r -N linux-vanilla/drivers/misc/parport_arc.c linux/drivers/misc/parport_arc.c
--- linux-vanilla/drivers/misc/parport_arc.c Wed Feb 25 07:33:03 1998
+++ linux/drivers/misc/parport_arc.c Tue May 5 14:01:11 1998
@@ -82,6 +82,12 @@
         arc_release_resources,
         arc_claim_resources,
         
+ NULL, /* epp_write_data */
+ NULL, /* epp_read_data */
+ NULL, /* epp_write_addr */
+ NULL, /* epp_read_addr */
+ NULL, /* epp_check_timeout */
+
         NULL, /* epp_write_block */
         NULL, /* epp_read_block */
 
diff -u -r -N linux-vanilla/drivers/misc/parport_ax.c linux/drivers/misc/parport_ax.c
--- linux-vanilla/drivers/misc/parport_ax.c Wed Feb 25 07:33:03 1998
+++ linux/drivers/misc/parport_ax.c Tue May 5 14:01:11 1998
@@ -39,7 +39,8 @@
 #define DATA 0x00
 #define STATUS 0x01
 #define CONTROL 0x02
-#define EPPREG 0x04
+#define EPPADDR 0x03
+#define EPPDATA 0x04
 
 #define CFIFO 0x400
 #define DFIFO 0x400
@@ -57,13 +58,34 @@
 void
 parport_ax_write_epp(struct parport *p, unsigned char d)
 {
- outb(d, p->base + EPPREG);
+ outb(d, p->base + EPPDATA);
 }
 
 unsigned char
 parport_ax_read_epp(struct parport *p)
 {
- return inb(p->base + EPPREG);
+ return inb(p->base + EPPDATA);
+}
+
+void
+parport_ax_write_epp_addr(struct parport *p, unsigned char d)
+{
+ outb(d, p->base + EPPADDR);
+}
+
+unsigned char
+parport_ax_read_epp_addr(struct parport *p)
+{
+ return inb(p->base + EPPADDR);
+}
+
+int
+parport_ax_check_epp_timeout(struct parport *p)
+{
+ if (!(inb(p->base+STATUS) & 1))
+ return 0;
+ parport_ax_epp_clear_timeout(p);
+ return 1;
 }
 
 unsigned char
@@ -295,6 +317,12 @@
         parport_ax_release_resources,
         parport_ax_claim_resources,
         
+ parport_ax_write_epp,
+ parport_ax_read_epp,
+ parport_ax_write_epp_addr,
+ parport_ax_read_epp_addr,
+ parport_ax_check_epp_timeout,
+
         parport_ax_epp_write_block,
         parport_ax_epp_read_block,
 
@@ -490,7 +518,7 @@
         if (!(p = parport_register_port(base, irq, dma, &parport_ax_ops)))
                 return 0;
 
- /* Safe away pointer to our EBus DMA */
+ /* Save away pointer to our EBus DMA */
         p->private_data = (void *)dev->base_address[2];
 
         p->modes = PARPORT_MODE_PCSPP | parport_PS2_supported(p);
diff -u -r -N linux-vanilla/drivers/misc/parport_pc.c linux/drivers/misc/parport_pc.c
--- linux-vanilla/drivers/misc/parport_pc.c Wed Apr 15 23:38:36 1998
+++ linux/drivers/misc/parport_pc.c Tue May 5 14:01:11 1998
@@ -19,8 +19,8 @@
  *
  * In addition, there are some optional registers:
  *
- * base+3 EPP command
- * base+4 EPP
+ * base+3 EPP address
+ * base+4 EPP data
  * base+0x400 ECP config A
  * base+0x401 ECP config B
  * base+0x402 ECP control
@@ -59,12 +59,30 @@
 
 void parport_pc_write_epp(struct parport *p, unsigned char d)
 {
- outb(d, p->base+EPPREG);
+ outb(d, p->base+EPPDATA);
 }
 
 unsigned char parport_pc_read_epp(struct parport *p)
 {
- return inb(p->base+EPPREG);
+ return inb(p->base+EPPDATA);
+}
+
+void parport_pc_write_epp_addr(struct parport *p, unsigned char d)
+{
+ outb(d, p->base+EPPADDR);
+}
+
+unsigned char parport_pc_read_epp_addr(struct parport *p)
+{
+ return inb(p->base+EPPADDR);
+}
+
+int parport_pc_check_epp_timeout(struct parport *p)
+{
+ if (!(inb(p->base+STATUS) & 1))
+ return 0;
+ parport_pc_epp_clear_timeout(p);
+ return 1;
 }
 
 unsigned char parport_pc_read_configb(struct parport *p)
@@ -187,7 +205,7 @@
 {
         size_t got = 0;
         for (; got < length; got++) {
- *((char*)buf)++ = inb (p->base+EPPREG);
+ *((char*)buf)++ = inb (p->base+EPPDATA);
                 if (inb (p->base+STATUS) & 0x01)
                         break;
         }
@@ -198,7 +216,7 @@
 {
         size_t written = 0;
         for (; written < length; written++) {
- outb (*((char*)buf)++, p->base+EPPREG);
+ outb (*((char*)buf)++, p->base+EPPDATA);
                 if (inb (p->base+STATUS) & 0x01)
                         break;
         }
@@ -258,6 +276,12 @@
         parport_pc_release_resources,
         parport_pc_claim_resources,
         
+ parport_pc_write_epp,
+ parport_pc_read_epp,
+ parport_pc_write_epp_addr,
+ parport_pc_read_epp_addr,
+ parport_pc_check_epp_timeout,
+
         parport_pc_epp_write_block,
         parport_pc_epp_read_block,
 
@@ -280,7 +304,7 @@
 /*
  * Clear TIMEOUT BIT in EPP MODE
  */
-static int epp_clear_timeout(struct parport *pb)
+int parport_pc_epp_clear_timeout(struct parport *pb)
 {
         unsigned char r;
 
@@ -303,6 +327,14 @@
  */
 static int parport_SPP_supported(struct parport *pb)
 {
+ /*
+ * first clear an eventually pending EPP timeout
+ * I (sailer@ife.ee.ethz.ch) have an SMSC chipset
+ * that does not even respond to SPP cycles if an EPP
+ * timeout is pending
+ */
+ parport_pc_epp_clear_timeout(pb);
+
         /* Do a simple read-write test to make sure the port exists. */
         parport_pc_write_econtrol(pb, 0xc);
         parport_pc_write_control(pb, 0xc);
@@ -396,18 +428,18 @@
 static int parport_EPP_supported(struct parport *pb)
 {
         /* If EPP timeout bit clear then EPP available */
- if (!epp_clear_timeout(pb))
+ if (!parport_pc_epp_clear_timeout(pb))
                 return 0; /* No way to clear timeout */
 
         parport_pc_write_control(pb, parport_pc_read_control(pb) | 0x20);
         parport_pc_write_control(pb, parport_pc_read_control(pb) | 0x10);
- epp_clear_timeout(pb);
+ parport_pc_epp_clear_timeout(pb);
         
         parport_pc_read_epp(pb);
         udelay(30); /* Wait for possible EPP timeout */
         
         if (parport_pc_read_status(pb) & 0x01) {
- epp_clear_timeout(pb);
+ parport_pc_epp_clear_timeout(pb);
                 return PARPORT_MODE_PCEPP;
         }
 
@@ -454,7 +486,7 @@
         int ok = 0;
         unsigned char octr = parport_pc_read_control(pb);
   
- epp_clear_timeout(pb);
+ parport_pc_epp_clear_timeout(pb);
 
         parport_pc_write_control(pb, octr | 0x20); /* try to tri-state the buffer */
         
@@ -548,10 +580,10 @@
         if (pb->modes & PARPORT_MODE_PCECR)
                 parport_pc_frob_econtrol (pb, 0x10, 0x10);
         
- epp_clear_timeout(pb);
+ parport_pc_epp_clear_timeout(pb);
         parport_pc_frob_control (pb, 0x20, 0x20);
         parport_pc_frob_control (pb, 0x10, 0x10);
- epp_clear_timeout(pb);
+ parport_pc_epp_clear_timeout(pb);
 
         /* Device isn't expecting an EPP read
          * and generates an IRQ.
@@ -633,12 +665,12 @@
                 parport_pc_write_econtrol(pb, oecr);
         }
 
- epp_clear_timeout(pb);
+ parport_pc_epp_clear_timeout(pb);
 
         if (pb->irq == PARPORT_IRQ_NONE && (pb->modes & PARPORT_MODE_PCEPP))
                 pb->irq = irq_probe_EPP(pb);
 
- epp_clear_timeout(pb);
+ parport_pc_epp_clear_timeout(pb);
 
         if (pb->irq == PARPORT_IRQ_NONE)
                 pb->irq = irq_probe_SPP(pb);
diff -u -r -N linux-vanilla/include/asm-alpha/bitops.h linux/include/asm-alpha/bitops.h
--- linux-vanilla/include/asm-alpha/bitops.h Mon Mar 30 10:21:40 1998
+++ linux/include/asm-alpha/bitops.h Tue May 5 14:01:12 1998
@@ -183,6 +183,24 @@
 }
 
 /*
+ * ffs: find first bit set. This is defined the same way as
+ * the libc and compiler builtin ffs routines, therefore
+ * differs in spirit from the above ffz (man ffs).
+ */
+
+#define ffs(x) generic_ffs(x)
+
+/*
+ * hweightN: returns the hamming weight (i.e. the number
+ * of bits set) of a N-bit word
+ */
+
+#define hweight32(x) generic_hweight32(x)
+#define hweight16(x) generic_hweight16(x)
+#define hweight8(x) generic_hweight8(x)
+
+
+/*
  * Find next zero bit in a bitmap reasonably efficiently..
  */
 extern inline unsigned long find_next_zero_bit(void * addr, unsigned long size, unsigned long offset)
diff -u -r -N linux-vanilla/include/asm-arm/bitops.h linux/include/asm-arm/bitops.h
--- linux-vanilla/include/asm-arm/bitops.h Wed Jan 21 01:39:42 1998
+++ linux/include/asm-arm/bitops.h Tue May 5 14:01:12 1998
@@ -53,6 +53,24 @@
         return k;
 }
 
+/*
+ * ffs: find first bit set. This is defined the same way as
+ * the libc and compiler builtin ffs routines, therefore
+ * differs in spirit from the above ffz (man ffs).
+ */
+
+#define ffs(x) generic_ffs(x)
+
+/*
+ * hweightN: returns the hamming weight (i.e. the number
+ * of bits set) of a N-bit word
+ */
+
+#define hweight32(x) generic_hweight32(x)
+#define hweight16(x) generic_hweight16(x)
+#define hweight8(x) generic_hweight8(x)
+
+
 #ifdef __KERNEL__
 
 #define ext2_set_bit test_and_set_bit
diff -u -r -N linux-vanilla/include/asm-generic/bitops.h linux/include/asm-generic/bitops.h
--- linux-vanilla/include/asm-generic/bitops.h Mon Aug 15 09:54:22 1994
+++ linux/include/asm-generic/bitops.h Tue May 5 14:01:12 1998
@@ -50,4 +50,22 @@
         mask = 1 << (nr & 0x1f);
         return ((mask & *addr) != 0);
 }
+
+/*
+ * ffs: find first bit set. This is defined the same way as
+ * the libc and compiler builtin ffs routines, therefore
+ * differs in spirit from the above ffz (man ffs).
+ */
+
+#define ffs(x) generic_ffs(x)
+
+/*
+ * hweightN: returns the hamming weight (i.e. the number
+ * of bits set) of a N-bit word
+ */
+
+#define hweight32(x) generic_hweight32(x)
+#define hweight16(x) generic_hweight16(x)
+#define hweight8(x) generic_hweight8(x)
+
 #endif /* _ASM_GENERIC_BITOPS_H */
diff -u -r -N linux-vanilla/include/asm-i386/bitops.h linux/include/asm-i386/bitops.h
--- linux-vanilla/include/asm-i386/bitops.h Mon Dec 1 20:16:57 1997
+++ linux/include/asm-i386/bitops.h Tue May 5 14:01:12 1998
@@ -187,6 +187,33 @@
         return word;
 }
 
+/*
+ * ffs: find first bit set. This is defined the same way as
+ * the libc and compiler builtin ffs routines, therefore
+ * differs in spirit from the above ffz (man ffs).
+ */
+
+extern __inline__ int ffs(int x)
+{
+ int r;
+
+ __asm__("bsfl %1,%0\n\t"
+ "jnz 1f\n\t"
+ "movl $-1,%0\n"
+ "1:" : "=r" (r) : "g" (x));
+ return r+1;
+}
+
+/*
+ * hweightN: returns the hamming weight (i.e. the number
+ * of bits set) of a N-bit word
+ */
+
+#define hweight32(x) generic_hweight32(x)
+#define hweight16(x) generic_hweight16(x)
+#define hweight8(x) generic_hweight8(x)
+
+
 #ifdef __KERNEL__
 
 #define ext2_set_bit test_and_set_bit
diff -u -r -N linux-vanilla/include/asm-m68k/bitops.h linux/include/asm-m68k/bitops.h
--- linux-vanilla/include/asm-m68k/bitops.h Fri Feb 13 01:30:13 1998
+++ linux/include/asm-m68k/bitops.h Tue May 5 14:01:12 1998
@@ -210,6 +210,23 @@
         return res ^ 31;
 }
 
+/*
+ * ffs: find first bit set. This is defined the same way as
+ * the libc and compiler builtin ffs routines, therefore
+ * differs in spirit from the above ffz (man ffs).
+ */
+
+#define ffs(x) generic_ffs(x)
+
+/*
+ * hweightN: returns the hamming weight (i.e. the number
+ * of bits set) of a N-bit word
+ */
+
+#define hweight32(x) generic_hweight32(x)
+#define hweight16(x) generic_hweight16(x)
+#define hweight8(x) generic_hweight8(x)
+
 /* Bitmap functions for the minix filesystem */
 
 extern __inline__ int
diff -u -r -N linux-vanilla/include/asm-mips/bitops.h linux/include/asm-mips/bitops.h
--- linux-vanilla/include/asm-mips/bitops.h Tue Dec 16 21:45:55 1997
+++ linux/include/asm-mips/bitops.h Tue May 5 14:01:12 1998
@@ -372,6 +372,23 @@
         return __res;
 }
 
+/*
+ * ffs: find first bit set. This is defined the same way as
+ * the libc and compiler builtin ffs routines, therefore
+ * differs in spirit from the above ffz (man ffs).
+ */
+
+#define ffs(x) generic_ffs(x)
+
+/*
+ * hweightN: returns the hamming weight (i.e. the number
+ * of bits set) of a N-bit word
+ */
+
+#define hweight32(x) generic_hweight32(x)
+#define hweight16(x) generic_hweight16(x)
+#define hweight8(x) generic_hweight8(x)
+
 #ifdef __MIPSEB__
 /* For now I steal the Sparc C versions, no need for speed, just need to
  * get it working.
diff -u -r -N linux-vanilla/include/asm-ppc/bitops.h linux/include/asm-ppc/bitops.h
--- linux-vanilla/include/asm-ppc/bitops.h Sat Aug 16 18:51:09 1997
+++ linux/include/asm-ppc/bitops.h Tue May 5 14:01:12 1998
@@ -97,6 +97,34 @@
 }
 
 /*
+ * ffs: find first bit set. This is defined the same way as
+ * the libc and compiler builtin ffs routines, therefore
+ * differs in spirit from the above ffz (man ffs).
+ */
+
+#define ffs(x) generic_ffs(x)
+
+#if 0
+/* untested, someone with PPC knowledge? */
+/* From Alexander Kjeldaas <astor@guardian.no> */
+extern __inline__ int ffs(int x)
+{
+ int result;
+ asm ("cntlzw %0,%1" : "=r" (result) : "r" (x));
+ return 32 - result; /* IBM backwards ordering of bits */
+}
+#endif
+
+/*
+ * hweightN: returns the hamming weight (i.e. the number
+ * of bits set) of a N-bit word
+ */
+
+#define hweight32(x) generic_hweight32(x)
+#define hweight16(x) generic_hweight16(x)
+#define hweight8(x) generic_hweight8(x)
+
+/*
  * This implementation of find_{first,next}_zero_bit was stolen from
  * Linus' asm-alpha/bitops.h.
  */
diff -u -r -N linux-vanilla/include/asm-sparc/bitops.h linux/include/asm-sparc/bitops.h
--- linux-vanilla/include/asm-sparc/bitops.h Wed Apr 15 02:44:23 1998
+++ linux/include/asm-sparc/bitops.h Tue May 5 14:01:12 1998
@@ -182,6 +182,24 @@
         return result;
 }
 
+/*
+ * ffs: find first bit set. This is defined the same way as
+ * the libc and compiler builtin ffs routines, therefore
+ * differs in spirit from the above ffz (man ffs).
+ */
+
+#define ffs(x) generic_ffs(x)
+
+/*
+ * hweightN: returns the hamming weight (i.e. the number
+ * of bits set) of a N-bit word
+ */
+
+#define hweight32(x) generic_hweight32(x)
+#define hweight16(x) generic_hweight16(x)
+#define hweight8(x) generic_hweight8(x)
+
+
 /* find_next_zero_bit() finds the first zero bit in a bit string of length
  * 'size' bits, starting the search at bit 'offset'. This is largely based
  * on Linus's ALPHA routines, which are pretty portable BTW.
diff -u -r -N linux-vanilla/include/asm-sparc64/bitops.h linux/include/asm-sparc64/bitops.h
--- linux-vanilla/include/asm-sparc64/bitops.h Tue Jan 13 00:15:54 1998
+++ linux/include/asm-sparc64/bitops.h Tue May 5 14:01:13 1998
@@ -186,6 +186,53 @@
         return result;
 }
 
+/*
+ * ffs: find first bit set. This is defined the same way as
+ * the libc and compiler builtin ffs routines, therefore
+ * differs in spirit from the above ffz (man ffs).
+ */
+
+#define ffs(x) generic_ffs(x)
+
+/*
+ * hweightN: returns the hamming weight (i.e. the number
+ * of bits set) of a N-bit word
+ */
+
+#ifdef ULTRA_HAS_POPULATION_COUNT
+
+extern __inline__ unsigned int hweight32(unsigned int w)
+{
+ unsigned int res;
+
+ __asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xffffffff));
+ return res;
+}
+
+extern __inline__ unsigned int hweight16(unsigned int w)
+{
+ unsigned int res;
+
+ __asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xffff));
+ return res;
+}
+
+extern __inline__ unsigned int hweight8(unsigned int w)
+{
+ unsigned int res;
+
+ __asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xff));
+ return res;
+}
+
+#else
+
+#define hweight32(x) generic_hweight32(x)
+#define hweight16(x) generic_hweight16(x)
+#define hweight8(x) generic_hweight8(x)
+
+#endif
+
 /* find_next_zero_bit() finds the first zero bit in a bit string of length
  * 'size' bits, starting the search at bit 'offset'. This is largely based
  * on Linus's ALPHA routines, which are pretty portable BTW.
diff -u -r -N linux-vanilla/include/linux/bitops.h linux/include/linux/bitops.h
--- linux-vanilla/include/linux/bitops.h Thu Jan 1 02:00:00 1970
+++ linux/include/linux/bitops.h Tue May 5 14:01:13 1998
@@ -0,0 +1,72 @@
+#ifndef _LINUX_BITOPS_H
+#define _LINUX_BITOPS_H
+
+
+/*
+ * ffs: find first bit set. This is defined the same way as
+ * the libc and compiler builtin ffs routines, therefore
+ * differs in spirit from the above ffz (man ffs).
+ */
+
+extern __inline__ int generic_ffs(int x)
+{
+ int r = 1;
+
+ if (!x)
+ return 0;
+ if (!(x & 0xffff)) {
+ x >>= 16;
+ r += 16;
+ }
+ if (!(x & 0xff)) {
+ x >>= 8;
+ r += 8;
+ }
+ if (!(x & 0xf)) {
+ x >>= 4;
+ r += 4;
+ }
+ if (!(x & 3)) {
+ x >>= 2;
+ r += 2;
+ }
+ if (!(x & 1)) {
+ x >>= 1;
+ r += 1;
+ }
+ return r;
+}
+
+/*
+ * hweightN: returns the hamming weight (i.e. the number
+ * of bits set) of a N-bit word
+ */
+
+extern __inline__ unsigned int generic_hweight32(unsigned int w)
+{
+ unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
+ res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
+ res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
+ res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
+ return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
+}
+
+extern __inline__ unsigned int generic_hweight16(unsigned int w)
+{
+ unsigned int res = (w & 0x5555) + ((w >> 1) & 0x5555);
+ res = (res & 0x3333) + ((res >> 2) & 0x3333);
+ res = (res & 0x0F0F) + ((res >> 4) & 0x0F0F);
+ return (res & 0x00FF) + ((res >> 8) & 0x00FF);
+}
+
+extern __inline__ unsigned int generic_hweight8(unsigned int w)
+{
+ unsigned int res = (w & 0x55) + ((w >> 1) & 0x55);
+ res = (res & 0x33) + ((res >> 2) & 0x33);
+ return (res & 0x0F) + ((res >> 4) & 0x0F);
+}
+
+#include <asm/bitops.h>
+
+
+#endif
diff -u -r -N linux-vanilla/include/linux/parport.h linux/include/linux/parport.h
--- linux-vanilla/include/linux/parport.h Thu Apr 23 04:01:06 1998
+++ linux/include/linux/parport.h Mon May 11 14:34:50 1998
@@ -106,6 +106,11 @@
         void (*release_resources)(struct parport *);
         int (*claim_resources)(struct parport *);
 
+ void (*epp_write_data)(struct parport *, unsigned char);
+ unsigned char (*epp_read_data)(struct parport *);
+ void (*epp_write_addr)(struct parport *, unsigned char);
+ unsigned char (*epp_read_addr)(struct parport *);
+ int (*epp_check_timeout)(struct parport *);
         size_t (*epp_write_block)(struct parport *, void *, size_t);
         size_t (*epp_read_block)(struct parport *, void *, size_t);
 
@@ -329,6 +334,11 @@
 #define parport_change_mode(p,m) parport_pc_change_mode(p,m)
 #define parport_release_resources(p) parport_pc_release_resources(p)
 #define parport_claim_resources(p) parport_pc_claim_resources(p)
+#define parport_epp_write_data(p,x) parport_pc_write_epp(p,x)
+#define parport_epp_read_data(p) parport_pc_read_epp(p)
+#define parport_epp_write_addr(p,x) parport_pc_write_epp_addr(p,x)
+#define parport_epp_read_addr(p) parport_pc_read_epp_addr(p)
+#define parport_epp_check_timeout(p) parport_pc_check_epp_timeout(p)
 #endif
 
 #ifdef PARPORT_NEED_GENERIC_OPS
@@ -348,6 +358,11 @@
 #define parport_change_mode(p,m) (p)->ops->change_mode(p,m)
 #define parport_release_resources(p) (p)->ops->release_resources(p)
 #define parport_claim_resources(p) (p)->ops->claim_resources(p)
+#define parport_epp_write_data(p,x) (p)->ops->epp_write_data(p,x)
+#define parport_epp_read_data(p) (p)->ops->epp_read_data(p)
+#define parport_epp_write_addr(p,x) (p)->ops->epp_write_addr(p,x)
+#define parport_epp_read_addr(p) (p)->ops->epp_read_addr(p)
+#define parport_epp_check_timeout(p) (p)->ops->epp_check_timeout(p)
 #endif
 
 #endif /* __KERNEL__ */
diff -u -r -N linux-vanilla/include/linux/parport_pc.h linux/include/linux/parport_pc.h
--- linux-vanilla/include/linux/parport_pc.h Wed Feb 25 07:33:04 1998
+++ linux/include/linux/parport_pc.h Mon May 11 14:34:50 1998
@@ -8,19 +8,41 @@
 #define ECONTROL 0x402
 #define CONFIGB 0x401
 #define CONFIGA 0x400
-#define EPPREG 0x4
+#define EPPDATA 0x4
+#define EPPADDR 0x3
 #define CONTROL 0x2
 #define STATUS 0x1
 #define DATA 0
 
+extern int parport_pc_epp_clear_timeout(struct parport *pb);
+
+
 extern __inline__ void parport_pc_write_epp(struct parport *p, unsigned char d)
 {
- outb(d, p->base+EPPREG);
+ outb(d, p->base+EPPDATA);
 }
 
 extern __inline__ unsigned char parport_pc_read_epp(struct parport *p)
 {
- return inb(p->base+EPPREG);
+ return inb(p->base+EPPDATA);
+}
+
+extern __inline__ void parport_pc_write_epp_addr(struct parport *p, unsigned char d)
+{
+ outb(d, p->base+EPPADDR);
+}
+
+extern __inline__ unsigned char parport_pc_read_epp_addr(struct parport *p)
+{
+ return inb(p->base+EPPADDR);
+}
+
+extern __inline__ int parport_pc_check_epp_timeout(struct parport *p)
+{
+ if (!(inb(p->base+STATUS) & 1))
+ return 0;
+ parport_pc_epp_clear_timeout(p);
+ return 1;
 }
 
 extern __inline__ unsigned char parport_pc_read_configb(struct parport *p)

-- 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 30 Dec 1998 - 10:17:44 EST