11 #ifndef SLAB_USB_SPI_H
12 #define SLAB_USB_SPI_H
14 #ifdef SLAB_USB_SPI_EXPORTS
15 #define SLAB_USB_SPI_API __declspec(dllexport)
17 #define SLAB_USB_SPI_API __declspec(dllimport)
18 #endif // USB_SPI_EXPORTS
27 typedef unsigned char BYTE;
28 typedef unsigned short WORD;
29 typedef unsigned long DWORD;
31 typedef const char* LPCSTR;
41 #define CALLBACK __stdcall
42 #define WINAPI __stdcall
50 typedef void* CP213x_DEVICE;
51 typedef int USB_SPI_STATUS;
60 #define BULK_PACKETSIZE 64
61 #define EP_BUFSIZE BULK_PACKETSIZE
63 #define CMD_TIMEOUT_MS 1000 // Timeout for completion of SPI command (i.e. first packet)
64 #define STRING_DESCRIPTOR_SIZE 256
65 #define SIZE_PIN_CONFIG 20
69 #define WRITEREAD_MAX_BLOCKSIZE 256 // Matches size of firmware Read buffer
72 #define CP213x_NUM_GPIO 11
76 #define CSMODE_ACTIVE 1
77 #define CSMODE_ACTIVE_OTHERS_IDLE 2
80 #define GPIO_MODE_INPUT 0
81 #define GPIO_MODE_OUTPUT_OD 1
82 #define GPIO_MODE_OUTPUT_PP 2
83 #define GPIO_MODE_CHIPSELECT 3 // Chip select mode
85 #define GPIO_MODE__RTR_ACTLOW 4
86 #define GPIO_MODE__RTR_ACTHIGH 5
88 #define GPIO_MODE__EVTCNTR_RISING 4
89 #define GPIO_MODE__EVTCNTR_FALLING 5
90 #define GPIO_MODE__EVTCNTR_NEGPULSE 6
91 #define GPIO_MODE__EVTCNTR_POSPULSE 7
93 #define GPIO_MODE__CLK_OUT 4
94 #define GPIO_MODE__SPI_ACTIVITY 4
95 #define GPIO_MODE__SUSPEND 4
96 #define GPIO_MODE__SUSPENDBAR 4
102 #define SHORT_STRING_LEN 60
103 #define LONG_STRING_LEN_1 61
104 #define LONG_STRING_LEN_2 63
113 #define CMD_TRANSFER_DATA 0x0000
115 #define SUBCMD_READ 0
116 #define SUBCMD_WRITE 1
117 #define SUBCMD_WRITEREAD 2
118 #define SUBCMD_RTREAD 4
119 #define SUBCMD_MSB_RELEASE_BUS 0x80
127 #define SPICTL_CPHA_SHIFT 5
128 #define SPICTL_CPHA_MASK 0x20
129 #define SPICTL_CPHA_LEADING_EDGE 0
130 #define SPICTL_CPHA_TRAILING_EDGE 1
133 #define SPICTL_CPOL_SHIFT 4
134 #define SPICTL_CPOL_MASK 0x10
135 #define SPICTL_CPOL_ACTIVE_HIGH 0
136 #define SPICTL_CPOL_ACTIVE_LOW 1
139 #define SPICTL_CSMODE_SHIFT 3
140 #define SPICTL_CSMODE_MASK 0x08
141 #define SPICTL_CSMODE_OPENDRAIN 0
142 #define SPICTL_CSMODE_PUSHPULL 1
145 #define SPICTL_CLKRATE_SHIFT 0
146 #define SPICTL_CLKRATE_MASK 0x07
147 #define SPICTL_CLKRATE_12M 0 // 12 MHz
148 #define SPICTL_CLKRATE_6M 1 // 6 MHz
149 #define SPICTL_CLKRATE_3M 2 // 3 MHz
150 #define SPICTL_CLKRATE_1M5 3 // 1.5 MHz
151 #define SPICTL_CLKRATE_750K 4 // 750 kHz
152 #define SPICTL_CLKRATE_375K 5 // 375 kHz
153 #define SPICTL_CLKRATE_187K5 6 // 187.5 kHz
154 #define SPICTL_CLKRATE_93K75 7 // 93.75 kHz
163 #define bRESULT_PASS TRUE
164 #define bRESULT_FAIL FALSE
167 #define USB_SPI_ERRCODE_SYSTEM_ERROR 0xFFFFFFFE
172 #define USB_SPI_ERRCODE_SUCCESS 0x00
173 #define USB_SPI_ERRCODE_ALLOC_FAILURE 0x01
174 #define USB_SPI_ERRCODE_INVALID_ENUM_VALUE 0x02
175 #define USB_SPI_ERRCODE_NULL_POINTER 0x03
176 #define USB_SPI_ERRCODE_INVALID_CHANNEL_INDEX 0x04
177 #define USB_SPI_ERRCODE_INVALID_GPIO_MODE 0x05
179 #define USB_SPI_ERRCODE_UNKNOWN_ERROR 0xFFFFFFFF
187 #define USB_SPI_ERRCODE_INVALID_PARAMETER 0x10
189 #define USB_SPI_ERRCODE_INVALID_DEVICE_OBJECT 0x11
198 #define USB_SPI_ERRCODE_DEVICE_NOT_FOUND 0x20
201 #define USB_SPI_ERRCODE_USB_DEVICE_NOT_OPENED 0x21
204 #define USB_SPI_ERRCODE_INVALID_HANDLE 0x22
213 #define USB_SPI_ERRCODE_HWIF_DEVICE_ERROR 0x30
216 #define USB_SPI_ERRCODE_HWIF_TRANSFER_TIMEOUT 0x31
222 #define USB_SPI_ERRCODE_CONTROL_TRANSFER_ERROR 0x50
223 #define USB_SPI_ERRCODE_INVALID_TRANSFER_SIZE 0x51
225 #define USB_SPI_ERRCODE_PIPE_INIT_FAIL 0x60
226 #define USB_SPI_ERRCODE_PIPE_QUERY_FAIL 0x61
227 #define USB_SPI_ERRCODE_PIPE_WRITE_FAIL 0x62
228 #define USB_SPI_ERRCODE_PIPE_READ_FAIL 0x63
229 #define USB_SPI_ERRCODE_PIPE_ABORT_FAIL 0x64
230 #define USB_SPI_ERRCODE_PIPE_FLUSH_FAIL 0x65
231 #define USB_SPI_ERRCODE_PIPE_INVALID_ID 0x66
233 #define USB_SPI_ERRCODE_READ_THREAD_CREATE_FAILURE 0x70
234 #define USB_SPI_ERRCODE_READ_THREAD_NOT_RUNNING 0x71
235 #define USB_SPI_ERRCODE_READ_THREAD_START_FAILURE 0x72
237 #define USB_SPI_ERRCODE_DEVICE_RETURNED_TOO_MUCH_DATA 0x80
243 #define CP213x_LOCK_PRODUCT_STR_1 0x0001
244 #define CP213x_LOCK_PRODUCT_STR_2 0x0002
245 #define CP213x_LOCK_SERIAL_STR 0x0004
246 #define CP213x_LOCK_PIN_CONFIG 0x0008
248 #define CP213x_LOCK_VID 0x0100
249 #define CP213x_LOCK_PID 0x0200
250 #define CP213x_LOCK_POWER 0x0400
251 #define CP213x_LOCK_POWER_MODE 0x0800
252 #define CP213x_LOCK_RELEASE_VERSION 0x1000
253 #define CP213x_LOCK_MFG_STR_1 0x2000
254 #define CP213x_LOCK_MFG_STR_2 0x4000
255 #define CP213x_LOCK_TRANSFER_PRIORITY 0x8000
258 #define CP213x_SET_VID 0x01
259 #define CP213x_SET_PID 0x02
260 #define CP213x_SET_POWER 0x04
261 #define CP213x_SET_POWER_MODE 0x08
262 #define CP213x_SET_RELEASE_VERSION 0x10
263 #define CP213x_SET_TRANSFER_PRIORITY 0x80
266 #define MFG_STRLEN 62
267 #define PRODUCT_STRLEN 62
268 #define SERIAL_STRLEN 30
270 typedef char MFG_STR[MFG_STRLEN];
272 typedef char PRODUCT_STR[PRODUCT_STRLEN];
274 typedef char SERIAL_STR[SERIAL_STRLEN];
280 enum SET_STATUS {SET_SUCCESS, SET_FAIL, SET_VERIFY_FAIL};
287 #define CP213x_INDEX_GPIO_0 0
288 #define CP213x_INDEX_GPIO_1 1
289 #define CP213x_INDEX_GPIO_2 2
290 #define CP213x_INDEX_GPIO_3 3
291 #define CP213x_INDEX_GPIO_4 4
292 #define CP213x_INDEX_GPIO_5 5
293 #define CP213x_INDEX_GPIO_6 6
294 #define CP213x_INDEX_GPIO_7 7
295 #define CP213x_INDEX_GPIO_8 8
296 #define CP213x_INDEX_GPIO_9 9
297 #define CP213x_INDEX_GPIO_10 10
300 #define CP213x_MASK_SCK 0x0001
301 #define CP213x_MASK_MISO 0x0002
302 #define CP213x_MASK_MOSI 0x0004
303 #define CP213x_MASK_GPIO_0 0x0008
304 #define CP213x_MASK_GPIO_1 0x0010
305 #define CP213x_MASK_GPIO_2 0x0020
306 #define CP213x_MASK_GPIO_3 0x0040
307 #define CP213x_MASK_GPIO_4 0x0080
308 #define CP213x_MASK_GPIO_5 0x0100
309 #define CP213x_MASK_GPIO_6 0x0400
310 #define CP213x_MASK_GPIO_7 0x0800
311 #define CP213x_MASK_GPIO_8 0x1000
312 #define CP213x_MASK_GPIO_9 0x2000
313 #define CP213x_MASK_GPIO_10 0x4000
329 BYTE bDescriptorType;
332 BYTE bDeviceSubClass;
333 BYTE bDeviceProtocol;
334 BYTE bMaxPacketSize0;
341 BYTE bNumConfigurations;
357 #define SPI_INTERBYTE_DELAY_MASK 0x01
358 #define SPI_CS_POSTASSERT_DELAY_MASK 0x02
359 #define SPI_CS_PREDEASSERT_DELAY_MASK 0x04
360 #define SPI_CS_TOGGLE_MASK 0x08
373 #endif // __cplusplus
375 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
384 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
387 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
390 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
393 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
394 CP213x_GetDevicePath ( DWORD deviceIndex, LPSTR path );
396 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
398 CP213x_DEVICE* phDevice );
400 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
402 CP213x_DEVICE* phDevice );
404 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
405 CP213x_GetVidPid(DWORD deviceIndex, WORD* vid, WORD* pid );
407 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
408 CP213x_GetOpenedDevicePath ( CP213x_DEVICE device, LPSTR path );
410 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
411 CP213x_GetOpenedVidPid ( CP213x_DEVICE device, WORD* vid, WORD* pid );
413 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
416 SLAB_USB_SPI_API BOOL WINAPI
417 CP213x_IsOpened ( CP213x_DEVICE hDevice);
419 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
422 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
425 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
427 PDEVICE_DESCRIPTOR pDescriptor );
429 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
432 BYTE stringDescriptor[STRING_DESCRIPTOR_SIZE] );
434 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
440 WORD* releaseVersion,
441 BYTE* transferPriority );
443 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
450 BYTE transferPriority,
453 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
456 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
459 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
462 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
465 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
468 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
471 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
474 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
477 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
480 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
483 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
486 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
496 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
499 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
502 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
506 WORD* interByteDelay,
507 WORD* postAssertDelay,
508 WORD* preDeassertDelay );
510 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
515 WORD postAssertDelay,
516 WORD preDeassertDelay );
518 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
520 WORD* channelCsEnable,
523 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
526 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
530 BOOL releaseBusAfterTransfer,
532 DWORD* pBytesActuallyWritten );
534 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
539 BOOL releaseBusAfterTransfer,
541 DWORD* pBytesActuallyTransferred );
543 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
547 BOOL releaseBusAfterTransfer );
549 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
553 BOOL releaseBusAfterTransfer,
555 DWORD* pBytesActuallyRead );
557 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
561 BOOL releaseBusAfterTransfer );
563 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
568 BOOL releaseBusAfterTransfer,
570 DWORD* pBytesActuallyRead );
572 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
575 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
578 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
582 DWORD* pBytesActuallyRead );
584 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
587 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
590 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
593 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
596 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
599 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
602 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
613 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
616 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
619 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
622 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
625 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
628 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
631 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
634 SLAB_USB_SPI_API USB_SPI_STATUS WINAPI
641 #endif // __cplusplus
643 #endif // SLAB_USB_SPI_H
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetLibraryVersion(BYTE *pMajor, BYTE *pMinor, BOOL *pIsRelease)
Get the Interface Library version numbers.
Definition: SLAB_USB_SPI.cpp:139
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetLock(CP213x_DEVICE hDevice, WORD *lockValue)
Get the Lock values.
Definition: SLAB_USB_SPI.cpp:2628
struct SPI_CMD SPI_CMD
SPI Command Word.
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetFifoFullThreshold(CP213x_DEVICE hDevice, BYTE fifoFullThreshold)
Set the FIFO full threshold.
Definition: SLAB_USB_SPI.cpp:1065
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.
Definition: SLAB_USB_SPI.cpp:2487
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetGpioModeAndLevel(CP213x_DEVICE hDevice, BYTE channel, BYTE *mode, BYTE *level)
Get the GPIO mode control.
Definition: SLAB_USB_SPI.cpp:1245
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_FlushInputPipe(CP213x_DEVICE hDevice)
Flush USB input pipe.
Definition: SLAB_USB_SPI.cpp:690
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 su...
Definition: SLAB_USB_SPI.cpp:405
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetStringDescriptor(CP213x_DEVICE hDevice, BYTE index, BYTE stringDescriptor[STRING_DESCRIPTOR_SIZE])
Get specified string descriptor.
Definition: SLAB_USB_SPI.cpp:628
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetLock(CP213x_DEVICE hDevice, WORD lockValue)
Set the Lock values.
Definition: SLAB_USB_SPI.cpp:2594
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)
Definition: SLAB_USB_SPI.cpp:1765
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.
Definition: SLAB_USB_SPI.cpp:968
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetProductString(CP213x_DEVICE hDevice, LPCSTR productString, BYTE strlen)
Set the USB device Product string.
Definition: SLAB_USB_SPI.cpp:2821
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_Close(CP213x_DEVICE hDevice)
Close device handle.
Definition: SLAB_USB_SPI.cpp:521
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetSpiControlBytes(CP213x_DEVICE hDevice, BYTE controlBytes[CP213x_NUM_GPIO])
Get the SPI control word.
Definition: SLAB_USB_SPI.cpp:930
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.
Definition: SLAB_USB_SPI.cpp:2668
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetGuid(LPGUID pDevGuid)
Set the GUID used for device managment.
Definition: SLAB_USB_SPI.cpp:179
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_OpenByDevicePath(LPCSTR devicePath, CP213x_DEVICE *phDevice)
Open device using specified Device Path.
Definition: SLAB_USB_SPI.cpp:465
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_ReadAbort(CP213x_DEVICE hDevice)
Abort an asynchronous Read or ReadRTR operation.
Definition: SLAB_USB_SPI.cpp:2558
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetRtrState(CP213x_DEVICE hDevice, BYTE *inRtrMode)
Read status of RTR operation.
Definition: SLAB_USB_SPI.cpp:826
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetSerialString(CP213x_DEVICE hDevice, LPCSTR serialString, BYTE strlen)
Set the USB device Serial Number string.
Definition: SLAB_USB_SPI.cpp:2897
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_WriteProm(CP213x_DEVICE hDevice, BYTE pWbuffer[])
Write device EPROM configuration.
Definition: SLAB_USB_SPI.cpp:3054
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetManufacturingString(CP213x_DEVICE hDevice, LPSTR manufacturingString, BYTE *strlen)
Get the USB device Manufacturer string.
Definition: SLAB_USB_SPI.cpp:2754
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetEventCounter(CP213x_DEVICE hDevice, BYTE *mode, WORD *count)
Get the Event Count value.
Definition: SLAB_USB_SPI.cpp:1415
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)
Definition: SLAB_USB_SPI.cpp:2189
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetChipSelect(CP213x_DEVICE hDevice, WORD *channelCsEnable, WORD *pinCsEnable)
Get SPI chip select control word.
Definition: SLAB_USB_SPI.cpp:1165
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.
Definition: SLAB_USB_SPI.cpp:1016
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.
Definition: SLAB_USB_SPI.cpp:1682
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetChipSelect(CP213x_DEVICE hDevice, BYTE channel, BYTE mode)
Set SPI chip select control word.
Definition: SLAB_USB_SPI.cpp:1131
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetNumDevices(DWORD *numDevices)
Definition: SLAB_USB_SPI.cpp:221
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetEventCounter(CP213x_DEVICE hDevice, BYTE mode, WORD count)
Set the Event Count value.
Definition: SLAB_USB_SPI.cpp:1380
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetRtrStop(CP213x_DEVICE hDevice, BYTE stopRtr)
Stop 'Read with RTR' operation.
Definition: SLAB_USB_SPI.cpp:795
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetManufacturingString(CP213x_DEVICE hDevice, LPCSTR manufacturingString, BYTE strlen)
Set the USB device Manufacturer string.
Definition: SLAB_USB_SPI.cpp:2776
This struct has the same format as _USB_DEVICE_DESCRIPTOR, as defined in Windows usb100.h.
Definition: SLAB_USB_SPI.h:326
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetDeviceVersion(CP213x_DEVICE hDevice, BYTE *majorVersion, BYTE *minorVersion)
Get the read-only device version.
Definition: SLAB_USB_SPI.cpp:861
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetGpioValues(CP213x_DEVICE hDevice, WORD mask, WORD gpioValues)
Set the GPIO values.
Definition: SLAB_USB_SPI.cpp:1287
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetGpioValues(CP213x_DEVICE hDevice, WORD *gpioValues)
Get the GPIO values.
Definition: SLAB_USB_SPI.cpp:1335
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetSerialString(CP213x_DEVICE hDevice, LPSTR serialString, BYTE *strlen)
Get the USB device Serial Number string.
Definition: SLAB_USB_SPI.cpp:2844
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.
Definition: SLAB_USB_SPI.cpp:2714
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.
Definition: SLAB_USB_SPI.cpp:2977
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_AbortInputPipe(CP213x_DEVICE hDevice)
Abort USB input pipe.
Definition: SLAB_USB_SPI.cpp:667
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_TransferReadAsync(CP213x_DEVICE hDevice, DWORD totalSize, DWORD blockSize, BOOL releaseBusAfterTransfer)
Perform SPI Read (asynchronous)
Definition: SLAB_USB_SPI.cpp:2406
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)
Definition: SLAB_USB_SPI.cpp:1944
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetFifoFullThreshold(CP213x_DEVICE hDevice, BYTE *pFifoFullThreshold)
Get the FIFO full threshold value.
Definition: SLAB_USB_SPI.cpp:1096
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)
Definition: SLAB_USB_SPI.cpp:2304
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetProductString(CP213x_DEVICE hDevice, LPSTR productString, BYTE *strlen)
Get the USB device Product string.
Definition: SLAB_USB_SPI.cpp:2799
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetGpioModeAndLevel(CP213x_DEVICE hDevice, BYTE index, BYTE mode, BYTE level)
Set the GPIO mode control.
Definition: SLAB_USB_SPI.cpp:1201
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_AbortOutputPipe(CP213x_DEVICE hDevice)
Abort USB output pipe.
Definition: SLAB_USB_SPI.cpp:713
SPI Command Word.
Definition: SLAB_USB_SPI.h:345
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetGuid(LPGUID pDevGuid)
Return the GUID used for device managment.
Definition: SLAB_USB_SPI.cpp:157
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetDeviceDescriptor(CP213x_DEVICE hDevice, PDEVICE_DESCRIPTOR pDescriptor)
Get specified device descriptor.
Definition: SLAB_USB_SPI.cpp:585
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetClockDivider(CP213x_DEVICE hDevice, BYTE clockDivider)
Set clock divider.
Definition: SLAB_USB_SPI.cpp:1449
struct DEVICE_DESCRIPTOR DEVICE_DESCRIPTOR
This struct has the same format as _USB_DEVICE_DESCRIPTOR, as defined in Windows usb100.h.
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_ReadProm(CP213x_DEVICE hDevice, BYTE pRbuffer[])
Read device EPROM configuration.
Definition: SLAB_USB_SPI.cpp:3009
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_FlushOutputPipe(CP213x_DEVICE hDevice)
Flush USB output pipe.
Definition: SLAB_USB_SPI.cpp:737
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_SetSpiControlByte(CP213x_DEVICE hDevice, BYTE channel, BYTE controlByte)
Set the SPI control word.
Definition: SLAB_USB_SPI.cpp:897
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_Reset(CP213x_DEVICE hDevice)
Reset device.
Definition: SLAB_USB_SPI.cpp:765
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetPinConfig(CP213x_DEVICE hDevice, BYTE *pinConfig)
Get the USB device Pin Configuration info.
Definition: SLAB_USB_SPI.cpp:2940
SLAB_USB_SPI_API USB_SPI_STATUS WINAPI CP213x_GetClockDivider(CP213x_DEVICE hDevice, BYTE *pClockDivider)
Get clock divider.
Definition: SLAB_USB_SPI.cpp:1480