![]() |
SLAB_USB_SPI
1.0
Silicon Labs CP2130 USB-to-SPI Interface Library
|
This file defines the API of the CP2130 Interface Library. More...
Go to the source code of this file.
Data Structures | |
struct | DEVICE_DESCRIPTOR |
This struct has the same format as _USB_DEVICE_DESCRIPTOR, as defined in Windows usb100.h. More... | |
struct | SPI_CMD |
SPI Command Word. More... | |
Functions | |
Exported API Functions | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetLibraryVersion (BYTE *major, BYTE *minor, BOOL *release) |
Get the Interface Library version numbers. More... | |
CP2130 Device Management | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetGuid (LPGUID guid) |
Return the GUID used for device managment. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_SetGuid (LPGUID guid) |
Set the GUID used for device managment. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetNumDevices (DWORD *numDevices) |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetDevicePath (DWORD deviceIndex, LPSTR path) |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_OpenByIndex (DWORD deviceIndex, CP213x_DEVICE *phDevice) |
Opens a USB device using a device index and returns a device object pointer which will be used for subsequent access. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_OpenByDevicePath (LPCSTR devicePath, CP213x_DEVICE *phDevice) |
Open device using specified Device Path. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetVidPid (DWORD deviceIndex, WORD *vid, WORD *pid) |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetOpenedDevicePath (CP213x_DEVICE device, LPSTR path) |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetOpenedVidPid (CP213x_DEVICE device, WORD *vid, WORD *pid) |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_Close (CP213x_DEVICE hDevice) |
Close device handle. More... | |
SLAB_USB_SPI_API BOOL WINAPI | CP213x_IsOpened (CP213x_DEVICE hDevice) |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_Reset (CP213x_DEVICE hDevice) |
Reset device. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetDeviceVersion (CP213x_DEVICE hDevice, BYTE *majorVersion, BYTE *minorVersion) |
Get the read-only device version. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetDeviceDescriptor (CP213x_DEVICE hDevice, PDEVICE_DESCRIPTOR pDescriptor) |
Get specified device descriptor. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetStringDescriptor (CP213x_DEVICE hDevice, BYTE index, BYTE stringDescriptor[STRING_DESCRIPTOR_SIZE]) |
Get specified string descriptor. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetUsbConfig (CP213x_DEVICE hDevice, WORD *vid, WORD *pid, BYTE *power, BYTE *powerMode, WORD *releaseVersion, BYTE *transferPriority) |
Get the USB Device Configuration info. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_SetUsbConfig (CP213x_DEVICE hDevice, WORD vid, WORD pid, BYTE power, BYTE powerMode, WORD releaseVersion, BYTE transferPriority, BYTE mask) |
Set the USB device Configuration info. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetManufacturingString (CP213x_DEVICE hDevice, LPSTR manufacturingString, BYTE *strlen) |
Get the USB device Manufacturer string. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_SetManufacturingString (CP213x_DEVICE hDevice, LPCSTR manufacturingString, BYTE strlen) |
Set the USB device Manufacturer string. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetProductString (CP213x_DEVICE hDevice, LPSTR productString, BYTE *strlen) |
Get the USB device Product string. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_SetProductString (CP213x_DEVICE hDevice, LPCSTR productString, BYTE strlen) |
Set the USB device Product string. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetSerialString (CP213x_DEVICE hDevice, LPSTR serialString, BYTE *strlen) |
Get the USB device Serial Number string. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_SetSerialString (CP213x_DEVICE hDevice, LPCSTR serialString, BYTE strlen) |
Set the USB device Serial Number string. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetPinConfig (CP213x_DEVICE hDevice, BYTE pinConfig[SIZE_PIN_CONFIG]) |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_SetPinConfig (CP213x_DEVICE hDevice, BYTE pinConfig[SIZE_PIN_CONFIG]) |
Set the USB device Pin Configuration info. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetLock (CP213x_DEVICE hDevice, WORD *lockValue) |
Get the Lock values. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_SetLock (CP213x_DEVICE hDevice, WORD lockValue) |
Set the Lock values. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_ReadProm (CP213x_DEVICE hDevice, BYTE pReadBuf[]) |
Read device EPROM configuration. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_WriteProm (CP213x_DEVICE hDevice, BYTE pWriteBuf[]) |
Write device EPROM configuration. More... | |
CP2130 SPI Configuration and Transfer Operations | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetSpiControlBytes (CP213x_DEVICE hDevice, BYTE controlBytes[CP213x_NUM_GPIO]) |
Get the SPI control word. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_SetSpiControlByte (CP213x_DEVICE hDevice, BYTE channel, BYTE controlByte) |
Set the SPI control word. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetSpiDelay (CP213x_DEVICE hDevice, BYTE channel, BYTE *delayMode, WORD *interByteDelay, WORD *postAssertDelay, WORD *preDeassertDelay) |
Get the SPI delay values. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_SetSpiDelay (CP213x_DEVICE hDevice, BYTE channel, BYTE delayMode, WORD interByteDelay, WORD postAssertDelay, WORD preDeassertDelay) |
Set the SPI delay values. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetChipSelect (CP213x_DEVICE hDevice, WORD *channelCsEnable, WORD *pinCsEnable) |
Get SPI chip select control word. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_SetChipSelect (CP213x_DEVICE hDevice, BYTE channel, BYTE mode) |
Set SPI chip select control word. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_TransferWrite (CP213x_DEVICE hDevice, BYTE pWriteBuf[], DWORD length, BOOL releaseBusAfterTransfer, DWORD timeoutMs, DWORD *pBytesActuallyWritten) |
Perform SPI Write. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_TransferWriteRead (CP213x_DEVICE hDevice, BYTE pWriteBuf[], BYTE pReadBuf[], DWORD length, BOOL releaseBusAfterTransfer, DWORD timeoutMs, DWORD *pBytesActuallyTransferred) |
Perform SPI Write/Read (synchronous) More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_TransferReadAsync (CP213x_DEVICE hDevice, DWORD totalSize, DWORD blockSize, BOOL releaseBusAfterTransfer) |
Perform SPI Read (asynchronous) More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_TransferReadSync (CP213x_DEVICE hDevice, BYTE pReadBuf[], DWORD length, BOOL releaseBusAfterTransfer, DWORD timeoutMs, DWORD *pBytesActuallyRead) |
Perform SPI Read (synchronous) More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_TransferReadRtrAsync (CP213x_DEVICE hDevice, DWORD totalSize, DWORD blockSize, BOOL releaseBusAfterTransfer) |
Perform SPI Read with RTR (asynchronous) More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_TransferReadRtrSync (CP213x_DEVICE hDevice, BYTE pReadBuf[], DWORD totalSize, DWORD blockSize, BOOL releaseBusAfterTransfer, DWORD timeoutMs, DWORD *pBytesActuallyRead) |
Perform SPI Read with RTR (synchronous) More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetRtrState (CP213x_DEVICE hDevice, BYTE *isStopped) |
Read status of RTR operation. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_SetRtrStop (CP213x_DEVICE hDevice, BYTE stopRtr) |
Stop 'Read with RTR' operation. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_ReadPoll (CP213x_DEVICE hDevice, BYTE pReadBuf[], DWORD maxLength, DWORD *pBytesActuallyRead) |
Read bytes received during an asynchronous Read or ReadRTR operation. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_ReadAbort (CP213x_DEVICE hDevice) |
Abort an asynchronous Read or ReadRTR operation. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_AbortInputPipe (CP213x_DEVICE hDevice) |
Abort USB input pipe. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_FlushInputPipe (CP213x_DEVICE hDevice) |
Flush USB input pipe. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_AbortOutputPipe (CP213x_DEVICE hDevice) |
Abort USB output pipe. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_FlushOutputPipe (CP213x_DEVICE hDevice) |
Flush USB output pipe. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetFifoFullThreshold (CP213x_DEVICE hDevice, BYTE *pFifoFullThreshold) |
Get the FIFO full threshold value. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_SetFifoFullThreshold (CP213x_DEVICE hDevice, BYTE fifoFullThreshold) |
Set the FIFO full threshold. More... | |
CP2130 GPIO and Auxiliary-Function Pins | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetGpioModeAndLevel (CP213x_DEVICE hDevice, BYTE channel, BYTE *mode, BYTE *level) |
Get the GPIO mode control. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_SetGpioModeAndLevel (CP213x_DEVICE hDevice, BYTE channel, BYTE mode, BYTE level) |
Set the GPIO mode control. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetGpioValues (CP213x_DEVICE hDevice, WORD *gpioValues) |
Get the GPIO values. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_SetGpioValues (CP213x_DEVICE hDevice, WORD mask, WORD gpioValues) |
Set the GPIO values. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetEventCounter (CP213x_DEVICE hDevice, BYTE *mode, WORD *eventCount) |
Get the Event Count value. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_SetEventCounter (CP213x_DEVICE hDevice, BYTE mode, WORD eventCount) |
Set the Event Count value. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_GetClockDivider (CP213x_DEVICE hDevice, BYTE *clockDivider) |
Get clock divider. More... | |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI | CP213x_SetClockDivider (CP213x_DEVICE hDevice, BYTE clockDivider) |
Set clock divider. More... | |
Type and structure definitions | |
#define | SPI_INTERBYTE_DELAY_MASK 0x01 |
#define | SPI_CS_POSTASSERT_DELAY_MASK 0x02 |
#define | SPI_CS_PREDEASSERT_DELAY_MASK 0x04 |
#define | SPI_CS_TOGGLE_MASK 0x08 |
typedef struct DEVICE_DESCRIPTOR | DEVICE_DESCRIPTOR |
This struct has the same format as _USB_DEVICE_DESCRIPTOR, as defined in Windows usb100.h. More... | |
typedef struct DEVICE_DESCRIPTOR * | PDEVICE_DESCRIPTOR |
typedef struct SPI_CMD | SPI_CMD |
SPI Command Word. | |
typedef struct SPI_CMD * | PSPI_CMD |
This file defines the API of the CP2130 Interface Library.
typedef struct DEVICE_DESCRIPTOR 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.
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetLibraryVersion | ( | BYTE * | pMajor, |
BYTE * | pMinor, | ||
BOOL * | pIsRelease | ||
) |
Get the Interface Library version numbers.
[out] | pMajor | Major release number |
[out] | pMinor | Minor release number |
[out] | pIsRelease | 0: Not released version, 1: Released version |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetGuid | ( | LPGUID | pDevGuid | ) |
Return the GUID used for device managment.
[out] | pDevGuid | Pointer to DEVGUID struct |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetGuid | ( | LPGUID | pDevGuid | ) |
Set the GUID used for device managment.
Application must call GetNumDevices() after the GUID is changed.
[in] | pDevGuid | Pointer to DEVGUID struct |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetNumDevices | ( | DWORD * | numDevices | ) |
Returns the number of CP213x devices connected to the system
[in] | numDevices | A return value of 0 indicates that no devices are available. Otherwise this parameter returns the number of connected devices. When refering to a device by deviceIndex , the index may range from 0 to (CP213x_GetNumDevices() - 1). |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_OpenByIndex | ( | DWORD | deviceIndex, |
CP213x_DEVICE * | device | ||
) |
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] | device | Returns a pointer to a device object used for subsequent device access. |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_OpenByDevicePath | ( | LPCSTR | devicePath, |
CP213x_DEVICE * | phDevice | ||
) |
Open device using specified Device Path.
[in] | devicePath | The specified Device Path |
[out] | phDevice | [Pointer to device handle |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_Close | ( | CP213x_DEVICE | hDevice | ) |
Close device handle.
[in] | hDevice | Pointer to device handle |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_Reset | ( | CP213x_DEVICE | hDevice | ) |
Reset device.
Send command to reset the device
[in] | hDevice | USB Interface Handle |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetDeviceVersion | ( | CP213x_DEVICE | hDevice, |
BYTE * | majorVersion, | ||
BYTE * | minorVersion | ||
) |
Get the read-only device version.
[in] | hDevice | USB Interface Handle |
[out] | majorVersion | |
[out] | minorVersion |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetDeviceDescriptor | ( | CP213x_DEVICE | hDevice, |
PDEVICE_DESCRIPTOR | pDescriptor | ||
) |
Get specified device descriptor.
[in] | hDevice | Interface Handle |
[out] | pDescriptor | Pointer to device descriptor |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetStringDescriptor | ( | CP213x_DEVICE | hDevice, |
BYTE | index, | ||
BYTE | stringDescriptor[STRING_DESCRIPTOR_SIZE] | ||
) |
Get specified string descriptor.
[in] | hDevice | Device Handle |
[in] | index | String descriptor index |
[out] | stringDescriptor | String descriptor |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetUsbConfig | ( | CP213x_DEVICE | hDevice, |
WORD * | vid, | ||
WORD * | pid, | ||
BYTE * | power, | ||
BYTE * | powerMode, | ||
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] | power | Power of the device |
[out] | powerMode | Power Mode of the device |
[out] | releaseVersion | Release version of the device |
[out] | transferPriority | Transfer priority of the device |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetUsbConfig | ( | CP213x_DEVICE | hDevice, |
WORD | vid, | ||
WORD | pid, | ||
BYTE | power, | ||
BYTE | powerMode, | ||
WORD | releaseVersion, | ||
BYTE | transferPriority, | ||
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] | power | 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 |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetManufacturingString | ( | CP213x_DEVICE | hDevice, |
LPSTR | manufacturingString, | ||
BYTE * | strlen | ||
) |
Get the USB device Manufacturer string.
[in] | hDevice | USB Interface Handle |
[out] | manufacturingString | Pointer to buffer that will be populated with Manufacturer string |
[out] | strlen | Pointer to BYTE that will be set to the Manufacturer string length |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetManufacturingString | ( | CP213x_DEVICE | hDevice, |
LPCSTR | manufacturingString, | ||
BYTE | strlen | ||
) |
Set the USB device Manufacturer string.
[in] | hDevice | USB Interface Handle |
[in] | manufacturingString | Buffer containing the USB device Manufacturer string to be set |
[in] | strlen | The length of the supplied Manufacturer string |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetProductString | ( | CP213x_DEVICE | hDevice, |
LPSTR | productString, | ||
BYTE * | strlen | ||
) |
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] | strlen | Pointer to BYTE that will be set to the Product string length |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetProductString | ( | CP213x_DEVICE | hDevice, |
LPCSTR | productString, | ||
BYTE | strlen | ||
) |
Set the USB device Product string.
[in] | hDevice | USB Interface Handle |
[in] | productString | Buffer containing the USB device Product string |
[in] | strlen | The length of the supplied Product string |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetSerialString | ( | CP213x_DEVICE | hDevice, |
LPSTR | serialString, | ||
BYTE * | strlen | ||
) |
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] | strlen | Pointer to BYTE that will be set to the Serial Number string length |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetSerialString | ( | CP213x_DEVICE | hDevice, |
LPCSTR | serialString, | ||
BYTE | strlen | ||
) |
Set the USB device Serial Number string.
[in] | hDevice | USB Interface Handle |
[in] | serialString | Buffer containing the USB device Serial Number string |
[in] | strlen | The length of the supplied Serial Number string |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetPinConfig | ( | CP213x_DEVICE | hDevice, |
BYTE | pinConfig[SIZE_PIN_CONFIG] | ||
) |
Set the USB device Pin Configuration info.
[in] | hDevice | USB Interface Handle |
[in] | pinConfig | Buffer containing the USB device Pin Configuration info |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetLock | ( | CP213x_DEVICE | hDevice, |
WORD * | lockValue | ||
) |
Get the Lock values.
[in] | hDevice | USB Interface Handle |
[out] | lockValue | The Lock values |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetLock | ( | CP213x_DEVICE | hDevice, |
WORD | lockValue | ||
) |
Set the Lock values.
[in] | hDevice | USB Interface Handle |
[in] | lockValue | The Lock values to set |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_ReadProm | ( | CP213x_DEVICE | hDevice, |
BYTE | pRbuffer[] | ||
) |
Read device EPROM configuration.
[in] | hDevice | USB Interface Handle |
[out] | pRbuffer | Pointer to byte array to be filled |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_WriteProm | ( | CP213x_DEVICE | hDevice, |
BYTE | pWbuffer[] | ||
) |
Write device EPROM configuration.
[in] | hDevice | USB Interface Handle |
[in] | pWbuffer | Pointer to byte array containing data to write to EPROM |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetSpiControlBytes | ( | CP213x_DEVICE | hDevice, |
BYTE | controlBytes[CP213x_NUM_GPIO] | ||
) |
Get the SPI control word.
[in] | hDevice | USB Interface Handle |
[out] | controlBytes | Buffer that contains the SPI control bytes for each channel |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetSpiControlByte | ( | CP213x_DEVICE | hDevice, |
BYTE | channel, | ||
BYTE | controlByte | ||
) |
Set the SPI control word.
Set the SPI control byte for a given channel
[in] | hDevice | USB Interface Handle |
[in] | channel | Channel for which to set SPI control byte |
[in] | controlByte | SPI control byte |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetSpiDelay | ( | CP213x_DEVICE | hDevice, |
BYTE | channel, | ||
BYTE * | delayMode, | ||
WORD * | interByteDelay, | ||
WORD * | postAssertDelay, | ||
WORD * | preDeassertDelay | ||
) |
Get the SPI delay values.
Pass the desired SPI channel number in buffer[0]
[in] | hDevice | USB Interface Handle |
[in] | channel | SPI channel for which to get delays |
[out] | delayMode | |
[out] | interByteDelay | |
[out] | postAssertDelay | |
[out] | preDeassertDelay |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetSpiDelay | ( | CP213x_DEVICE | hDevice, |
BYTE | channel, | ||
BYTE | delayMode, | ||
WORD | interByteDelay, | ||
WORD | postAssertDelay, | ||
WORD | preDeassertDelay | ||
) |
Set the SPI delay values.
[in] | hDevice | USB Interface Handle |
[in] | channel | SPI channel for which to set delays |
[in] | delayMode | |
[in] | interByteDelay | |
[in] | postAssertDelay | |
[in] | preDeassertDelay |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetChipSelect | ( | CP213x_DEVICE | hDevice, |
WORD * | channelCsEnable, | ||
WORD * | pinCsEnable | ||
) |
Get SPI chip select control word.
[in] | hDevice | USB Interface Handle |
[out] | channelCsEnable | |
[out] | pinCsEnable |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetChipSelect | ( | CP213x_DEVICE | hDevice, |
BYTE | channel, | ||
BYTE | mode | ||
) |
Set SPI chip select control word.
[in] | hDevice | USB Interface Handle |
[in] | channel | |
[in] | mode | Chip select mode 0: Idle, 1: Active, 2: Active; all other channels idle |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_TransferWrite | ( | CP213x_DEVICE | hDevice, |
BYTE | pWriteBuf[], | ||
DWORD | length, | ||
BOOL | releaseBusAfterTransfer, | ||
DWORD | timeoutMs, | ||
DWORD * | pBytesActuallyWritten | ||
) |
Perform SPI Write.
[in] | hDevice | USB Interface Handle |
[in] | pWriteBuf | Buffer of data to write |
[in] | length | Number of bytes to write |
[in] | releaseBusAfterTransfer | 1: Release buffer after transfer is complete |
[in] | timeoutMs | Timeout (ms) |
[out] | pBytesActuallyWritten | Number of bytes actually written |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_TransferWriteRead | ( | CP213x_DEVICE | hDevice, |
BYTE | pWriteBuf[], | ||
BYTE | pReadBuf[], | ||
DWORD | length, | ||
BOOL | releaseBusAfterTransfer, | ||
DWORD | timeoutMs, | ||
DWORD * | pBytesActuallyTransferred | ||
) |
Perform SPI Write/Read (synchronous)
This function returns after 'length' bytes have been written and read, or a timeout or error occurs
[in] | hDevice | USB Interface Handle |
[in] | pWriteBuf | Buffer of data to write |
[in] | pReadBuf | Buffer of data to read |
[in] | length | Number of bytes to write and read |
[in] | releaseBusAfterTransfer | Release buf after transfer is complete |
[in] | timeoutMs | Timeout (ms) |
[out] | pBytesActuallyTransferred | Number of bytes actually written and read |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_TransferReadAsync | ( | 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 |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_TransferReadSync | ( | CP213x_DEVICE | hDevice, |
BYTE | pReadBuf[], | ||
DWORD | length, | ||
BOOL | releaseBusAfterTransfer, | ||
DWORD | timeoutMs, | ||
DWORD * | pBytesActuallyRead | ||
) |
Perform SPI Read (synchronous)
This function returns after 'length' bytes have been read, or a timeout or error occurs
[in] | hDevice | USB Interface Handle |
[in] | pReadBuf | Buffer of data to read |
[in] | length | Number of bytes to read |
[in] | releaseBusAfterTransfer | 1: Release buffer after transfer is complete |
[in] | timeoutMs | Timeout (ms) |
[out] | pBytesActuallyRead | Number of bytes actually read |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_TransferReadRtrAsync | ( | CP213x_DEVICE | hDevice, |
DWORD | totalSize, | ||
DWORD | blockSize, | ||
BOOL | releaseBusAfterTransfer | ||
) |
Perform SPI Read with RTR (asynchronous)
The device reads SPI data in 'blockSize' chunks while the RTR pin is asserted. 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 |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_TransferReadRtrSync | ( | CP213x_DEVICE | hDevice, |
BYTE | pReadBuf[], | ||
DWORD | totalSize, | ||
DWORD | blockSize, | ||
BOOL | releaseBusAfterTransfer, | ||
DWORD | timeoutMs, | ||
DWORD * | pBytesActuallyRead | ||
) |
Perform SPI Read with RTR (synchronous)
The device reads SPI data in 'blockSize' chunks while the RTR pin is asserted. This function returns after 'totalSize' bytes have been read, or a timeout or error occurs.
[in] | hDevice | USB Interface Handle |
[in] | pReadBuf | Buffer of data to read |
[in] | totalSize | Total number of bytes to read |
[in] | blockSize | Number of bytes to read at a time |
[in] | releaseBusAfterTransfer | 1: Release buffer after transfer is complete |
[in] | timeoutMs | Timeout (ms) |
[out] | pBytesActuallyRead | Number of bytes actually read |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetRtrState | ( | CP213x_DEVICE | hDevice, |
BYTE * | inRtrMode | ||
) |
Read status of RTR operation.
[in] | hDevice | USB Interface Handle |
[out] | inRtrMode | 0: Device is not in RTR mode 1: Device is in RTR mode |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetRtrStop | ( | CP213x_DEVICE | hDevice, |
BYTE | stopRtr | ||
) |
Stop 'Read with RTR' operation.
[in] | hDevice | USB Interface Handle |
[in] | stopRtr | 0: No effect 1: Stop Read with RTR operation |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_ReadPoll | ( | 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 |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_ReadAbort | ( | CP213x_DEVICE | hDevice | ) |
Abort an asynchronous Read or ReadRTR operation.
[in] | hDevice | USB Interface Handle |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_AbortInputPipe | ( | CP213x_DEVICE | hDevice | ) |
Abort USB input pipe.
Calls WinUsb_AbortPipe
[in] | hDevice | USB Interface Handle |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_FlushInputPipe | ( | CP213x_DEVICE | hDevice | ) |
Flush USB input pipe.
Calls WinUsb_FlushPipe
[in] | hDevice | USB Interface Handle |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_AbortOutputPipe | ( | CP213x_DEVICE | hDevice | ) |
Abort USB output pipe.
Calls WinUsb_AbortPipe
[in] | hDevice | USB Interface Handle |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_FlushOutputPipe | ( | CP213x_DEVICE | hDevice | ) |
Flush USB output pipe.
Calls WinUsb_FlushPipe
[in] | hDevice | USB Interface Handle |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetFifoFullThreshold | ( | CP213x_DEVICE | hDevice, |
BYTE * | pFifoFullThreshold | ||
) |
Get the FIFO full threshold value.
[in] | hDevice | USB Interface Handle |
[out] | pFifoFullThreshold | The FIFO full threshold |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetFifoFullThreshold | ( | CP213x_DEVICE | hDevice, |
BYTE | fifoFullThreshold | ||
) |
Set the FIFO full threshold.
[in] | hDevice | USB Interface Handle |
[in] | fifoFullThreshold | The FIFO full threshold value to set |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetGpioModeAndLevel | ( | CP213x_DEVICE | hDevice, |
BYTE | channel, | ||
BYTE * | mode, | ||
BYTE * | level | ||
) |
Get the GPIO mode control.
[in] | hDevice | USB Interface Handle |
[in] | channel | The GPIO line |
[out] | mode | The mode for the specified GPIO line |
[out] | level | The level for the specified GPIO line |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetGpioModeAndLevel | ( | CP213x_DEVICE | hDevice, |
BYTE | index, | ||
BYTE | mode, | ||
BYTE | level | ||
) |
Set the GPIO mode control.
[in] | hDevice | USB Interface Handle |
[in] | index | GPIO number to configure |
[in] | mode | GPIO mode |
[in] | level | GPIO state [0,1] |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetGpioValues | ( | CP213x_DEVICE | hDevice, |
WORD * | gpioValues | ||
) |
Get the GPIO values.
[in] | hDevice | USB Interface Handle |
[out] | gpioValues | The GPIO values |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetGpioValues | ( | CP213x_DEVICE | hDevice, |
WORD | mask, | ||
WORD | gpioValues | ||
) |
Set the GPIO values.
[in] | hDevice | USB Interface Handle |
[in] | mask | The mask of which GPIO values to set |
[in] | gpioValues | The GPIO values to set for the specified mask |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetEventCounter | ( | CP213x_DEVICE | hDevice, |
BYTE * | mode, | ||
WORD * | count | ||
) |
Get the Event Count value.
[in] | hDevice | USB Interface Handle |
[out] | mode | The current Event Counter mode |
[out] | count | The current Event Counter count |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetEventCounter | ( | CP213x_DEVICE | hDevice, |
BYTE | mode, | ||
WORD | count | ||
) |
Set the Event Count value.
[in] | hDevice | USB Interface Handle |
[in] | mode | Event Counter mode |
[in] | count | Event count value to set |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetClockDivider | ( | CP213x_DEVICE | hDevice, |
BYTE * | pClockDivider | ||
) |
Get clock divider.
[in] | hDevice | USB Interface Handle |
[out] | pClockDivider | Clock divider value |
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetClockDivider | ( | CP213x_DEVICE | hDevice, |
BYTE | clockDivider | ||
) |
Set clock divider.
[in] | hDevice | USB Interface Handle |
[in] | clockDivider | Clock divider value |