1 /* Header for CPC-USB Driver ********************
2 * Copyright 1999, 2000, 2001
4 * Company: EMS Dr. Thomas Wuensche
7 * Phone: +49-8441-490260
9 * email: support@ems-wuensche.com
10 * WWW: www.ems-wuensche.com
20 /* Use our own dbg macro */
21 #define dbg(format, arg...) do { if (debug) printk(KERN_INFO "CPC-USB: " format "\n" , ## arg); } while (0)
22 #define info(format, arg...) do { printk(KERN_INFO "CPC-USB: " format "\n" , ## arg); } while (0)
23 #define err(format, arg...) do { printk(KERN_INFO "CPC-USB(ERROR): " format "\n" , ## arg); } while (0)
25 #define CPC_USB_CARD_CNT 4
27 typedef struct CPC_USB_READ_URB
{
28 unsigned char *buffer
; /* the buffer to send data */
29 size_t size
; /* the size of the send buffer */
30 struct urb
*urb
; /* the urb used to send data */
33 typedef struct CPC_USB_WRITE_URB
{
34 unsigned char *buffer
; /* the buffer to send data */
35 size_t size
; /* the size of the send buffer */
36 struct urb
*urb
; /* the urb used to send data */
37 atomic_t busy
; /* true if write urb is busy */
38 struct completion finished
; /* wait for the write to finish */
39 } CPC_USB_WRITE_URB_T
;
41 #define CPC_USB_URB_CNT 10
43 typedef struct CPC_USB
{
44 struct usb_device
*udev
; /* save off the usb device pointer */
45 struct usb_interface
*interface
; /* the interface for this device */
46 unsigned char minor
; /* the starting minor number for this device */
47 unsigned char num_ports
; /* the number of ports this device has */
48 int num_intr_in
; /* number of interrupt in endpoints we have */
49 int num_bulk_in
; /* number of bulk in endpoints we have */
50 int num_bulk_out
; /* number of bulk out endpoints we have */
52 CPC_USB_READ_URB_T urbs
[CPC_USB_URB_CNT
];
54 unsigned char intr_in_buffer
[4]; /* interrupt transfer buffer */
55 struct urb
*intr_in_urb
; /* interrupt transfer urb */
57 CPC_USB_WRITE_URB_T wrUrbs
[CPC_USB_URB_CNT
];
59 int open
; /* if the port is open or not */
60 int present
; /* if the device is not disconnected */
61 struct semaphore sem
; /* locks this structure */
63 int free_slots
; /* free send slots of CPC-USB */
68 char serialNumber
[128]; /* serial number */
69 int productId
; /* product id to differ between M16C and LPC2119 */
73 #define CPCTable CPCUSB_Table
75 #define CPC_DRIVER_VERSION "0.724"
76 #define CPC_DRIVER_SERIAL "not applicable"
78 #define OBUF_SIZE 255 // 4096
80 /* read timeouts -- RD_NAK_TIMEOUT * RD_EXPIRE = Number of seconds */
81 #define RD_NAK_TIMEOUT (10*HZ) /* Default number of X seconds to wait */
82 #define RD_EXPIRE 12 /* Number of attempts to wait X seconds */
84 #define CPC_USB_BASE_MNR 0 /* CPC-USB start at minor 0 */