Silicon Labs Host Libraries
CP2130 SPI interface Library

Data Structures

struct  PDEVICE_DESCRIPTOR
 
struct  PSPI_CMD
 
struct  _SPI_CMD
 SPI Command Word. Alias of this struct is SPI_CMD. More...
 

Macros

#define SLAB_USB_SPI_API
 Silabs USB to SPI API. More...
 
#define WINAPI
 Win API. More...
 

Typedefs

typedef void * CP213x_DEVICE
 CP213X_DEVICE opaque object. More...
 
typedef enum _USB_SPI_STATUS * PUSB_SPI_STATUS
 API Status return codes pointer. More...
 

Enumerations

enum  USB_SPI_STATUS {
  USB_SPI_ERRCODE_SUCCESS = SILABS_STATUS_SUCCESS, USB_SPI_ERRCODE_ALLOC_FAILURE = 0x01, USB_SPI_ERRCODE_INVALID_ENUM_VALUE = 0x02, USB_SPI_ERRCODE_NULL_POINTER = 0x03,
  USB_SPI_ERRCODE_INVALID_CHANNEL_INDEX = 0x04, USB_SPI_ERRCODE_INVALID_GPIO_MODE = 0x05, USB_SPI_ERRCODE_UNKNOWN_ERROR = 0xFFFFFFFF, USB_SPI_ERRCODE_INVALID_PARAMETER = 0x10,
  USB_SPI_ERRCODE_INVALID_DEVICE_OBJECT = 0x11, USB_SPI_ERRCODE_DEVICE_NOT_FOUND = 0x20, USB_SPI_ERRCODE_USB_DEVICE_NOT_OPENED = 0x21, USB_SPI_ERRCODE_INVALID_HANDLE = 0x22,
  USB_SPI_ERRCODE_HWIF_DEVICE_ERROR = 0x30, USB_SPI_ERRCODE_HWIF_TRANSFER_TIMEOUT = 0x31, USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR = 0x50, USB_SPI_ERRCODE_INVALID_TRANSFER_SIZE = 0x51,
  USB_SPI_ERRCODE_PIPE_INIT_FAIL = 0x60, USB_SPI_ERRCODE_PIPE_QUERY_FAIL = 0x61, USB_SPI_ERRCODE_PIPE_WRITE_FAIL = 0x62, USB_SPI_ERRCODE_PIPE_READ_FAIL = 0x63,
  USB_SPI_ERRCODE_PIPE_ABORT_FAIL = 0x64, USB_SPI_ERRCODE_PIPE_FLUSH_FAIL = 0x65, USB_SPI_ERRCODE_PIPE_INVALID_ID = 0x66, USB_SPI_ERRCODE_READ_THREAD_CREATE_FAILURE = 0x70,
  USB_SPI_ERRCODE_READ_THREAD_NOT_RUNNING = 0x71, USB_SPI_ERRCODE_READ_THREAD_START_FAILURE = 0x72, USB_SPI_ERRCODE_DEVICE_RETURNED_TOO_MUCH_DATA = 0x80, USB_SPI_ERRCODE_SYSTEM_ERROR = 0xFFFFFFFE
}
 API Status return codes. More...
 

Windows Definitions

#define MAX_PATH   260
 Max string path length. More...
 
#define CALLBACK   __stdcall
 Calback definition. More...
 

Definitions specific to USB SPI code

#define BULK_PACKETSIZE   64
 Bulk packet size. More...
 
#define EP_BUFSIZE   BULK_PACKETSIZE
 Endpoint buffer size. More...
 
#define CMD_SIZE   8
 Command size. More...
 
#define CMD_TIMEOUT_MS   1000
 Timeout for completion of SPI command (i.e. first packet) More...
 
#define STRING_DESCRIPTOR_SIZE   256
 String descriptor size. More...
 
#define SIZE_PIN_CONFIG   20
 Config pin size. More...
 
#define WRITEREAD_MAX_BLOCKSIZE   256
 Matches size of firmware Read buffer. More...
 
#define CP213x_NUM_GPIO   11
 Number of GPIO/CS pins. More...
 
#define CSMODE_IDLE   0
 Chip Select Mode idle. More...
 
#define CSMODE_ACTIVE   1
 Chip Select Mode active. More...
 
#define CSMODE_ACTIVE_OTHERS_IDLE   2
 Chip Select Mode active othe idle. More...
 
#define GPIO_MODE_INPUT   0
 GPIO mode input. More...
 
#define GPIO_MODE_OUTPUT_OD   1
 GPIO mode output OD. More...
 
#define GPIO_MODE_OUTPUT_PP   2
 GPIO mode output PP. More...
 
#define GPIO_MODE_CHIPSELECT   3
 Chip select mode. More...
 
#define GPIO_MODE__RTR_ACTLOW   4
 GPIO mode RTR act low. More...
 
#define GPIO_MODE__RTR_ACTHIGH   5
 GPIO mode RTR act high. More...
 
#define GPIO_MODE__EVTCNTR_RISING   4
 GPIO mode event control rising. More...
 
#define GPIO_MODE__EVTCNTR_FALLING   5
 GPIO mode event control falling. More...
 
#define GPIO_MODE__EVTCNTR_NEGPULSE   6
 GPIO mode event control negative pulse. More...
 
#define GPIO_MODE__EVTCNTR_POSPULSE   7
 GPIO mode event control positive pulse. More...
 
#define GPIO_MODE__CLK_OUT   4
 GPIO mode clock out. More...
 
#define GPIO_MODE__SPI_ACTIVITY   4
 GPIO mode spi activity. More...
 
#define GPIO_MODE__SUSPEND   4
 GPIO mode suspend. More...
 
#define GPIO_MODE__SUSPENDBAR   4
 GPIO mode suspend bar. More...
 
#define SHORT_STRING_LEN   60
 Short string length. More...
 
#define LONG_STRING_LEN_1   61
 Long string length 1. More...
 
#define LONG_STRING_LEN_2   63
 Long string length 2. More...
 

SPI Data Transfer command and subcommands

#define CMD_TRANSFER_DATA   0x0000
 Command transfer data. More...
 
#define SUBCMD_READ   0
 Sub-command read. More...
 
#define SUBCMD_WRITE   1
 Sub-command write. More...
 
#define SUBCMD_WRITEREAD   2
 Sub-command write read. More...
 
#define SUBCMD_RTREAD   4
 Sub-command RT read. More...
 
#define SUBCMD_MSB_RELEASE_BUS   0x80
 Sub-command MSB release bus. More...
 

SPI Control Word bitfield definitions

#define SPICTL_CPHA_SHIFT   5
 SPI control clock phase shift. More...
 
#define SPICTL_CPHA_MASK   0x20
 SPI control clock phase mask. More...
 
#define SPICTL_CPHA_LEADING_EDGE   0
 SPI control clock phase leading adge. More...
 
#define SPICTL_CPHA_TRAILING_EDGE   1
 SPI control clock phase trailing edge. More...
 
#define SPICTL_CPOL_SHIFT   4
 SPI control clock polarity shift. More...
 
#define SPICTL_CPOL_MASK   0x10
 SPI control clock polarity mask. More...
 
#define SPICTL_CPOL_ACTIVE_HIGH   0
 SPI control clock polarity active high. More...
 
#define SPICTL_CPOL_ACTIVE_LOW   1
 SPI control clock polarity active low. More...
 
#define SPICTL_CSMODE_SHIFT   3
 Chip Select Mode shift. More...
 
#define SPICTL_CSMODE_MASK   0x08
 Chip Select Mode mask. More...
 
#define SPICTL_CSMODE_OPENDRAIN   0
 Chip Select Mode opendrain. More...
 
#define SPICTL_CSMODE_PUSHPULL   1
 Chip Select Mode pushpull. More...
 
#define SPICTL_CLKRATE_SHIFT   0
 Clock rate shift. More...
 
