source: trunk/kitgen/8.x/libusb-win32/usbi.h@ 175

Last change on this file since 175 was 175, checked in by demin, 12 years ago

initial commit

File size: 1.9 KB
Line 
1#ifndef _USBI_H_
2#define _USBI_H_
3
4#include "lusb0_usb.h"
5
6#include "error.h"
7
8typedef unsigned char uint8_t;
9typedef unsigned short uint16_t;
10typedef unsigned long uint32_t;
11
12extern int usb_debug;
13
14/* Some quick and generic macros for the simple kind of lists we use */
15#define LIST_ADD(begin, ent) \
16 do { \
17 if (begin) { \
18 ent->next = begin; \
19 ent->next->prev = ent; \
20 } else \
21 ent->next = NULL; \
22 ent->prev = NULL; \
23 begin = ent; \
24 } while(0)
25
26#define LIST_DEL(begin, ent) \
27 do { \
28 if (ent->prev) \
29 ent->prev->next = ent->next; \
30 else \
31 begin = ent->next; \
32 if (ent->next) \
33 ent->next->prev = ent->prev; \
34 ent->prev = NULL; \
35 ent->next = NULL; \
36 } while (0)
37
38#define DESC_HEADER_LENGTH 2
39#define DEVICE_DESC_LENGTH 18
40#define CONFIG_DESC_LENGTH 9
41#define INTERFACE_DESC_LENGTH 9
42#define ENDPOINT_DESC_LENGTH 7
43#define ENDPOINT_AUDIO_DESC_LENGTH 9
44
45struct usb_dev_handle
46{
47 int fd;
48
49 struct usb_bus *bus;
50 struct usb_device *device;
51
52 int config;
53 int interface;
54 int altsetting;
55
56 /* Added by RMT so implementations can store other per-open-device data */
57 void *impl_info;
58};
59
60/* descriptors.c */
61int usb_parse_descriptor(unsigned char *source, char *description, void *dest);
62int usb_parse_configuration(struct usb_config_descriptor *config,
63 unsigned char *buffer);
64void usb_fetch_and_parse_descriptors(usb_dev_handle *udev);
65void usb_destroy_configuration(struct usb_device *dev);
66
67/* OS specific routines */
68int usb_os_find_busses(struct usb_bus **busses);
69int usb_os_find_devices(struct usb_bus *bus, struct usb_device **devices);
70int usb_os_determine_children(struct usb_bus *bus);
71void usb_os_init(void);
72int usb_os_open(usb_dev_handle *dev);
73int usb_os_close(usb_dev_handle *dev);
74
75void usb_free_dev(struct usb_device *dev);
76void usb_free_bus(struct usb_bus *bus);
77
78#endif /* _USBI_H_ */
79
Note: See TracBrowser for help on using the repository browser.