patch-2.1.89 linux/include/linux/parport.h
Next file: linux/include/linux/parport_pc.h
Previous file: linux/include/linux/nfs_fs.h
Back to the patch index
Back to the overall index
- Lines: 225
- Date:
Tue Feb 24 22:40:45 1998
- Orig file:
v2.1.88/linux/include/linux/parport.h
- Orig date:
Fri Jan 30 11:28:10 1998
diff -u --recursive --new-file v2.1.88/linux/include/linux/parport.h linux/include/linux/parport.h
@@ -3,6 +3,64 @@
#ifndef _PARPORT_H_
#define _PARPORT_H_
+/* Start off with user-visible constants */
+
+/* Maximum of 8 ports per machine */
+#define PARPORT_MAX 8
+
+/* Magic numbers */
+#define PARPORT_IRQ_NONE -1
+#define PARPORT_DMA_NONE -1
+#define PARPORT_IRQ_AUTO -2
+#define PARPORT_DMA_AUTO -2
+#define PARPORT_DISABLE -2
+
+#define PARPORT_CONTROL_STROBE 0x1
+#define PARPORT_CONTROL_AUTOFD 0x2
+#define PARPORT_CONTROL_INIT 0x4
+#define PARPORT_CONTROL_SELECT 0x8
+#define PARPORT_CONTROL_INTEN 0x10
+#define PARPORT_CONTROL_DIRECTION 0x20
+
+#define PARPORT_STATUS_ERROR 0x8
+#define PARPORT_STATUS_SELECT 0x10
+#define PARPORT_STATUS_PAPEROUT 0x20
+#define PARPORT_STATUS_ACK 0x40
+#define PARPORT_STATUS_BUSY 0x80
+
+/* Type classes for Plug-and-Play probe. */
+typedef enum {
+ PARPORT_CLASS_LEGACY = 0, /* Non-IEEE1284 device */
+ PARPORT_CLASS_PRINTER,
+ PARPORT_CLASS_MODEM,
+ PARPORT_CLASS_NET,
+ PARPORT_CLASS_HDC, /* Hard disk controller */
+ PARPORT_CLASS_PCMCIA,
+ PARPORT_CLASS_MEDIA, /* Multimedia device */
+ PARPORT_CLASS_FDC, /* Floppy disk controller */
+ PARPORT_CLASS_PORTS,
+ PARPORT_CLASS_SCANNER,
+ PARPORT_CLASS_DIGCAM,
+ PARPORT_CLASS_OTHER, /* Anything else */
+ PARPORT_CLASS_UNSPEC /* No CLS field in ID */
+} parport_device_class;
+
+/* The "modes" entry in parport is a bit field representing the following
+ * modes.
+ * Note that PARPORT_MODE_PCECPEPP is for the SMC EPP+ECP mode which is NOT
+ * 100% compatible with EPP.
+ */
+#define PARPORT_MODE_PCSPP 0x0001
+#define PARPORT_MODE_PCPS2 0x0002
+#define PARPORT_MODE_PCEPP 0x0004
+#define PARPORT_MODE_PCECP 0x0008
+#define PARPORT_MODE_PCECPEPP 0x0010
+#define PARPORT_MODE_PCECR 0x0020 /* ECR Register Exists */
+#define PARPORT_MODE_PCECPPS2 0x0040
+
+/* The rest is for the kernel only */
+#ifdef __KERNEL__
+
#include <asm/system.h>
#include <asm/ptrace.h>
#include <asm/spinlock.h>
@@ -11,16 +69,6 @@
#define PARPORT_NEED_GENERIC_OPS
-/* Maximum of 8 ports per machine */
-#define PARPORT_MAX 8
-
-/* Magic numbers */
-#define PARPORT_IRQ_NONE -2
-#define PARPORT_DMA_NONE -2
-#define PARPORT_IRQ_AUTO -1
-#define PARPORT_DMA_AUTO -1
-#define PARPORT_DISABLE -2
-
/* Define this later. */
struct parport;
@@ -39,29 +87,29 @@
};
struct parport_operations {
- void (*write_data)(struct parport *, unsigned int);
- unsigned int (*read_data)(struct parport *);
- void (*write_control)(struct parport *, unsigned int);
- unsigned int (*read_control)(struct parport *);
- unsigned int (*frob_control)(struct parport *, unsigned int mask, unsigned int val);
- void (*write_econtrol)(struct parport *, unsigned int);
- unsigned int (*read_econtrol)(struct parport *);
- unsigned int (*frob_econtrol)(struct parport *, unsigned int mask, unsigned int val);
- void (*write_status)(struct parport *, unsigned int);
- unsigned int (*read_status)(struct parport *);
- void (*write_fifo)(struct parport *, unsigned int);
- unsigned int (*read_fifo)(struct parport *);
+ void (*write_data)(struct parport *, unsigned char);
+ unsigned char (*read_data)(struct parport *);
+ void (*write_control)(struct parport *, unsigned char);
+ unsigned char (*read_control)(struct parport *);
+ unsigned char (*frob_control)(struct parport *, unsigned char mask, unsigned char val);
+ void (*write_econtrol)(struct parport *, unsigned char);
+ unsigned char (*read_econtrol)(struct parport *);
+ unsigned char (*frob_econtrol)(struct parport *, unsigned char mask, unsigned char val);
+ void (*write_status)(struct parport *, unsigned char);
+ unsigned char (*read_status)(struct parport *);
+ void (*write_fifo)(struct parport *, unsigned char);
+ unsigned char (*read_fifo)(struct parport *);
void (*change_mode)(struct parport *, int);
void (*release_resources)(struct parport *);
int (*claim_resources)(struct parport *);
- unsigned int (*epp_write_block)(struct parport *, void *, unsigned int);
- unsigned int (*epp_read_block)(struct parport *, void *, unsigned int);
+ size_t (*epp_write_block)(struct parport *, void *, size_t);
+ size_t (*epp_read_block)(struct parport *, void *, size_t);
- unsigned int (*ecp_write_block)(struct parport *, void *, unsigned int, void (*fn)(struct parport *, void *, unsigned int), void *);
- unsigned int (*ecp_read_block)(struct parport *, void *, unsigned int, void (*fn)(struct parport *, void *, unsigned int), void *);
+ int (*ecp_write_block)(struct parport *, void *, size_t, void (*fn)(struct parport *, void *, size_t), void *);
+ int (*ecp_read_block)(struct parport *, void *, size_t, void (*fn)(struct parport *, void *, size_t), void *);
void (*save_state)(struct parport *, struct parport_state *);
void (*restore_state)(struct parport *, struct parport_state *);
@@ -74,36 +122,6 @@
void (*dec_use_count)(void);
};
-#define PARPORT_CONTROL_STROBE 0x1
-#define PARPORT_CONTROL_AUTOFD 0x2
-#define PARPORT_CONTROL_INIT 0x4
-#define PARPORT_CONTROL_SELECT 0x8
-#define PARPORT_CONTROL_INTEN 0x10
-#define PARPORT_CONTROL_DIRECTION 0x20
-
-#define PARPORT_STATUS_ERROR 0x8
-#define PARPORT_STATUS_SELECT 0x10
-#define PARPORT_STATUS_PAPEROUT 0x20
-#define PARPORT_STATUS_ACK 0x40
-#define PARPORT_STATUS_BUSY 0x80
-
-/* Type classes for Plug-and-Play probe. */
-typedef enum {
- PARPORT_CLASS_LEGACY = 0, /* Non-IEEE1284 device */
- PARPORT_CLASS_PRINTER,
- PARPORT_CLASS_MODEM,
- PARPORT_CLASS_NET,
- PARPORT_CLASS_HDC, /* Hard disk controller */
- PARPORT_CLASS_PCMCIA,
- PARPORT_CLASS_MEDIA, /* Multimedia device */
- PARPORT_CLASS_FDC, /* Floppy disk controller */
- PARPORT_CLASS_PORTS,
- PARPORT_CLASS_SCANNER,
- PARPORT_CLASS_DIGCAM,
- PARPORT_CLASS_OTHER, /* Anything else */
- PARPORT_CLASS_UNSPEC /* No CLS field in ID */
-} parport_device_class;
-
struct parport_device_info {
parport_device_class class;
char *mfr;
@@ -178,7 +196,7 @@
struct parport_operations *ops;
void *private_data; /* for lowlevel driver */
-
+ int number; /* port index - the `n' in `parportn' */
spinlock_t lock;
};
@@ -243,28 +261,29 @@
extern void parport_release(struct pardevice *dev);
-extern __inline__ unsigned int parport_yield(struct pardevice *dev,
- unsigned int block)
+/* parport_yield relinquishes the port if it would be helpful to other
+ * drivers. The return value is the same as for parport_claim.
+ */
+extern __inline__ unsigned int parport_yield(struct pardevice *dev)
{
unsigned long int timeslip = (jiffies - dev->time);
if ((dev->port->waithead == NULL) || (timeslip < dev->timeslice))
- return 1;
+ return 0;
parport_release(dev);
- return (block)?parport_claim_or_block(dev):parport_claim(dev);
+ return parport_claim(dev);
}
-/* The "modes" entry in parport is a bit field representing the following
- * modes.
- * Note that LP_ECPEPP is for the SMC EPP+ECP mode which is NOT
- * 100% compatible with EPP.
+/* parport_yield_blocking is the same but uses parport_claim_or_block
+ * instead of parport_claim.
*/
-#define PARPORT_MODE_PCSPP 0x0001
-#define PARPORT_MODE_PCPS2 0x0002
-#define PARPORT_MODE_PCEPP 0x0004
-#define PARPORT_MODE_PCECP 0x0008
-#define PARPORT_MODE_PCECPEPP 0x0010
-#define PARPORT_MODE_PCECR 0x0020 /* ECR Register Exists */
-#define PARPORT_MODE_PCECPPS2 0x0040
+extern __inline__ unsigned int parport_yield_blocking(struct pardevice *dev)
+{
+ unsigned long int timeslip = (jiffies - dev->time);
+ if ((dev->port->waithead == NULL) || (timeslip < dev->timeslice))
+ return 0;
+ parport_release(dev);
+ return parport_claim_or_block(dev);
+}
/* Flags used to identify what a device does. */
#define PARPORT_DEV_TRAN 0x0000 /* We're transient. */
@@ -329,4 +348,5 @@
#define parport_claim_resources(p) (p)->ops->claim_resources(p)
#endif
+#endif /* __KERNEL__ */
#endif /* _PARPORT_H_ */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov