Silicon Labs Host Libraries
CP210xManufacturingDLL.h
1 #ifndef HOST_LIB_MANUFACTURING_INCLUDE_CP210XMANUFACTURINGDLL_H_INCLUDED_XF3N9QM3BK
2 #define HOST_LIB_MANUFACTURING_INCLUDE_CP210XMANUFACTURINGDLL_H_INCLUDED_XF3N9QM3BK
3 
39 
40 #include <stddef.h>
41 #include <stdlib.h>
42 #include <string.h>
43 #include <stdio.h>
44 #include <stdint.h> // For C99 fixed sized types
45 #include <stdbool.h> // For C99 _Bool
46 
47 #include "silabs_defs.h"
48 #include "silabs_sal.h"
49 
50 #ifdef _WIN32
51 // The following ifdef block is the standard way of creating macros which make exporting
52 // from a DLL simpler. All files within this DLL are compiled with the CP210xDLL_EXPORTS
53 // symbol defined on the command line. this symbol should not be defined on any project
54 // that uses this DLL. This way any other project whose source files include this file see
55 // CP210xDLL_API functions as being imported from a DLL, whereas this DLL sees symbols
56 // defined with this macro as being exported.
57 #ifdef CP210xDLL_EXPORTS
58 #define CP210xDLL_API
59 #else
60 #if defined(SILABS_STATIC_LINK)
61 #define CP210xDLL_API extern
62 #pragma comment (lib, "CP210xManufacturing.static.lib")
63 #else // defined(SILABS_STATIC_LINK)
64 #define CP210xDLL_API __declspec(dllimport)
65 #pragma comment (lib, "CP210xManufacturing.lib")
66 #endif // defined(SILABS_STATIC_LINK)
67 #endif
68 #else // !_WIN32
69 #define CP210xDLL_API
70 #define WINAPI
71 #endif // !_WIN32
72 
73 
75 typedef enum _CP210X_GETPRODUCTSTRING {
79 
84 _Check_return_
85 _Success_(return == TRUE)
86 __inline static bool IsValidSILABS_GETPRODUCTSTRING(_In_ const CP210X_GETPRODUCTSTRING _s) { return (CP210x_GETPRODUCTSTRING_SERIAL_NUMBER == _s) || (CP210x_GETPRODUCTSTRING_DESCRIPTION == _s) || (CP210x_GETPRODUCTSTRING_FULL_PATH == _s); }
87 
91 #define CP210x_CP2101_VERSION CP210x_PARTNUM_CP2101
92 #define CP210x_CP2102_VERSION CP210x_PARTNUM_CP2102
93 #define CP210x_CP2103_VERSION CP210x_PARTNUM_CP2103
94 #define CP210x_CP2104_VERSION CP210x_PARTNUM_CP2104
95 #define CP210x_CP2105_VERSION CP210x_PARTNUM_CP2105
96 #define CP210x_CP2108_VERSION CP210x_PARTNUM_CP2108
97 #define CP210x_CP2109_VERSION CP210x_PARTNUM_CP2109
98 #define CP210x_CP2102N_QFN28_VERSION CP210x_PARTNUM_CP2102N_QFN28
99 #define CP210x_CP2102N_QFN24_VERSION CP210x_PARTNUM_CP2102N_QFN24
100 #define CP210x_CP2102N_QFN20_VERSION CP210x_PARTNUM_CP2102N_QFN20
101 
103 #if defined(NOT_YET) // TODO: Enstone: These defines are a cut'n'paste dup of the ones in CP210xRuntimeDLL.h.
105 typedef enum _CP210x_STATUS {
107  , CP210x_INVALID_HANDLE = 0x01
108  , CP210x_INVALID_PARAMETER = 0x02
109  , CP210x_DEVICE_IO_FAILED = 0x03
111  , CP210x_GLOBAL_DATA_ERROR = 0x05
112  , CP210x_FILE_ERROR = 0x06
113  , CP210x_COMMAND_FAILED = 0x08
115 
116  , CP210x_DEVICE_NOT_FOUND = 0xFF
117 } CP210x_STATUS, *PCP210x_STATUS;
118 #else // defined(NOT_YET)
119 #define CP210x_SUCCESS SILABS_STATUS_SUCCESS
122 #define CP210x_INVALID_HANDLE 0x01
123 #define CP210x_INVALID_PARAMETER 0x02
124 #define CP210x_DEVICE_IO_FAILED 0x03
125 #define CP210x_FUNCTION_NOT_SUPPORTED 0x04
126 #define CP210x_GLOBAL_DATA_ERROR 0x05
127 #define CP210x_FILE_ERROR 0x06
128 #define CP210x_COMMAND_FAILED 0x08
129 #define CP210x_INVALID_ACCESS_TYPE 0x09
130 #define CP210x_DEVICE_NOT_FOUND 0xFF
131 typedef int CP210x_STATUS;
132 #endif // defined(NOT_YET)
134 
140 #define CP210x_MAX_DEVICE_STRLEN 256
141 #define CP210x_MAX_SETUP_STRING_SIZE 246
142 
143 #define CP210x_MAX_MANUFACTURER_STRLEN 45
144 #define CP210x_MAX_PRODUCT_STRLEN 126
145 #define CP210x_MAX_SERIAL_STRLEN 63
146 
147 #define CP2105_MAX_MANUFACTURER_STRLEN 12
149 #define CP2105_MAX_PRODUCT_STRLEN 47
150 #define CP2105_MAX_SERIAL_STRLEN 16
151 #define CP2105_MAX_INTERFACE_STRLEN 32
152 
153 #define CP2108_MAX_MANUFACTURER_STRLEN 126
155 #define CP2108_MAX_PRODUCT_STRLEN 126
156 #define CP2108_MAX_SERIAL_STRLEN 126
157 #define CP2108_MAX_INTERFACE_STRLEN 126
158 
160 // CP2102N
161 #define CP2102N_MAX_
162 // Type definitions
169 
170 #define CP210x_MAX_MAXPOWER 250
171 
172 
176 #define NUM_BAUD_CONFIGS 32
177 //
178 typedef struct _BAUD_CONFIG
181 {
182  uint16_t BaudGen;
183  uint16_t Timer0Reload;
184  uint8_t Prescaler;
185  uint32_t BaudRate;
186 } BAUD_CONFIG, *PBAUD_CONFIG;
187 //
190 //
192 #define BAUD_CONFIG_SIZE 10
193 //
197 
198 
204 #define FC_OPEN_TX 0x01
205 #define FC_OPEN_RX 0x02
206 #define FC_CLOSE_TX 0x04
207 #define FC_CLOSE_RX 0x08
208 //
209 #define FC_OPEN_TX_SCI FC_OPEN_TX
211 #define FC_OPEN_RX_SCI FC_OPEN_RX
212 #define FC_CLOSE_TX_SCI FC_CLOSE_TX
213 #define FC_CLOSE_RX_SCI FC_CLOSE_RX
214 //
215 #define FC_OPEN_TX_ECI 0x10
217 #define FC_OPEN_RX_ECI 0x20
218 #define FC_CLOSE_TX_ECI 0x40
219 #define FC_CLOSE_RX_ECI 0x80
220 //
221 #define FC_OPEN_TX_IFC0 0x0001
223 #define FC_OPEN_RX_IFC0 0x0002
224 #define FC_CLOSE_TX_IFC0 0x0004
225 #define FC_CLOSE_RX_IFC0 0x0008
226 #define FC_OPEN_TX_IFC1 0x0010
227 #define FC_OPEN_RX_IFC1 0x0020
228 #define FC_CLOSE_TX_IFC1 0x0040
229 #define FC_CLOSE_RX_IFC1 0x0080
230 #define FC_OPEN_TX_IFC2 0x0100
231 #define FC_OPEN_RX_IFC2 0x0200
232 #define FC_CLOSE_TX_IFC2 0x0400
233 #define FC_CLOSE_RX_IFC2 0x0800
234 #define FC_OPEN_TX_IFC3 0x1000
235 #define FC_OPEN_RX_IFC3 0x2000
236 #define FC_CLOSE_TX_IFC3 0x4000
237 #define FC_CLOSE_RX_IFC3 0x8000
238 
240 typedef struct _PORT_CONFIG
246 {
247  uint16_t Mode;
248  uint16_t Reset_Latch;
249  uint16_t Suspend_Latch;
250  unsigned char EnhancedFxn;
251 } PORT_CONFIG, *PPORT_CONFIG;
252 //
255 //
257 #define PORT_RI_ON 0x0001
258 #define PORT_DCD_ON 0x0002
259 #define PORT_DTR_ON 0x0004
260 #define PORT_DSR_ON 0x0008
261 #define PORT_TXD_ON 0x0010
262 #define PORT_RXD_ON 0x0020
263 #define PORT_RTS_ON 0x0040
264 #define PORT_CTS_ON 0x0080
265 //
266 #define PORT_GPIO_0_ON 0x0100
267 #define PORT_GPIO_1_ON 0x0200
268 #define PORT_GPIO_2_ON 0x0400
269 #define PORT_GPIO_3_ON 0x0800
270 //
271 #define PORT_SUSPEND_ON 0x4000
272 #define PORT_SUSPEND_BAR_ON 0x8000
273 //
274 #define EF_GPIO_0_TXLED 0x01
276 #define EF_GPIO_1_RXLED 0x02
277 #define EF_GPIO_2_RS485 0x04
278 #define EF_RS485_INVERT 0x08
279 #define EF_WEAKPULLUP 0x10
280 #define EF_RESERVED_1 0x20
281 #define EF_SERIAL_DYNAMIC_SUSPEND 0x40
282 #define EF_GPIO_DYNAMIC_SUSPEND 0x80
283 
285 
291 typedef struct _DUAL_PORT_CONFIG
292 {
293  uint16_t Mode;
294  uint16_t Reset_Latch;
295  uint16_t Suspend_Latch;
296  unsigned char EnhancedFxn_ECI;
297  unsigned char EnhancedFxn_SCI;
298  unsigned char EnhancedFxn_Device;
299 } DUAL_PORT_CONFIG, *PDUAL_PORT_CONFIG;
300 //
303 //
305 #define PORT_RI_SCI_ON 0x0001
306 #define PORT_DCD_SCI_ON 0x0002
307 #define PORT_DTR_SCI_ON 0x0004
308 #define PORT_DSR_SCI_ON 0x0008
309 #define PORT_TXD_SCI_ON 0x0010
310 #define PORT_RXD_SCI_ON 0x0020
311 #define PORT_RTS_SCI_ON 0x0040
312 #define PORT_CTS_SCI_ON 0x0080
313 #define PORT_GPIO_0_SCI_ON 0x0002
314 #define PORT_GPIO_1_SCI_ON 0x0004
315 #define PORT_GPIO_2_SCI_ON 0x0008
316 #define PORT_SUSPEND_SCI_ON 0x0001
317 
318 #define PORT_RI_ECI_ON 0x0100
319 #define PORT_DCD_ECI_ON 0x0200
320 #define PORT_DTR_ECI_ON 0x0400
321 #define PORT_DSR_ECI_ON 0x0800
322 #define PORT_TXD_ECI_ON 0x1000
323 #define PORT_RXD_ECI_ON 0x2000
324 #define PORT_RTS_ECI_ON 0x4000
325 #define PORT_CTS_ECI_ON 0x8000
326 #define PORT_GPIO_0_ECI_ON 0x0400
327 #define PORT_GPIO_1_ECI_ON 0x0800
328 #define PORT_SUSPEND_ECI_ON 0x0100
329 
330 #define EF_GPIO_0_TXLED_ECI 0x01
332 #define EF_GPIO_1_RXLED_ECI 0x02
333 #define EF_GPIO_1_RS485_ECI 0x04
334 #define EF_RS485_INVERT 0x08
335 #define EF_INVERT_SUSPEND_ECI 0x10
336 #define EF_DYNAMIC_SUSPEND_ECI 0x40
337 
338 #define EF_GPIO_0_TXLED_SCI 0x01
340 #define EF_GPIO_1_RXLED_SCI 0x02
341 #define EF_INVERT_SUSPEND_SCI 0x10
342 #define EF_DYNAMIC_SUSPEND_SCI 0x40
343 
344 #define EF_WEAKPULLUP 0x10
346 
348 
354 typedef struct _QUAD_PORT_STATE
355 {
356  uint16_t Mode_PB0;
357  uint16_t Mode_PB1;
358  uint16_t Mode_PB2;
359  uint16_t Mode_PB3;
360  uint16_t Mode_PB4;
361 
362  uint16_t LowPower_PB0;
363  uint16_t LowPower_PB1;
364  uint16_t LowPower_PB2;
365  uint16_t LowPower_PB3;
366  uint16_t LowPower_PB4;
367 
368  uint16_t Latch_PB0;
369  uint16_t Latch_PB1;
370  uint16_t Latch_PB2;
371  uint16_t Latch_PB3;
372  uint16_t Latch_PB4;
373 } QUAD_PORT_STATE, *PQUAD_PORT_STATE;
374 //
377 //
380 typedef struct _QUAD_PORT_CONFIG
381 {
382  QUAD_PORT_STATE Reset_Latch;
383  QUAD_PORT_STATE Suspend_Latch;
384  uint8_t IPDelay_IFC0;
385  uint8_t IPDelay_IFC1;
386  uint8_t IPDelay_IFC2;
387  uint8_t IPDelay_IFC3;
389  uint8_t EnhancedFxn_IFC1;
390  uint8_t EnhancedFxn_IFC2;
391  uint8_t EnhancedFxn_IFC3;
393  uint8_t ExtClk0Freq;
394  uint8_t ExtClk1Freq;
395  uint8_t ExtClk2Freq;
396  uint8_t ExtClk3Freq;
397 } QUAD_PORT_CONFIG, *PQUAD_PORT_CONFIG;
398 //
401 //
403 // PB0
404 #define PORT_TX0 0x0001
405 #define PORT_RX0 0x0002
406 #define PORT_RTS0 0x0004
407 #define PORT_CTS0 0x0008
408 #define PORT_DTR0 0x0010
409 #define PORT_DSR0 0x0020
410 #define PORT_DCD0 0x0040
411 #define PORT_RI0 0x0080
412 #define PORT_TX1 0x0100
413 #define PORT_RX1 0x0200
414 #define PORT_RTS1 0x0400
415 #define PORT_CTS1 0x0800
416 #define PORT_DTR1 0x1000
417 #define PORT_DSR1 0x2000
418 #define PORT_DCD1 0x4000
419 #define PORT_RI1 0x8000
420 
421 // PB1
422 #define PORT_GPIO_0 0x0001
423 #define PORT_GPIO_1 0x0002
424 #define PORT_GPIO_2 0x0004
425 #define PORT_GPIO_3 0x0008
426 #define PORT_GPIO_4 0x0010
427 #define PORT_GPIO_5 0x0020
428 #define PORT_GPIO_6 0x0040
429 #define PORT_GPIO_7 0x0080
430 #define PORT_GPIO_8 0x0100
431 #define PORT_GPIO_9 0x0200
432 #define PORT_GPIO_10 0x0400
433 #define PORT_GPIO_11 0x0800
434 #define PORT_GPIO_12 0x1000
435 #define PORT_GPIO_13 0x2000
436 #define PORT_GPIO_14 0x4000
437 #define PORT_GPIO_15 0x8000
438 
439 // PB2
440 #define PORT_SUSPEND 0x0001
441 #define PORT_SUSPEND_BAR 0x0002
442 #define PORT_DTR2 0x0004
443 #define PORT_DSR2 0x0008
444 
445 // PB3
446 #define PORT_TX2 0x0001
447 #define PORT_RX2 0x0002
448 #define PORT_RTS2 0x0004
449 #define PORT_CTS2 0x0008
450 #define PORT_DCD2 0x0010
451 #define PORT_RI2 0x0020
452 #define PORT_DTR3 0x0040
453 #define PORT_DSR3 0x0080
454 #define PORT_DCD3 0x0100
455 #define PORT_RI3 0x0200
456 
457 // PB4
458 #define PORT_RTS3 0x0001
459 #define PORT_CTS3 0x0002
460 #define PORT_TX3 0x0004
461 #define PORT_RX3 0x0008
462 
463 //
465 #define EF_IFC_GPIO_TXLED 0x01
466 #define EF_IFC_GPIO_RXLED 0x02
467 #define EF_IFC_GPIO_RS485 0x04
468 // If the next bit is clear, GPIO1 is low while sending UART data.
469 // If it is set, GPIO1 is high while sending UART data, and low otherwise
470 #define EF_IFC_GPIO_RS485_LOGIC 0x08
471 #define EF_IFC_GPIO_CLOCK 0x10
472 #define EF_IFC_DYNAMIC_SUSPEND 0x40
473 
474 //
476 #define EF_DEVICE_WEAKPULLUP_RESET 0x10
477 #define EF_DEVICE_WEAKPULLUP_SUSPEND 0x20
478 #define EF_DEVICE_DYNAMIC_SUSPEND 0x40
479 
481 
487 typedef struct _firmware_t {
488  uint8_t major;
489  uint8_t minor;
490  uint8_t build;
491 } firmware_t, *pFirmware_t;
492 //
495 //
496 #ifdef __cplusplus
497 extern "C" {
498 #endif
499 
507 _Check_return_
509 _Success_(return == CP210x_SUCCESS)
512  _Out_writes_bytes_(sizeof(uint32_t)) _Pre_defensive_ uint32_t *lpdwNumDevices
513  );
514 
547 _Check_return_
549 _Success_(return == CP210x_SUCCESS)
552  _In_ _Pre_defensive_ const uint32_t dwDeviceIndex,
553  _Out_writes_z_(CP210x_MAX_DEVICE_STRLEN) _Pre_defensive_ void * lpvProductString,
554  _In_ _Pre_defensive_ const uint32_t dwFlags
555  );
556 
587 _Check_return_
589 _Success_(return == CP210x_SUCCESS)
592  _In_ _Pre_defensive_ const uint32_t dwDeviceIndex,
593  _In_ _Pre_defensive_ const CP210X_GETPRODUCTSTRING WhichProductStringToReturn,
594  _Out_writes_z_(sizeof(wchar_t) * ProductStringLenInBytes) _Pre_defensive_ wchar_t *pProductString,
595  _In_ _Pre_defensive_ const size_t ProductStringLenInBytes);
596 
597 
614 _Check_return_
616 _Success_(return == CP210x_SUCCESS)
619  _In_ _Pre_defensive_ const uint32_t DeviceIndex,
620  _Out_writes_bytes_(sizeof(HANDLE)) _Pre_defensive_ PHANDLE pcyHandle
621  );
622 
631 _Success_(return == CP210x_SUCCESS)
634  _In_ _Pre_defensive_ const HANDLE cyHandle
635  );
636 
647 _Check_return_
649 _Success_(return == CP210x_SUCCESS)
652  _In_ _Pre_defensive_ const HANDLE cyHandle,
653  _Out_writes_bytes_(sizeof(uint8_t)) _Pre_defensive_ uint8_t *lpbPartNum
654  );
655 
667 _Check_return_
669 _Success_(return == CP210x_SUCCESS)
672  _In_ _Pre_defensive_ const HANDLE cyHandle,
673  _In_ _Pre_defensive_ const uint16_t Vid
674  );
675 
687 _Check_return_
689 _Success_(return == CP210x_SUCCESS)
692  _In_ _Pre_defensive_ const HANDLE cyHandle,
693  _In_ _Pre_defensive_ const uint16_t Pid
694  );
695 
714 _Check_return_
716 _Success_(return == CP210x_SUCCESS)
719  _In_ _Pre_defensive_ const HANDLE cyHandle,
720  _In_ _Pre_defensive_ void *lpvManufacturerString,
721  _In_ _Pre_defensive_ const uint8_t bManufacturerStringLength,
722  _In_ _Pre_defensive_ const BOOL bIsStringASCII = TRUE
723  );
724 
743 _Check_return_
745 _Success_(return == CP210x_SUCCESS)
748  _In_ _Pre_defensive_ const HANDLE cyHandle,
749  _In_ _Pre_defensive_ void * lpvProductString,
750  _In_ _Pre_defensive_ const uint8_t bProductStringLength,
751  _In_ _Pre_defensive_ const BOOL bIsStringASCII = TRUE
752  );
753 
776 _Check_return_
778 _Success_(return == CP210x_SUCCESS)
781  _In_ _Pre_defensive_ const HANDLE cyHandle,
782  _In_ _Pre_defensive_ const uint8_t bInterfaceNumber,
783  _In_ _Pre_defensive_ void * lpvInterfaceString,
784  _In_ _Pre_defensive_ const uint8_t bInterfaceStringLength,
785  _In_ _Pre_defensive_ const BOOL bIsStringASCII
786  );
787 
807 _Check_return_
809 _Success_(return == CP210x_SUCCESS)
812  _In_ _Pre_defensive_ const HANDLE cyHandle,
813  _In_ _Pre_defensive_ void *lpvSerialNumberString,
814  _In_ _Pre_defensive_ const uint8_t bSerialNumberStringLength,
815  _In_ _Pre_defensive_ const BOOL bIsStringASCII = TRUE
816  );
817 
829 _Check_return_
831 _Success_(return == CP210x_SUCCESS)
834  _In_ _Pre_defensive_ const HANDLE cyHandle,
835  _In_ _Pre_defensive_ const BOOL bSelfPower
836  );
837 
849 _Check_return_
851 _Success_(return == CP210x_SUCCESS)
854  _In_ _Pre_defensive_ const HANDLE cyHandle,
855  _In_ _Pre_defensive_ const uint8_t bMaxPower
856  );
857 
872 _Check_return_
874 _Success_(return == CP210x_SUCCESS)
877  _In_ _Pre_defensive_ const HANDLE cyHandle,
878  _In_ _Pre_defensive_ const uint16_t wFlushBufferConfig
879  );
880 
894 _Check_return_
896 _Success_(return == CP210x_SUCCESS)
899  _In_ _Pre_defensive_ const HANDLE cyHandle,
900  _In_ _Pre_defensive_ const uint8_t bDeviceModeECI,
901  _In_ _Pre_defensive_ const uint8_t bDeviceModeSCI
902  );
903 
915 _Check_return_
917 _Success_(return == CP210x_SUCCESS)
920  _In_ _Pre_defensive_ const HANDLE cyHandle,
921  _In_ _Pre_defensive_ const uint16_t wVersion
922  );
923 
937 _Check_return_
939 _Success_(return == CP210x_SUCCESS)
942  _In_ _Pre_defensive_ const HANDLE cyHandle,
943  _In_reads_bytes_(sizeof(BAUD_CONFIG)) _Pre_defensive_ PBAUD_CONFIG pBaudConfig
944  );
945 
950 void _ConfigLatchRS485(BYTE partNum, PORT_CONFIG * PortConfig, uint16_t & Temp_Reset_Latch, uint16_t & Temp_Suspend_Latch);
951 
965 _Check_return_
967 _Success_(return == CP210x_SUCCESS)
970  _In_ _Pre_defensive_ const HANDLE cyHandle,
971  _In_ _Pre_defensive_ PORT_CONFIG *pPortConfig
972  );
973 
989 _Check_return_
991 _Success_(return == CP210x_SUCCESS)
994  _In_ _Pre_defensive_ const HANDLE cyHandle,
995  _In_ _Pre_defensive_ DUAL_PORT_CONFIG *pDualPortConfig
996  );
997 
1011 _Check_return_
1013 _Success_(return == CP210x_SUCCESS)
1016  _In_ _Pre_defensive_ const HANDLE cyHandle,
1017  _In_ _Pre_defensive_ QUAD_PORT_CONFIG *pQuadPortConfig
1018  );
1019 
1034 _Check_return_
1036 _Success_(return == CP210x_SUCCESS)
1039  _In_ _Pre_defensive_ const HANDLE cyHandle
1040  );
1041 
1052 _Check_return_
1054 _Success_(return == CP210x_SUCCESS)
1057  _In_ _Pre_defensive_ const HANDLE cyHandle,
1058  _Out_writes_bytes_(sizeof(uint16_t)) _Pre_defensive_ uint16_t *lpwVid
1059  );
1060 
1071 _Check_return_
1073 _Success_(return == CP210x_SUCCESS)
1076  _In_ _Pre_defensive_ const HANDLE cyHandle,
1077  _Out_writes_bytes_(sizeof(uint16_t)) _Pre_defensive_ uint16_t *lpwPid
1078  );
1079 
1096 _Check_return_
1098 _Success_(return == CP210x_SUCCESS)
1101  _In_ _Pre_defensive_ const HANDLE cyHandle,
1102  _Out_writes_bytes_(*lpbManufacturerStringLengthInBytes) _Pre_defensive_ void *pManufacturerString,
1103  _Out_writes_bytes_(1) _Pre_defensive_ uint8_t *lpbManufacturerStringLengthInBytes,
1104  _In_ _Pre_defensive_ const BOOL bConvertToASCII = FALSE
1105  );
1106 
1123 _Check_return_
1125 _Success_(return == CP210x_SUCCESS)
1128  _In_ _Pre_defensive_ const HANDLE cyHandle,
1129  _Out_writes_bytes_(*lpbProductStringLengthInBytes) _Pre_defensive_ void *pProductString,
1130  _Out_writes_bytes_(1) _Pre_defensive_ uint8_t *lpbProductStringLengthInBytes,
1131  _In_ _Pre_defensive_ const BOOL bConvertToASCII = FALSE
1132  );
1133 
1152 _Check_return_
1154 _Success_(return == CP210x_SUCCESS)
1157  _In_ _Pre_defensive_ const HANDLE cyHandle,
1158  _In_ _Pre_defensive_ const uint8_t bInterfaceNumber,
1159  _Out_writes_bytes_(*lpbInterfaceStringLengthInBytes) _Pre_defensive_ void *pInterfaceString,
1160  _Out_writes_bytes_(1) _Pre_defensive_ uint8_t *lpbInterfaceStringLengthInBytes,
1161  _In_ _Pre_defensive_ const BOOL bConvertToASCII = FALSE
1162  );
1163 
1180 _Check_return_
1182 _Success_(return == CP210x_SUCCESS)
1185  _In_ _Pre_defensive_ const HANDLE cyHandle,
1186  _Out_writes_bytes_(*lpbSerialNumberStringLengthInBytes) _Pre_defensive_ void *pSerialNumberString,
1187  _Out_writes_bytes_(1) _Pre_defensive_ uint8_t *lpbSerialNumberStringLengthInBytes,
1188  _In_ _Pre_defensive_ const BOOL bConvertToASCII = FALSE
1189  );
1190 
1191 
1192 #if ! defined(_WIN32)
1193 _Check_return_
1205 _Success_(return == CP210x_SUCCESS)
1208  _In_ _Pre_defensive_ const HANDLE cyHandle,
1209  uint8_t *lpbAddress);
1210 #endif // ! defined(_WIN32)
1211 
1222 _Check_return_
1224 _Success_(return == CP210x_SUCCESS)
1227  _In_ _Pre_defensive_ const HANDLE cyHandle,
1228  _Out_writes_bytes_(sizeof(BOOL)) _Pre_defensive_ LPBOOL lpbSelfPower
1229  );
1230 
1241 _Check_return_
1243 _Success_(return == CP210x_SUCCESS)
1246  _In_ _Pre_defensive_ const HANDLE cyHandle,
1247  _Out_writes_bytes_(sizeof(uint8_t)) _Pre_defensive_ uint8_t *lpbPower
1248  );
1249 
1265 _Check_return_
1267 _Success_(return == CP210x_SUCCESS)
1270  _In_ _Pre_defensive_ const HANDLE cyHandle,
1271  _Out_writes_bytes_(sizeof(uint16_t)) _Pre_defensive_ uint16_t *lpwFlushBufferConfig
1272  );
1273 
1288 _Check_return_
1290 _Success_(return == CP210x_SUCCESS)
1293  _In_ _Pre_defensive_ const HANDLE cyHandle,
1294  _Out_writes_bytes_(sizeof(uint8_t)) _Pre_defensive_ uint8_t *lpbDeviceModeECI,
1295  _Out_writes_bytes_(sizeof(uint8_t)) _Pre_defensive_ uint8_t *lpbDeviceModeSCI
1296  );
1297 
1312 _Check_return_
1314 _Success_(return == CP210x_SUCCESS)
1317  _In_ _Pre_defensive_ const HANDLE cyHandle,
1318  _Out_writes_bytes_(sizeof(uint16_t)) _Pre_defensive_ uint16_t *lpwVersion
1319  );
1320 
1334 _Check_return_
1336 _Success_(return == CP210x_SUCCESS)
1339  _In_ _Pre_defensive_ const HANDLE cyHandle,
1340  _Out_writes_bytes_(sizeof(BAUD_CONFIG)) _Pre_defensive_ PBAUD_CONFIG pBaudConfig
1341  );
1342 
1356 _Check_return_
1358 _Success_(return == CP210x_SUCCESS)
1361  _In_ _Pre_defensive_ const HANDLE cyHandle,
1362  _Out_writes_bytes_(sizeof(PORT_CONFIG)) _Pre_defensive_ PPORT_CONFIG pPortConfig
1363  );
1364 
1378 _Check_return_
1380 _Success_(return == CP210x_SUCCESS)
1383  _In_ _Pre_defensive_ const HANDLE cyHandle,
1384  _Out_writes_bytes_(sizeof(DUAL_PORT_CONFIG)) _Pre_defensive_ DUAL_PORT_CONFIG* pDualPortConfig
1385  );
1386 
1400 _Check_return_
1402 _Success_(return == CP210x_SUCCESS)
1405  _In_ _Pre_defensive_ const HANDLE cyHandle,
1406  _Out_writes_bytes_(sizeof(QUAD_PORT_CONFIG)) _Pre_defensive_ QUAD_PORT_CONFIG* pQuadPortConfig
1407  );
1408 
1425 _Check_return_
1427 _Success_(return == CP210x_SUCCESS)
1430  _In_ _Pre_defensive_ const HANDLE cyHandle,
1431  _Out_writes_bytes_(sizeof(uint8_t)) _Pre_defensive_ uint8_t *lpbLockValue
1432  );
1433 
1448 _Check_return_
1450 _Success_(return == CP210x_SUCCESS)
1452 CP210x_Reset(
1453  _In_ _Pre_defensive_ const HANDLE cyHandle
1454  );
1455 
1469 _Check_return_
1471 _Success_(return == CP210x_SUCCESS)
1474  _In_ _Pre_defensive_ const HANDLE cyHandle,
1475  _In_ LPCSTR lpvFileName
1476  );
1477 
1491 _Check_return_
1493 _Success_(return == CP210x_SUCCESS)
1496  _In_ _Pre_defensive_ const HANDLE cyHandle,
1497  _Out_writes_bytes_(sizeof(firmware_t)) _Pre_defensive_ pFirmware_t lpVersion
1498  );
1499 
1514 _Check_return_
1516 _Success_(return == CP210x_SUCCESS)
1519  _In_ _Pre_defensive_ const HANDLE cyHandle,
1520  _Out_writes_bytes_(bLength) _Pre_defensive_ uint8_t *lpbConfig,
1521  _In_ _Pre_defensive_ const uint16_t bLength
1522 );
1523 
1538 _Check_return_
1540 _Success_(return == CP210x_SUCCESS)
1543  _In_ _Pre_defensive_ const HANDLE cyHandle,
1544  _In_reads_bytes_(bLength) _Pre_defensive_ uint8_t *lpbConfig,
1545  _In_ _Pre_defensive_ const uint16_t bLength
1546  );
1547 
1559 _Check_return_
1561 _Success_(return == CP210x_SUCCESS)
1564  _In_ _Pre_defensive_ const HANDLE cyHandle);
1565 
1578 _Check_return_
1580 _Success_(return == CP210x_SUCCESS)
1583  _In_ _Pre_defensive_ const HANDLE cyHandle,
1584  _Out_writes_bytes_(bLength) _Pre_defensive_ uint8_t *lpbGeneric,
1585  _In_ _Pre_defensive_ const uint16_t bLength
1586  );
1587 
1600 _Check_return_
1602 _Success_(return == CP210x_SUCCESS)
1605  _In_ _Pre_defensive_ const HANDLE cyHandle,
1606  _In_reads_bytes_(bLength) _Pre_defensive_ uint8_t *lpbGeneric,
1607  _In_ _Pre_defensive_ const uint16_t bLength
1608  );
1609 
1610 #ifdef __cplusplus
1611 }
1612 #endif
1613 
1615 
1616 #endif // !HOST_LIB_MANUFACTURING_INCLUDE_CP210XMANUFACTURINGDLL_H_INCLUDED_XF3N9QM3BK
char CP210x_MANUFACTURER_STRING[45]
CP210x Manufacture string.
Definition: CP210xManufacturingDLL.h:164
#define CP210x_DEVICE_IO_FAILED
device I/O failed
Definition: CP210xManufacturingDLL.h:124
firmware version. Alias of this struct is firmware_t
CP210x_STATUS CP210x_Reset(const HANDLE cyHandle)
Initiates a reset of the USB device.
CP210x_STATUS CP210x_GetDualPortConfig(const HANDLE cyHandle, DUAL_PORT_CONFIG *pDualPortConfig)
Gets and returns the current Dual Port Configuration from the Dual Port device.
char CP2105_INTERFACE_STRING[32]
CP2105 Interface string.
Definition: CP210xManufacturingDLL.h:167
CP210x_STATUS CP210x_GetPortConfig(const HANDLE cyHandle, PPORT_CONFIG pPortConfig)
Gets and returns the Port Configuration from the device.
CP210x_STATUS CP210x_Close(const HANDLE cyHandle)
Closes an open handle to the device.
CP210x_STATUS CP210x_SetProductString(const HANDLE cyHandle, void *lpvProductString, const uint8_t bProductStringLength, const BOOL bIsStringASCII=TRUE)
Sets the Product Description String of the device&#39;s USB Device Descriptor&#39;s iProduct USB String Descr...
CP210x_STATUS CP210x_SetManufacturerString(const HANDLE cyHandle, void *lpvManufacturerString, const uint8_t bManufacturerStringLength, const BOOL bIsStringASCII=TRUE)
Sets the Manufacturer Description String of the device&#39;s USB Device Descriptor&#39;s iManufacturer USB St...
BAUD_CONFIG BAUD_CONFIG_DATA[32]
Array of all Baud Rate Configurations.
Definition: CP210xManufacturingDLL.h:195
#define CP210x_MAX_SERIAL_STRLEN
Single port device Max Serial Number string length.
Definition: CP210xManufacturingDLL.h:145
Definition: CP210xManufacturingDLL.h:245
uint8_t minor
minor version number
Definition: CP210xManufacturingDLL.h:489
CP210x_STATUS CP210x_SetFlushBufferConfig(const HANDLE cyHandle, const uint16_t wFlushBufferConfig)
Sets the Flush Buffer configuration of the device.
Description string a la "Friendly Name".
Definition: CP210xManufacturingDLL.h:77
#define CP210x_DEVICE_NOT_FOUND
the specified device was not found
Definition: CP210xManufacturingDLL.h:130
uint16_t Mode
Push-Pull = 1, Open-Drain = 0.
Definition: CP210xManufacturingDLL.h:293
CP210x_STATUS CP210x_SetGeneric(const HANDLE cyHandle, uint8_t *lpbGeneric, const uint16_t bLength)
Issue a generic host-to-device USB command to the device.
CP210x_STATUS CP210x_GetSelfPower(const HANDLE cyHandle, LPBOOL lpbSelfPower)
Reads and returns the Self-Powered bit of the Power Attributes field of the USB Configuration Descrip...
#define CP2105_MAX_INTERFACE_STRLEN
Dual port device Max Interface string length.
Definition: CP210xManufacturingDLL.h:151
no error
Definition: silabs_defs.h:262
char CP210x_PRODUCT_STRING[126]
CP210x Product string.
Definition: CP210xManufacturingDLL.h:165
CP210x_STATUS CP210x_SetBaudRateConfig(const HANDLE cyHandle, PBAUD_CONFIG pBaudConfig)
Sets the baud rate configuration data of the device.
Serial Number string.
Definition: CP210xManufacturingDLL.h:76
CP210x_STATUS CP210x_SetSelfPower(const HANDLE cyHandle, const BOOL bSelfPower)
Sets or clears the Self-Powered bit of the Power Attributes field of the USB Configuration Descriptor...
CP2103/4 Port Config Structure. Alias of this struct is PORT_CONFIG.
uint16_t Mode_PB0
tbd
Definition: CP210xManufacturingDLL.h:356
CP210x_STATUS CP210x_SetSerialNumber(const HANDLE cyHandle, void *lpvSerialNumberString, const uint8_t bSerialNumberStringLength, const BOOL bIsStringASCII=TRUE)
Sets the Serial Number Description String of the device&#39;s USB Device Descriptor&#39;s iSerialNumber USB S...
uint8_t EnhancedFxn_IFC0
Enhanced function of Interface 0.
Definition: CP210xManufacturingDLL.h:388
#define CP210x_INVALID_PARAMETER
a parameter was not valid
Definition: CP210xManufacturingDLL.h:123
#define NUM_BAUD_CONFIGS
Number of Baud Configurations.
Definition: CP210xManufacturingDLL.h:176
CP210x_STATUS CP210x_GetFlushBufferConfig(const HANDLE cyHandle, uint16_t *lpwFlushBufferConfig)
Reads and returns the Flush Buffer configuration from the device.
CP210x_STATUS CP210x_GetDeviceProductString(const HANDLE cyHandle, void *pProductString, uint8_t *lpbProductStringLengthInBytes, const BOOL bConvertToASCII=FALSE)
Read and return the USB Device Descriptor&#39;s iProduct USB String Descriptor string.
CP210x_STATUS CP210x_GetLockValue(const HANDLE cyHandle, uint8_t *lpbLockValue)
Reads and returns the Lock Value from the device.
CP210x_STATUS CP210x_GetDevicePid(const HANDLE cyHandle, uint16_t *lpwPid)
Reads and returns the 2-byte Product ID from the USB Device Descriptor from the device.
uint16_t Reset_Latch
Logic High = 1, Logic Low = =0.
Definition: CP210xManufacturingDLL.h:248
CP210x_STATUS CP210x_GetConfig(const HANDLE cyHandle, uint8_t *lpbConfig, const uint16_t bLength)
Retrieves the current configuration from the device as a byte array.
uint16_t Suspend_Latch
Logic High = 1, Logic Low = =0.
Definition: CP210xManufacturingDLL.h:249
CP210x_STATUS CP210x_GetMaxPower(const HANDLE cyHandle, uint8_t *lpbPower)
Reads and returns the Max Power field of the USB Configuration Descriptor from the device...
CP210x_STATUS CP210x_SetConfig(const HANDLE cyHandle, uint8_t *lpbConfig, const uint16_t bLength)
Program the device&#39;s configurable area with the given byte array.
Definition: CP210xManufacturingDLL.h:80
uint16_t Reset_Latch
Logic High = 1, Logic Low = =0.
Definition: CP210xManufacturingDLL.h:294
#define WINAPI
WINAPI.
Definition: CP210xManufacturingDLL.h:70
CP210x_STATUS CP210x_SetQuadPortConfig(const HANDLE cyHandle, QUAD_PORT_CONFIG *pQuadPortConfig)
Sets the current port pin configuration from the device.
CP210x_STATUS CP210x_SetInterfaceString(const HANDLE cyHandle, const uint8_t bInterfaceNumber, void *lpvInterfaceString, const uint8_t bInterfaceStringLength, const BOOL bIsStringASCII)
Sets the Interface Description String of the device&#39;s specified interface&#39;s iInterface USB String Des...
CP210X_GETPRODUCTSTRING
CP210x_GetProductString() function flags
Definition: CP210xManufacturingDLL.h:75
CP210x_STATUS CP210x_GetNumDevices(uint32_t *lpdwNumDevices)
Determines the number of CP210x devices connected to the system.
unsigned char EnhancedFxn_SCI
Enhanced function of SCI port.
Definition: CP210xManufacturingDLL.h:297
char CP210x_DEVICE_STRING[256]
CP210x Device string.
Definition: CP210xManufacturingDLL.h:163
CP210x_STATUS CP210x_GetProductStringSafe(const uint32_t dwDeviceIndex, const CP210X_GETPRODUCTSTRING WhichProductStringToReturn, wchar_t *pProductString, const size_t ProductStringLenInBytes)
Gets a "Product string".
CP210x_STATUS CP210x_GetQuadPortConfig(const HANDLE cyHandle, QUAD_PORT_CONFIG *pQuadPortConfig)
Gets and returns the current Quad Port Configuration from the Quad Port device.
CP210x_STATUS CP210x_SetLockValue(const HANDLE cyHandle)
Sets the Lock Value of a device – prevents all future customizing of the device. ...
CP210x_STATUS CP210x_GetDeviceVid(const HANDLE cyHandle, uint16_t *lpwVid)
Reads and returns the 2-byte Vendor ID from the USB Device Descriptor from the device.
CP210x_STATUS CP210x_GetBaudRateConfig(const HANDLE cyHandle, PBAUD_CONFIG pBaudConfig)
Reads and returns the Baud Rate Configuration from the device.
CP210x_STATUS CP210x_SetPid(const HANDLE cyHandle, const uint16_t Pid)
Sets the Product ID field of the device&#39;s USB Device Descriptor.
CP210x_STATUS CP210x_CreateHexFile(const HANDLE cyHandle, LPCSTR lpvFileName)
Create a hex file dump of TBD.
uint16_t Suspend_Latch
Logic High = 1, Logic Low = =0.
Definition: CP210xManufacturingDLL.h:295
#define CP210x_MAX_DEVICE_STRLEN
CP210x Maximum Device-side string length.
Definition: CP210xManufacturingDLL.h:140
#define CP210x_MAX_MANUFACTURER_STRLEN
Single port device Max Manufacturing string length.
Definition: CP210xManufacturingDLL.h:143
CP210x_STATUS CP210x_GetDeviceMode(const HANDLE cyHandle, uint8_t *lpbDeviceModeECI, uint8_t *lpbDeviceModeSCI)
Reads and returns the operating mode (GPIO or Modem) of each Interface from the device.
int CP210x_STATUS
CP210x_STATUS.
Definition: CP210xManufacturingDLL.h:131
CP210x_STATUS CP210x_SetDeviceVersion(const HANDLE cyHandle, const uint16_t wVersion)
Sets the Device Release Version field of the USB Device Descriptor of the device. ...
CP210x_STATUS CP210x_GetDeviceSerialNumber(const HANDLE cyHandle, void *pSerialNumberString, uint8_t *lpbSerialNumberStringLengthInBytes, const BOOL bConvertToASCII=FALSE)
Read and return the USB Device Descriptor&#39;s iSerialNumber USB String Descriptor string.
Definition: CP210xManufacturingDLL.h:180
uint16_t Mode
Push-Pull = 1, Open-Drain = 0.
Definition: CP210xManufacturingDLL.h:247
CP210x_STATUS CP210x_SetVid(const HANDLE cyHandle, const uint16_t Vid)
Sets the Vendor ID field of the device&#39;s USB Device Descriptor.
unsigned char BYTE
Byte definition.
Definition: silabs_defs.h:41
#define CP210x_COMMAND_FAILED
command failed
Definition: CP210xManufacturingDLL.h:128
void _ConfigLatchRS485(BYTE partNum, PORT_CONFIG *PortConfig, uint16_t &Temp_Reset_Latch, uint16_t &Temp_Suspend_Latch)
overwrite latch value if in RS485 mode
#define CP210x_FUNCTION_NOT_SUPPORTED
the specified function is not supported
Definition: CP210xManufacturingDLL.h:125
Baud Config Structure. Alias of this struct is BAUD_CONFIG.
CP210x_STATUS CP210x_GetDeviceVersion(const HANDLE cyHandle, uint16_t *lpwVersion)
Reads and returns the Device Release Number (bcdDevice) Version USB Standard Device Descriptor from t...
CP210x_STATUS CP210x_SetPortConfig(const HANDLE cyHandle, PORT_CONFIG *pPortConfig)
Sets the current port pin configuration from the device.
CP210x_STATUS CP210x_GetDeviceManufacturerString(const HANDLE cyHandle, void *pManufacturerString, uint8_t *lpbManufacturerStringLengthInBytes, const BOOL bConvertToASCII=FALSE)
Read and return the USB Device Descriptor&#39;s iManufacturer USB String Descriptor string.
CP2105 Dual Port Config Structure. Alias of this struct is DUAL_PORT_CONFIG.
unsigned char EnhancedFxn_ECI
Enhanced function of ECI port.
Definition: CP210xManufacturingDLL.h:296
CP210x_STATUS CP210x_GetGeneric(const HANDLE cyHandle, uint8_t *lpbGeneric, const uint16_t bLength)
Issue a generic device-to-host USB command to the device.
uint8_t build
build number
Definition: CP210xManufacturingDLL.h:490
CP210x_STATUS CP210x_GetProductString(const uint32_t dwDeviceIndex, void *lpvProductString, const uint32_t dwFlags)
Gets a "Product string".
Full Path string a la "Device Path" "A NULL-terminated string that contains the device interface path...
Definition: CP210xManufacturingDLL.h:78
char CP2108_INTERFACE_STRING[126]
CP2108 Interface string.
Definition: CP210xManufacturingDLL.h:168
unsigned char EnhancedFxn_Device
Enhanced function of Device.
Definition: CP210xManufacturingDLL.h:298
Definition: CP210xManufacturingDLL.h:81
#define CP210x_MAX_PRODUCT_STRLEN
Single port device Max Product string length.
Definition: CP210xManufacturingDLL.h:144
CP210x_STATUS CP210x_Open(const uint32_t DeviceIndex, PHANDLE pcyHandle)
Opens a handle to the device.
CP210x_STATUS CP210x_GetFirmwareVersion(const HANDLE cyHandle, pFirmware_t lpVersion)
Reads and returns the Firmware Version from the device.
#define CP210x_SUCCESS
Success.
Definition: CP210xManufacturingDLL.h:121
#define CP210x_FILE_ERROR
file error
Definition: CP210xManufacturingDLL.h:127
CP210x_STATUS CP210x_UpdateFirmware(const HANDLE cyHandle)
Requests device enter Bootloader mode.
CP210x_STATUS CP210x_SetDeviceMode(const HANDLE cyHandle, const uint8_t bDeviceModeECI, const uint8_t bDeviceModeSCI)
Sets the operating mode (GPIO or Modem) of each Interface of the device.
#define CP210x_GLOBAL_DATA_ERROR
global data error
Definition: CP210xManufacturingDLL.h:126
char CP210x_SERIAL_STRING[63]
CP210x Serial string.
Definition: CP210xManufacturingDLL.h:166
Definition: CP210xManufacturingDLL.h:82
uint8_t EnhancedFxn_Device
Enhanced function of Devie.
Definition: CP210xManufacturingDLL.h:392
Definition: CP210xManufacturingDLL.h:487
#define CP210x_INVALID_ACCESS_TYPE
invalid access type
Definition: CP210xManufacturingDLL.h:129
CP210x_STATUS CP210x_SetDualPortConfig(const HANDLE cyHandle, DUAL_PORT_CONFIG *pDualPortConfig)
Sets the current port pin configuration from the device.
Definition: CP210xManufacturingDLL.h:291
Definition: CP210xManufacturingDLL.h:380
unsigned char EnhancedFxn
tbd
Definition: CP210xManufacturingDLL.h:250
uint8_t major
major version number
Definition: CP210xManufacturingDLL.h:488
CP210x_STATUS CP210x_GetDeviceAddress(const HANDLE cyHandle, uint8_t *lpbAddress)
Returns the USB Address of the device.
#define CP210x_INVALID_HANDLE
an handle parameter was not valid
Definition: CP210xManufacturingDLL.h:122
#define CP210xDLL_API
CP210xDLL_API.
Definition: CP210xManufacturingDLL.h:69
CP210x_STATUS CP210x_GetPartNumber(const HANDLE cyHandle, uint8_t *lpbPartNum)
Reads and returns the Part Number from the device.
Definition: CP210xManufacturingDLL.h:354
enum _CP210X_GETPRODUCTSTRING * PCP210X_GETPRODUCTSTRING
define CP210X_GETPRODUCTSTRING function flags
#define CP2108_MAX_INTERFACE_STRLEN
Quad port device Max Interface string length.
Definition: CP210xManufacturingDLL.h:157
CP210x_STATUS CP210x_GetDeviceInterfaceString(const HANDLE cyHandle, const uint8_t bInterfaceNumber, void *pInterfaceString, uint8_t *lpbInterfaceStringLengthInBytes, const BOOL bConvertToASCII=FALSE)
Read and return the Interface Description USB String Descriptor string.
CP210x_STATUS CP210x_SetMaxPower(const HANDLE cyHandle, const uint8_t bMaxPower)
Sets the Max Power field of the USB Configuration Descriptor of the device.
CP2108 Quad Port Config structure. Alias of this struct is QUAD_PORT_CONFIG.
CP2108 Quad Port State structure (used in QUAD_PORT_CONFIG). Alias of this struct is QUAD_PORT_STATE...