nidas  v1.2-1520
Classes | Macros | Typedefs | Enumerations | Functions | Variables
PassMarkUSB.h File Reference
#include <libusb-1.0/libusb.h>

Go to the source code of this file.

Classes

struct  config_info_def
 
struct  USBInfo
 
struct  _BENCHMARK_RESULTS
 

Macros

#define BUF_256   256
 
#define BUF_128   128
 
#define LOOPBACK_VENDOR_ID   0x0403
 
#define LOOPBACK_USB_2_PRODUCT_ID   0xff0a
 
#define LOOPBACK_USB_3_PRODUCT_ID   0xff0b
 
#define MAXNUMUSBPORTS   20
 
#define MAXSERIALNUMLEN   20
 
#define MAX_DRIVER_NAME   64
 
#define USB_2_CHANGEMODE   0xB0
 
#define USB_2_CHANGEMODEIN   1
 
#define USB_2_CHANGEMODEOUT   2
 
#define USB_2_CHANGEMODEOUTSTAT   50
 
#define USB_2_INITIALISATION   0
 
#define USB_2_LOOPBACK   1
 
#define USB_2_BENCHMARK   2
 
#define USB_2_STATISTICS   3
 
#define USB_2_CHANGELEDS   4
 
#define USB_2_EPLOOPOUT   0x02
 
#define USB_2_EPLOOPIN   0x86
 
#define USB_2_EPBENCHIN   0x88
 
#define USB_2_EPBENCHOUT   0x04
 
#define USB_2_EPHISTORY   0x81
 
#define USB_2_FSFIFOSIZE   64
 
#define USB_2_HSFIFOSIZE   512
 
#define USB_2_LOOPBACKFSBUFFERSIZE   64
 
#define USB_2_LOOPBACKHSBUFFERSIZE   512
 
#define USB_2_BENCHMARKFSBUFFERSIZE   2048
 
#define USB_2_BENCHMARKHSBUFFERSIZE   32768
 
#define USB_2_BENCHMARKHISTBUFFERSIZE   64
 
#define READWRITECYCLES   10
 
#define BENCHMARKCYCLES   10
 
#define USB_3_EPLOOPOUT   0x01
 
#define USB_3_EPLOOPIN   0x81
 
#define USB_3_BENCHMARK_RW_BUFFER_SIZE   24576
 
#define USB_3_BENCHMARK_RW_BUFFER_COUNT   2
 
#define USB_3_BENCHMARK_BUFFER_SIZE   49512
 
#define USB_3_BENCHMARK_BUFFER_COUNT   2
 
#define USB_3_LOOPBACK_BUFFER_SIZE   1024
 
#define USB_3_LOOPBACK_BUFFER_COUNT   64
 
#define USB_3_DISPLAY_DISABLE   0
 
#define USB_3_DISPLAY_ENABLE   (1 << 8)
 
#define LPM_ENTRY_DISABLE   0
 
#define LPM_ENTRY_ENABLE   (1 << 8)
 
#define USB_3_PHY_ERROR_DECODE_EV   (1 << 0)
 
#define USB_3_PHY_ERROR_EB_OVR_EV   (1 << 1)
 
#define USB_3_PHY_ERROR_EB_UND_EV   (1 << 2)
 
#define USB_3_PHY_ERROR_DISPARITY_EV   (1 << 3)
 
#define USB_3_RX_ERROR_CRC5_EV   (1 << 5)
 
#define USB_3_RX_ERROR_CRC16_EV   (1 << 6)
 
#define USB_3_RX_ERROR_CRC32_EV   (1 << 7)
 
#define USB_3_TRAINING_ERROR_EV   (1 << 8)
 
#define USB_3_PHY_LOCK_EV   (1 << 9)
 
#define USB_3_HP_TIMEOUT_EN   (1 << 0)
 
#define USB_3_RX_SEQ_NUM_ERR_EN   (1 << 1)
 
#define USB_3_RX_HP_FAIL_EN   (1 << 2)
 
#define USB_3_MISSING_LGOOD_EN   (1 << 3)
 
