Data Structures | |
| struct | pFirmware_t |
| struct | _firmware_t |
| firmware version. Alias of this struct is firmware_t More... | |
Macros | |
| #define | CP210xDLL_API |
| CP210xDLL_API. More... | |
| #define | WINAPI |
| WINAPI. More... | |
| #define | CP2102N_MAX_ |
| tbd More... | |
| #define | CP210x_MAX_MAXPOWER 250 |
| TBD Unused in Manufacturing library. More... | |
Typedefs | |
| typedef enum _CP210X_GETPRODUCTSTRING * | PCP210X_GETPRODUCTSTRING |
| define CP210X_GETPRODUCTSTRING function flags More... | |
| typedef char | CP210x_DEVICE_STRING[256] |
| CP210x Device string. More... | |
| typedef char | CP210x_MANUFACTURER_STRING[45] |
| CP210x Manufacture string. More... | |
| typedef char | CP210x_PRODUCT_STRING[126] |
| CP210x Product string. More... | |
| typedef char | CP210x_SERIAL_STRING[63] |
| CP210x Serial string. More... | |
| typedef char | CP2105_INTERFACE_STRING[32] |
| CP2105 Interface string. More... | |
| typedef char | CP2108_INTERFACE_STRING[126] |
| CP2108 Interface string. More... | |
Enumerations | |
| enum | CP210X_GETPRODUCTSTRING { CP210x_GETPRODUCTSTRING_SERIAL_NUMBER = 0x00, CP210x_GETPRODUCTSTRING_DESCRIPTION = 0x01, CP210x_GETPRODUCTSTRING_FULL_PATH = 0x02, CP210x_RETURN_SERIAL_NUMBER = CP210x_GETPRODUCTSTRING_SERIAL_NUMBER, CP210x_RETURN_DESCRIPTION = CP210x_GETPRODUCTSTRING_DESCRIPTION, CP210x_RETURN_FULL_PATH = CP210x_GETPRODUCTSTRING_FULL_PATH } |
| CP210x_GetProductString() function flags More... | |
Functions | |
| CP210x_STATUS | CP210x_GetNumDevices (uint32_t *lpdwNumDevices) |
| Determines the number of CP210x devices connected to the system. More... | |
| CP210x_STATUS | CP210x_GetProductString (const uint32_t dwDeviceIndex, void *lpvProductString, const uint32_t dwFlags) |
| Gets a "Product string". More... | |
| CP210x_STATUS | CP210x_GetProductStringSafe (const uint32_t dwDeviceIndex, const CP210X_GETPRODUCTSTRING WhichProductStringToReturn, wchar_t *pProductString, const size_t ProductStringLenInBytes) |
| Gets a "Product string". More... | |
| CP210x_STATUS | CP210x_Open (const uint32_t DeviceIndex, PHANDLE pcyHandle) |
| Opens a handle to the device. More... | |
| CP210x_STATUS | CP210x_Close (const HANDLE cyHandle) |
| Closes an open handle to the device. More... | |
| CP210x_STATUS | CP210x_GetPartNumber (const HANDLE cyHandle, uint8_t *lpbPartNum) |
| Reads and returns the Part Number from the device. More... | |
| CP210x_STATUS | CP210x_SetVid (const HANDLE cyHandle, const uint16_t Vid) |
| Sets the Vendor ID field of the device's USB Device Descriptor. More... | |
| CP210x_STATUS | CP210x_SetPid (const HANDLE cyHandle, const uint16_t Pid) |
| Sets the Product ID field of the device's USB Device Descriptor. More... | |
| 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's USB Device Descriptor's iManufacturer USB String Descriptor. More... | |
| 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's USB Device Descriptor's iProduct USB String Descriptor. More... | |
| 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's specified interface's iInterface USB String Descriptor. More... | |
| 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's USB Device Descriptor's iSerialNumber USB String Descriptor. More... | |
| 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 on the device. More... | |
| CP210x_STATUS | CP210x_SetMaxPower (const HANDLE cyHandle, const uint8_t bMaxPower) |
| Sets the Max Power field of the USB Configuration Descriptor of the device. More... | |
| CP210x_STATUS | CP210x_SetFlushBufferConfig (const HANDLE cyHandle, const uint16_t wFlushBufferConfig) |
| Sets the Flush Buffer configuration of the device. More... | |
| 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. More... | |
| 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. More... | |
| CP210x_STATUS | CP210x_SetBaudRateConfig (const HANDLE cyHandle, PBAUD_CONFIG pBaudConfig) |
| Sets the baud rate configuration data of the device. More... | |
| void | _ConfigLatchRS485 (BYTE partNum, PORT_CONFIG *PortConfig, uint16_t &Temp_Reset_Latch, uint16_t &Temp_Suspend_Latch) |
| overwrite latch value if in RS485 mode More... | |
| CP210x_STATUS | CP210x_SetPortConfig (const HANDLE cyHandle, PORT_CONFIG *pPortConfig) |
| Sets the current port pin configuration from the device. More... | |
| CP210x_STATUS | CP210x_SetDualPortConfig (const HANDLE cyHandle, DUAL_PORT_CONFIG *pDualPortConfig) |
| Sets the current port pin configuration from the device. More... | |
| CP210x_STATUS | CP210x_SetQuadPortConfig (const HANDLE cyHandle, QUAD_PORT_CONFIG *pQuadPortConfig) |
| Sets the current port pin configuration from the device. More... | |
| CP210x_STATUS | CP210x_SetLockValue (const HANDLE cyHandle) |
| Sets the Lock Value of a device – prevents all future customizing of the device. More... | |
| 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. More... | |
| 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. More... | |
| CP210x_STATUS | CP210x_GetDeviceManufacturerString (const HANDLE cyHandle, void *pManufacturerString, uint8_t *lpbManufacturerStringLengthInBytes, const BOOL bConvertToASCII=FALSE) |
| Read and return the USB Device Descriptor's iManufacturer USB String Descriptor string. More... | |
| CP210x_STATUS | CP210x_GetDeviceProductString (const HANDLE cyHandle, void *pProductString, uint8_t *lpbProductStringLengthInBytes, const BOOL bConvertToASCII=FALSE) |
| Read and return the USB Device Descriptor's iProduct USB String Descriptor string. More... | |
| 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. More... | |
| CP210x_STATUS | CP210x_GetDeviceSerialNumber (const HANDLE cyHandle, void *pSerialNumberString, uint8_t *lpbSerialNumberStringLengthInBytes, const BOOL bConvertToASCII=FALSE) |
| Read and return the USB Device Descriptor's iSerialNumber USB String Descriptor string. More... | |
| CP210x_STATUS | CP210x_GetDeviceAddress (const HANDLE cyHandle, uint8_t *lpbAddress) |
| Returns the USB Address of the device. More... | |
| 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 Descriptor from the device. More... | |
| 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. More... | |
| CP210x_STATUS | CP210x_GetFlushBufferConfig (const HANDLE cyHandle, uint16_t *lpwFlushBufferConfig) |
| Reads and returns the Flush Buffer configuration from the device. More... | |
| 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. More... | |
| CP210x_STATUS | CP210x_GetDeviceVersion (const HANDLE cyHandle, uint16_t *lpwVersion) |
| Reads and returns the Device Release Number (bcdDevice) Version USB Standard Device Descriptor from the device. More... | |
| CP210x_STATUS | CP210x_GetBaudRateConfig (const HANDLE cyHandle, PBAUD_CONFIG pBaudConfig) |
| Reads and returns the Baud Rate Configuration from the device. More... | |
| CP210x_STATUS | CP210x_GetPortConfig (const HANDLE cyHandle, PPORT_CONFIG pPortConfig) |
| Gets and returns the Port Configuration from the device. More... | |
| CP210x_STATUS | CP210x_GetDualPortConfig (const HANDLE cyHandle, DUAL_PORT_CONFIG *pDualPortConfig) |
| Gets and returns the current Dual Port Configuration from the Dual Port device. More... | |
| CP210x_STATUS | CP210x_GetQuadPortConfig (const HANDLE cyHandle, QUAD_PORT_CONFIG *pQuadPortConfig) |
| Gets and returns the current Quad Port Configuration from the Quad Port device. More... | |
| CP210x_STATUS | CP210x_GetLockValue (const HANDLE cyHandle, uint8_t *lpbLockValue) |
| Reads and returns the Lock Value from the device. More... | |
| CP210x_STATUS | CP210x_Reset (const HANDLE cyHandle) |
| Initiates a reset of the USB device. More... | |
| CP210x_STATUS | CP210x_CreateHexFile (const HANDLE cyHandle, LPCSTR lpvFileName) |
| Create a hex file dump of TBD. More... | |
| CP210x_STATUS | CP210x_GetFirmwareVersion (const HANDLE cyHandle, pFirmware_t lpVersion) |
| Reads and returns the Firmware Version from the device. More... | |
| 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. More... | |
| CP210x_STATUS | CP210x_SetConfig (const HANDLE cyHandle, uint8_t *lpbConfig, const uint16_t bLength) |
| Program the device's configurable area with the given byte array. More... | |
| CP210x_STATUS | CP210x_UpdateFirmware (const HANDLE cyHandle) |
| Requests device enter Bootloader mode. More... | |
| 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. More... | |
| 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. More... | |
The Silicon Labs CP210x USB-to-UART bridges are devices that communicate over the Universal Serial Bus (USB) to perform Universal Asynchronous Receiver / Transmitter (UART) data transfers. These devices have many programmable options that can be configured via USB. These devices also often include flexible GPIO functions that can be configured and accessed via USB during runtime. Silicon Labs provides libraries that can be used to configure these devices and access their GPIOs.
Two interface library files can be used to interface with CP210x devices, CP210xManufacturing.DLL and .LIB, which is responsible for reading and writing the device settings, and CP210xRuntime.DLL and .LIB, which is responsible for interfacing with the device's GPIOs. The APIs for CP210xManufacturing are described below.
This document supercedes, obsoletes and takes precedences over AN978.
The CP210x Manufacturing Host API is provided as a means to facilitate production of customized CP210x devices. This API allows access to the CP210x device for retrieving and setting the VID, PID, product string, serial number, self - power attribute, maximum power consumption, and device version.
The CP210x Manufacturing Host API is provided in the form of a Windows Dynamic Link Library (DLL), CP210xManufacturing.DLL and as a Windows static link library (CP210xManufacturing.static.LIB). The host interface library communicates with the bridge controller device via the provided device driver and the operating system's USB stack.
Custom applications can use the CP210x Manufacturing API implemented in CP210xManufacturing.DLL. To use functions implemented in CP210xManufacturing.DLL link CP210xManufacturing.LIB include CP210xManufacturingDLL.h into any source code files that call any functions implemented in CP210xManufacturing.DLL and include the PATH to the location of CP210xManufacturing.DLL in your custom application Visual Studio .VCXPROJ Profile File's Properties->Linker->General->Additional Library Directories property.
Typically, the user initiates communication with the target CP210x device by making a call to CP210x_GetNumDevices(). This call returns the number of CP210x target devices. This number is used as a range when calling CP210x_GetProductString() to build a list of devices connected to the host machine. A handle to the device must first be opened by a call to CP210x_Open() using an index determined from the call to CP210x_GetNumDevices(). The handle will be used for all subsequent accesses. When I/O operations are complete, the device handle is closed by a call to CP210x_Close().
| struct firmware_t |
| struct _firmware_t |
firmware version. Alias of this struct is firmware_t
Firmware version structure see CP210x_GetFirmwareVersion() Not writeable by OEMs or end-users. Automatically populated by build infrastructure
| #define CP2102N_MAX_ |
tbd
| #define CP210x_MAX_MAXPOWER 250 |
TBD Unused in Manufacturing library.
| #define CP210xDLL_API |
CP210xDLL_API.
| #define WINAPI |
WINAPI.
| typedef char CP2105_INTERFACE_STRING[32] |
CP2105 Interface string.
| typedef char CP2108_INTERFACE_STRING[126] |
CP2108 Interface string.
| typedef char CP210x_DEVICE_STRING[256] |
CP210x Device string.
| typedef char CP210x_MANUFACTURER_STRING[45] |
CP210x Manufacture string.
| typedef char CP210x_PRODUCT_STRING[126] |
CP210x Product string.
| typedef char CP210x_SERIAL_STRING[63] |
CP210x Serial string.
| typedef enum _CP210X_GETPRODUCTSTRING * PCP210X_GETPRODUCTSTRING |
define CP210X_GETPRODUCTSTRING function flags
CP210x_GetProductString() function flags
| void _ConfigLatchRS485 | ( | BYTE | partNum, |
| PORT_CONFIG * | PortConfig, | ||
| uint16_t & | Temp_Reset_Latch, | ||
| uint16_t & | Temp_Suspend_Latch | ||
| ) |
overwrite latch value if in RS485 mode
| [in] | partNum | is a number as returned by CP210x_GetPartNumber() |
| [in] | pPortConfig | is a pointer to a PORT_CONFIG structure |
| CP210x_STATUS CP210x_Close | ( | const HANDLE | cyHandle | ) |
Closes an open handle to the device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_STATUS CP210x_CreateHexFile | ( | const HANDLE | cyHandle, |
| LPCSTR | lpvFileName | ||
| ) |
Create a hex file dump of TBD.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | lpvFileName | is a file name to be always-created and written to |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpvFileName is an unexpected value |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support create a hex file dump from it |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_GetBaudRateConfig | ( | const HANDLE | cyHandle, |
| PBAUD_CONFIG | pBaudConfig | ||
| ) |
Reads and returns the Baud Rate Configuration from the device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [out] | pBaudConfig | is a pointer to a BAUD_CONFIG structure into which the Baud Rate Configuration will be written |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – pBaudConfig is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support setting of the Baud Rate Configuration |
| 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.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [out] | lpbConfig | points to a buffer into which the current configuration will be written |
| [in] | bLength | is the number of bytes in the lpbConfig buffer |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpbConfig or bLength is an unexpected value |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support reporting its Firmware Version |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_GetDeviceAddress | ( | const HANDLE | cyHandle, |
| uint8_t * | lpbAddress | ||
| ) |
Returns the USB Address of the device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [out] | lpbAddress | points to a 1-byte buffer into which the address will be written. |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpbAddress is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| 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.
If bConvertToASCII parameter is set/true, the string will be converted to ASCII format before being returned to the caller. The character size limit (in characters, not bytes), NOT including a NULL terminator, is CP210x_MAX_PRODUCT_STRLEN.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | bInterfaceNumber | is Set to 0 for Enhanced Interface String, or 1 for Standard Interface String on the CP2105, or 0 - 3 for the CP2108 which has 4 interfaces. |
| [out] | pInterfaceString | points at a buffer into which the Interface string will be written |
| [out] | lpbInterfaceStringLengthInBytes | points at a 1-byte buffer into which the total number of bytes in the returned Interface string is returned. |
| [in] | bConvertToASCII | is a true or false value indicating whether the device's 16-bit UCS-2 Interface string should be converted to 8-bit ascii character string (true) (possible loss of data), or not (false). |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – bInterfaceNumber, lpInterface or lpbInterfaceStringLengthInBytes is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_GetDeviceManufacturerString | ( | const HANDLE | cyHandle, |
| void * | pManufacturerString, | ||
| uint8_t * | lpbManufacturerStringLengthInBytes, | ||
| const BOOL | bConvertToASCII = FALSE |
||
| ) |
Read and return the USB Device Descriptor's iManufacturer USB String Descriptor string.
Returns the Manufacturer Description string of the iManufacturer USB String Descriptor from the CP210x device. If bConvertToASCII parameter is set/true, the string will be converted to ASCII format before being returned to the caller. The character size limit (in characters, not bytes), NOT including a NULL terminator, is CP210x_MAX_PRODUCT_STRLEN.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [out] | pManufacturerString | points at a buffer into which the Manufacturer string will be written |
| [out] | lpbManufacturerStringLengthInBytes | points at a 1-byte buffer into which the total number of bytes in the returned Manufacturer string is returned. |
| [in] | bConvertToASCII | is a true or false value indicating whether the device's 16-bit UCS-2 Manufacturer string should be converted to 8-bit ascii character string (true) (possible loss of data), or not (false). |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpManufacturer or lpbManufacturerStringLengthInBytes is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| 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.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [out] | lpbDeviceModeECI | points to a 1-byte location into which the ECI mode will be written (0 if interface is in Modem mode, or 1 if GPIO mode) |
| [out] | lpbDeviceModeSCI | points to a 1-byte location into which the SCI mode will be written (0 if interface is in Modem mode, or 1 if GPIO mode) |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpbDeviceModeECI or lpbDeviceModeSCI are unexpected values |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support device mode |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| 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.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [out] | lpwPid | points at a 2-byte buffer into which the PID will be written |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpwPid is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_GetDeviceProductString | ( | const HANDLE | cyHandle, |
| void * | pProductString, | ||
| uint8_t * | lpbProductStringLengthInBytes, | ||
| const BOOL | bConvertToASCII = FALSE |
||
| ) |
Read and return the USB Device Descriptor's iProduct USB String Descriptor string.
Returns the Product Description string of the iProduct USB String Descriptor from the CP210x device. If bConvertToASCII parameter is set/true, the string will be converted to ASCII format before being returned to the caller. The character size limit (in characters, not bytes), NOT including a NULL terminator, is CP210x_MAX_PRODUCT_STRLEN.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [out] | pProductString | points at a buffer into which the Product string will be written |
| [out] | lpbProductStringLengthInBytes | points at a 1-byte buffer into which the total number of bytes in the returned Product string is returned. |
| [in] | bConvertToASCII | is a true or false value indicating whether the device's 16-bit UCS-2 Product string should be converted to 8-bit ascii character string (true) (possible loss of data), or not (false). |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpProduct or lpbProductStringLengthInBytes is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_GetDeviceSerialNumber | ( | const HANDLE | cyHandle, |
| void * | pSerialNumberString, | ||
| uint8_t * | lpbSerialNumberStringLengthInBytes, | ||
| const BOOL | bConvertToASCII = FALSE |
||
| ) |
Read and return the USB Device Descriptor's iSerialNumber USB String Descriptor string.
Returns the Serial Number string of the iSerialNumber USB String Descriptor from the CP210x device. If bConvertToASCII parameter is set/true, the string will be converted to ASCII format before being returned to the caller. The character size limit (in characters, not bytes), NOT including a NULL terminator, is CP210x_MAX_PRODUCT_STRLEN.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [out] | pSerialNumberString | points at a buffer into which the Serial Number string will be written |
| [out] | lpbSerialNumberStringLengthInBytes | points at a 1-byte buffer into which the total number of bytes in the returned Serial Number string is returned. |
| [in] | bConvertToASCII | is a true or false value indicating whether the device's 16-bit UCS-2 Serial Number string should be converted to 8-bit ascii character string (true) (possible loss of data), or not (false). |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpSerialNumber or lpbSerialNumberStringLengthInBytes is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_GetDeviceVersion | ( | const HANDLE | cyHandle, |
| uint16_t * | lpwVersion | ||
| ) |
Reads and returns the Device Release Number (bcdDevice) Version USB Standard Device Descriptor from the device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [out] | lpwVersion | points to a 2-byte buffer into which the Device Release Number (bcdDevice) Version will be written |
The 2-byte Device Release Number (bcdDevice) Version will be returned in Binary-Coded Decimal (BCD) format with the upper two nibbles containing the two decimal digits of the major version and the lower two nibbles containing the two decimal digits of the minor version.
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpwVersion is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| 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.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [out] | lpwVid | points at a 2-byte buffer into which the VID will be written |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpwVid is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_GetDualPortConfig | ( | const HANDLE | cyHandle, |
| DUAL_PORT_CONFIG * | pDualPortConfig | ||
| ) |
Gets and returns the current Dual Port Configuration from the Dual Port device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [out] | pDualPortConfig | is a pointer to a DUAL_PORT_CONFIG structure into which the Dual Port Configuration will be written and returned |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – pDualPortConfig is an unexpected value |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support Dual Port Configuration |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_GetFirmwareVersion | ( | const HANDLE | cyHandle, |
| pFirmware_t | lpVersion | ||
| ) |
Reads and returns the Firmware Version from the device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [out] | lpVersion | points to a firmware_t structure into which the Firmware Version will be written |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpVersion is an unexpected value |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support reporting its Firmware Version |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_GetFlushBufferConfig | ( | const HANDLE | cyHandle, |
| uint16_t * | lpwFlushBufferConfig | ||
| ) |
Reads and returns the Flush Buffer configuration from the device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | lpwFlushBufferConfig | points to a 2-byte buffer into which a bitmask to determine which buffer/s to flush (TX and/or RX) and upon which event (Open and/or Close). will be written |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpwFlushBufferConfig is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support Flush Buffer Config |
| 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.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [out] | lpbGeneric | points to a buffer containing the USB command to be sent to the device |
| [in] | bLength | is the number of bytes in the lpbGeneric buffer |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpbGeneric or bLength is an unexpected value |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support the specified comman |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_GetLockValue | ( | const HANDLE | cyHandle, |
| uint8_t * | lpbLockValue | ||
| ) |
Reads and returns the Lock Value from the device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [out] | lpbLockValue | points to a 1-byte buffer into which the Lock Value of the device will be written |
A Lock Value of 0x00 denotes that the device is UNlocked, non-0x00 values indicate it is locked and prevented from all future customizing of the device.
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpbLockValue is an unexpected value |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support Lock Value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| 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.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [out] | lpbPower | points to a 1-byte buffer into which the Maximum power, expressed in 2mA units, will be written. |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpbPower is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_GetNumDevices | ( | uint32_t * | lpdwNumDevices | ) |
Determines the number of CP210x devices connected to the system.
| [out] | lpdwNumDevices | a pointer to a uint32_t location to hold the returned device count |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_PARAMETER | – lpdwNumDevices is an unexpected value |
| CP210x_STATUS CP210x_GetPartNumber | ( | const HANDLE | cyHandle, |
| uint8_t * | lpbPartNum | ||
| ) |
Reads and returns the Part Number from the device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() or CreateFile() |
| [out] | lpbPartNum | points at a 1-byte buffer into which the SILABS_PARTNUM_CPXXXX Part Number value will be written |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpbPartNum is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_GetPortConfig | ( | const HANDLE | cyHandle, |
| PPORT_CONFIG | pPortConfig | ||
| ) |
Gets and returns the Port Configuration from the device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [out] | pPortConfig | is a pointer to a PORT_CONFIG structure into which the Port Configuration will be written and returned |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – pPortConfig is an unexpected value |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support Port Configuration |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_GetProductString | ( | const uint32_t | dwDeviceIndex, |
| void * | lpvProductString, | ||
| const uint32_t | dwFlags | ||
| ) |
Gets a "Product string".
This function returns a NULL-terminated serial number string, product description string, or full path string for the device specified by an index passed in the dwDeviceIndex parameter. The index of the first device is 0, and the index of the last device is the value(NumDevices) returned by CP210x_GetNumDevices() - 1.
The full path string is the "device interface path" or "Device Path". This path can be passed to Win32 functions such as CreateFile().
The Serial Number string is derived from the "full path" string.
The Description string is either the "description of a device" Plug and Play device property from the Registry, if available, else the "friendly name of a device" Plug and Play device property from the Registry, if available, else the same "device interface path" returned for the "full path" string.
Returned strings are UCS-1?/ASCII and NULL-terminated. (verified)
lpvDeviceString must be <= CP210x_MAX_SETUP_STRING_SIZElpvDeviceString parameter. | [in] | dwDeviceIndex | is the desired device's index into the device list used to determine CP210x_GetNumDevices() |
| [out] | lpvProductString | points at a buffer into which the "Product string" will be copied and returned |
| [in] | dwFlags | is the indication of which "Product string" to return, one of CP210X_GETPRODUCTSTRING |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_PARAMETER | – lpvProductString or dwFlags is an unexpected value |
| CP210x_DEVICE_NOT_FOUND | – the device specified by the dwDeviceIndex was not found |
| CP210x_STATUS CP210x_GetProductStringSafe | ( | const uint32_t | dwDeviceIndex, |
| const CP210X_GETPRODUCTSTRING | WhichProductStringToReturn, | ||
| wchar_t * | pProductString, | ||
| const size_t | ProductStringLenInBytes | ||
| ) |
Gets a "Product string".
This function returns a NULL-terminated serial number string, product description string, or full path string for the device specified by an index passed in the dwDeviceIndex parameter. The index of the first device is 0, and the index of the last device is the value(NumDevices) returned by CP210x_GetNumDevices() - 1.
The full path string is the "device interface path" or "Device Path". This path can be passed to Win32 functions such as CreateFile().
The Serial Number string is derived from the "full path" string.
The Description string is either the "description of a device" Plug and Play device property from the Registry, if available, else the "friendly name of a device" Plug and Play device property from the Registry, if available, else the same "device interface path" returned for the "full path" string.
Returned strings are UCS-2 and are NULL-terminated. (verified)
lpvDeviceString must be <= CP210x_MAX_SETUP_STRING_SIZE| [in] | dwDeviceIndex | is the desired device's index into the device list used to determine CP210x_GetNumDevices() |
| [in] | WhichProductStringToReturn | is the indication of which "Product string" to return, one of CP210X_GETPRODUCTSTRING |
| [out] | pProductString | points at a buffer into which the "Product string" will be copied and returned |
| [in] | ProductStringLenInBytes | is the size, in bytes/octets, of the buffer into which the the "Product string" will be copied and returned I.e. sizeof pProductString buffer |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_PARAMETER | – lpvProductString or dwFlags is an unexpected value |
| CP210x_DEVICE_NOT_FOUND | – the device specified by the dwDeviceIndex was not found |
| CP210x_STATUS CP210x_GetQuadPortConfig | ( | const HANDLE | cyHandle, |
| QUAD_PORT_CONFIG * | pQuadPortConfig | ||
| ) |
Gets and returns the current Quad Port Configuration from the Quad Port device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [out] | pQuadPortConfig | is a pointer to a QUAD_PORT_CONFIG structure into which the Quad Port Configuration will be written and returned |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – pQuadPortConfig is an unexpected value |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support Quad Port Configuration |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| 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 Descriptor from the device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [out] | lpbSelfPower | points to a buffer into which a Boolean flag where TRUE means the Self-Powered bit is set, and FALSE means the Self-Powered bit is clear will be written |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpbSelfPower is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_Open | ( | const uint32_t | DeviceIndex, |
| PHANDLE | pcyHandle | ||
| ) |
Opens a handle to the device.
Opens and returns a handle to a device using a device index determined by the number returned from CP210x_GetNumDevices().
Close by passing the returned handle to CP210x_Close()
| [in] | DeviceIndex | is the desired device's zero-based index into the device list used to determine CP210x_GetNumDevices(). 0 for the first device, 1 for the second, etc. |
| [out] | pcyHandle | is a pointer to a HANDLE/4-byte location to hold the returned open handle to the device |
The returned handle is used for all/most subsequent accesses to the device (I.e. the cyHandle parameter to all/most other API functions)
| CP210x_SUCCESS | – success |
| CP210x_INVALID_PARAMETER | – pcyHandle is an unexpected value |
| CP210x_DEVICE_NOT_FOUND | – the device specified by the DeviceIndex was not found |
| CP210x_STATUS CP210x_Reset | ( | const HANDLE | cyHandle | ) |
Initiates a reset of the USB device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support Reset |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_SetBaudRateConfig | ( | const HANDLE | cyHandle, |
| PBAUD_CONFIG | pBaudConfig | ||
| ) |
Sets the baud rate configuration data of the device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | pBaudConfig | is a pointer to a BAUD_CONFIG structure containing the Baud Config data to be set on the device. |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – pBaudConfig is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support setting of the Baud Rate Configuration |
| CP210x_STATUS CP210x_SetConfig | ( | const HANDLE | cyHandle, |
| uint8_t * | lpbConfig, | ||
| const uint16_t | bLength | ||
| ) |
Program the device's configurable area with the given byte array.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | lpbConfig | points to a buffer containing the configuration to be programmed to the device |
| [in] | bLength | is the number of bytes in the lpbConfig buffer |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpbConfig or bLength is an unexpected value |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support reporting its Firmware Version |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| 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.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | bDeviceModeECI | Set to 0 for modem mode for Enhanced interface |
| [in] | bDeviceModeSCI | Set to 0 for modem mode for Standard interface |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support setting of the Device Mode |
| 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.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | wVersion | is the 2-byte Device Release Version number in Binary-Coded Decimal (BCD) format with the upper two nibbles containing the two decimal digits of the major version and the lower two nibbles containing the two decimal digits of the minor version. |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_SetDualPortConfig | ( | const HANDLE | cyHandle, |
| DUAL_PORT_CONFIG * | pDualPortConfig | ||
| ) |
Sets the current port pin configuration from the device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | pDualPortConfig | is a pointer to a DUAL_PORT_CONFIG structure |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – pDualPortConfig is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support setting of the port pin configuration |
| CP210x_STATUS CP210x_SetFlushBufferConfig | ( | const HANDLE | cyHandle, |
| const uint16_t | wFlushBufferConfig | ||
| ) |
Sets the Flush Buffer configuration of the device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | wFlushBufferConfig | is a 2-byte bitmask Set to determine which buffer/s to flush (TX and/or RX) and upon which event (Open and/or Close). |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support Flush Buffer Config |
| 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.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | lpbGeneric | points to a buffer containing the USB command to be sent to the device |
| [in] | bLength | is the number of bytes in the lpbGeneric buffer |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_PARAMETER | – lpbGeneric or bLength is an unexpected value |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support the specified comman |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| 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's specified interface's iInterface USB String Descriptor.
If the string is not already in Unicode format, the function can convert the string to Unicode before committing it to programmable memory (set bIsStringASCII to TRUE). The character size limit (in characters, not bytes), NOT including a NULL terminator, is CP2105_MAX_INTERFACE_STRLEN or CP2108_MAX_INTERFACE_STRLEN for the CP2105 and CP2108 devices respectively.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | bInterfaceNumber | is Set to 0 for Enhanced Interface String, or 1 for Standard Interface String on the CP2105. 0 - 3 for the CP2108 which has 4 interfaces. |
| [in] | lpvInterfaceString | is a pointer to a buffer containing the Interface String value |
| [in] | bInterfaceStringLength | is the length of the string in characters NOT including a NULL terminator. |
| [in] | bIsStringASCII | is a flag indicating whether the string is ASCII and needs converting to UNICODE (TRUE), else FALSE. |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – bInterfaceNumber, lpvInterfaceString or bInterfaceStringLength is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_FUNCTION_NOT_SUPPORTED | – Only the CP2105 and CP2108 have (multiple) interfaces and thus interface strings |
| CP210x_STATUS CP210x_SetLockValue | ( | const HANDLE | cyHandle | ) |
Sets the Lock Value of a device – prevents all future customizing of the device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support setting of the Lock Value |
| 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's USB Device Descriptor's iManufacturer USB String Descriptor.
If the string is not already in Unicode format, the function can convert the string to Unicode before committing it to programmable memory (set bIsStringASCII to TRUE). The character size limit (in characters, not bytes), NOT including a NULL terminator, is CP210x_MAX_MANUFACTURER_STRLEN for the device type.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | lpvManufacturerString | is a pointer to a buffer containing the Manufacturer String value |
| [in] | bManufacturerStringLength | is the length of the string in characters NOT including a NULL terminator. |
| [in] | bIsStringASCII | is a flag indicating whether the string is ASCII and needs converting to UNICODE (TRUE), else FALSE. |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpvManufacturer or bManufacturerStringLength is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_SetMaxPower | ( | const HANDLE | cyHandle, |
| const uint8_t | bMaxPower | ||
| ) |
Sets the Max Power field of the USB Configuration Descriptor of the device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | bMaxPower | is a 1-byte value representing the maximum power consumption of the CP210x USB device, expressed in 2 mA units. |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_SetPid | ( | const HANDLE | cyHandle, |
| const uint16_t | Pid | ||
| ) |
Sets the Product ID field of the device's USB Device Descriptor.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | Pid | is the 2-byte Product ID value. |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_SetPortConfig | ( | const HANDLE | cyHandle, |
| PORT_CONFIG * | pPortConfig | ||
| ) |
Sets the current port pin configuration from the device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | pPortConfig | is a pointer to a PORT_CONFIG structure |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – pPortConfig is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support setting of the port pin configuration |
| 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's USB Device Descriptor's iProduct USB String Descriptor.
If the string is not already in Unicode format, the function can convert the string to Unicode before committing it to programmable memory (set bIsStringASCII to TRUE). The character size limit (in characters, not bytes), NOT including a NULL terminator, is CP210x_MAX_PRODUCT_STRLEN or CP2105_MAX_PRODUCT_STRLEN.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | lpvProductString | is a pointer to a buffer containing the Product String value |
| [in] | bProductStringLength | is the length of the string in characters NOT including a NULL terminator. |
| [in] | bIsStringASCII | is a flag indicating whether the string is ASCII and needs converting to UNICODE (TRUE), else FALSE. |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpvProductString or bProductStringLength is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_SetQuadPortConfig | ( | const HANDLE | cyHandle, |
| QUAD_PORT_CONFIG * | pQuadPortConfig | ||
| ) |
Sets the current port pin configuration from the device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | pQuadPortConfig | is a pointer to a QUAD_PORT_CONFIG structure |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – pQuadPortConfig is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support setting of the port pin configuration |
| 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 on the device.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | bSelfPower | is a Boolean flag where TRUE means set the Self-Powered bit, and FALSE means clear the Self-Powered bit. |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| 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's USB Device Descriptor's iSerialNumber USB String Descriptor.
If the string is not already in Unicode format, the function can convert the string to Unicode before committing it to programmable memory (set bIsStringASCII to TRUE). The character size limit(in characters, not bytes), NOT including a NULL terminator, is CP210x_MAX_SERIAL_STRLEN for the particular device type.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | lpvSerialNumberString | is a pointer to a buffer containing the Serial Number String value |
| [in] | bSerialNumberStringLength | is the length of the string in characters NOT including a NULL terminator. |
| [in] | bIsStringASCII | is a flag indicating whether the string is ASCII and needs converting to UNICODE (TRUE), else FALSE. |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_INVALID_PARAMETER | – lpvSerialNumberString or bSerialNumberStringLength is an unexpected value |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support setting of the Serial Number string |
| CP210x_STATUS CP210x_SetVid | ( | const HANDLE | cyHandle, |
| const uint16_t | Vid | ||
| ) |
Sets the Vendor ID field of the device's USB Device Descriptor.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| [in] | Vid | is the 2-byte Vendor ID value. |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |
| CP210x_STATUS CP210x_UpdateFirmware | ( | const HANDLE | cyHandle | ) |
Requests device enter Bootloader mode.
| [in] | cyHandle | is an open handle to the device as returned by CP210x_Open() |
| CP210x_SUCCESS | – success |
| CP210x_INVALID_HANDLE | – cyHandle is invalid |
| CP210x_FUNCTION_NOT_SUPPORTED | – the device does not support Update Firmware |
| CP210x_DEVICE_IO_FAILED | – the device failed to respond to I/O in any expected manner |