| Line 192... |
Line 192... |
| 192 |
uint8_t reserved3;
|
192 |
uint8_t reserved3;
|
| 193 |
int (*ctrl_request)(const struct usb_instance* data, int interface, int endpoint, union usb_ep0_buffer* request, const void** response);
|
193 |
int (*ctrl_request)(const struct usb_instance* data, int interface, int endpoint, union usb_ep0_buffer* request, const void** response);
|
| 194 |
void (*xfer_complete)(const struct usb_instance* data, int interface, int endpoint, int bytesleft);
|
194 |
void (*xfer_complete)(const struct usb_instance* data, int interface, int endpoint, int bytesleft);
|
| 195 |
union __attribute__((packed))
|
195 |
union __attribute__((packed))
|
| 196 |
{
|
196 |
{
|
| 197 |
void (*setup_received)(const struct usb_instance* data, int interface, int endpoint, int back2back);
|
197 |
void (*setup_received)(const struct usb_instance* data, int interface, int endpoint);
|
| 198 |
void (*timeout)(const struct usb_instance* data, int interface, int endpoint, int bytesleft);
|
198 |
void (*timeout)(const struct usb_instance* data, int interface, int endpoint, int bytesleft);
|
| 199 |
};
|
199 |
};
|
| 200 |
};
|
200 |
};
|
| 201 |
|
201 |
|
| 202 |
struct __attribute__((packed,aligned(4))) usb_altsetting
|
202 |
struct __attribute__((packed,aligned(4))) usb_altsetting
|
| Line 214... |
Line 214... |
| 214 |
{
|
214 |
{
|
| 215 |
void (*bus_reset)(const struct usb_instance* data, int configuration, int interface, int highspeed);
|
215 |
void (*bus_reset)(const struct usb_instance* data, int configuration, int interface, int highspeed);
|
| 216 |
int (*ctrl_request)(const struct usb_instance* data, int interface, union usb_ep0_buffer* request, const void** response);
|
216 |
int (*ctrl_request)(const struct usb_instance* data, int interface, union usb_ep0_buffer* request, const void** response);
|
| 217 |
uint8_t reserved1;
|
217 |
uint8_t reserved1;
|
| 218 |
uint8_t reserved2;
|
218 |
uint8_t reserved2;
|
| 219 |
uint8_t current_altsetting;
|
219 |
uint8_t reserved3;
|
| 220 |
uint8_t altsetting_count;
|
220 |
uint8_t altsetting_count;
|
| 221 |
const struct usb_altsetting* altsettings[];
|
221 |
const struct usb_altsetting* altsettings[];
|
| 222 |
};
|
222 |
};
|
| 223 |
|
223 |
|
| 224 |
struct __attribute__((packed,aligned(4))) usb_configuration
|
224 |
struct __attribute__((packed,aligned(4))) usb_configuration
|
| Line 228... |
Line 228... |
| 228 |
void (*unset_configuration)(const struct usb_instance* data, int configuration);
|
228 |
void (*unset_configuration)(const struct usb_instance* data, int configuration);
|
| 229 |
uint8_t reserved1;
|
229 |
uint8_t reserved1;
|
| 230 |
uint8_t reserved2;
|
230 |
uint8_t reserved2;
|
| 231 |
uint8_t reserved3;
|
231 |
uint8_t reserved3;
|
| 232 |
uint8_t interface_count;
|
232 |
uint8_t interface_count;
|
| 233 |
struct usb_interface* interfaces[];
|
233 |
const struct usb_interface* interfaces[];
|
| 234 |
};
|
234 |
};
|
| 235 |
|
235 |
|
| 236 |
struct __attribute__((packed,aligned(4))) usb_state
|
236 |
struct __attribute__((packed,aligned(4))) usb_state
|
| 237 |
{
|
237 |
{
|
| - |
|
238 |
bool (*ep0_rx_callback)(const struct usb_instance* data, int bytesleft);
|
| - |
|
239 |
bool (*ep0_tx_callback)(const struct usb_instance* data, int bytesleft);
|
| - |
|
240 |
const void* ep0_tx_ptr;
|
| - |
|
241 |
uint16_t ep0_tx_len;
|
| 238 |
uint8_t current_address;
|
242 |
uint8_t current_address;
|
| 239 |
uint8_t current_configuration;
|
243 |
uint8_t current_configuration;
|
| 240 |
uint8_t reserved1;
|
- |
|
| 241 |
uint8_t reserved2;
|
244 |
uint8_t interface_altsetting[];
|
| 242 |
};
|
245 |
};
|
| 243 |
|
246 |
|
| 244 |
struct __attribute__((packed,aligned(4))) usb_driver
|
247 |
struct __attribute__((packed,aligned(4))) usb_driver
|
| 245 |
{
|
248 |
{
|
| 246 |
void (*init)(const struct usb_instance* data);
|
249 |
void (*init)(const struct usb_instance* data);
|
| Line 265... |
Line 268... |
| 265 |
struct usb_state* state;
|
268 |
struct usb_state* state;
|
| 266 |
union usb_ep0_buffer* buffer;
|
269 |
union usb_ep0_buffer* buffer;
|
| 267 |
void (*bus_reset)(const struct usb_instance* data, int highspeed);
|
270 |
void (*bus_reset)(const struct usb_instance* data, int highspeed);
|
| 268 |
int (*ctrl_request)(const struct usb_instance* data, union usb_ep0_buffer* request, const void** response);
|
271 |
int (*ctrl_request)(const struct usb_instance* data, union usb_ep0_buffer* request, const void** response);
|
| 269 |
int (*ep0_setup_hook)(const struct usb_instance* data, union usb_ep0_buffer* buf);
|
272 |
int (*ep0_setup_hook)(const struct usb_instance* data, union usb_ep0_buffer* buf);
|
| 270 |
int (*ep0_data_hook)(const struct usb_instance* data, union usb_ep0_buffer* buf, int size);
|
- |
|
| 271 |
uint8_t configuration_count;
|
273 |
uint8_t configuration_count;
|
| 272 |
uint8_t stringdescriptor_count;
|
274 |
uint8_t stringdescriptor_count;
|
| 273 |
uint8_t reserved1;
|
275 |
uint8_t reserved1;
|
| 274 |
uint8_t reserved2;
|
276 |
uint8_t reserved2;
|
| 275 |
const struct usb_devicedescriptor* devicedescriptor;
|
277 |
const struct usb_devicedescriptor* devicedescriptor;
|
| Line 280... |
Line 282... |
| 280 |
extern void usb_init(const struct usb_instance* data);
|
282 |
extern void usb_init(const struct usb_instance* data);
|
| 281 |
extern void usb_exit(const struct usb_instance* data);
|
283 |
extern void usb_exit(const struct usb_instance* data);
|
| 282 |
extern void usb_handle_bus_reset(const struct usb_instance* data, int highspeed);
|
284 |
extern void usb_handle_bus_reset(const struct usb_instance* data, int highspeed);
|
| 283 |
extern void usb_handle_timeout(const struct usb_instance* data, union usb_endpoint_number epnum, int bytesleft);
|
285 |
extern void usb_handle_timeout(const struct usb_instance* data, union usb_endpoint_number epnum, int bytesleft);
|
| 284 |
extern void usb_handle_xfer_complete(const struct usb_instance* data, union usb_endpoint_number epnum, int bytesleft);
|
286 |
extern void usb_handle_xfer_complete(const struct usb_instance* data, union usb_endpoint_number epnum, int bytesleft);
|
| 285 |
extern void usb_handle_setup_received(const struct usb_instance* data, union usb_endpoint_number epnum, int back2back);
|
287 |
extern void usb_handle_setup_received(const struct usb_instance* data, union usb_endpoint_number epnum);
|
| 286 |
extern void usb_ep0_start_rx(const struct usb_instance* data, int non_setup);
|
288 |
extern void usb_ep0_start_rx(const struct usb_instance* data, int non_setup, bool (*callback)(const struct usb_instance* data, int bytesleft));
|
| 287 |
extern void usb_ep0_start_tx(const struct usb_instance* data, const void* buf, int len);
|
289 |
extern void usb_ep0_start_tx(const struct usb_instance* data, const void* buf, int len, bool last, bool (*callback)(const struct usb_instance* data, int bytesleft));
|
| 288 |
extern void usb_ep0_expect_setup(const struct usb_instance* data);
|
290 |
extern void usb_ep0_expect_setup(const struct usb_instance* data);
|
| 289 |
extern void usb_start_rx(const struct usb_instance* data, union usb_endpoint_number ep, void* buf, int size);
|
291 |
extern void usb_start_rx(const struct usb_instance* data, union usb_endpoint_number ep, void* buf, int size);
|
| 290 |
extern void usb_start_tx(const struct usb_instance* data, union usb_endpoint_number ep, const void* buf, int size);
|
292 |
extern void usb_start_tx(const struct usb_instance* data, union usb_endpoint_number ep, const void* buf, int size);
|
| 291 |
extern void usb_set_stall(const struct usb_instance* data, union usb_endpoint_number ep, int stall);
|
293 |
extern void usb_set_stall(const struct usb_instance* data, union usb_endpoint_number ep, int stall);
|
| 292 |
extern void usb_configure_ep(const struct usb_instance* data, union usb_endpoint_number ep, enum usb_endpoint_type type, int maxpacket);
|
294 |
extern void usb_configure_ep(const struct usb_instance* data, union usb_endpoint_number ep, enum usb_endpoint_type type, int maxpacket);
|