patch-2.3.10 linux/include/linux/parport_pc.h
Next file: linux/include/linux/pci.h
Previous file: linux/include/linux/parport.h
Back to the patch index
Back to the overall index
- Lines: 223
- Date:
Wed Jul 7 09:20:54 1999
- Orig file:
v2.3.9/linux/include/linux/parport_pc.h
- Orig date:
Tue Jun 22 14:41:46 1999
diff -u --recursive --new-file v2.3.9/linux/include/linux/parport_pc.h linux/include/linux/parport_pc.h
@@ -5,57 +5,39 @@
/* --- 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)
+#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)
-/* Private data for PC low-level driver. */
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));
-}
-
-extern __inline__ unsigned char parport_pc_read_epp(struct parport *p)
-{
- return inb(EPPDATA(p));
-}
+ /* Number of PWords that FIFO will hold. */
+ int fifo_depth;
-extern __inline__ void parport_pc_write_epp_addr(struct parport *p, unsigned char d)
-{
- outb(d, EPPADDR(p));
-}
+ /* Number of bytes per portword. */
+ int pword;
-extern __inline__ unsigned char parport_pc_read_epp_addr(struct parport *p)
-{
- return inb(EPPADDR(p));
-}
+ /* Not used yet. */
+ int readIntrThreshold;
+ int writeIntrThreshold;
-extern __inline__ int parport_pc_check_epp_timeout(struct parport *p)
-{
- if (!(inb(STATUS(p)) & 1))
- return 0;
- parport_pc_epp_clear_timeout(p);
- return 1;
-}
-
-extern __inline__ unsigned char parport_pc_read_configb(struct parport *p)
-{
- return inb(CONFIGB(p));
-}
+ /* buffer suitable for DMA, if DMA enabled */
+ char *dma_buf;
+};
extern __inline__ void parport_pc_write_data(struct parport *p, unsigned char d)
{
@@ -67,31 +49,68 @@
return inb(DATA(p));
}
-extern __inline__ void parport_pc_write_control(struct parport *p, unsigned char d)
+extern __inline__ unsigned char __frob_control (struct parport *p,
+ unsigned char mask,
+ unsigned char val)
{
- struct parport_pc_private *priv = p->private_data;
- priv->ctr = d;/* update soft copy */
- outb(d, CONTROL(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_control(struct parport *p)
+extern __inline__ void parport_pc_data_reverse (struct parport *p)
{
- struct parport_pc_private *priv = p->private_data;
- return priv->ctr;
+ __frob_control (p, 0x20, 0x20);
}
-extern __inline__ unsigned char parport_pc_frob_control(struct parport *p, unsigned char mask, unsigned char val)
+extern __inline__ void parport_pc_write_control (struct parport *p,
+ unsigned char d)
{
- 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);
+
+ /* 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__ void parport_pc_write_status(struct parport *p, unsigned char d)
+extern __inline__ unsigned char parport_pc_read_control(struct parport *p)
{
- outb(d, STATUS(p));
+ 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)
+{
+ 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 (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,50 +118,30 @@
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);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)