#define SPICTL_CLKRATE_MASK   0x07
 Clock rate mask. More...
 
#define SPICTL_CLKRATE_12M   0
 12 MHz More...
 
#define SPICTL_CLKRATE_6M   1
 6 MHz More...
 
#define SPICTL_CLKRATE_3M   2
 3 MHz More...
 
#define SPICTL_CLKRATE_1M5   3
 1.5 MHz More...
 
#define SPICTL_CLKRATE_750K   4
 750 kHz More...
 
#define SPICTL_CLKRATE_375K   5
 375 kHz More...
 
#define SPICTL_CLKRATE_187K5   6
 187.5 kHz More...
 
#define SPICTL_CLKRATE_93K75   7
 93.75 kHz More...
 

Return values for BOOL-returning functions

#define bRESULT_PASS   TRUE
 Return values pass. More...
 
#define bRESULT_FAIL   FALSE
 Return values fail. More...
 

CP213x Customization Masks

enum  SET_STATUS { SET_SUCCESS, SET_FAIL, SET_VERIFY_FAIL }
 Set status return. More...
 
typedef char MFG_STR[62]
 Manufacture string. More...
 
typedef char PRODUCT_STR[62]
 Product string. More...
 
typedef char SERIAL_STR[30]
 Serial string. More...
 
#define CP213x_LOCK_PRODUCT_STR_1   0x0001
 CP213x lock product string 1. More...
 
#define CP213x_LOCK_PRODUCT_STR_2   0x0002
 CP213x lock product string 2. More...
 
#define CP213x_LOCK_SERIAL_STR   0x0004
 CP213x lock serial string. More...
 
#define CP213x_LOCK_PIN_CONFIG   0x0008
 CP213x lock pin configure. More...
 
#define CP213x_LOCK_VID   0x0100
 CP213x lock vid. More...
 
#define CP213x_LOCK_PID   0x0200
 CP213x lock pid. More...
 
#define CP213x_LOCK_POWER   0x0400
 CP213x lock power. More...
 
#define CP213x_LOCK_POWER_MODE   0x0800
 CP213x lock power mode. More...
 
#define CP213x_LOCK_RELEASE_VERSION   0x1000
 CP213x lock release version. More...
 
#define CP213x_LOCK_MFG_STR_1   0x2000
 CP213x lock manufacture string 1. More...
 
#define CP213x_LOCK_MFG_STR_2   0x4000
 CP213x lock manufacture string 2. More...
 
#define CP213x_LOCK_TRANSFER_PRIORITY   0x8000
 CP213x lock transfer priority. More...
 
#define CP213x_SET_VID   0x01
 CP213x lock set vid. More...
 
#define CP213x_SET_PID   0x02
 CP213x lock set pid. More...
 
#define CP213x_SET_POWER   0x04
 CP213x lock set power. More...
 
#define CP213x_SET_POWER_MODE   0x08
 CP213x lock set power mode. More...
 
#define CP213x_SET_RELEASE_VERSION   0x10
 CP213x lock set release version. More...
 
#define CP213x_SET_TRANSFER_PRIORITY   0x80
 CP213x lock transfer priority. More...
 
#define MFG_STRLEN   62
 Manufacture string length. More...
 
#define PRODUCT_STRLEN   62
 Product string length. More...
 
#define SERIAL_STRLEN   30
 Serial string length. More...
 
#define CP213x_INDEX_GPIO_0   0
 CP213x index GPIO 0. More...
 
#define CP213x_INDEX_GPIO_1   1
 CP213x index GPIO 1. More...
 
#define CP213x_INDEX_GPIO_2   2
 CP213x index GPIO 2. More...
 
#define CP213x_INDEX_GPIO_3   3
 CP213x index GPIO 3. More...
 
#define CP213x_INDEX_GPIO_4   4
 CP213x index GPIO 4. More...
 
#define CP213x_INDEX_GPIO_5   5
 CP213x index GPIO 5. More...
 
#define CP213x_INDEX_GPIO_6   6
 CP213x index GPIO 6. More...
 
#define CP213x_INDEX_GPIO_7   7
 CP213x index GPIO 7. More...
 
#define CP213x_INDEX_GPIO_8   8
 CP213x index GPIO 8. More...
 
#define CP213x_INDEX_GPIO_9   9
 CP213x index GPIO 9. More...
 
#define CP213x_INDEX_GPIO_10   10
 CP213x index GPIO 10. More...
 
#define CP213x_MASK_SCK   0x0001
 CP213x SCK ask. More...
 
#define CP213x_MASK_MISO   0x0002
 CP213x MISO mask. More...
 
#define CP213x_MASK_MOSI   0x0004
 CP213x MOSI mask. More...
 
#define CP213x_MASK_GPIO_0   0x0008
 CP213x GPIO_0 mask. More...
 
#define CP213x_MASK_GPIO_1   0x0010
 CP213x GPIO_1 mask. More...
 
#define CP213x_MASK_GPIO_2   0x0020
 CP213x GPIO_2 mask. More...
 
#define CP213x_MASK_GPIO_3   0x0040
 CP213x GPIO_3 mask. More...
 
#define CP213x_MASK_GPIO_4   0x0080
 CP213x GPIO_4 mask. More...
 
#define CP213x_MASK_GPIO_5   0x0100
 CP213x GPIO_5 mask. More...
 
#define CP213x_MASK_GPIO_6   0x0400
 CP213x GPIO_6 mask. More...
 
#define CP213x_MASK_GPIO_7   0x0800
 CP213x GPIO_7 mask. More...
 
#define CP213x_MASK_GPIO_8   0x1000
 CP213x GPIO_8 mask. More...
 
#define CP213x_MASK_GPIO_9   0x2000
 CP213x GPIO_9 mask. More...
 
#define CP213x_MASK_GPIO_10   0x4000
 CP213x GPIO_10 mask. More...
 

Type and structure definitions

#define SPI_INTERBYTE_DELAY_MASK   0x01
 Spi inter byte delay mask. More...
 
#define SPI_CS_POSTASSERT_DELAY_MASK   0x02
 Chip select post assert delay mask. More...
 
#define SPI_CS_PREDEASSERT_DELAY_MASK   0x04
 Chip select pre deassert delay mask. More...
 
#define SPI_CS_TOGGLE_MASK   0x08
 Chip select toggle mask. More...
 

Exported API Functions

USB_SPI_STATUS CP213x_GetLibraryVersion (BYTE *major, BYTE *minor, BOOL *release)
 what it does in brief More...
 

CP2130 Device Management

USB_SPI_STATUS CP213x_GetGuid (LPGUID guid)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_SetGuid (LPGUID guid)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_GetNumDevices (DWORD *numDevices, DWORD VID, DWORD PID)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_GetDevicePath (const DWORD deviceIndex, LPSTR path)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_Open (DWORD deviceIndex, CP213x_DEVICE *phDevice, DWORD VID, DWORD PID)
 Opens a USB device using a device index and returns a device object pointer which will be used for subsequent access. More...
 
USB_SPI_STATUS CP213x_GetVidPid (const DWORD deviceIndex, WORD *vid, WORD *pid)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_GetOpenedDevicePath (const CP213x_DEVICE device, LPSTR path)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_GetOpenedVidPid (const CP213x_DEVICE device, WORD *vid, WORD *pid)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_Close (const CP213x_DEVICE hDevice)
 what it does in brief More...
 
BOOL CP213x_IsOpened (const CP213x_DEVICE hDevice)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_Reset (const CP213x_DEVICE hDevice)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_GetDeviceVersion (const CP213x_DEVICE hDevice, BYTE *majorVersion, BYTE *minorVersion)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_GetDeviceDescriptor (const CP213x_DEVICE hDevice, PDEVICE_DESCRIPTOR pDescriptor)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_GetStringDescriptor (const CP213x_DEVICE hDevice, BYTE index, BYTE stringDescriptor[256])
 what it does in brief More...
 
