1 /*
2  * Copyright (C) 2005-2007 Takahiro Hirofuchi
3  */
4 
5 #ifndef __VHCI_DRIVER_H
6 #define __VHCI_DRIVER_H
7 
8 #include <libudev.h>
9 #include <stdint.h>
10 
11 #include "usbip_common.h"
12 
13 #define USBIP_VHCI_BUS_TYPE "platform"
14 #define MAXNPORT 128
15 
16 struct usbip_imported_device {
17 	uint8_t port;
18 	uint32_t status;
19 
20 	uint32_t devid;
21 
22 	uint8_t busnum;
23 	uint8_t devnum;
24 
25 	/* usbip_class_device list */
26 	struct usbip_usb_device udev;
27 };
28 
29 struct usbip_vhci_driver {
30 
31 	/* /sys/devices/platform/vhci_hcd */
32 	struct udev_device *hc_device;
33 
34 	int nports;
35 	struct usbip_imported_device idev[MAXNPORT];
36 };
37 
38 
39 extern struct usbip_vhci_driver *vhci_driver;
40 
41 int usbip_vhci_driver_open(void);
42 void usbip_vhci_driver_close(void);
43 
44 int  usbip_vhci_refresh_device_list(void);
45 
46 
47 int usbip_vhci_get_free_port(void);
48 int usbip_vhci_attach_device2(uint8_t port, int sockfd, uint32_t devid,
49 		uint32_t speed);
50 
51 /* will be removed */
52 int usbip_vhci_attach_device(uint8_t port, int sockfd, uint8_t busnum,
53 		uint8_t devnum, uint32_t speed);
54 
55 int usbip_vhci_detach_device(uint8_t port);
56 
57 int usbip_vhci_imported_device_dump(struct usbip_imported_device *idev);
58 
59 #endif /* __VHCI_DRIVER_H */
60