summaryrefslogtreecommitdiffstats
path: root/include/linux/parport_pc.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-09-28 22:25:29 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-09-28 22:25:29 +0000
commit0ae8dceaebe3659ee0c3352c08125f403e77ebca (patch)
tree5085c389f09da78182b899d19fe1068b619a69dd /include/linux/parport_pc.h
parent273767781288c35c9d679e908672b9996cda4c34 (diff)
Merge with 2.3.10.
Diffstat (limited to 'include/linux/parport_pc.h')
-rw-r--r--include/linux/parport_pc.h165
1 files changed, 82 insertions, 83 deletions
diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h
index cf93bb008..955e685ad 100644
--- a/include/linux/parport_pc.h
+++ b/include/linux/parport_pc.h
@@ -5,93 +5,112 @@
/* --- register definitions ------------------------------- */
-#define ECONTROL(p) ((p)->base_hi + 0x02)
-#define CONFIGB(p) ((p)->base_hi + 0x01)
-#define CONFIGA(p) ((p)->base_hi + 0x00)
-#define EPPDATA(p) ((p)->base + 0x04)
-#define EPPADDR(p) ((p)->base + 0x03)
-#define CONTROL(p) ((p)->base + 0x02)
-#define STATUS(p) ((p)->base + 0x01)
-#define DATA(p) ((p)->base + 0x00)
-
-/* Private data for PC low-level driver. */
+#define ECONTROL(p) ((p)->base_hi + 0x2)
+#define CONFIGB(p) ((p)->base_hi + 0x1)
+#define CONFIGA(p) ((p)->base_hi + 0x0)
+#define FIFO(p) ((p)->base_hi + 0x0)
+#define EPPDATA(p) ((p)->base + 0x4)
+#define EPPADDR(p) ((p)->base + 0x3)
+#define CONTROL(p) ((p)->base + 0x2)
+#define STATUS(p) ((p)->base + 0x1)
+#define DATA(p) ((p)->base + 0x0)
+
struct parport_pc_private {
/* Contents of CTR. */
unsigned char ctr;
-};
-extern int parport_pc_epp_clear_timeout(struct parport *pb);
+ /* Bitmask of writable CTR bits. */
+ unsigned char ctr_writable;
-extern volatile unsigned char parport_pc_ctr;
+ /* Whether or not there's an ECR. */
+ int ecr;
-extern __inline__ void parport_pc_write_epp(struct parport *p, unsigned char d)
-{
- outb(d, EPPDATA(p));
-}
+ /* Number of PWords that FIFO will hold. */
+ int fifo_depth;
-extern __inline__ unsigned char parport_pc_read_epp(struct parport *p)
-{
- return inb(EPPDATA(p));
-}
+ /* Number of bytes per portword. */
+ int pword;
-extern __inline__ void parport_pc_write_epp_addr(struct parport *p, unsigned char d)
-{
- outb(d, EPPADDR(p));
-}
+ /* Not used yet. */
+ int readIntrThreshold;
+ int writeIntrThreshold;
-extern __inline__ unsigned char parport_pc_read_epp_addr(struct parport *p)
-{
- return inb(EPPADDR(p));
-}
+ /* buffer suitable for DMA, if DMA enabled */
+ char *dma_buf;
+};
-extern __inline__ int parport_pc_check_epp_timeout(struct parport *p)
+extern __inline__ void parport_pc_write_data(struct parport *p, unsigned char d)
{
- if (!(inb(STATUS(p)) & 1))
- return 0;
- parport_pc_epp_clear_timeout(p);
- return 1;
+ outb(d, DATA(p));
}
-extern __inline__ unsigned char parport_pc_read_configb(struct parport *p)
+extern __inline__ unsigned char parport_pc_read_data(struct parport *p)
{
- return inb(CONFIGB(p));
+ return inb(DATA(p));
}
-extern __inline__ void parport_pc_write_data(struct parport *p, unsigned char d)
+extern __inline__ unsigned char __frob_control (struct parport *p,
+ unsigned char mask,
+ unsigned char val)
{
- outb(d, DATA(p));
+ struct parport_pc_private *priv = p->physport->private_data;
+ unsigned char ctr = priv->ctr;
+ ctr = (ctr & ~mask) ^ val;
+ ctr &= priv->ctr_writable; /* only write writable bits. */
+ outb (ctr, CONTROL (p));
+ return priv->ctr = ctr; /* update soft copy */
}
-extern __inline__ unsigned char parport_pc_read_data(struct parport *p)
+extern __inline__ void parport_pc_data_reverse (struct parport *p)
{
- return inb(DATA(p));
+ __frob_control (p, 0x20, 0x20);
}
-extern __inline__ void parport_pc_write_control(struct parport *p, unsigned char d)
+extern __inline__ void parport_pc_write_control (struct parport *p,
+ unsigned char d)
{
- struct parport_pc_private *priv = p->private_data;
- priv->ctr = d;/* update soft copy */
- outb(d, CONTROL(p));
+ const unsigned char wm = (PARPORT_CONTROL_STROBE |
+ PARPORT_CONTROL_AUTOFD |
+ PARPORT_CONTROL_INIT |
+ PARPORT_CONTROL_SELECT);
+
+ /* Take this out when drivers have adapted to newer interface. */
+ if (d & 0x20) {
+ printk (KERN_DEBUG "%s (%s): use data_reverse for this!\n",
+ p->name, p->cad->name);
+ parport_pc_data_reverse (p);
+ }
+
+ __frob_control (p, wm, d & wm);
}
extern __inline__ unsigned char parport_pc_read_control(struct parport *p)
{
- struct parport_pc_private *priv = p->private_data;
- return priv->ctr;
+ const struct parport_pc_private *priv = p->physport->private_data;
+ return priv->ctr; /* Use soft copy */
}
-extern __inline__ unsigned char parport_pc_frob_control(struct parport *p, unsigned char mask, unsigned char val)
+extern __inline__ unsigned char parport_pc_frob_control (struct parport *p,
+ unsigned char mask,
+ unsigned char val)
{
- struct parport_pc_private *priv = p->private_data;
- unsigned char ctr = priv->ctr;
- ctr = (ctr & ~mask) ^ val;
- outb (ctr, CONTROL(p));
- return priv->ctr = ctr; /* update soft copy */
-}
+ const unsigned char wm = (PARPORT_CONTROL_STROBE |
+ PARPORT_CONTROL_AUTOFD |
+ PARPORT_CONTROL_INIT |
+ PARPORT_CONTROL_SELECT);
-extern __inline__ void parport_pc_write_status(struct parport *p, unsigned char d)
-{
- outb(d, STATUS(p));
+ /* Take this out when drivers have adapted to newer interface. */
+ if (mask & 0x20) {
+ printk (KERN_DEBUG "%s (%s): use data_reverse for this!\n",
+ p->name, p->cad->name);
+ parport_pc_data_reverse (p);
+ }
+
+ /* Restrict mask and val to control lines. */
+ mask &= wm;
+ val &= wm;
+
+ return __frob_control (p, mask, val);
}
extern __inline__ unsigned char parport_pc_read_status(struct parport *p)
@@ -99,51 +118,31 @@ extern __inline__ unsigned char parport_pc_read_status(struct parport *p)
return inb(STATUS(p));
}
-extern __inline__ void parport_pc_write_econtrol(struct parport *p, unsigned char d)
+extern __inline__ void parport_pc_data_forward (struct parport *p)
{
- outb(d, ECONTROL(p));
+ __frob_control (p, 0x20, 0x00);
}
-extern __inline__ unsigned char parport_pc_read_econtrol(struct parport *p)
+extern __inline__ void parport_pc_disable_irq(struct parport *p)
{
- return inb(ECONTROL(p));
+ __frob_control (p, 0x10, 0x00);
}
-extern __inline__ unsigned char parport_pc_frob_econtrol(struct parport *p, unsigned char mask, unsigned char val)
+extern __inline__ void parport_pc_enable_irq(struct parport *p)
{
- unsigned char old = inb(ECONTROL(p));
- outb(((old & ~mask) ^ val), ECONTROL(p));
- return old;
+ __frob_control (p, 0x10, 0x10);
}
-extern void parport_pc_change_mode(struct parport *p, int m);
-
-extern void parport_pc_write_fifo(struct parport *p, unsigned char v);
-
-extern unsigned char parport_pc_read_fifo(struct parport *p);
-
-extern void parport_pc_disable_irq(struct parport *p);
-
-extern void parport_pc_enable_irq(struct parport *p);
-
extern void parport_pc_release_resources(struct parport *p);
extern int parport_pc_claim_resources(struct parport *p);
-extern void parport_pc_init_state(struct parport_state *s);
+extern void parport_pc_init_state(struct pardevice *, struct parport_state *s);
extern void parport_pc_save_state(struct parport *p, struct parport_state *s);
extern void parport_pc_restore_state(struct parport *p, struct parport_state *s);
-extern size_t parport_pc_epp_read_block(struct parport *p, void *buf, size_t length);
-
-extern size_t parport_pc_epp_write_block(struct parport *p, void *buf, size_t length);
-
-extern int parport_pc_ecp_read_block(struct parport *p, void *buf, size_t length, void (*fn)(struct parport *, void *, size_t), void *handle);
-
-extern int parport_pc_ecp_write_block(struct parport *p, void *buf, size_t length, void (*fn)(struct parport *, void *, size_t), void *handle);
-
extern void parport_pc_inc_use_count(void);
extern void parport_pc_dec_use_count(void);