USB_SPI_STATUS CP213x_GetUsbConfig (const CP213x_DEVICE hDevice, WORD *vid, WORD *pid, BYTE *pMaxPower, BYTE *pPowerMode, WORD *releaseVersion, BYTE *transferPriority)
 Get the USB Device Configuration info. More...
 
USB_SPI_STATUS CP213x_SetUsbConfig (const CP213x_DEVICE hDevice, const WORD vid, const WORD pid, const BYTE MaxPower, const BYTE PowerMode, const WORD releaseVersion, const BYTE transferPriority, const BYTE mask)
 Set the USB device Configuration info. More...
 
USB_SPI_STATUS CP213x_GetManufacturingString (const CP213x_DEVICE hDevice, LPSTR manufacturingString, BYTE *manufacturingStringLen)
 Get the USB device Manufacturer string. More...
 
USB_SPI_STATUS CP213x_SetManufacturingString (const CP213x_DEVICE hDevice, LPCSTR manufacturingString, const BYTE manufacturingStringlen)
 Set the USB device Manufacturer string. More...
 
USB_SPI_STATUS CP213x_GetProductString (const CP213x_DEVICE hDevice, LPSTR productString, BYTE *productStringLen)
 Get the USB device Product string. More...
 
USB_SPI_STATUS CP213x_SetProductString (const CP213x_DEVICE hDevice, LPCSTR productString, const BYTE productStringlen)
 Set the USB device Product string. More...
 
USB_SPI_STATUS CP213x_GetSerialString (const CP213x_DEVICE hDevice, LPSTR serialString, BYTE *serialStringlen)
 Get the USB device Serial Number string. More...
 
USB_SPI_STATUS CP213x_SetSerialString (const CP213x_DEVICE hDevice, LPCSTR serialString, const BYTE serialStringlen)
 Set the USB device Serial Number string. More...
 
USB_SPI_STATUS CP213x_GetPinConfig (const CP213x_DEVICE hDevice, BYTE pinConfig[20])
 Get the USB device Pin Configuration info. More...
 
USB_SPI_STATUS CP213x_SetPinConfig (const CP213x_DEVICE hDevice, BYTE pinConfig[20])
 Set the USB device Pin Configuration info. More...
 
USB_SPI_STATUS CP213x_GetLock (const CP213x_DEVICE hDevice, WORD *lockValue)
 Get the Lock values. More...
 
USB_SPI_STATUS CP213x_SetLock (const CP213x_DEVICE hDevice, const WORD lockValue)
 Set the Lock values. More...
 
USB_SPI_STATUS CP213x_ReadProm (const CP213x_DEVICE hDevice, BYTE pReadBuf[])
 what it does in brief More...
 
USB_SPI_STATUS CP213x_WriteProm (const CP213x_DEVICE hDevice, BYTE pWriteBuf[])
 what it does in brief More...
 

CP2130 SPI Configuration and Transfer Operations

USB_SPI_STATUS CP213x_GetSpiControlBytes (const CP213x_DEVICE hDevice, BYTE controlBytes[11])
 what it does in brief More...
 
USB_SPI_STATUS CP213x_SetSpiControlByte (const CP213x_DEVICE hDevice, const BYTE channel, const BYTE controlByte)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_GetSpiDelay (const CP213x_DEVICE hDevice, const BYTE channel, BYTE *delayMode, WORD *interByteDelay, WORD *postAssertDelay, WORD *preDeassertDelay)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_SetSpiDelay (const CP213x_DEVICE hDevice, const BYTE channel, const BYTE delayMode, const WORD interByteDelay, const WORD postAssertDelay, const WORD preDeassertDelay)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_GetChipSelect (const CP213x_DEVICE hDevice, WORD *channelCsEnable, WORD *pinCsEnable)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_SetChipSelect (const CP213x_DEVICE hDevice, const BYTE channel, const BYTE mode)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_TransferWrite (const CP213x_DEVICE hDevice, BYTE pWriteBuf[], const DWORD length, const BOOL releaseBusAfterTransfer, const DWORD timeoutMs, DWORD *pBytesActuallyWritten)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_TransferWriteRead (const CP213x_DEVICE hDevice, BYTE pWriteBuf[], BYTE pReadBuf[], const DWORD length, const BOOL releaseBusAfterTransfer, const DWORD timeoutMs, DWORD *pBytesActuallyTransferred)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_TransferReadAsync (const CP213x_DEVICE hDevice, DWORD totalSize, DWORD blockSize, BOOL releaseBusAfterTransfer)
 Perform SPI Read (asynchronous) More...
 
USB_SPI_STATUS CP213x_TransferReadSync (const CP213x_DEVICE hDevice, BYTE pReadBuf[], DWORD length, BOOL releaseBusAfterTransfer, DWORD timeoutMs, DWORD *pBytesActuallyRead)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_TransferReadRtrAsync (const CP213x_DEVICE hDevice, DWORD totalSize, DWORD blockSize, BOOL releaseBusAfterTransfer)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_TransferReadRtrSync (const CP213x_DEVICE hDevice, BYTE pReadBuf[], DWORD totalSize, DWORD blockSize, BOOL releaseBusAfterTransfer, DWORD timeoutMs, DWORD *pBytesActuallyRead)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_GetRtrState (const CP213x_DEVICE hDevice, BYTE *isStopped)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_SetRtrStop (const CP213x_DEVICE hDevice, BYTE stopRtr)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_ReadPoll (const CP213x_DEVICE hDevice, BYTE pReadBuf[], DWORD maxLength, DWORD *pBytesActuallyRead)
 Read bytes received during an asynchronous Read or ReadRTR operation. More...
 
USB_SPI_STATUS CP213x_ReadAbort (const CP213x_DEVICE hDevice)
 Abort an asynchronous Read or ReadRTR operation. More...
 
USB_SPI_STATUS CP213x_AbortInputPipe (const CP213x_DEVICE hDevice)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_AbortOutputPipe (const CP213x_DEVICE hDevice)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_FlushInputPipe (const CP213x_DEVICE hDevice)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_FlushOutputPipe (const CP213x_DEVICE hDevice)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_GetFifoFullThreshold (const CP213x_DEVICE hDevice, BYTE *pFifoFullThreshold)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_SetFifoFullThreshold (const CP213x_DEVICE hDevice, const BYTE fifoFullThreshold)
 what it does in brief More...
 

CP2130 GPIO and Auxiliary-Function Pins

USB_SPI_STATUS CP213x_GetGpioModeAndLevel (const CP213x_DEVICE hDevice, const BYTE channel, BYTE *mode, BYTE *level)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_SetGpioModeAndLevel (const CP213x_DEVICE hDevice, const BYTE channel, const BYTE mode, const BYTE level)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_GetGpioValues (const CP213x_DEVICE hDevice, WORD *gpioValues)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_SetGpioValues (const CP213x_DEVICE hDevice, const WORD mask, const WORD gpioValues)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_GetEventCounter (const CP213x_DEVICE hDevice, BYTE *mode, WORD *eventCount)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_SetEventCounter (const CP213x_DEVICE hDevice, const BYTE mode, const WORD eventCount)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_GetClockDivider (const CP213x_DEVICE hDevice, BYTE *clockDivider)
 what it does in brief More...
 
USB_SPI_STATUS CP213x_SetClockDivider (const CP213x_DEVICE hDevice, const BYTE clockDivider)
 what it does in brief More...
 

Detailed Description


Data Structure Documentation

◆ DEVICE_DESCRIPTOR

struct DEVICE_DESCRIPTOR

This struct has the same format as _USB_DEVICE_DESCRIPTOR, as defined in Windows usb100.h. Using this typedef enables portable application code.

Data Fields
WORD bcdDevice
WORD bcdUSB
BYTE bDescriptorType
BYTE bDeviceClass
BYTE bDeviceProtocol
BYTE bDeviceSubClass
BYTE bLength
BYTE bMaxPacketSize0
BYTE bNumConfigurations
WORD idProduct
WORD idVendor
BYTE iManufacturer
BYTE iProduct
BYTE iSerialNumber

