Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1029 serge 1
 
2
 
3
  void   *start;              /**< Start address of first item. */
4
  addr_t  nextavail;          /**< The index of next available item. */
5
  addr_t  dma;
6
} slab_t;
7
8
9
 
10
 
11
#define USB_CLASS_HID                      3
12
#define USB_CLASS_PHYSICAL                 5
13
#define USB_CLASS_STILL_IMAGE              6
14
#define USB_CLASS_PRINTER                  7
15
#define USB_CLASS_MASS_STORAGE             8
16
#define USB_CLASS_HUB                      9
17
#define USB_CLASS_CDC_DATA              0x0a
18
#define USB_CLASS_CSCID                 0x0b    /* chip+ smart card */
19
#define USB_CLASS_CONTENT_SEC           0x0d    /* content security */
20
#define USB_CLASS_VIDEO                 0x0e
21
#define USB_CLASS_WIRELESS_CONTROLLER	0xe0
22
#define USB_CLASS_MISC                  0xef
23
#define USB_CLASS_APP_SPEC              0xfe
24
#define USB_CLASS_VENDOR_SPEC           0xff
25
26
27
 
28
 
29
    addr_t  qlink;
30
    addr_t  qelem;
31
32
    addr_t  dma;
33
 
34
35
}qh_t __attribute__((aligned(16)));
36
 
37
typedef struct
38
 
39
    link_t  link;
40
41
    addr_t  iobase;
42
 
43
    u32_t   *frame_base;
44
 
45
    addr_t  frame_dma;
46
47
    qh_t   *qh1;
48
 
49
    u32_t  *data;
50
 
51
52
    u32_t   port_map;
53
 
54
    int     numports;
55
 
56
    u32_t   pciId;
57
 
58
    addr_t  ioBase[6];
59
    addr_t  memBase[6];
60
    size_t  memSize[6];
61
    u32_t   memType[6];
62
}hc_t;
63
64
typedef struct tag_td
65
 
66
	/* Hardware fields */
67
    addr_t   link;
68
    u32_t    status;
69
    u32_t    token;
70
    addr_t   buffer;
71
72
	/* Software fields */
73
 
74
75
    struct   tag_td *bk;
76
 
77
  //  struct list_head list;
78
 
79
  //  int frame;          /* for iso: what frame? */
80
 
81
82
    u32_t    reserved[2];
83
 
84
85
#define TD_CTRL_SPD         (1 << 29)   /* Short Packet Detect */
86
 
87
#define TD_CTRL_C_ERR_SHIFT	27
88
#define TD_CTRL_LS          (1 << 26)   /* Low Speed Device */
89
#define TD_CTRL_IOS         (1 << 25)   /* Isochronous Select */
90
#define TD_CTRL_IOC         (1 << 24)   /* Interrupt on Complete */
91
#define TD_CTRL_ACTIVE		(1 << 23)	/* TD Active */
92
#define TD_CTRL_STALLED		(1 << 22)	/* TD Stalled */
93
#define TD_CTRL_DBUFERR		(1 << 21)	/* Data Buffer Error */
94
#define TD_CTRL_BABBLE		(1 << 20)	/* Babble Detected */
95
#define TD_CTRL_NAK         (1 << 19)   /* NAK Received */
96
#define TD_CTRL_CRCTIMEO	(1 << 18)	/* CRC/Time Out Error */
97
#define TD_CTRL_BITSTUFF    (1 << 17)   /* Bit Stuff Error */
98
99
#define TD_ANY_ERROR   (TD_CTRL_STALLED | TD_CTRL_DBUFERR  | \
100
 
101
                        TD_CTRL_BITSTUFF)
102
103
typedef struct __attribute__ ((packed))
104
 
105
    u8_t    bLength;
106
    u8_t    bDescriptorType;
107
    u16_t   bcdUSB;
108
109
    u8_t    bDeviceClass;
110
 
111
    u8_t    bDeviceProtocol;
112
    u8_t    bMaxPacketSize0;
113
114
    u16_t   idVendor;
115
 
116
    u16_t   bcdDevice;
117
118
    u8_t    iManufacturer;
119
 
120
    u8_t    iSerialNumber;
121
    u8_t    bNumConfigurations;
122
}dev_descr_t;
123
124
typedef struct  __attribute__ ((packed))
125
 
126
    u8_t    bLength;
127
    u8_t    bDescriptorType;
128
    u16_t   wTotalLength;
129
    u8_t    bNumInterfaces;
130
    u8_t    bConfigurationValue;
131
    u8_t    iConfiguration;
132
    u8_t    bmAttributes;
133
    u8_t    bMaxPower;
134
}conf_descr_t;
135
136
typedef struct __attribute__ ((packed))
137
 
138
    u8_t    bLength;
139
    u8_t    bDescriptorType;
140
    u8_t    bInterfaceNumber;
141
    u8_t    bAlternateSetting;
142
    u8_t    bNumEndpoints;
143
    u8_t    bInterfaceClass;
144
    u8_t    bInterfaceSubClass;
145
    u8_t    bInterfaceProtocol;
146
    u8_t    iInterface;
147
}interface_descr_t ;
148
149
typedef struct __attribute__ ((packed))
150
 
151
    u8_t    bLength;
152
    u8_t    bDescriptorType;
153
154
    u8_t    bEndpointAddress;
155
 
156
    u16_t   wMaxPacketSize;
157
    u8_t    bInterval;
158
159
	/* NOTE:  these two are _only_ in audio endpoints. */
160
 
161
    u8_t    bRefresh;
162
    u8_t    bSynchAddress;
163
}endpoint_descr_t;
164
165
typedef struct
166
 
167
    addr_t  address;
168
    addr_t  size;
169
    u32_t   toggle;
170
171
}endp_t;
172
 
173
typedef struct __attribute__ ((packed))
174
 
175
    u8_t    bRequestType;
176
    u8_t    bRequest;
177
    u16_t   wValue;
178
    u16_t   wIndex;
179
    u16_t   wLength;
180
}ctrl_request_t;
181
182
183
 
184
 
185
    link_t  link;
186
    u32_t   id;
187
188
    hc_t   *host;
189
 
190
    u32_t   speed;
191
 
192
193
    addr_t  ep0_size;
194
 
195
    endp_t  enp;
196
 
197
    u32_t   status;
198
 
199
200
    dev_descr_t   dev_descr;
201
 
202
}udev_t;
203
204
typedef struct   tag_request
205
 
206
    link_t        link;
207
    td_t         *td_head;
208
    td_t         *td_tail;
209
    addr_t        data;
210
    size_t        size;
211
    udev_t       *dev;
212
    u32_t         type;
213
    Bool        (*handler)(udev_t *dev, struct   tag_request *rq);
214
}request_t;
215
216
217
 
218
 
219
#define  TOKEN( size, toggle, ep, addr, pid) \
220
 
221
222
Bool ctrl_request(udev_t *dev, void *req, u32_t dir,
223
 
224
225
226
 
227
 
228
Bool init_device(udev_t *dev);
229
 
230
Bool init_hid(udev_t *dev);
231
 
232
struct boot_packet
233
 
234
    u8_t buttons;
235
    i8_t x;
236
    i8_t y;
237
    i8_t z;
238
}__attribute__ ((packed));
239
240
#define DOUT   0xE1
241
 
242
243
#define DATA0  (0<<19)
244
 
245
#define>
246
#define>
247