Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx
[cascardo/linux.git] / drivers / staging / cpc-usb / cpcusb.h
1 /* Header for CPC-USB Driver ********************
2  * Copyright 1999, 2000, 2001
3  *
4  * Company:  EMS Dr. Thomas Wuensche
5  *           Sonnenhang 3
6  *           85304 Ilmmuenster
7  *           Phone: +49-8441-490260
8  *           Fax:   +49-8441-81860
9  *           email: support@ems-wuensche.com
10  *           WWW:   www.ems-wuensche.com
11  */
12
13 #ifndef CPCUSB_H
14 #define CPCUSB_H
15
16 #undef err
17 #undef dbg
18 #undef info
19
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)
24
25 #define CPC_USB_CARD_CNT      4
26
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 */
31 } CPC_USB_READ_URB_T;
32
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;
40
41 #define CPC_USB_URB_CNT  10
42
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 */
51
52         CPC_USB_READ_URB_T urbs[CPC_USB_URB_CNT];
53
54         unsigned char intr_in_buffer[4];        /* interrupt transfer buffer */
55         struct urb *intr_in_urb;        /* interrupt transfer urb */
56
57         CPC_USB_WRITE_URB_T wrUrbs[CPC_USB_URB_CNT];
58
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 */
62
63         int free_slots;         /* free send slots of CPC-USB */
64         int idx;
65
66         spinlock_t slock;
67
68         char serialNumber[128]; /* serial number */
69         int productId;          /* product id to differ between M16C and LPC2119 */
70         CPC_CHAN_T *chan;
71 } CPC_USB_T;
72
73 #define CPCTable               CPCUSB_Table
74
75 #define CPC_DRIVER_VERSION "0.724"
76 #define CPC_DRIVER_SERIAL  "not applicable"
77
78 #define OBUF_SIZE 255           // 4096
79
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 */
83
84 #define CPC_USB_BASE_MNR 0      /* CPC-USB start at minor 0  */
85
86 #endif