◆ SPI_CMD

struct SPI_CMD
Data Fields
DWORD blockSize
WORD Cmd
DWORD Len
DWORD res
WORD SubCmd
DWORD timeoutMs

◆ _SPI_CMD

struct _SPI_CMD

SPI Command Word. Alias of this struct is SPI_CMD.

Macro Definition Documentation

◆ bRESULT_FAIL

#define bRESULT_FAIL   FALSE

Return values fail.

◆ bRESULT_PASS

#define bRESULT_PASS   TRUE

Return values pass.

◆ BULK_PACKETSIZE

#define BULK_PACKETSIZE   64

Bulk packet size.

◆ CALLBACK

#define CALLBACK   __stdcall

Calback definition.

◆ CMD_SIZE

#define CMD_SIZE   8

Command size.

◆ CMD_TIMEOUT_MS

#define CMD_TIMEOUT_MS   1000

Timeout for completion of SPI command (i.e. first packet)

◆ CMD_TRANSFER_DATA

#define CMD_TRANSFER_DATA   0x0000

Command transfer data.

◆ CP213x_INDEX_GPIO_0

#define CP213x_INDEX_GPIO_0   0

CP213x index GPIO 0.

◆ CP213x_INDEX_GPIO_1

#define CP213x_INDEX_GPIO_1   1

CP213x index GPIO 1.

◆ CP213x_INDEX_GPIO_10

#define CP213x_INDEX_GPIO_10   10

CP213x index GPIO 10.

◆ CP213x_INDEX_GPIO_2

#define CP213x_INDEX_GPIO_2   2

CP213x index GPIO 2.

◆ CP213x_INDEX_GPIO_3

#define CP213x_INDEX_GPIO_3   3

CP213x index GPIO 3.

◆ CP213x_INDEX_GPIO_4

#define CP213x_INDEX_GPIO_4   4

CP213x index GPIO 4.

◆ CP213x_INDEX_GPIO_5

#define CP213x_INDEX_GPIO_5   5

CP213x index GPIO 5.

◆ CP213x_INDEX_GPIO_6

#define CP213x_INDEX_GPIO_6   6

CP213x index GPIO 6.

◆ CP213x_INDEX_GPIO_7

#define CP213x_INDEX_GPIO_7   7

CP213x index GPIO 7.

◆ CP213x_INDEX_GPIO_8

#define CP213x_INDEX_GPIO_8   8

CP213x index GPIO 8.

◆ CP213x_INDEX_GPIO_9

#define CP213x_INDEX_GPIO_9   9

CP213x index GPIO 9.

◆ CP213x_LOCK_MFG_STR_1

#define CP213x_LOCK_MFG_STR_1   0x2000

CP213x lock manufacture string 1.

◆ CP213x_LOCK_MFG_STR_2

#define CP213x_LOCK_MFG_STR_2   0x4000

CP213x lock manufacture string 2.

◆ CP213x_LOCK_PID

#define CP213x_LOCK_PID   0x0200

CP213x lock pid.

◆ CP213x_LOCK_PIN_CONFIG

#define CP213x_LOCK_PIN_CONFIG   0x0008

CP213x lock pin configure.

◆ CP213x_LOCK_POWER

#define CP213x_LOCK_POWER   0x0400

CP213x lock power.

◆ CP213x_LOCK_POWER_MODE

#define CP213x_LOCK_POWER_MODE   0x0800

CP213x lock power mode.

◆ CP213x_LOCK_PRODUCT_STR_1

#define CP213x_LOCK_PRODUCT_STR_1   0x0001

CP213x lock product string 1.

◆ CP213x_LOCK_PRODUCT_STR_2

#define CP213x_LOCK_PRODUCT_STR_2   0x0002

CP213x lock product string 2.

◆ CP213x_LOCK_RELEASE_VERSION

#define CP213x_LOCK_RELEASE_VERSION   0x1000

CP213x lock release version.

◆ CP213x_LOCK_SERIAL_STR

#define CP213x_LOCK_SERIAL_STR   0x0004

CP213x lock serial string.

◆ CP213x_LOCK_TRANSFER_PRIORITY

#define CP213x_LOCK_TRANSFER_PRIORITY   0x8000

CP213x lock transfer priority.

◆ CP213x_LOCK_VID

#define CP213x_LOCK_VID   0x0100

CP213x lock vid.

◆ CP213x_MASK_GPIO_0

#define CP213x_MASK_GPIO_0   0x0008

CP213x GPIO_0 mask.

◆ CP213x_MASK_GPIO_1

#define CP213x_MASK_GPIO_1   0x0010

CP213x GPIO_1 mask.

◆ CP213x_MASK_GPIO_10

#define CP213x_MASK_GPIO_10   0x4000

CP213x GPIO_10 mask.

◆ CP213x_MASK_GPIO_2

#define CP213x_MASK_GPIO_2   0x0020

CP213x GPIO_2 mask.

◆ CP213x_MASK_GPIO_3

#define CP213x_MASK_GPIO_3   0x0040

CP213x GPIO_3 mask.

◆ CP213x_MASK_GPIO_4

#define CP213x_MASK_GPIO_4   0x0080

CP213x GPIO_4 mask.

◆ CP213x_MASK_GPIO_5

#define CP213x_MASK_GPIO_5   0x0100

CP213x GPIO_5 mask.

◆ CP213x_MASK_GPIO_6

#define CP213x_MASK_GPIO_6   0x0400

CP213x GPIO_6 mask.

◆ CP213x_MASK_GPIO_7

#define CP213x_MASK_GPIO_7   0x0800

CP213x GPIO_7 mask.

◆ CP213x_MASK_GPIO_8

#define CP213x_MASK_GPIO_8   0x1000

CP213x GPIO_8 mask.

◆ CP213x_MASK_GPIO_9

#define CP213x_MASK_GPIO_9   0x2000

CP213x GPIO_9 mask.

◆ CP213x_MASK_MISO

#define CP213x_MASK_MISO   0x0002

CP213x MISO mask.

◆ CP213x_MASK_MOSI

#define CP213x_MASK_MOSI   0x0004

CP213x MOSI mask.

◆ CP213x_MASK_SCK

#define CP213x_MASK_SCK   0x0001

CP213x SCK ask.

◆ CP213x_NUM_GPIO

#define CP213x_NUM_GPIO   11

Number of GPIO/CS pins.

◆ CP213x_SET_PID

#define CP213x_SET_PID   0x02

CP213x lock set pid.

◆ CP213x_SET_POWER

#define CP213x_SET_POWER   0x04

CP213x lock set power.

◆ CP213x_SET_POWER_MODE

#define CP213x_SET_POWER_MODE   0x08

CP213x lock set power mode.

◆ CP213x_SET_RELEASE_VERSION

#define CP213x_SET_RELEASE_VERSION   0x10

CP213x lock set release version.

◆ CP213x_SET_TRANSFER_PRIORITY

#define CP213x_SET_TRANSFER_PRIORITY   0x80

CP213x lock transfer priority.

◆ CP213x_SET_VID

#define CP213x_SET_VID   0x01

CP213x lock set vid.

◆ CSMODE_ACTIVE

#define CSMODE_ACTIVE   1

Chip Select Mode active.

◆ CSMODE_ACTIVE_OTHERS_IDLE

#define CSMODE_ACTIVE_OTHERS_IDLE   2

Chip Select Mode active othe idle.

◆ CSMODE_IDLE

#define CSMODE_IDLE   0

Chip Select Mode idle.

◆ EP_BUFSIZE

#define EP_BUFSIZE   BULK_PACKETSIZE

Endpoint buffer size.

◆ GPIO_MODE__CLK_OUT

#define GPIO_MODE__CLK_OUT   4

GPIO mode clock out.

◆ GPIO_MODE__EVTCNTR_FALLING

