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... | |
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... | |
| 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 | |
| struct _SPI_CMD |
SPI Command Word. Alias of this struct is SPI_CMD.
| #define bRESULT_FAIL FALSE |
Return values fail.
| #define bRESULT_PASS TRUE |
Return values pass.
| #define BULK_PACKETSIZE 64 |
Bulk packet size.
| #define CALLBACK __stdcall |
Calback definition.
| #define CMD_SIZE 8 |
Command size.
| #define CMD_TIMEOUT_MS 1000 |
Timeout for completion of SPI command (i.e. first packet)
| #define CMD_TRANSFER_DATA 0x0000 |
Command transfer data.
| #define CP213x_INDEX_GPIO_0 0 |
CP213x index GPIO 0.
| #define CP213x_INDEX_GPIO_1 1 |
CP213x index GPIO 1.
| #define CP213x_INDEX_GPIO_10 10 |
CP213x index GPIO 10.
| #define CP213x_INDEX_GPIO_2 2 |
CP213x index GPIO 2.
| #define CP213x_INDEX_GPIO_3 3 |
CP213x index GPIO 3.
| #define CP213x_INDEX_GPIO_4 4 |
CP213x index GPIO 4.
| #define CP213x_INDEX_GPIO_5 5 |
CP213x index GPIO 5.
| #define CP213x_INDEX_GPIO_6 6 |
CP213x index GPIO 6.
| #define CP213x_INDEX_GPIO_7 7 |
CP213x index GPIO 7.
| #define CP213x_INDEX_GPIO_8 8 |
CP213x index GPIO 8.
| #define CP213x_INDEX_GPIO_9 9 |
CP213x index GPIO 9.
| #define CP213x_LOCK_MFG_STR_1 0x2000 |
CP213x lock manufacture string 1.
| #define CP213x_LOCK_MFG_STR_2 0x4000 |
CP213x lock manufacture string 2.
| #define CP213x_LOCK_PID 0x0200 |
CP213x lock pid.
| #define CP213x_LOCK_PIN_CONFIG 0x0008 |
CP213x lock pin configure.
| #define CP213x_LOCK_POWER 0x0400 |
CP213x lock power.
| #define CP213x_LOCK_POWER_MODE 0x0800 |
CP213x lock power mode.
| #define CP213x_LOCK_PRODUCT_STR_1 0x0001 |
CP213x lock product string 1.
| #define CP213x_LOCK_PRODUCT_STR_2 0x0002 |
CP213x lock product string 2.
| #define CP213x_LOCK_RELEASE_VERSION 0x1000 |
CP213x lock release version.
| #define CP213x_LOCK_SERIAL_STR 0x0004 |
CP213x lock serial string.
| #define CP213x_LOCK_TRANSFER_PRIORITY 0x8000 |
CP213x lock transfer priority.
| #define CP213x_LOCK_VID 0x0100 |
CP213x lock vid.
| #define CP213x_MASK_GPIO_0 0x0008 |
CP213x GPIO_0 mask.
| #define CP213x_MASK_GPIO_1 0x0010 |
CP213x GPIO_1 mask.
| #define CP213x_MASK_GPIO_10 0x4000 |
CP213x GPIO_10 mask.
| #define CP213x_MASK_GPIO_2 0x0020 |
CP213x GPIO_2 mask.
| #define CP213x_MASK_GPIO_3 0x0040 |
CP213x GPIO_3 mask.
| #define CP213x_MASK_GPIO_4 0x0080 |
CP213x GPIO_4 mask.
| #define CP213x_MASK_GPIO_5 0x0100 |
CP213x GPIO_5 mask.
| #define CP213x_MASK_GPIO_6 0x0400 |
CP213x GPIO_6 mask.
| #define CP213x_MASK_GPIO_7 0x0800 |
CP213x GPIO_7 mask.
| #define CP213x_MASK_GPIO_8 0x1000 |
CP213x GPIO_8 mask.
| #define CP213x_MASK_GPIO_9 0x2000 |
CP213x GPIO_9 mask.
| #define CP213x_MASK_MISO 0x0002 |
CP213x MISO mask.
| #define CP213x_MASK_MOSI 0x0004 |
CP213x MOSI mask.
| #define CP213x_MASK_SCK 0x0001 |
CP213x SCK ask.
| #define CP213x_NUM_GPIO 11 |
Number of GPIO/CS pins.
| #define CP213x_SET_PID 0x02 |
CP213x lock set pid.
| #define CP213x_SET_POWER 0x04 |
CP213x lock set power.
| #define CP213x_SET_POWER_MODE 0x08 |
CP213x lock set power mode.
| #define CP213x_SET_RELEASE_VERSION 0x10 |
CP213x lock set release version.
| #define CP213x_SET_TRANSFER_PRIORITY 0x80 |
CP213x lock transfer priority.
| #define CP213x_SET_VID 0x01 |
CP213x lock set vid.
| #define CSMODE_ACTIVE 1 |
Chip Select Mode active.
| #define CSMODE_ACTIVE_OTHERS_IDLE 2 |
Chip Select Mode active othe idle.
| #define CSMODE_IDLE 0 |
Chip Select Mode idle.
| #define EP_BUFSIZE BULK_PACKETSIZE |
Endpoint buffer size.
| #define GPIO_MODE__CLK_OUT 4 |
GPIO mode clock out.
| #define GPIO_MODE__EVTCNTR_FALLING 5 |
GPIO mode event control falling.
| #define GPIO_MODE__EVTCNTR_NEGPULSE 6 |
GPIO mode event control negative pulse.
| #define GPIO_MODE__EVTCNTR_POSPULSE 7 |
GPIO mode event control positive pulse.
| #define GPIO_MODE__EVTCNTR_RISING 4 |
GPIO mode event control rising.
| #define GPIO_MODE__RTR_ACTHIGH 5 |
GPIO mode RTR act high.
| #define GPIO_MODE__RTR_ACTLOW 4 |
GPIO mode RTR act low.
| #define GPIO_MODE__SPI_ACTIVITY 4 |
GPIO mode spi activity.
| #define GPIO_MODE__SUSPEND 4 |
GPIO mode suspend.
| #define GPIO_MODE__SUSPENDBAR 4 |
GPIO mode suspend bar.
| #define GPIO_MODE_CHIPSELECT 3 |
Chip select mode.
| #define GPIO_MODE_INPUT 0 |
GPIO mode input.
| #define GPIO_MODE_OUTPUT_OD 1 |
GPIO mode output OD.
| #define GPIO_MODE_OUTPUT_PP 2 |
GPIO mode output PP.
| #define LONG_STRING_LEN_1 61 |
Long string length 1.
| #define LONG_STRING_LEN_2 63 |
Long string length 2.
| #define MAX_PATH 260 |
Max string path length.
| #define MFG_STRLEN 62 |
Manufacture string length.
| #define PRODUCT_STRLEN 62 |
Product string length.
| #define SERIAL_STRLEN 30 |
Serial string length.
| #define SHORT_STRING_LEN 60 |
Short string length.
| #define SIZE_PIN_CONFIG 20 |
Config pin size.
| #define SLAB_USB_SPI_API |
Silabs USB to SPI API.
| #define SPI_CS_POSTASSERT_DELAY_MASK 0x02 |
Chip select post assert delay mask.
| #define SPI_CS_PREDEASSERT_DELAY_MASK 0x04 |
Chip select pre deassert delay mask.
| #define SPI_CS_TOGGLE_MASK 0x08 |
Chip select toggle mask.
| #define SPI_INTERBYTE_DELAY_MASK 0x01 |
Spi inter byte delay mask.
| #define SPICTL_CLKRATE_12M 0 |
12 MHz
| #define SPICTL_CLKRATE_187K5 6 |
187.5 kHz
| #define SPICTL_CLKRATE_1M5 3 |
1.5 MHz
| #define SPICTL_CLKRATE_375K 5 |
375 kHz
| #define SPICTL_CLKRATE_3M 2 |
3 MHz
| #define SPICTL_CLKRATE_6M 1 |
6 MHz
| #define SPICTL_CLKRATE_750K 4 |
750 kHz
| #define SPICTL_CLKRATE_93K75 7 |
93.75 kHz
| #define SPICTL_CLKRATE_MASK 0x07 |
Clock rate mask.
| #define SPICTL_CLKRATE_SHIFT 0 |
Clock rate shift.
| #define SPICTL_CPHA_LEADING_EDGE 0 |
SPI control clock phase leading adge.
| #define SPICTL_CPHA_MASK 0x20 |
SPI control clock phase mask.
| #define SPICTL_CPHA_SHIFT 5 |
SPI control clock phase shift.
| #define SPICTL_CPHA_TRAILING_EDGE 1 |
SPI control clock phase trailing edge.
| #define SPICTL_CPOL_ACTIVE_HIGH 0 |
SPI control clock polarity active high.
| #define SPICTL_CPOL_ACTIVE_LOW 1 |
SPI control clock polarity active low.
| #define SPICTL_CPOL_MASK 0x10 |
SPI control clock polarity mask.
| #define SPICTL_CPOL_SHIFT 4 |
SPI control clock polarity shift.
| #define SPICTL_CSMODE_MASK 0x08 |
Chip Select Mode mask.
| #define SPICTL_CSMODE_OPENDRAIN 0 |
Chip Select Mode opendrain.
| #define SPICTL_CSMODE_PUSHPULL 1 |
Chip Select Mode pushpull.
| #define SPICTL_CSMODE_SHIFT 3 |
Chip Select Mode shift.
| #define STRING_DESCRIPTOR_SIZE 256 |
String descriptor size.
| #define SUBCMD_MSB_RELEASE_BUS 0x80 |
Sub-command MSB release bus.
| #define SUBCMD_READ 0 |
Sub-command read.
| #define SUBCMD_RTREAD 4 |
Sub-command RT read.
| #define SUBCMD_WRITE 1 |
Sub-command write.
| #define SUBCMD_WRITEREAD 2 |
Sub-command write read.
| #define WINAPI |
Win API.
| #define WRITEREAD_MAX_BLOCKSIZE 256 |
Matches size of firmware Read buffer.
| typedef void* CP213x_DEVICE |
CP213X_DEVICE opaque object.
| typedef char MFG_STR[62] |
Manufacture string.
| typedef char PRODUCT_STR[62] |
Product string.
API Status return codes pointer.
| typedef char SERIAL_STR[30] |
Serial string.
| enum SET_STATUS |
Set status return.
| enum USB_SPI_STATUS |
API Status return codes.
| USB_SPI_STATUS CP213x_AbortInputPipe | ( | const CP213x_DEVICE | hDevice | ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_AbortOutputPipe | ( | const CP213x_DEVICE | hDevice | ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_Close | ( | const CP213x_DEVICE | hDevice | ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_FlushInputPipe | ( | const CP213x_DEVICE | hDevice | ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_FlushOutputPipe | ( | const CP213x_DEVICE | hDevice | ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_GetChipSelect | ( | const CP213x_DEVICE | hDevice, |
| WORD * | channelCsEnable, | ||
| WORD * | pinCsEnable | ||
| ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| [out] | channelCsEnable | Channel chip select enable |
| [out] | pinCsEnable | Pin chip select enable |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_GetClockDivider | ( | const CP213x_DEVICE | hDevice, |
| BYTE * | clockDivider | ||
| ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| [out] | clockDivider | Clock devider return |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_GetDeviceDescriptor | ( | const CP213x_DEVICE | hDevice, |
| PDEVICE_DESCRIPTOR | pDescriptor | ||
| ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| [out] | pDescriptor | Descriptor return |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_GetDevicePath | ( | const DWORD | deviceIndex, |
| LPSTR | path | ||
| ) |
what it does in brief
what it does in detail
| [in] | deviceIndex | USB device index |
| [out] | path | USB device path |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_GetDeviceVersion | ( | const CP213x_DEVICE | hDevice, |
| BYTE * | majorVersion, | ||
| BYTE * | minorVersion | ||
| ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| [in] | majorVersion | Major version return |
| [in] | minorVersion | Minor version return |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_GetEventCounter | ( | const CP213x_DEVICE | hDevice, |
| BYTE * | mode, | ||
| WORD * | eventCount | ||
| ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| [out] | mode | Mode return |
| [out] | eventCount | Event counter return |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_GetFifoFullThreshold | ( | const CP213x_DEVICE | hDevice, |
| BYTE * | pFifoFullThreshold | ||
| ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| [in] | pFifoFullThreshold | Fifo full threshold return |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| 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
| [in] | hDevice | USB Interface Handle |
| [in] | channel | GPIO channel |
| [out] | mode | GPIO mode |
| [out] | level | GPIO level |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_GetGpioValues | ( | const CP213x_DEVICE | hDevice, |
| WORD * | gpioValues | ||
| ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| [out] | gpioValues | GPIO values |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_GetGuid | ( | LPGUID | guid | ) |
what it does in brief
what it does in detail
| [in] | guid | Globally unique identifier |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_GetLibraryVersion | ( | BYTE * | major, |
| BYTE * | minor, | ||
| BOOL * | release | ||
| ) |
what it does in brief
what it does in detail
| [out] | major | Major version |
| [out] | minor | Minor version |
| [out] | release | Release version |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_STATUS CP213x_GetLock | ( | const CP213x_DEVICE | hDevice, |
| WORD * | lockValue | ||
| ) |
Get the Lock values.
| [in] | hDevice | USB Interface Handle |
| [out] | lockValue | The Lock values |
| USB_SPI_ERRCODE_SUCCESS | |
| USB_SPI_ERRCODE_INVALID_HANDLE | |
| USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR |
| USB_SPI_STATUS CP213x_GetManufacturingString | ( | const CP213x_DEVICE | hDevice, |
| LPSTR | manufacturingString, | ||
| BYTE * | manufacturingStringLen | ||
| ) |
Get the USB device Manufacturer string.
| [in] | hDevice | USB Interface Handle |
| [out] | manufacturingString | Pointer to buffer that will be populated with Manufacturer string |
| [out] | manufacturingStringLen | Pointer to BYTE that will be set to the Manufacturer string length |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR |
| USB_SPI_STATUS CP213x_GetNumDevices | ( | DWORD * | numDevices, |
| DWORD | VID, | ||
| DWORD | PID | ||
| ) |
what it does in brief
what it does in detail
| [in] | numDevices | Number of devices |
| [in] | VID | Vendor id |
| [in] | PID | Product id |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_GetOpenedDevicePath | ( | const CP213x_DEVICE | device, |
| LPSTR | path | ||
| ) |
what it does in brief
what it does in detail
| [in] | device | USB device Handle |
| [in] | path | Device path |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_GetOpenedVidPid | ( | const CP213x_DEVICE | device, |
| WORD * | vid, | ||
| WORD * | pid | ||
| ) |
what it does in brief
what it does in detail
| [in] | device | USB device Handle |
| [in] | vid | Vendor id |
| [in] | pid | Product id |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_GetPinConfig | ( | const CP213x_DEVICE | hDevice, |
| BYTE | pinConfig[20] | ||
| ) |
Get the USB device Pin Configuration info.
| [in] | hDevice | USB Interface Handle |
| [out] | pinConfig | Buffer containing the USB device Pin Configuration info |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR |
| USB_SPI_STATUS CP213x_GetProductString | ( | const CP213x_DEVICE | hDevice, |
| LPSTR | productString, | ||
| BYTE * | productStringLen | ||
| ) |
Get the USB device Product string.
| [in] | hDevice | USB Interface Handle |
| [out] | productString | Buffer that will be populated with the USB device Product string |
| [out] | productStringLen | Pointer to BYTE that will be set to the Product string length |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR |
| USB_SPI_STATUS CP213x_GetRtrState | ( | const CP213x_DEVICE | hDevice, |
| BYTE * | isStopped | ||
| ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| [in] | isStopped | is stopped |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_GetSerialString | ( | const CP213x_DEVICE | hDevice, |
| LPSTR | serialString, | ||
| BYTE * | serialStringlen | ||
| ) |
Get the USB device Serial Number string.
| [in] | hDevice | USB Interface Handle |
| [out] | serialString | Buffer that will be populated with the USB device Serial Number string |
| [out] | serialStringlen | Pointer to BYTE that will be set to the Serial Number string length |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR |
| USB_SPI_STATUS CP213x_GetSpiControlBytes | ( | const CP213x_DEVICE | hDevice, |
| BYTE | controlBytes[11] | ||
| ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| [in] | controlBytes | SPI control bytes |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| 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
| [in] | hDevice | USB Interface Handle |
| [in] | channel | SPI channel |
| [out] | delayMode | Delay mode |
| [out] | interByteDelay | Inter byte delay |
| [out] | postAssertDelay | Post assert delay |
| [out] | preDeassertDelay | Pre deassert delay |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_GetStringDescriptor | ( | const CP213x_DEVICE | hDevice, |
| BYTE | index, | ||
| BYTE | stringDescriptor[256] | ||
| ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| [in] | index | Index of string descriptor |
| [in] | stringDescriptor | String descriptor |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| 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.
| [in] | hDevice | USB Interface Handle |
| [out] | vid | VID of the device |
| [out] | pid | PID of the device |
| [out] | pMaxPower | Power of the device |
| [out] | pPowerMode | Power Mode of the device |
| [out] | releaseVersion | Release version of the device |
| [out] | transferPriority | Transfer priority of the device |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR |
| USB_SPI_STATUS CP213x_GetVidPid | ( | const DWORD | deviceIndex, |
| WORD * | vid, | ||
| WORD * | pid | ||
| ) |
what it does in brief
what it does in detail
| [in] | deviceIndex | Device index |
| [out] | vid | Vendor id |
| [out] | pid | Product id |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| BOOL CP213x_IsOpened | ( | const CP213x_DEVICE | hDevice | ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| 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.
| [in] | deviceIndex | Index of device to open |
| [out] | phDevice | Returns a pointer to an opaque device object CP213x_DEVICE used for subsequent device access. |
| [in] | VID | Vendor ID |
| [in] | PID | Product ID |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_DEVICE_OBJECT | |
| USB_SPI_ERRCODE_INVALID_PARAMETER |
| USB_SPI_STATUS CP213x_ReadAbort | ( | const CP213x_DEVICE | hDevice | ) |
Abort an asynchronous Read or ReadRTR operation.
| [in] | hDevice | USB Interface Handle |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_ERRCODE_NULL_POINTER |
| 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.
| [in] | hDevice | USB Interface Handle |
| [in] | pReadBuf | Buffer of data to read |
| [in] | maxLength | Maximum number of bytes to read |
| [out] | pBytesActuallyRead | Number of bytes actually read |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_NULL_POINTER | |
| USB_SPI_ERRCODE_READ_THREAD_NOT_RUNNING |
| USB_SPI_STATUS CP213x_ReadProm | ( | const CP213x_DEVICE | hDevice, |
| BYTE | pReadBuf[] | ||
| ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| [in] | pReadBuf | Data return |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_Reset | ( | const CP213x_DEVICE | hDevice | ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| 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
| [in] | hDevice | USB Interface Handle |
| [in] | channel | SPI channel |
| [in] | mode | Mode |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_SetClockDivider | ( | const CP213x_DEVICE | hDevice, |
| const BYTE | clockDivider | ||
| ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| [in] | clockDivider | Clock deivider of device |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| 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
| [in] | hDevice | USB Interface Handle |
| [in] | mode | Mode of event |
| [in] | eventCount | Event counter |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_SetFifoFullThreshold | ( | const CP213x_DEVICE | hDevice, |
| const BYTE | fifoFullThreshold | ||
| ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| [in] | fifoFullThreshold | FIFO full threshold |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| 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
| [in] | hDevice | USB Interface Handle |
| [in] | channel | GPIO channel |
| [in] | mode | GPIO mode |
| [in] | level | GPIO level |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| 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
| [in] | hDevice | USB Interface Handle |
| [in] | mask | GPIO mask |
| [in] | gpioValues | GPIO value |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_SetGuid | ( | LPGUID | guid | ) |
what it does in brief
what it does in detail
| [in] | guid | Global unified identifier |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_SetLock | ( | const CP213x_DEVICE | hDevice, |
| const WORD | lockValue | ||
| ) |
Set the Lock values.
| [in] | hDevice | USB Interface Handle |
| [in] | lockValue | The Lock values to set |
| USB_SPI_ERRCODE_SUCCESS | |
| USB_SPI_ERRCODE_INVALID_HANDLE | |
| USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR |
| USB_SPI_STATUS CP213x_SetManufacturingString | ( | const CP213x_DEVICE | hDevice, |
| LPCSTR | manufacturingString, | ||
| const BYTE | manufacturingStringlen | ||
| ) |
Set the USB device Manufacturer string.
| [in] | hDevice | USB Interface Handle |
| [in] | manufacturingString | Buffer containing the USB device Manufacturer string to be set |
| [in] | manufacturingStringlen | The length of the supplied Manufacturer string |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR |
| USB_SPI_STATUS CP213x_SetPinConfig | ( | const CP213x_DEVICE | hDevice, |
| BYTE | pinConfig[20] | ||
| ) |
Set the USB device Pin Configuration info.
| [in] | hDevice | USB Interface Handle |
| [out] | pinConfig | Buffer containing the USB device Pin Configuration info |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR | – |
| USB_SPI_STATUS CP213x_SetProductString | ( | const CP213x_DEVICE | hDevice, |
| LPCSTR | productString, | ||
| const BYTE | productStringlen | ||
| ) |
Set the USB device Product string.
| [in] | hDevice | USB Interface Handle |
| [in] | productString | Buffer containing the USB device Product string |
| [in] | productStringlen | The length of the supplied Product string |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR |
| USB_SPI_STATUS CP213x_SetRtrStop | ( | const CP213x_DEVICE | hDevice, |
| BYTE | stopRtr | ||
| ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| [in] | stopRtr | Rtr Stop |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_SetSerialString | ( | const CP213x_DEVICE | hDevice, |
| LPCSTR | serialString, | ||
| const BYTE | serialStringlen | ||
| ) |
Set the USB device Serial Number string.
| [in] | hDevice | USB Interface Handle |
| [in] | serialString | Buffer containing the USB device Serial Number string |
| [in] | serialStringlen | The length of the supplied Serial Number string |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR |
| 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
| [in] | hDevice | USB Interface Handle |
| [in] | channel | Spi channel |
| [in] | controlByte | Control byte |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| 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
| [in] | hDevice | USB Interface Handle |
| [in] | channel | SPI channel |
| [in] | delayMode | Delay mode |
| [in] | interByteDelay | Inter byte delay |
| [in] | postAssertDelay | Post assert delay |
| [in] | preDeassertDelay | Pre deassert delay |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| 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.
| [in] | hDevice | USB Interface Handle |
| [in] | vid | New VID to be set in the device |
| [in] | pid | New PID to be set in the device |
| [in] | MaxPower | New Power to be set in the device |
| [in] | PowerMode | New Power Mode to be set in the device |
| [in] | releaseVersion | New Release version to be set in the device |
| [in] | transferPriority | New Transfer priority to be set in the device |
| [in] | mask | Mask that represents which of the settings to write to the device |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR |
| 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().
| [in] | hDevice | USB Interface Handle |
| [in] | totalSize | Total number of bytes to read |
| [in] | blockSize | Number of bytes to read at a time |
| [in] | releaseBusAfterTransfer | Release buf after transfer is complete |
| 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 |
| 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
| [in] | hDevice | USB Interface Handle |
| [in] | totalSize | Total size |
| [in] | blockSize | Block size |
| [in] | releaseBusAfterTransfer | Release Bus after transfer |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| 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
| [in] | hDevice | USB Interface Handle |
| [in] | pReadBuf | Read buffer pointer |
| [in] | totalSize | Total size |
| [in] | blockSize | Block size |
| [in] | releaseBusAfterTransfer | Release bus after transfer |
| [in] | timeoutMs | Timeout ms |
| [out] | pBytesActuallyRead | Bytes actally read |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| 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
| [in] | hDevice | USB Interface Handle |
| [in] | pReadBuf | Read buffer pointer |
| [in] | length | Length of buffer |
| [in] | releaseBusAfterTransfer | Release bus after transfer |
| [in] | timeoutMs | Time out in ms |
| [in] | pBytesActuallyRead | Bytes actually read |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| 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
| [in] | hDevice | USB Interface Handle |
| [in] | pWriteBuf | Buffer write pointer |
| [in] | length | Length of buffer |
| [in] | releaseBusAfterTransfer | Release bus after transfer |
| [in] | timeoutMs | Time out in ms |
| [out] | pBytesActuallyWritten | Bytes actually write pointer |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| 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
| [in] | hDevice | USB Interface Handle |
| [in] | pWriteBuf | Write buffer pointer |
| [out] | pReadBuf | Read buffer pointer |
| [in] | length | Length of buffer |
| [in] | releaseBusAfterTransfer | Release bus after transfer |
| [in] | timeoutMs | Timeout ms |
| [out] | pBytesActuallyTransferred | Bytes actually transferred |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |
| USB_SPI_STATUS CP213x_WriteProm | ( | const CP213x_DEVICE | hDevice, |
| BYTE | pWriteBuf[] | ||
| ) |
what it does in brief
what it does in detail
| [in] | hDevice | USB Interface Handle |
| [in] | pWriteBuf | Write buffer pointer |
| USB_SPI_ERRCODE_SUCCESS | – success |
| USB_SPI_ERRCODE_INVALID_HANDLE | – |