2 Copyright © 2015-2017, 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",
37 "libusb_release_interface",
38 "libusb_get_active_config_descriptor",
40 "libusb_get_configuration",
41 "libusb_free_config_descriptor",
42 "libusb_get_string_descriptor_ascii"
45 #define LIBUSB_NUM_FUNCS (sizeof(libusb_func_names) / sizeof(libusb_func_names[0]))
48 int (*libusb_init
)(libusb_context
**ctx
);
49 void (*libusb_exit
)(libusb_context
*ctx
);
50 int (*libusb_has_capability
)(uint32_t capability
);
51 int (*libusb_hotplug_register_callback
)(libusb_context
*ctx
,
52 libusb_hotplug_event events
,
53 libusb_hotplug_flag flags
,
57 libusb_hotplug_callback_fn cb_fn
,
59 libusb_hotplug_callback_handle
*handle
);
60 int (*libusb_handle_events
)(libusb_context
*ctx
);
61 int (*libusb_get_device_descriptor
)(libusb_device
*dev
,
62 struct libusb_device_descriptor
*desc
);
63 int (*libusb_open
)(libusb_device
*dev
, libusb_device_handle
**handle
);
64 void (*libusb_close
)(libusb_device_handle
*dev_handle
);
65 int (*libusb_submit_transfer
)(struct libusb_transfer
*transfer
);
66 struct libusb_transfer
* (*libusb_alloc_transfer
)(int iso_packets
);
67 void (*libusb_free_transfer
)(struct libusb_transfer
*transfer
);
68 int (*libusb_handle_events_completed
)(libusb_context
*ctx
, int *completed
);
70 int (*libusb_control_transfer
)(libusb_device_handle
*dev_handle
,
71 uint8_t request_type
, uint8_t bRequest
, uint16_t wValue
, uint16_t wIndex
,
72 unsigned char *data
, uint16_t wLength
, unsigned int timeout
);
74 int (*libusb_interrupt_transfer
)(libusb_device_handle
*dev_handle
,
75 unsigned char endpoint
, unsigned char *data
, int length
,
76 int *actual_length
, unsigned int timeout
);
78 int (*libusb_bulk_transfer
)(libusb_device_handle
*dev_handle
,
79 unsigned char endpoint
, unsigned char *data
, int length
,
80 int *actual_length
, unsigned int timeout
);
82 int (*libusb_set_auto_detach_kernel_driver
)(libusb_device_handle
*dev
, int enable
);
84 int (*libusb_get_device_speed
)(libusb_device
*dev
);
85 int (*libusb_claim_interface
)(libusb_device_handle
*dev
, int interface_number
);
86 void (*libusb_set_debug
)(libusb_context
*ctx
, int level
);
87 int (*libusb_set_configuration
)(libusb_device_handle
*dev
, int configuration
);
88 int (*libusb_kernel_driver_active
)(libusb_device_handle
*dev
, int interface_number
);
89 int (*libusb_detach_kernel_driver
)(libusb_device_handle
*dev
, int interface_number
);
90 int (*libusb_release_interface
)(libusb_device_handle
*dev
, int interface_number
);
91 int (*libusb_get_active_config_descriptor
)(libusb_device
*dev
, struct libusb_config_descriptor
**config
);
92 libusb_device
* (*libusb_get_device
)(libusb_device_handle
*dev
);
93 int (*libusb_get_configuration
)(libusb_device_handle
*dev
, int *config
);
94 void (*libusb_free_config_descriptor
)(struct libusb_config_descriptor
*config
);
95 int (*libusb_get_string_descriptor_ascii
)(libusb_device_handle
*dev
, uint8_t desc_index
, unsigned char *data
, int length
);
98 //extern struct libusb_func libusb_func;
100 #define LIBUSBCALL(func,...) (libusb_func.func(__VA_ARGS__))
102 #endif /* VUSBHCI_BRIDGE_H */