#define GPIO_MODE__EVTCNTR_FALLING   5

GPIO mode event control falling.

◆ GPIO_MODE__EVTCNTR_NEGPULSE

#define GPIO_MODE__EVTCNTR_NEGPULSE   6

GPIO mode event control negative pulse.

◆ GPIO_MODE__EVTCNTR_POSPULSE

#define GPIO_MODE__EVTCNTR_POSPULSE   7

GPIO mode event control positive pulse.

◆ GPIO_MODE__EVTCNTR_RISING

#define GPIO_MODE__EVTCNTR_RISING   4

GPIO mode event control rising.

◆ GPIO_MODE__RTR_ACTHIGH

#define GPIO_MODE__RTR_ACTHIGH   5

GPIO mode RTR act high.

◆ GPIO_MODE__RTR_ACTLOW

#define GPIO_MODE__RTR_ACTLOW   4

GPIO mode RTR act low.

◆ GPIO_MODE__SPI_ACTIVITY

#define GPIO_MODE__SPI_ACTIVITY   4

GPIO mode spi activity.

◆ GPIO_MODE__SUSPEND

#define GPIO_MODE__SUSPEND   4

GPIO mode suspend.

◆ GPIO_MODE__SUSPENDBAR

#define GPIO_MODE__SUSPENDBAR   4

GPIO mode suspend bar.

◆ GPIO_MODE_CHIPSELECT

#define GPIO_MODE_CHIPSELECT   3

Chip select mode.

◆ GPIO_MODE_INPUT

#define GPIO_MODE_INPUT   0

GPIO mode input.

◆ GPIO_MODE_OUTPUT_OD

#define GPIO_MODE_OUTPUT_OD   1

GPIO mode output OD.

◆ GPIO_MODE_OUTPUT_PP

#define GPIO_MODE_OUTPUT_PP   2

GPIO mode output PP.

◆ LONG_STRING_LEN_1

#define LONG_STRING_LEN_1   61

Long string length 1.

◆ LONG_STRING_LEN_2

#define LONG_STRING_LEN_2   63

Long string length 2.

◆ MAX_PATH

#define MAX_PATH   260

Max string path length.

◆ MFG_STRLEN

#define MFG_STRLEN   62

Manufacture string length.

◆ PRODUCT_STRLEN

#define PRODUCT_STRLEN   62

Product string length.

◆ SERIAL_STRLEN

#define SERIAL_STRLEN   30

Serial string length.

◆ SHORT_STRING_LEN

#define SHORT_STRING_LEN   60

Short string length.

◆ SIZE_PIN_CONFIG

#define SIZE_PIN_CONFIG   20

Config pin size.

◆ SLAB_USB_SPI_API

#define SLAB_USB_SPI_API

Silabs USB to SPI API.

◆ SPI_CS_POSTASSERT_DELAY_MASK

#define SPI_CS_POSTASSERT_DELAY_MASK   0x02

Chip select post assert delay mask.

◆ SPI_CS_PREDEASSERT_DELAY_MASK

#define SPI_CS_PREDEASSERT_DELAY_MASK   0x04

Chip select pre deassert delay mask.

◆ SPI_CS_TOGGLE_MASK

#define SPI_CS_TOGGLE_MASK   0x08

Chip select toggle mask.

◆ SPI_INTERBYTE_DELAY_MASK

#define SPI_INTERBYTE_DELAY_MASK   0x01

Spi inter byte delay mask.

◆ SPICTL_CLKRATE_12M

#define SPICTL_CLKRATE_12M   0

12 MHz

◆ SPICTL_CLKRATE_187K5

#define SPICTL_CLKRATE_187K5   6

187.5 kHz

◆ SPICTL_CLKRATE_1M5

#define SPICTL_CLKRATE_1M5   3

1.5 MHz

◆ SPICTL_CLKRATE_375K

#define SPICTL_CLKRATE_375K   5

375 kHz

◆ SPICTL_CLKRATE_3M

#define SPICTL_CLKRATE_3M   2

3 MHz

◆ SPICTL_CLKRATE_6M

#define SPICTL_CLKRATE_6M   1

6 MHz

◆ SPICTL_CLKRATE_750K

#define SPICTL_CLKRATE_750K   4

750 kHz

◆ SPICTL_CLKRATE_93K75

#define SPICTL_CLKRATE_93K75   7

93.75 kHz

◆ SPICTL_CLKRATE_MASK

#define SPICTL_CLKRATE_MASK   0x07

Clock rate mask.

◆ SPICTL_CLKRATE_SHIFT

#define SPICTL_CLKRATE_SHIFT   0

Clock rate shift.

◆ SPICTL_CPHA_LEADING_EDGE

#define SPICTL_CPHA_LEADING_EDGE   0

SPI control clock phase leading adge.

◆ SPICTL_CPHA_MASK

#define SPICTL_CPHA_MASK   0x20

SPI control clock phase mask.

◆ SPICTL_CPHA_SHIFT

#define SPICTL_CPHA_SHIFT   5

SPI control clock phase shift.

◆ SPICTL_CPHA_TRAILING_EDGE

#define SPICTL_CPHA_TRAILING_EDGE   1

SPI control clock phase trailing edge.

◆ SPICTL_CPOL_ACTIVE_HIGH

#define SPICTL_CPOL_ACTIVE_HIGH   0

SPI control clock polarity active high.

◆ SPICTL_CPOL_ACTIVE_LOW

#define SPICTL_CPOL_ACTIVE_LOW   1

SPI control clock polarity active low.

◆ SPICTL_CPOL_MASK

#define SPICTL_CPOL_MASK   0x10

SPI control clock polarity mask.

◆ SPICTL_CPOL_SHIFT

#define SPICTL_CPOL_SHIFT   4

SPI control clock polarity shift.

◆ SPICTL_CSMODE_MASK

#define SPICTL_CSMODE_MASK   0x08

Chip Select Mode mask.

◆ SPICTL_CSMODE_OPENDRAIN

#define SPICTL_CSMODE_OPENDRAIN   0

Chip Select Mode opendrain.

◆ SPICTL_CSMODE_PUSHPULL

#define SPICTL_CSMODE_PUSHPULL   1

Chip Select Mode pushpull.

◆ SPICTL_CSMODE_SHIFT

#define SPICTL_CSMODE_SHIFT   3

Chip Select Mode shift.

◆ STRING_DESCRIPTOR_SIZE

#define STRING_DESCRIPTOR_SIZE   256

String descriptor size.

◆ SUBCMD_MSB_RELEASE_BUS

#define SUBCMD_MSB_RELEASE_BUS   0x80

Sub-command MSB release bus.

◆ SUBCMD_READ

#define SUBCMD_READ   0

Sub-command read.

◆ SUBCMD_RTREAD

#define SUBCMD_RTREAD   4

Sub-command RT read.

◆ SUBCMD_WRITE

#define SUBCMD_WRITE   1

Sub-command write.

◆ SUBCMD_WRITEREAD

#define SUBCMD_WRITEREAD   2

Sub-command write read.

◆ WINAPI

#define WINAPI

Win API.

◆ WRITEREAD_MAX_BLOCKSIZE

#define WRITEREAD_MAX_BLOCKSIZE   256

Matches size of firmware Read buffer.

Typedef Documentation

◆ CP213x_DEVICE

typedef void* CP213x_DEVICE

CP213X_DEVICE opaque object.

◆ MFG_STR

typedef char MFG_STR[62]

Manufacture string.

◆ PRODUCT_STR

typedef char PRODUCT_STR[62]

Product string.

◆ PUSB_SPI_STATUS

API Status return codes pointer.

◆ SERIAL_STR

typedef char SERIAL_STR[30]

Serial string.

Enumeration Type Documentation

◆ SET_STATUS

enum SET_STATUS

Set status return.

◆ USB_SPI_STATUS

API Status return codes.

Enumerator
USB_SPI_ERRCODE_SUCCESS 

