Staging: Merge branch 'staging-next' into 2.6.38-rc3
[cascardo/linux.git] / drivers / staging / dabusb / dabusb.h
1 #define _BULK_DATA_LEN 64
2 typedef struct {
3         unsigned char data[_BULK_DATA_LEN];
4         unsigned int size;
5         unsigned int pipe;
6 } bulk_transfer_t, *pbulk_transfer_t;
7
8 #define DABUSB_MINOR 240                /* some unassigned USB minor */
9 #define DABUSB_VERSION 0x1000
10 #define IOCTL_DAB_BULK              _IOWR('d', 0x30, bulk_transfer_t)
11 #define IOCTL_DAB_OVERRUNS          _IOR('d',  0x15, int)
12 #define IOCTL_DAB_VERSION           _IOR('d', 0x3f, int)
13
14 #ifdef __KERNEL__
15
16 typedef enum { _stopped = 0, _started } driver_state_t;
17
18 typedef struct {
19         struct mutex mutex;
20         struct usb_device *usbdev;
21         wait_queue_head_t wait;
22         wait_queue_head_t remove_ok;
23         spinlock_t lock;
24         atomic_t pending_io;
25         driver_state_t state;
26         int remove_pending;
27         int got_mem;
28         int total_buffer_size;
29         unsigned int overruns;
30         int readptr;
31         int opened;
32         int devnum;
33         struct list_head free_buff_list;
34         struct list_head rec_buff_list;
35 } dabusb_t, *pdabusb_t;
36
37 typedef struct {
38         pdabusb_t s;
39         struct urb *purb;
40         struct list_head buff_list;
41 } buff_t, *pbuff_t;
42
43 typedef struct {
44         wait_queue_head_t wait;
45 } bulk_completion_context_t, *pbulk_completion_context_t;
46
47
48 #define _DABUSB_IF 2
49 #define _DABUSB_ISOPIPE 0x09
50 #define _ISOPIPESIZE    16384
51
52 #define _BULK_DATA_LEN 64
53 /* Vendor specific request code for Anchor Upload/Download
54  *This one is implemented in the core */
55 #define ANCHOR_LOAD_INTERNAL  0xA0
56
57 /* EZ-USB Control and Status Register.  Bit 0 controls 8051 reset */
58 #define CPUCS_REG    0x7F92
59 #define _TOTAL_BUFFERS 384
60
61 #define MAX_INTEL_HEX_RECORD_LENGTH 16
62
63 #ifndef _BYTE_DEFINED
64 #define _BYTE_DEFINED
65 typedef unsigned char BYTE;
66 #endif /* !_BYTE_DEFINED */
67
68 #ifndef _WORD_DEFINED
69 #define _WORD_DEFINED
70 typedef unsigned short WORD;
71 #endif /* !_WORD_DEFINED */
72
73 typedef struct _INTEL_HEX_RECORD {
74         BYTE  Length;
75         WORD  Address;
76         BYTE  Type;
77         BYTE  Data[MAX_INTEL_HEX_RECORD_LENGTH];
78 } INTEL_HEX_RECORD, *PINTEL_HEX_RECORD;
79
80 #endif