Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/usb_emul.h
Show All 25 Lines | |||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
* | * | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#ifndef _USB_EMUL_H_ | #ifndef _USB_EMUL_H_ | ||||
#define _USB_EMUL_H_ | #define _USB_EMUL_H_ | ||||
#include <sys/nv.h> | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <sys/linker_set.h> | #include <sys/linker_set.h> | ||||
#include <pthread.h> | #include <pthread.h> | ||||
#define USB_MAX_XFER_BLOCKS 8 | #define USB_MAX_XFER_BLOCKS 8 | ||||
#define USB_XFER_OUT 0 | #define USB_XFER_OUT 0 | ||||
#define USB_XFER_IN 1 | #define USB_XFER_IN 1 | ||||
struct usb_hci; | struct usb_hci; | ||||
struct usb_device_request; | struct usb_device_request; | ||||
struct usb_data_xfer; | struct usb_data_xfer; | ||||
struct vm_snapshot_meta; | struct vm_snapshot_meta; | ||||
/* Device emulation handlers */ | /* Device emulation handlers */ | ||||
struct usb_devemu { | struct usb_devemu { | ||||
char *ue_emu; /* name of device emulation */ | char *ue_emu; /* name of device emulation */ | ||||
int ue_usbver; /* usb version: 2 or 3 */ | int ue_usbver; /* usb version: 2 or 3 */ | ||||
int ue_usbspeed; /* usb device speed */ | int ue_usbspeed; /* usb device speed */ | ||||
/* instance creation */ | /* instance creation */ | ||||
void *(*ue_init)(struct usb_hci *hci, char *opt); | void *(*ue_init)(struct usb_hci *hci, nvlist_t *nvl); | ||||
/* handlers */ | /* handlers */ | ||||
int (*ue_request)(void *sc, struct usb_data_xfer *xfer); | int (*ue_request)(void *sc, struct usb_data_xfer *xfer); | ||||
int (*ue_data)(void *sc, struct usb_data_xfer *xfer, int dir, | int (*ue_data)(void *sc, struct usb_data_xfer *xfer, int dir, | ||||
int epctx); | int epctx); | ||||
int (*ue_reset)(void *sc); | int (*ue_reset)(void *sc); | ||||
int (*ue_remove)(void *sc); | int (*ue_remove)(void *sc); | ||||
int (*ue_stop)(void *sc); | int (*ue_stop)(void *sc); | ||||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | |||||
#define USB_DATA_XFER_LOCK(x) do { \ | #define USB_DATA_XFER_LOCK(x) do { \ | ||||
pthread_mutex_lock(&((x)->mtx)); \ | pthread_mutex_lock(&((x)->mtx)); \ | ||||
} while (0) | } while (0) | ||||
#define USB_DATA_XFER_UNLOCK(x) do { \ | #define USB_DATA_XFER_UNLOCK(x) do { \ | ||||
pthread_mutex_unlock(&((x)->mtx)); \ | pthread_mutex_unlock(&((x)->mtx)); \ | ||||
} while (0) | } while (0) | ||||
struct usb_devemu *usb_emu_finddev(char *name); | struct usb_devemu *usb_emu_finddev(const char *name); | ||||
struct usb_data_xfer_block *usb_data_xfer_append(struct usb_data_xfer *xfer, | struct usb_data_xfer_block *usb_data_xfer_append(struct usb_data_xfer *xfer, | ||||
void *buf, int blen, void *hci_data, int ccs); | void *buf, int blen, void *hci_data, int ccs); | ||||
#endif /* _USB_EMUL_H_ */ | #endif /* _USB_EMUL_H_ */ |