The function returned successfully.

USB_SPI_ERRCODE_ALLOC_FAILURE 

Allocation error.

USB_SPI_ERRCODE_INVALID_ENUM_VALUE 

Invalid enumeration value.

USB_SPI_ERRCODE_NULL_POINTER 

Null pointer.

USB_SPI_ERRCODE_INVALID_CHANNEL_INDEX 

Channel index is not in range.

USB_SPI_ERRCODE_INVALID_GPIO_MODE 

Mode != INPUT, OUTPUT_OD, or OUTPUT_PP.

USB_SPI_ERRCODE_UNKNOWN_ERROR 

Unknown/unspecified error. TODO: No, not all-F's, how about 0xFF?

USB_SPI_ERRCODE_INVALID_PARAMETER 

Invalid function parameter.

USB_SPI_ERRCODE_INVALID_DEVICE_OBJECT 

The specified device object pointer is invalid.

USB_SPI_ERRCODE_DEVICE_NOT_FOUND 

The specified USB device could not be found.

USB_SPI_ERRCODE_USB_DEVICE_NOT_OPENED 

The current USB device is not opened.

USB_SPI_ERRCODE_INVALID_HANDLE 

The handle is invalid.

USB_SPI_ERRCODE_HWIF_DEVICE_ERROR 

An error occurred while communicating with the device or while retrieving device information.

USB_SPI_ERRCODE_HWIF_TRANSFER_TIMEOUT 

A control transfer operation timed out.

USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR 

USB SPI error code control transfer error.

USB_SPI_ERRCODE_INVALID_TRANSFER_SIZE 

USB SPI error code invalid transfer size.

USB_SPI_ERRCODE_PIPE_INIT_FAIL 

USB SPI error code pipe init fail.

USB_SPI_ERRCODE_PIPE_QUERY_FAIL 

USB SPI error code pipe query fail.

USB_SPI_ERRCODE_PIPE_WRITE_FAIL 

USB SPI error code pipe write fail.

USB_SPI_ERRCODE_PIPE_READ_FAIL 

USB SPI error code pipe read fail.

USB_SPI_ERRCODE_PIPE_ABORT_FAIL 

USB SPI error code pipe abort fail.

USB_SPI_ERRCODE_PIPE_FLUSH_FAIL 

USB SPI error code pipe flush fail.

USB_SPI_ERRCODE_PIPE_INVALID_ID 

USB SPI error code pipe invalid id.

USB_SPI_ERRCODE_READ_THREAD_CREATE_FAILURE 

USB SPI error code read thread create failure.

USB_SPI_ERRCODE_READ_THREAD_NOT_RUNNING 

USB SPI error code read thread not running.

USB_SPI_ERRCODE_READ_THREAD_START_FAILURE 

USB SPI error code read thread start failure.

USB_SPI_ERRCODE_DEVICE_RETURNED_TOO_MUCH_DATA 

USB SPI error code device returned too much data.

USB_SPI_ERRCODE_SYSTEM_ERROR 

USB SPI error code system error.

Function Documentation

◆ CP213x_AbortInputPipe()

USB_SPI_STATUS CP213x_AbortInputPipe ( const CP213x_DEVICE  hDevice)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_AbortOutputPipe()

USB_SPI_STATUS CP213x_AbortOutputPipe ( const CP213x_DEVICE  hDevice)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_Close()

USB_SPI_STATUS CP213x_Close ( const CP213x_DEVICE  hDevice)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_FlushInputPipe()

USB_SPI_STATUS CP213x_FlushInputPipe ( const CP213x_DEVICE  hDevice)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_FlushOutputPipe()

USB_SPI_STATUS CP213x_FlushOutputPipe ( const CP213x_DEVICE  hDevice)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_GetChipSelect()

