2 Copyright © 2015-2016, The AROS Development Team. All rights reserved.
5 Desc: Virtual USB host controller
9 #ifndef VUSBHCI_BRIDGE_H
10 #define VUSBHCI_BRIDGE_H
12 #include <libusb-1.0/libusb.h>
14 static const char *libusb_func_names
[] = {
17 "libusb_has_capability",
18 "libusb_hotplug_register_callback",
19 "libusb_handle_events",
20 "libusb_get_device_descriptor",
23 "libusb_submit_transfer",
24 "libusb_alloc_transfer",
25 "libusb_free_transfer",
26 "libusb_handle_events_completed",
27 "libusb_control_transfer",
28 "libusb_interrupt_transfer",
29 "libusb_bulk_transfer",
30 "libusb_set_auto_detach_kernel_driver",
31 "libusb_get_device_speed",
32 "libusb_claim_interface",
34 "libusb_set_configuration",
35 "libusb_kernel_driver_active",
36 "libusb_detach_kernel_driver"
39 #define LIBUSB_NUM_FUNCS (sizeof(libusb_func_names) / sizeof(libusb_func_names[0]))
42 int (*libusb_init
)(libusb_context
**ctx
);
43 void (*libusb_exit
)(libusb_context
*ctx
);
44 int (*libusb_has_capability
)(uint32_t capability
);
45 int (*libusb_hotplug_register_callback
)(libusb_context
*ctx
,
46 libusb_hotplug_event events
,
47 libusb_hotplug_flag flags
,
51 libusb_hotplug_callback_fn cb_fn
,
53 libusb_hotplug_callback_handle
*handle
);
54 int (*libusb_handle_events
)(libusb_context
*ctx
);
55 int (*libusb_get_device_descriptor
)(libusb_device
*dev
,
56 struct libusb_device_descriptor
*desc
);
57 int (*libusb_open
)(libusb_device
*dev
, libusb_device_handle
**handle
);
58 void (*libusb_close
)(libusb_device_handle
*dev_handle
);
59 int (*libusb_submit_transfer
)(struct libusb_transfer
*transfer
);
60 struct libusb_transfer
* (*libusb_alloc_transfer
)(int iso_packets
);
61 void (*libusb_free_transfer
)(struct libusb_transfer
*transfer
);
62 int (*libusb_handle_events_completed
)(libusb_context
*ctx
, int *completed
);
64 int (*libusb_control_transfer
)(libusb_device_handle
*dev_handle
,
65 uint8_t request_type
, uint8_t bRequest
, uint16_t wValue
, uint16_t wIndex
,
66 unsigned char *data
, uint16_t wLength
, unsigned int timeout
);
68 int (*libusb_interrupt_transfer
)(libusb_device_handle
*dev_handle
,
69 unsigned char endpoint
, unsigned char *data
, int length
,
70 int *actual_length
, unsigned int timeout
);
72 int (*libusb_bulk_transfer
)(libusb_device_handle
*dev_handle
,
73 unsigned char endpoint
, unsigned char *data
, int length
,
74 int *actual_length
, unsigned int timeout
);
76 int (*libusb_set_auto_detach_kernel_driver
)(libusb_device_handle
*dev
, int enable
);
78 int (*libusb_get_device_speed
)(libusb_device
*dev
);
79 int (*libusb_claim_interface
)(libusb_device_handle
*dev
, int interface_number
);
80 void (*libusb_set_debug
)(libusb_context
*ctx
, int level
);
81 int (*libusb_set_configuration
)(libusb_device_handle
*dev
, int configuration
);
82 int (*libusb_kernel_driver_active
)(libusb_device_handle
*dev
, int interface_number
);
83 int (*libusb_detach_kernel_driver
)(libusb_device_handle
*dev
, int interface_number
);
86 //extern struct libusb_func libusb_func;
88 #define LIBUSBCALL(func,...) (libusb_func.func(__VA_ARGS__))
90 #endif /* VUSBHCI_BRIDGE_H */