#define USB_3_MISSING_LCRD_EN   (1 << 4)
 
#define USB_3_CREDIT_HP_TIMEOUT_EN   (1 << 5)
 
#define USB_3_PM_LC_TIMEOUT_EN   (1 << 6)
 
#define USB_3_TX_SEQ_NUM_ERR_EN   (1 << 7)
 
#define USB_3_HDR_ADV_TIMEOUT_EN   (1 << 8)
 
#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)
 

Typedefs

typedef enum _USB_3_TEST_MODE USB_3_TEST_MODE
 
typedef enum _USB_3_EP_TYPE USB_3_EP_TYPE
 
typedef enum _USB_3_SPEED USB3_SPEED
 
typedef struct USBInfoUSBInfoPtr
 
typedef enum _DATA_PATTERN DATA_PATTERN
 
typedef struct _BENCHMARK_RESULTS BENCHMARK_RESULTS
 

Enumerations

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 }
 

Functions

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)
 

Variables

libusb_context * USB_context
 
USBInfo usbInfo [MAXNUMUSBPORTS+1]
 

Macro Definition Documentation

#define BENCHMARKCYCLES   10
#define BUF_128   128
#define BUF_256   256
#define LOOPBACK_USB_2_PRODUCT_ID   0xff0a
#define LOOPBACK_USB_3_PRODUCT_ID   0xff0b
#define LOOPBACK_VENDOR_ID   0x0403
#define LPM_ENTRY_DISABLE   0

Referenced by EnableUSB3LowPowerEntry().

#define LPM_ENTRY_ENABLE   (1 << 8)
#define MAX_DRIVER_NAME   64

Referenced by ConnectUSBPlug().

#define MAXNUMUSBPORTS   20

Referenced by GetUSBPortsInfo().

#define MAXSERIALNUMLEN   20
#define READWRITECYCLES   10

Referenced by USB_2_BenchmarkTest().

#define USB_2_BENCHMARK   2
#define USB_2_BENCHMARKFSBUFFERSIZE   2048

Referenced by USB_2_BenchmarkTest().

#define USB_2_BENCHMARKHISTBUFFERSIZE   64
#define USB_2_BENCHMARKHSBUFFERSIZE   32768

Referenced by USB_2_BenchmarkTest().

#define USB_2_CHANGELEDS   4
#define USB_2_CHANGEMODE   0xB0

Referenced by SendUSB_2_VendorCommand().

#define USB_2_CHANGEMODEIN   1
#define USB_2_CHANGEMODEOUT   2

Referenced by SendUSB_2_VendorCommand().

#define USB_2_CHANGEMODEOUTSTAT   50
#define USB_2_EPBENCHIN   0x88

Referenced by USB_2_BenchmarkTest().

#define USB_2_EPBENCHOUT   0x04

Referenced by USB_2_BenchmarkTest().

#define USB_2_EPHISTORY   0x81

Referenced by USB_2_BenchmarkTest().

#define USB_2_EPLOOPIN   0x86

Referenced by ConnectUSBPlug(), and LoopbackTest().

#define USB_2_EPLOOPOUT   0x02

Referenced by ConnectUSBPlug(), and LoopbackTest().

#define USB_2_FSFIFOSIZE   64

Referenced by USB_2_BenchmarkTest().

#define USB_2_HSFIFOSIZE   512

Referenced by USB_2_BenchmarkTest().

#define USB_2_INITIALISATION   0
#define USB_2_LOOPBACK   1
#define USB_2_LOOPBACKFSBUFFERSIZE   64

Referenced by ConnectUSBPlug().

#define USB_2_LOOPBACKHSBUFFERSIZE   512

Referenced by ConnectUSBPlug().

#define USB_2_STATISTICS   3
#define USB_3_BENCHMARK_BUFFER_COUNT   2

Referenced by ConnectUSBPlug().

#define USB_3_BENCHMARK_BUFFER_SIZE   49512

Referenced by ConnectUSBPlug().

#define USB_3_BENCHMARK_RW_BUFFER_COUNT   2

Referenced by ConnectUSBPlug().

