#include <libusb-1.0/libusb.h>
Go to the source code of this file.
|
enum | _USB_3_TEST_MODE { USB_3_TEST_LOOPBACK = 0,
USB_3_TEST_BENCHMARK_READ,
USB_3_TEST_BENCHMARK_WRITE,
USB_3_TEST_BENCHMARK_RW
} |
|
enum | _USB_3_EP_TYPE { USB_3_EP_CONTROL = 0,
USB_3_EP_ISOCHRONOUS,
USB_3_EP_BULK,
USB_3_EP_INTERRUPT
} |
|
enum | {
USB_3_CHANGELEDS = 1,
USB_3_SET_CONFIG,
USB_3_GET_CONFIG,
USB_3_SET_DISP_MODE,
USB_3_CONF_ERROR_COUNTERS,
USB_3_GET_ERROR_COUNTS,
USB_3_GET_VOLTAGE,
USB_3_RESERVED_DONOTUSE = 0x08,
USB_3_GET_MAX_SPEED,
USB_3_RESET_ERROR_COUNTERS,
USB_3_CONFIG_LPM_ENTRY,
USB_3_GET_DEVICE_INFO = 0x50
} |
|
enum | _USB_3_SPEED { USB_3_ST_UNKNOWN = 0,
USB_3_ST_FS,
USB_3_ST_HS,
USB_3_ST_SS
} |
|
enum | _DATA_PATTERN { INCREMENTINGBYTE,
RANDOMBYTE,
CONSTANTBYTE
} |
|
|
int | GetUSBPortsInfo () |
|
int | SendUSB_3_VendorCommand (libusb_device_handle *udev, int wValue, unsigned char *buf, long bufflen) |
|
int | SendUSB_2_VendorCommand (libusb_device_handle *udev, int ReqMode, int Parameter, unsigned char *bufferout, int bufferSize) |
|
bool | ConnectUSBPlug (bool bReconnect, int usbPlugIndex, USB3_SPEED Speed, USB_3_TEST_MODE TestMode, libusb_device_handle **handle_udev, unsigned long *MaxTransferSize, unsigned long *CurrentTransferSize, unsigned char **inBuffer, unsigned char **outBuffer) |
|
int | GetUSBDeviceInfo (libusb_device_handle *udev, char *serial, unsigned int serial_size, char *desc, unsigned int desc_size, float *fwVer) |
|
void | wait_USB (int wait_time) |
|
int | LoopbackTest (libusb_device_handle *handle_udev, int usbIndex, int maxTransferSize, unsigned char *inBuffer, unsigned char *outBuffer) |
|
#define BENCHMARKCYCLES 10 |
#define LOOPBACK_USB_2_PRODUCT_ID 0xff0a |
#define LOOPBACK_USB_3_PRODUCT_ID 0xff0b |
#define LOOPBACK_VENDOR_ID 0x0403 |
#define LPM_ENTRY_DISABLE 0 |
#define LPM_ENTRY_ENABLE (1 << 8) |
#define MAX_DRIVER_NAME 64 |
#define MAXNUMUSBPORTS 20 |
#define MAXSERIALNUMLEN 20 |
#define READWRITECYCLES 10 |
#define USB_2_BENCHMARK 2 |
#define USB_2_BENCHMARKFSBUFFERSIZE 2048 |
#define USB_2_BENCHMARKHISTBUFFERSIZE 64 |
#define USB_2_BENCHMARKHSBUFFERSIZE 32768 |
#define USB_2_CHANGELEDS 4 |
#define USB_2_CHANGEMODE 0xB0 |
#define USB_2_CHANGEMODEIN 1 |
#define USB_2_CHANGEMODEOUT 2 |
#define USB_2_CHANGEMODEOUTSTAT 50 |
#define USB_2_EPBENCHIN 0x88 |
#define USB_2_EPBENCHOUT 0x04 |
#define USB_2_EPHISTORY 0x81 |
#define USB_2_EPLOOPIN 0x86 |
#define USB_2_EPLOOPOUT 0x02 |
#define USB_2_FSFIFOSIZE 64 |
#define USB_2_HSFIFOSIZE 512 |
#define USB_2_INITIALISATION 0 |
#define USB_2_LOOPBACKFSBUFFERSIZE 64 |
#define USB_2_LOOPBACKHSBUFFERSIZE 512 |
#define USB_2_STATISTICS 3 |
#define USB_3_BENCHMARK_BUFFER_COUNT 2 |
#define USB_3_BENCHMARK_BUFFER_SIZE 49512 |
#define USB_3_BENCHMARK_RW_BUFFER_COUNT 2 |
#define USB_3_BENCHMARK_RW_BUFFER_SIZE 24576 |
#define USB_3_CREDIT_HP_TIMEOUT_EN (1 << 5) |
#define USB_3_DISPLAY_DISABLE 0 |
#define USB_3_DISPLAY_ENABLE (1 << 8) |
#define USB_3_EPLOOPIN 0x81 |
#define USB_3_EPLOOPOUT 0x01 |
#define USB_3_HDR_ADV_HP_EN (1 << 9) |
#define USB_3_HDR_ADV_LCRD_EN (1 << 10) |
#define USB_3_HDR_ADV_LGO_EN (1 << 11) |
#define USB_3_HDR_ADV_TIMEOUT_EN (1 << 8) |
#define USB_3_HP_TIMEOUT_EN (1 << 0) |
#define USB_3_LOOPBACK_BUFFER_COUNT 64 |
#define USB_3_LOOPBACK_BUFFER_SIZE 1024 |
#define USB_3_MISSING_LCRD_EN (1 << 4) |
#define USB_3_MISSING_LGOOD_EN (1 << 3) |
#define USB_3_PHY_ERROR_DECODE_EV (1 << 0) |
#define USB_3_PHY_ERROR_DISPARITY_EV (1 << 3) |
#define USB_3_PHY_ERROR_EB_OVR_EV (1 << 1) |
#define USB_3_PHY_ERROR_EB_UND_EV (1 << 2) |
#define USB_3_PHY_LOCK_EV (1 << 9) |
#define USB_3_PM_LC_TIMEOUT_EN (1 << 6) |
#define USB_3_RX_ERROR_CRC16_EV (1 << 6) |
#define USB_3_RX_ERROR_CRC32_EV (1 << 7) |
#define USB_3_RX_ERROR_CRC5_EV (1 << 5) |
#define USB_3_RX_HP_FAIL_EN (1 << 2) |
#define USB_3_RX_SEQ_NUM_ERR_EN (1 << 1) |
#define USB_3_TRAINING_ERROR_EV (1 << 8) |
#define USB_3_TX_SEQ_NUM_ERR_EN (1 << 7) |
Enumerator |
---|
USB_3_CHANGELEDS |
|
USB_3_SET_CONFIG |
|
USB_3_GET_CONFIG |
|
USB_3_SET_DISP_MODE |
|
USB_3_CONF_ERROR_COUNTERS |
|
USB_3_GET_ERROR_COUNTS |
|
USB_3_GET_VOLTAGE |
|
USB_3_RESERVED_DONOTUSE |
|
USB_3_GET_MAX_SPEED |
|
USB_3_RESET_ERROR_COUNTERS |
|
USB_3_CONFIG_LPM_ENTRY |
|
USB_3_GET_DEVICE_INFO |
|
Enumerator |
---|
INCREMENTINGBYTE |
|
RANDOMBYTE |
|
CONSTANTBYTE |
|
Enumerator |
---|
USB_3_EP_CONTROL |
|
USB_3_EP_ISOCHRONOUS |
|
USB_3_EP_BULK |
|
USB_3_EP_INTERRUPT |
|
Enumerator |
---|
USB_3_ST_UNKNOWN |
|
USB_3_ST_FS |
|
USB_3_ST_HS |
|
USB_3_ST_SS |
|
Enumerator |
---|
USB_3_TEST_LOOPBACK |
|
USB_3_TEST_BENCHMARK_READ |
|
USB_3_TEST_BENCHMARK_WRITE |
|
USB_3_TEST_BENCHMARK_RW |
|
bool ConnectUSBPlug |
( |
bool |
bReconnect, |
|
|
int |
usbPlugIndex, |
|
|
USB3_SPEED |
Speed, |
|
|
USB_3_TEST_MODE |
TestMode, |
|
|
libusb_device_handle ** |
handle_udev, |
|
|
unsigned long * |
MaxTransferSize, |
|
|
unsigned long * |
CurrentTransferSize, |
|
|
unsigned char ** |
inBuffer, |
|
|
unsigned char ** |
outBuffer |
|
) |
| |
References config_info_def::buffer_count, config_info_def::buffer_size, device, config_info_def::ep_in, config_info_def::ep_out, config_info_def::ep_type, GetUSBDeviceInfo(), config_info_def::hs_bulk_nak_interval, config_info_def::iso_bytes_per_bus_interval, config_info_def::iso_transactions_per_bus_interval, LOOPBACK_USB_2_PRODUCT_ID, LOOPBACK_USB_3_PRODUCT_ID, LOOPBACK_VENDOR_ID, MAX_DRIVER_NAME, config_info_def::polling_interval, printf(), SendUSB_2_VendorCommand(), SendUSB_3_VendorCommand(), config_info_def::speed, config_info_def::ss_burst_len, config_info_def::test_mode, USBInfo::type, USB_2_CHANGEMODEOUTSTAT, USB_2_EPLOOPIN, USB_2_EPLOOPOUT, USB_2_LOOPBACK, USB_2_LOOPBACKFSBUFFERSIZE, USB_2_LOOPBACKHSBUFFERSIZE, USB_3_BENCHMARK_BUFFER_COUNT, USB_3_BENCHMARK_BUFFER_SIZE, USB_3_BENCHMARK_RW_BUFFER_COUNT, USB_3_BENCHMARK_RW_BUFFER_SIZE, USB_3_EP_BULK, USB_3_EPLOOPIN, USB_3_EPLOOPOUT, USB_3_LOOPBACK_BUFFER_COUNT, USB_3_LOOPBACK_BUFFER_SIZE, USB_3_SET_CONFIG, USB_3_TEST_BENCHMARK_RW, USB_3_TEST_BENCHMARK_WRITE, USB_3_TEST_LOOPBACK, USB_context, usbInfo, and wait_USB().
Referenced by main(), and USB_3_BenchmarkTest().
int GetUSBDeviceInfo |
( |
libusb_device_handle * |
udev, |
|
|
char * |
serial, |
|
|
unsigned int |
serial_size, |
|
|
char * |
desc, |
|
|
unsigned int |
desc_size, |
|
|
float * |
fwVer |
|
) |
| |
References USBInfo::bus, fclose(), fp, GetUSBInfoFromlibusb(), len, MAXNUMUSBPORTS, MAXSERIALNUMLEN, USBInfo::port, printf(), USBInfo::speed, and usbInfo.
Referenced by main().
int LoopbackTest |
( |
libusb_device_handle * |
handle_udev, |
|
|
int |
usbIndex, |
|
|
int |
maxTransferSize, |
|
|
unsigned char * |
inBuffer, |
|
|
unsigned char * |
outBuffer |
|
) |
| |
References CONSTANTBYTE, DisableUSB3LowPowerEntry(), EnableUSB3ErrorCounts(), GetUSB3GetErrorCounts(), INCREMENTINGBYTE, LOOPBACK_USB_2_PRODUCT_ID, LOOPBACK_USB_3_PRODUCT_ID, printf(), RANDOMBYTE, SendUSB_2_VendorCommand(), USB_2_CHANGELEDS, USB_2_CHANGEMODEOUTSTAT, USB_2_EPLOOPIN, USB_2_EPLOOPOUT, USB_2_STATISTICS, USB_3_EPLOOPIN, USB_3_EPLOOPOUT, usbInfo, and wait_USB().
Referenced by main().
int SendUSB_2_VendorCommand |
( |
libusb_device_handle * |
udev, |
|
|
int |
ReqMode, |
|
|
int |
Parameter, |
|
|
unsigned char * |
bufferout, |
|
|
int |
bufferSize |
|
) |
| |
int SendUSB_3_VendorCommand |
( |
libusb_device_handle * |
udev, |
|
|
int |
wValue, |
|
|
unsigned char * |
buf, |
|
|
long |
bufflen |
|
) |
| |
References printf(), USB_3_CONF_ERROR_COUNTERS, USB_3_CONFIG_LPM_ENTRY, USB_3_RESET_ERROR_COUNTERS, USB_3_SET_CONFIG, and USB_3_SET_DISP_MODE.
Referenced by ConnectUSBPlug(), DisableUSB3LowPowerEntry(), EnableUSB3ErrorCounts(), EnableUSB3LowPowerEntry(), GetUSB3GetErrorCounts(), GetUSBDeviceInfo(), and USB_3_BenchmarkTest().
void wait_USB |
( |
int |
wait_time | ) |
|
libusb_context* USB_context |