USB_SPI_STATUS CP213x_GetChipSelect ( const CP213x_DEVICE  hDevice,
WORD *  channelCsEnable,
WORD *  pinCsEnable 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[out]channelCsEnableChannel chip select enable
[out]pinCsEnablePin chip select enable
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_GetClockDivider()

USB_SPI_STATUS CP213x_GetClockDivider ( const CP213x_DEVICE  hDevice,
BYTE clockDivider 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[out]clockDividerClock devider return
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_GetDeviceDescriptor()

USB_SPI_STATUS CP213x_GetDeviceDescriptor ( const CP213x_DEVICE  hDevice,
PDEVICE_DESCRIPTOR  pDescriptor 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[out]pDescriptorDescriptor return
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_GetDevicePath()

USB_SPI_STATUS CP213x_GetDevicePath ( const DWORD  deviceIndex,
LPSTR  path 
)

what it does in brief

what it does in detail

Parameters
[in]deviceIndexUSB device index
[out]pathUSB device path
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_GetDeviceVersion()

USB_SPI_STATUS CP213x_GetDeviceVersion ( const CP213x_DEVICE  hDevice,
BYTE majorVersion,
BYTE minorVersion 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]majorVersionMajor version return
[in]minorVersionMinor version return
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_GetEventCounter()

USB_SPI_STATUS CP213x_GetEventCounter ( const CP213x_DEVICE  hDevice,
BYTE mode,
WORD *  eventCount 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[out]modeMode return
[out]eventCountEvent counter return
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_GetFifoFullThreshold()

USB_SPI_STATUS CP213x_GetFifoFullThreshold ( const CP213x_DEVICE  hDevice,
BYTE pFifoFullThreshold 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]pFifoFullThresholdFifo full threshold return
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_GetGpioModeAndLevel()

USB_SPI_STATUS CP213x_GetGpioModeAndLevel ( const CP213x_DEVICE  hDevice,
const BYTE  channel,
BYTE mode,
BYTE level 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]channelGPIO channel
[out]modeGPIO mode
[out]levelGPIO level
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_GetGpioValues()

USB_SPI_STATUS CP213x_GetGpioValues ( const CP213x_DEVICE  hDevice,
WORD *  gpioValues 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[out]gpioValuesGPIO values
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_GetGuid()

USB_SPI_STATUS CP213x_GetGuid ( LPGUID  guid)

what it does in brief

what it does in detail

Parameters
[in]guidGlobally unique identifier
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_GetLibraryVersion()

USB_SPI_STATUS CP213x_GetLibraryVersion ( BYTE major,
BYTE minor,
BOOL *  release 
)

what it does in brief

what it does in detail

Parameters
[out]majorMajor version
[out]minorMinor version
[out]releaseRelease version
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success

◆ CP213x_GetLock()

USB_SPI_STATUS CP213x_GetLock ( const CP213x_DEVICE  hDevice,
WORD *  lockValue 
)

Get the Lock values.

Parameters
[in]hDeviceUSB Interface Handle
[out]lockValueThe Lock values
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS
USB_SPI_ERRCODE_INVALID_HANDLE
USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR

◆ CP213x_GetManufacturingString()

USB_SPI_STATUS CP213x_GetManufacturingString ( const CP213x_DEVICE  hDevice,
LPSTR  manufacturingString,
BYTE manufacturingStringLen 
)

Get the USB device Manufacturer string.

Parameters
[in]hDeviceUSB Interface Handle
[out]manufacturingStringPointer to buffer that will be populated with Manufacturer string
[out]manufacturingStringLenPointer to BYTE that will be set to the Manufacturer string length
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE
USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR

◆ CP213x_GetNumDevices()

USB_SPI_STATUS CP213x_GetNumDevices ( DWORD *  numDevices,
DWORD  VID,
DWORD  PID 
)

what it does in brief

what it does in detail

Parameters
[in]numDevicesNumber of devices
[in]VIDVendor id
[in]PIDProduct id
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_GetOpenedDevicePath()

USB_SPI_STATUS CP213x_GetOpenedDevicePath ( const CP213x_DEVICE  device,
LPSTR  path 
)

what it does in brief

what it does in detail

Parameters
[in]deviceUSB device Handle
[in]pathDevice path
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_GetOpenedVidPid()

USB_SPI_STATUS CP213x_GetOpenedVidPid ( const CP213x_DEVICE  device,
WORD *  vid,
WORD *  pid 
)

what it does in brief

what it does in detail

Parameters
[in]deviceUSB device Handle
[in]vidVendor id
[in]pidProduct id
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_GetPinConfig()

USB_SPI_STATUS CP213x_GetPinConfig ( const CP213x_DEVICE  hDevice,
BYTE  pinConfig[20] 
)

Get the USB device Pin Configuration info.

Parameters
[in]hDeviceUSB Interface Handle
[out]pinConfigBuffer containing the USB device Pin Configuration info
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE
USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR

◆ CP213x_GetProductString()

USB_SPI_STATUS CP213x_GetProductString ( const CP213x_DEVICE  hDevice,
LPSTR  productString,
BYTE productStringLen 
)

Get the USB device Product string.

Parameters
[in]hDeviceUSB Interface Handle
[out]productStringBuffer that will be populated with the USB device Product string
[out]productStringLenPointer to BYTE that will be set to the Product string length
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE
USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR

◆ CP213x_GetRtrState()

USB_SPI_STATUS CP213x_GetRtrState ( const CP213x_DEVICE  hDevice,
BYTE isStopped 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]isStoppedis stopped
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_GetSerialString()

USB_SPI_STATUS CP213x_GetSerialString ( const CP213x_DEVICE  hDevice,
LPSTR  serialString,
BYTE serialStringlen 
)

Get the USB device Serial Number string.

Parameters
[in]hDeviceUSB Interface Handle
[out]serialStringBuffer that will be populated with the USB device Serial Number string
[out]serialStringlenPointer to BYTE that will be set to the Serial Number string length
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE
USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR

◆ CP213x_GetSpiControlBytes()

USB_SPI_STATUS CP213x_GetSpiControlBytes ( const CP213x_DEVICE  hDevice,
BYTE  controlBytes[11] 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]controlBytesSPI control bytes
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_GetSpiDelay()

USB_SPI_STATUS CP213x_GetSpiDelay ( const CP213x_DEVICE  hDevice,
const BYTE  channel,
BYTE delayMode,
WORD *  interByteDelay,
WORD *  postAssertDelay,
WORD *  preDeassertDelay 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]channelSPI channel
[out]delayModeDelay mode
[out]interByteDelayInter byte delay
[out]postAssertDelayPost assert delay
[out]preDeassertDelayPre deassert delay
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_GetStringDescriptor()

USB_SPI_STATUS CP213x_GetStringDescriptor ( const CP213x_DEVICE  hDevice,
BYTE  index,
BYTE  stringDescriptor[256] 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]indexIndex of string descriptor
[in]stringDescriptorString descriptor
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_GetUsbConfig()

USB_SPI_STATUS CP213x_GetUsbConfig ( const CP213x_DEVICE  hDevice,
WORD *  vid,
WORD *  pid,
BYTE pMaxPower,
BYTE pPowerMode,
WORD *  releaseVersion,
BYTE transferPriority 
)

Get the USB Device Configuration info.

Parameters
[in]hDeviceUSB Interface Handle
[out]vidVID of the device
[out]pidPID of the device
[out]pMaxPowerPower of the device
[out]pPowerModePower Mode of the device
[out]releaseVersionRelease version of the device
[out]transferPriorityTransfer priority of the device
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE
USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR

◆ CP213x_GetVidPid()

USB_SPI_STATUS CP213x_GetVidPid ( const DWORD  deviceIndex,
WORD *  vid,
WORD *  pid 
)

what it does in brief

what it does in detail

Parameters
[in]deviceIndexDevice index
[out]vidVendor id
[out]pidProduct id
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_IsOpened()

BOOL CP213x_IsOpened ( const CP213x_DEVICE  hDevice)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_Open()

USB_SPI_STATUS CP213x_Open ( DWORD  deviceIndex,
CP213x_DEVICE phDevice,
DWORD  VID,
DWORD  PID 
)

Opens a USB device using a device index and returns a device object pointer which will be used for subsequent access.

Parameters
[in]deviceIndexIndex of device to open
[out]phDeviceReturns a pointer to an opaque device object CP213x_DEVICE used for subsequent device access.
[in]VIDVendor ID
[in]PIDProduct ID
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_DEVICE_OBJECT
USB_SPI_ERRCODE_INVALID_PARAMETER
Note
CP213x_GetNumDevices() must be called prior to calling this function in order to initialize the library's internal device list.
See also
CP213x_GetNumDevices()

◆ CP213x_ReadAbort()

USB_SPI_STATUS CP213x_ReadAbort ( const CP213x_DEVICE  hDevice)

Abort an asynchronous Read or ReadRTR operation.

Parameters
[in]hDeviceUSB Interface Handle
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE
USB_SPI_ERRCODE_NULL_POINTER

◆ CP213x_ReadPoll()

USB_SPI_STATUS CP213x_ReadPoll ( const CP213x_DEVICE  hDevice,
BYTE  pReadBuf[],
DWORD  maxLength,
DWORD *  pBytesActuallyRead 
)

Read bytes received during an asynchronous Read or ReadRTR operation.

Parameters
[in]hDeviceUSB Interface Handle
[in]pReadBufBuffer of data to read
[in]maxLengthMaximum number of bytes to read
[out]pBytesActuallyReadNumber of bytes actually read
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_NULL_POINTER
USB_SPI_ERRCODE_READ_THREAD_NOT_RUNNING

◆ CP213x_ReadProm()

USB_SPI_STATUS CP213x_ReadProm ( const CP213x_DEVICE  hDevice,
BYTE  pReadBuf[] 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]pReadBufData return
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_Reset()

USB_SPI_STATUS CP213x_Reset ( const CP213x_DEVICE  hDevice)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_SetChipSelect()

USB_SPI_STATUS CP213x_SetChipSelect ( const CP213x_DEVICE  hDevice,
const BYTE  channel,
const BYTE  mode 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]channelSPI channel
[in]modeMode
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_SetClockDivider()

USB_SPI_STATUS CP213x_SetClockDivider ( const CP213x_DEVICE  hDevice,
const BYTE  clockDivider 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]clockDividerClock deivider of device
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_SetEventCounter()

USB_SPI_STATUS CP213x_SetEventCounter ( const CP213x_DEVICE  hDevice,
const BYTE  mode,
const WORD  eventCount 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]modeMode of event
[in]eventCountEvent counter
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_SetFifoFullThreshold()

USB_SPI_STATUS CP213x_SetFifoFullThreshold ( const CP213x_DEVICE  hDevice,
const BYTE  fifoFullThreshold 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]fifoFullThresholdFIFO full threshold
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_SetGpioModeAndLevel()

USB_SPI_STATUS CP213x_SetGpioModeAndLevel ( const CP213x_DEVICE  hDevice,
const BYTE  channel,
const BYTE  mode,
const BYTE  level 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]channelGPIO channel
[in]modeGPIO mode
[in]levelGPIO level
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_SetGpioValues()

USB_SPI_STATUS CP213x_SetGpioValues ( const CP213x_DEVICE  hDevice,
const WORD  mask,
const WORD  gpioValues 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]maskGPIO mask
[in]gpioValuesGPIO value
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_SetGuid()

USB_SPI_STATUS CP213x_SetGuid ( LPGUID  guid)

what it does in brief

what it does in detail

Parameters
[in]guidGlobal unified identifier
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_SetLock()

USB_SPI_STATUS CP213x_SetLock ( const CP213x_DEVICE  hDevice,
const WORD  lockValue 
)

Set the Lock values.

Parameters
[in]hDeviceUSB Interface Handle
[in]lockValueThe Lock values to set
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS
USB_SPI_ERRCODE_INVALID_HANDLE
USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR

◆ CP213x_SetManufacturingString()

USB_SPI_STATUS CP213x_SetManufacturingString ( const CP213x_DEVICE  hDevice,
LPCSTR  manufacturingString,
const BYTE  manufacturingStringlen 
)

Set the USB device Manufacturer string.

Parameters
[in]hDeviceUSB Interface Handle
[in]manufacturingStringBuffer containing the USB device Manufacturer string to be set
[in]manufacturingStringlenThe length of the supplied Manufacturer string
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE
USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR

◆ CP213x_SetPinConfig()

USB_SPI_STATUS CP213x_SetPinConfig ( const CP213x_DEVICE  hDevice,
BYTE  pinConfig[20] 
)

Set the USB device Pin Configuration info.

Parameters
[in]hDeviceUSB Interface Handle
[out]pinConfigBuffer containing the USB device Pin Configuration info
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE
USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR

◆ CP213x_SetProductString()

USB_SPI_STATUS CP213x_SetProductString ( const CP213x_DEVICE  hDevice,
LPCSTR  productString,
const BYTE  productStringlen 
)

Set the USB device Product string.

Parameters
[in]hDeviceUSB Interface Handle
[in]productStringBuffer containing the USB device Product string
[in]productStringlenThe length of the supplied Product string
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE
USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR

◆ CP213x_SetRtrStop()

USB_SPI_STATUS CP213x_SetRtrStop ( const CP213x_DEVICE  hDevice,
BYTE  stopRtr 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]stopRtrRtr Stop
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_SetSerialString()

USB_SPI_STATUS CP213x_SetSerialString ( const CP213x_DEVICE  hDevice,
LPCSTR  serialString,
const BYTE  serialStringlen 
)

Set the USB device Serial Number string.

Parameters
[in]hDeviceUSB Interface Handle
[in]serialStringBuffer containing the USB device Serial Number string
[in]serialStringlenThe length of the supplied Serial Number string
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE
USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR

◆ CP213x_SetSpiControlByte()

USB_SPI_STATUS CP213x_SetSpiControlByte ( const CP213x_DEVICE  hDevice,
const BYTE  channel,
const BYTE  controlByte 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]channelSpi channel
[in]controlByteControl byte
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_SetSpiDelay()

USB_SPI_STATUS CP213x_SetSpiDelay ( const CP213x_DEVICE  hDevice,
const BYTE  channel,
const BYTE  delayMode,
const WORD  interByteDelay,
const WORD  postAssertDelay,
const WORD  preDeassertDelay 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]channelSPI channel
[in]delayModeDelay mode
[in]interByteDelayInter byte delay
[in]postAssertDelayPost assert delay
[in]preDeassertDelayPre deassert delay
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_SetUsbConfig()

USB_SPI_STATUS CP213x_SetUsbConfig ( const CP213x_DEVICE  hDevice,
const WORD  vid,
const WORD  pid,
const BYTE  MaxPower,
const BYTE  PowerMode,
const WORD  releaseVersion,
const BYTE  transferPriority,
const BYTE  mask 
)

Set the USB device Configuration info.

Parameters
[in]hDeviceUSB Interface Handle
[in]vidNew VID to be set in the device
[in]pidNew PID to be set in the device
[in]MaxPowerNew Power to be set in the device
[in]PowerModeNew Power Mode to be set in the device
[in]releaseVersionNew Release version to be set in the device
[in]transferPriorityNew Transfer priority to be set in the device
[in]maskMask that represents which of the settings to write to the device
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE
USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR

◆ CP213x_TransferReadAsync()

USB_SPI_STATUS CP213x_TransferReadAsync ( const CP213x_DEVICE  hDevice,
DWORD  totalSize,
DWORD  blockSize,
BOOL  releaseBusAfterTransfer 
)

Perform SPI Read (asynchronous)

The device reads SPI data in 'blockSize' chunks. This function returns immediately. The application should call CP213x_ReadPoll() periodically to read data. When 'totalSize' bytes have been read, the Read operation is terminated. To terminate the operation before then, the application should call CP213x_ReadAbort().

Parameters
[in]hDeviceUSB Interface Handle
[in]totalSizeTotal number of bytes to read
[in]blockSizeNumber of bytes to read at a time
[in]releaseBusAfterTransferRelease buf after transfer is complete
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_READ_THREAD_CREATE_FAILURE
USB_SPI_ERRCODE_PIPE_ABORT_FAIL
USB_SPI_ERRCODE_PIPE_FLUSH_FAIL
USB_SPI_ERRCODE_HWIF_TRANSFER_TIMEOUT
USB_SPI_ERRCODE_PIPE_WRITE_FAIL
USB_SPI_ERRCODE_READ_THREAD_START_FAILURE

◆ CP213x_TransferReadRtrAsync()

USB_SPI_STATUS CP213x_TransferReadRtrAsync ( const CP213x_DEVICE  hDevice,
DWORD  totalSize,
DWORD  blockSize,
BOOL  releaseBusAfterTransfer 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]totalSizeTotal size
[in]blockSizeBlock size
[in]releaseBusAfterTransferRelease Bus after transfer
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_TransferReadRtrSync()

USB_SPI_STATUS CP213x_TransferReadRtrSync ( const CP213x_DEVICE  hDevice,
BYTE  pReadBuf[],
DWORD  totalSize,
DWORD  blockSize,
BOOL  releaseBusAfterTransfer,
DWORD  timeoutMs,
DWORD *  pBytesActuallyRead 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]pReadBufRead buffer pointer
[in]totalSizeTotal size
[in]blockSizeBlock size
[in]releaseBusAfterTransferRelease bus after transfer
[in]timeoutMsTimeout ms
[out]pBytesActuallyReadBytes actally read
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_TransferReadSync()

USB_SPI_STATUS CP213x_TransferReadSync ( const CP213x_DEVICE  hDevice,
BYTE  pReadBuf[],
DWORD  length,
BOOL  releaseBusAfterTransfer,
DWORD  timeoutMs,
DWORD *  pBytesActuallyRead 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]pReadBufRead buffer pointer
[in]lengthLength of buffer
[in]releaseBusAfterTransferRelease bus after transfer
[in]timeoutMsTime out in ms
[in]pBytesActuallyReadBytes actually read
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_TransferWrite()

USB_SPI_STATUS CP213x_TransferWrite ( const CP213x_DEVICE  hDevice,
BYTE  pWriteBuf[],
const DWORD  length,
const BOOL  releaseBusAfterTransfer,
const DWORD  timeoutMs,
DWORD *  pBytesActuallyWritten 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]pWriteBufBuffer write pointer
[in]lengthLength of buffer
[in]releaseBusAfterTransferRelease bus after transfer
[in]timeoutMsTime out in ms
[out]pBytesActuallyWrittenBytes actually write pointer
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_TransferWriteRead()

USB_SPI_STATUS CP213x_TransferWriteRead ( const CP213x_DEVICE  hDevice,
BYTE  pWriteBuf[],
BYTE  pReadBuf[],
const DWORD  length,
const BOOL  releaseBusAfterTransfer,
const DWORD  timeoutMs,
DWORD *  pBytesActuallyTransferred 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]pWriteBufWrite buffer pointer
[out]pReadBufRead buffer pointer
[in]lengthLength of buffer
[in]releaseBusAfterTransferRelease bus after transfer
[in]timeoutMsTimeout ms
[out]pBytesActuallyTransferredBytes actually transferred
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE

◆ CP213x_WriteProm()

USB_SPI_STATUS CP213x_WriteProm ( const CP213x_DEVICE  hDevice,
BYTE  pWriteBuf[] 
)

what it does in brief

what it does in detail

Parameters
[in]hDeviceUSB Interface Handle
[in]pWriteBufWrite buffer pointer
Returns
Returns USB_SPI_ERRCODE_SUCCESS on success, or another USB_SPI_STATUS Return value if there is an error.
Return values
USB_SPI_ERRCODE_SUCCESS– success
USB_SPI_ERRCODE_INVALID_HANDLE