#define USB_3_BENCHMARK_RW_BUFFER_SIZE   24576

Referenced by ConnectUSBPlug().

#define USB_3_CREDIT_HP_TIMEOUT_EN   (1 << 5)

Referenced by GetUSB3GetErrorCounts().

#define USB_3_DISPLAY_DISABLE   0

Referenced by USB_3_BenchmarkTest().

#define USB_3_DISPLAY_ENABLE   (1 << 8)

Referenced by USB_3_BenchmarkTest().

#define USB_3_EPLOOPIN   0x81
#define USB_3_EPLOOPOUT   0x01
#define USB_3_HDR_ADV_HP_EN   (1 << 9)

Referenced by GetUSB3GetErrorCounts().

#define USB_3_HDR_ADV_LCRD_EN   (1 << 10)

Referenced by GetUSB3GetErrorCounts().

#define USB_3_HDR_ADV_LGO_EN   (1 << 11)

Referenced by GetUSB3GetErrorCounts().

#define USB_3_HDR_ADV_TIMEOUT_EN   (1 << 8)

Referenced by GetUSB3GetErrorCounts().

#define USB_3_HP_TIMEOUT_EN   (1 << 0)

Referenced by GetUSB3GetErrorCounts().

#define USB_3_LOOPBACK_BUFFER_COUNT   64

Referenced by ConnectUSBPlug().

#define USB_3_LOOPBACK_BUFFER_SIZE   1024

Referenced by ConnectUSBPlug().

#define USB_3_MISSING_LCRD_EN   (1 << 4)

Referenced by GetUSB3GetErrorCounts().

#define USB_3_MISSING_LGOOD_EN   (1 << 3)

Referenced by GetUSB3GetErrorCounts().

#define USB_3_PHY_ERROR_DECODE_EV   (1 << 0)
#define USB_3_PHY_ERROR_DISPARITY_EV   (1 << 3)

Referenced by GetUSB3GetErrorCounts().

#define USB_3_PHY_ERROR_EB_OVR_EV   (1 << 1)

Referenced by GetUSB3GetErrorCounts().

#define USB_3_PHY_ERROR_EB_UND_EV   (1 << 2)

Referenced by GetUSB3GetErrorCounts().

#define USB_3_PHY_LOCK_EV   (1 << 9)

Referenced by GetUSB3GetErrorCounts().

#define USB_3_PM_LC_TIMEOUT_EN   (1 << 6)

Referenced by GetUSB3GetErrorCounts().

#define USB_3_RX_ERROR_CRC16_EV   (1 << 6)

Referenced by GetUSB3GetErrorCounts().

#define USB_3_RX_ERROR_CRC32_EV   (1 << 7)

Referenced by GetUSB3GetErrorCounts().

#define USB_3_RX_ERROR_CRC5_EV   (1 << 5)

Referenced by GetUSB3GetErrorCounts().

#define USB_3_RX_HP_FAIL_EN   (1 << 2)

Referenced by GetUSB3GetErrorCounts().

#define USB_3_RX_SEQ_NUM_ERR_EN   (1 << 1)

Referenced by GetUSB3GetErrorCounts().

#define USB_3_TRAINING_ERROR_EV   (1 << 8)

Referenced by GetUSB3GetErrorCounts().

#define USB_3_TX_SEQ_NUM_ERR_EN   (1 << 7)

Referenced by GetUSB3GetErrorCounts().

Typedef Documentation

typedef enum _USB_3_SPEED USB3_SPEED
typedef struct USBInfo * USBInfoPtr

Enumeration Type Documentation

anonymous enum
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 

Function Documentation

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 
)
int GetUSBPortsInfo ( )
int LoopbackTest ( libusb_device_handle *  handle_udev,
int  usbIndex,
int  maxTransferSize,
unsigned char *  inBuffer,
unsigned char *  outBuffer 
)
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 
)
void wait_USB ( int  wait_time)

Referenced by ConnectUSBPlug(), and LoopbackTest().

Variable Documentation

libusb_context* USB_context
USBInfo usbInfo[MAXNUMUSBPORTS+1]