Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2005-2007 Takahiro Hirofuchi |
| 3 | */ |
| 4 | |
matt mooney | 099f79f | 2011-06-19 22:44:37 -0700 | [diff] [blame] | 5 | #ifndef __VHCI_DRIVER_H |
| 6 | #define __VHCI_DRIVER_H |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 7 | |
Valentina Manea | a744b7c | 2014-03-08 14:53:28 +0200 | [diff] [blame] | 8 | #include <libudev.h> |
matt mooney | 099f79f | 2011-06-19 22:44:37 -0700 | [diff] [blame] | 9 | #include <stdint.h> |
| 10 | |
| 11 | #include "usbip_common.h" |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 12 | |
matt mooney | 5805842 | 2011-05-26 06:17:10 -0700 | [diff] [blame] | 13 | #define USBIP_VHCI_BUS_TYPE "platform" |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 14 | #define MAXNPORT 128 |
| 15 | |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 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 | |
matt mooney | 7e485ee | 2011-05-26 06:17:09 -0700 | [diff] [blame] | 25 | /* usbip_class_device list */ |
matt mooney | 35dd0c2 | 2011-05-27 01:44:14 -0700 | [diff] [blame] | 26 | struct usbip_usb_device udev; |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 27 | }; |
| 28 | |
| 29 | struct usbip_vhci_driver { |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 30 | |
matt mooney | 7e485ee | 2011-05-26 06:17:09 -0700 | [diff] [blame] | 31 | /* /sys/devices/platform/vhci_hcd */ |
Valentina Manea | a744b7c | 2014-03-08 14:53:28 +0200 | [diff] [blame] | 32 | struct udev_device *hc_device; |
matt mooney | 7e485ee | 2011-05-26 06:17:09 -0700 | [diff] [blame] | 33 | |
Yuyang Du | aa3ecb9 | 2017-05-22 18:20:16 +0800 | [diff] [blame] | 34 | int ncontrollers; |
Takahiro Hirofuchi | 0945b4f | 2011-05-14 03:55:07 -0700 | [diff] [blame] | 35 | int nports; |
| 36 | struct usbip_imported_device idev[MAXNPORT]; |
| 37 | }; |
| 38 | |
| 39 | |
| 40 | extern struct usbip_vhci_driver *vhci_driver; |
| 41 | |
| 42 | int usbip_vhci_driver_open(void); |
| 43 | void usbip_vhci_driver_close(void); |
| 44 | |
| 45 | int usbip_vhci_refresh_device_list(void); |
| 46 | |
| 47 | |
| 48 | int usbip_vhci_get_free_port(void); |
| 49 | int usbip_vhci_attach_device2(uint8_t port, int sockfd, uint32_t devid, |
| 50 | uint32_t speed); |
| 51 | |
| 52 | /* will be removed */ |
| 53 | int usbip_vhci_attach_device(uint8_t port, int sockfd, uint8_t busnum, |
| 54 | uint8_t devnum, uint32_t speed); |
| 55 | |
| 56 | int usbip_vhci_detach_device(uint8_t port); |
matt mooney | 099f79f | 2011-06-19 22:44:37 -0700 | [diff] [blame] | 57 | |
Valentina Manea | ec2ff62 | 2014-01-07 21:05:56 +0200 | [diff] [blame] | 58 | int usbip_vhci_imported_device_dump(struct usbip_imported_device *idev); |
| 59 | |
matt mooney | 099f79f | 2011-06-19 22:44:37 -0700 | [diff] [blame] | 60 | #endif /* __VHCI_DRIVER_H */ |