1 #ifndef HOST_LIB_SIUSBXP_INCLUDE_SIUSBXP_H_INCLUDED_9QM3BKN3FX 2 #define HOST_LIB_SIUSBXP_INCLUDE_SIUSBXP_H_INCLUDED_9QM3BKN3FX 41 #include "silabs_defs.h" 42 #include "silabs_sal.h" 52 #ifdef SI_USB_XP_EXPORTS 55 #define SI_USB_XP_API __declspec(dllimport) 56 #pragma comment (lib, "SiUSBXp.lib") 66 typedef enum _SI_STATUS {
90 #define SI_RETURN_SERIAL_NUMBER 0x00 91 #define SI_RETURN_DESCRIPTION 0x01 92 #define SI_RETURN_LINK_NAME 0x02 93 #define SI_RETURN_VID 0x03 94 #define SI_RETURN_PID 0x04 97 #define SI_RX_NO_OVERRUN 0x00 100 #define SI_RX_EMPTY 0x00 101 #define SI_RX_OVERRUN 0x01 102 #define SI_RX_READY 0x02 105 #define SI_MAX_DEVICE_STRLEN 256 108 #define SI_MAX_READ_SIZE 4096*16 109 #define SI_MAX_WRITE_SIZE 4096 118 #define SI_HELD_INACTIVE 0x00 119 #define SI_HELD_ACTIVE 0x01 120 #define SI_FIRMWARE_CONTROLLED 0x02 121 #define SI_RECEIVE_FLOW_CONTROL 0x02 122 #define SI_TRANSMIT_ACTIVE_SIGNAL 0x03 123 #define SI_STATUS_INPUT 0x00 124 #define SI_HANDSHAKE_LINE 0x01 127 #define SI_GPIO_0 (1<<0) 130 #define SI_GPIO_1 (1<<1) 131 #define SI_GPIO_2 (1<<2) 132 #define SI_GPIO_3 0x0008 133 #define SI_GPIO_4 0x0010 134 #define SI_GPIO_5 0x0020 135 #define SI_GPIO_6 0x0040 136 #define SI_GPIO_7 0x0080 137 #define SI_GPIO_8 0x0100 138 #define SI_GPIO_9 0x0200 139 #define SI_GPIO_10 0x0400 140 #define SI_GPIO_11 0x0800 141 #define SI_GPIO_12 0x1000 142 #define SI_GPIO_13 0x2000 143 #define SI_GPIO_14 0x4000 144 #define SI_GPIO_15 0x8000 147 #define SI_USBXPRESS_EFM8 CP210x_PARTNUM_USBXPRESS_EFM8 150 #define SI_USBXPRESS_EFM32 CP210x_PARTNUM_USBXPRESS_EFM32 151 #define SI_CP2101_VERSION CP210x_PARTNUM_CP2101 152 #define SI_CP2102_VERSION CP210x_PARTNUM_CP2102 153 #define SI_CP2103_VERSION CP210x_PARTNUM_CP2103 154 #define SI_CP2104_VERSION CP210x_PARTNUM_CP2104 155 #define SI_CP2105_VERSION CP210x_PARTNUM_CP2105 156 #define SI_CP2108_VERSION CP210x_PARTNUM_CP2108 157 #define SI_CP2109_VERSION CP210x_PARTNUM_CP2109 158 #define SI_CP2102N_QFN28_VERSION CP210x_PARTNUM_CP2102N_QFN28 159 #define SI_CP2102N_QFN24_VERSION CP210x_PARTNUM_CP2102N_QFN24 160 #define SI_CP2102N_QFN20_VERSION CP210x_PARTNUM_CP2102N_QFN20 168 #pragma pack(push, 1) 172 ULONG ulAmountInInQueue;
173 ULONG ulAmountInOutQueue;
175 UCHAR bWaitForImmediate;
197 _Out_writes_bytes_(
sizeof(DWORD)) _Pre_defensive_ LPDWORD lpdwNumDevices
243 _In_ _Pre_defensive_
const DWORD dwDeviceIndex,
245 _In_ _Pre_defensive_
const DWORD dwFlags
291 _In_ _Pre_defensive_
const DWORD dwDeviceIndex,
292 _Out_writes_bytes_(DeviceStringLenInBytes) LPVOID lpvDeviceString,
293 _In_ _Pre_defensive_
const size_t DeviceStringLenInBytes,
294 _In_ _Pre_defensive_
const DWORD dwFlags
322 _In_ _Pre_defensive_
const DWORD DeviceIndex,
323 _Out_writes_bytes_(
sizeof(HANDLE)) _Pre_defensive_ PHANDLE pcyHandle
339 _In_ _Pre_defensive_
const HANDLE cyHandle
378 _In_ _Pre_defensive_
const HANDLE cyHandle,
379 _Out_writes_bytes_(dwBytesToRead) LPVOID lpBuffer,
381 _Out_range_(0,dwBytesToRead) LPDWORD lpdwBytesReturned,
382 _In_opt_ LPOVERLAPPED lpOverlapped = NULL
413 _In_ _Pre_defensive_
const HANDLE cyHandle,
414 _In_reads_bytes_(dwBytesToWrite) _Pre_defensive_ LPVOID lpBuffer,
416 _Out_range_(0, dwBytesToWrite) _Pre_defensive_ LPDWORD lpdwBytesWritten,
417 _In_opt_ LPOVERLAPPED lpOverlapped = NULL
446 _In_ _Pre_defensive_
const HANDLE cyHandle,
447 _In_ _Pre_defensive_
const DWORD dwIoControlCode,
449 _In_ _Pre_defensive_
const DWORD dwBytesToRead,
451 _In_ _Pre_defensive_
const DWORD dwBytesToWrite,
452 LPDWORD lpdwBytesSucceeded
480 _In_ _Pre_defensive_
const HANDLE cyHandle,
481 _In_ _Pre_defensive_
const BYTE FlushTransmit,
482 _In_ _Pre_defensive_
const BYTE FlushReceive
504 _In_ _Pre_defensive_
const DWORD dwReadTimeoutInMilliseconds,
505 _In_ _Pre_defensive_
const DWORD dwWriteTimeoutInMilliseconds
526 _Out_writes_bytes_(
sizeof(DWORD)) _Pre_defensive_ LPDWORD lpdwReadTimeout,
527 _Out_writes_bytes_(
sizeof(DWORD)) _Pre_defensive_ LPDWORD lpdwWriteTimeout
552 _In_ _Pre_defensive_
const HANDLE cyHandle,
553 _Out_writes_bytes_(
sizeof(DWORD)) _Pre_defensive_ LPDWORD lpdwNumBytesInQueue,
554 _Out_writes_bytes_(
sizeof(DWORD)) _Pre_defensive_ LPDWORD lpdwQueueStatus
576 _In_ _Pre_defensive_
const HANDLE cyHandle,
577 _In_ _Pre_defensive_
const DWORD dwBaudRate
600 _In_ _Pre_defensive_
const HANDLE cyHandle,
601 _In_ _Pre_defensive_
const WORD wBaudDivisor
639 _In_ _Pre_defensive_
const HANDLE cyHandle,
640 _In_ _Pre_defensive_
const WORD wLineControl
688 _In_ _Pre_defensive_
const HANDLE cyHandle,
689 _In_ _Pre_defensive_
const BYTE bCTS_MaskCode,
690 _In_ _Pre_defensive_
const BYTE bRTS_MaskCode,
691 _In_ _Pre_defensive_
const BYTE bDTR_MaskCode,
692 _In_ _Pre_defensive_
const BYTE bDSR_MaskCode,
693 _In_ _Pre_defensive_
const BYTE bDCD_MaskCode,
694 _In_ _Pre_defensive_
const BOOL bFlowXonXoff
722 _In_ _Pre_defensive_
const HANDLE cyHandle,
723 _Out_writes_bytes_(
sizeof(
BYTE)) _Pre_defensive_ PBYTE pModemStatus
751 _In_ _Pre_defensive_
const HANDLE cyHandle,
752 _Out_writes_bytes_(
sizeof(
COMM_STATUS)) _Pre_defensive_ PCOMM_STATUS pCommStatus
776 _In_ _Pre_defensive_
const HANDLE cyHandle,
777 _In_ _Pre_defensive_
const WORD wBreakState
802 _In_ _Pre_defensive_
const HANDLE cyHandle,
803 _Out_writes_bytes_(
sizeof(WORD)) _Pre_defensive_ LPWORD lpwLatch
827 _In_ _Pre_defensive_
const HANDLE cyHandle,
828 _In_ _Pre_defensive_
const WORD mask,
829 _In_ _Pre_defensive_
const WORD latch
850 _In_ _Pre_defensive_
const HANDLE cyHandle,
851 _Out_writes_bytes_(
sizeof(
BYTE)) _Pre_defensive_ LPBYTE lpbPartNum
871 _In_ _Pre_defensive_
const HANDLE cyHandle,
872 _Out_writes_bytes_(2 *
sizeof(
BYTE)) _Pre_defensive_
BYTE pLibraryVersion[2]
892 _In_ _Pre_defensive_
const HANDLE cyHandle,
893 _Out_writes_bytes_(
sizeof(
BYTE)) _Pre_defensive_ LPBYTE lpbInterfaceNum
920 _In_ _Pre_defensive_
const HANDLE cyHandle,
921 _Out_writes_bytes_(*lpbProductStringLengthInBytes) _Pre_defensive_ LPVOID lpProductString,
922 _Out_writes_bytes_(1) _Pre_defensive_ LPBYTE lpbProductStringLengthInBytes,
923 _In_ _Pre_defensive_
const BOOL bConvertToASCII = TRUE
939 _Out_writes_bytes_(
sizeof(DWORD)) _Pre_defensive_ DWORD* HighVersion,
940 _Out_writes_bytes_(
sizeof(DWORD)) _Pre_defensive_ DWORD* LowVersion
955 _Out_writes_bytes_(
sizeof(DWORD)) _Pre_defensive_ DWORD* HighVersion,
956 _Out_writes_bytes_(
sizeof(DWORD)) _Pre_defensive_ DWORD* LowVersion
973 _In_ _Pre_defensive_
const HANDLE cyHandle
991 _In_ _Pre_defensive_
const HANDLE cyHandle,
992 LPOVERLAPPED lpOverlapped
1001 #endif //HOST_LIB_SIUSBXP_INCLUDE_SIUSBXP_H_INCLUDED_9QM3BKN3FX Nothing to cancel.
Definition: SiUSBXp.h:83
SI_STATUS SI_GetProductString(const DWORD dwDeviceIndex, LPVOID lpvDeviceString, const DWORD dwFlags)
Gets a "Product string".
char SI_DEVICE_STRING[256]
Device string.
Definition: SiUSBXp.h:114
SILABS_STATUS no error
Definition: SiUSBXp.h:67
SI_STATUS SI_SetBreak(const HANDLE cyHandle, const WORD wBreakState)
Send a break state to the device.
SI_STATUS SI_GetNumDevices(LPDWORD lpdwNumDevices)
Determines the number of CP210x devices configured as DirectAccess devices connected to the system...
SI_STATUS SI_GetCommStatus(const HANDLE cyHandle, PCOMM_STATUS pCommStatus)
Get the Comm Status from the device.
SI_STATUS SI_CancelIoEx(const HANDLE cyHandle, LPOVERLAPPED lpOverlapped)
Cancels particular pending IO on a device opened with an OVERLAPPED object.
SI_STATUS SI_SetTimeouts(const DWORD dwReadTimeoutInMilliseconds, const DWORD dwWriteTimeoutInMilliseconds)
Set the Read- and Write-timeouts.
Read timed out.
Definition: SiUSBXp.h:80
Write timed out.
Definition: SiUSBXp.h:81
SI_STATUS SI_GetDriverVersion(DWORD *HighVersion, DWORD *LowVersion)
Reads and returns the kernel-mode driver version from the driver (deprecated (architecture no longer ...
INvalid baudrate.
Definition: SiUSBXp.h:76
#define __declspec(n)
__declspec(n) defination
Definition: SiUSBXp.h:59
no error
Definition: silabs_defs.h:262
the specified function is not supported
Definition: SiUSBXp.h:77
SI_STATUS SI_FlushBuffers(const HANDLE cyHandle, const BYTE FlushTransmit, const BYTE FlushReceive)
Flush Buffers.
#define SI_MAX_WRITE_SIZE
Max Write Size.
Definition: SiUSBXp.h:109
SI_STATUS SI_GetDeviceProductString(const HANDLE cyHandle, LPVOID lpProductString, LPBYTE lpbProductStringLengthInBytes, const BOOL bConvertToASCII=TRUE)
Reads and returns the Product string directly from the device.
SI_STATUS SI_SetBaudDivisor(const HANDLE cyHandle, const WORD wBaudDivisor)
Set the baudrate on the device using a divisor.
SI_STATUS SI_SetBaudRate(const HANDLE cyHandle, const DWORD dwBaudRate)
Set the baudrate on the device.
Reset error.
Definition: SiUSBXp.h:72
#define SI_MAX_DEVICE_STRLEN
Max Device String Length.
Definition: SiUSBXp.h:107
SI_STATUS SI_WriteLatch(const HANDLE cyHandle, const WORD mask, const WORD latch)
Writes a new port latch value to the device.
device I/O failed
Definition: SiUSBXp.h:75
Write error.
Definition: SiUSBXp.h:71
SI_STATUS SI_GetPartLibraryVersion(const HANDLE cyHandle, BYTE pLibraryVersion[2])
Reads and returns the firmware library version from the device.
Invalid Request Length.
Definition: SiUSBXp.h:74
an handle parameter was not valid
Definition: SiUSBXp.h:68
SI_STATUS SI_Read(const HANDLE cyHandle, LPVOID lpBuffer, const DWORD dwBytesToRead, LPDWORD lpdwBytesReturned, LPOVERLAPPED lpOverlapped=NULL)
Read from the device.
SI_STATUS SI_GetProductStringSafe(const DWORD dwDeviceIndex, LPVOID lpvDeviceString, const size_t DeviceStringLenInBytes, const DWORD dwFlags)
Gets a "Product string".
#define SI_USB_XP_API
SI_USB_XP_API defination.
Definition: SiUSBXp.h:60
an unexpected, unrecoverable error happened while interacting with the operating system ...
Definition: SiUSBXp.h:79
CP210x struct for reading from the device. Alias of this struct is COMM_STATUS.
Read error.
Definition: SiUSBXp.h:69
#define CP210x_MAX_DEVICE_STRLEN
CP210x Maximum Device-side string length.
Definition: CP210xManufacturingDLL.h:140
Receive Queue NOT ready.
Definition: SiUSBXp.h:70
SI_STATUS SI_SetFlowControl(const HANDLE cyHandle, const BYTE bCTS_MaskCode, const BYTE bRTS_MaskCode, const BYTE bDTR_MaskCode, const BYTE bDSR_MaskCode, const BYTE bDCD_MaskCode, const BOOL bFlowXonXoff)
Set the flow control settings.
SI_STATUS SI_Write(const HANDLE cyHandle, LPVOID lpBuffer, const DWORD dwBytesToWrite, LPDWORD lpdwBytesWritten, LPOVERLAPPED lpOverlapped=NULL)
Write buffer to device.
SI_STATUS SI_GetInterfaceNumber(const HANDLE cyHandle, LPBYTE lpbInterfaceNum)
Get Interface Number.
unsigned char BYTE
Byte definition.
Definition: silabs_defs.h:41
SI_STATUS SI_GetPartNumber(const HANDLE cyHandle, LPBYTE lpbPartNum)
Reads and returns the Part Number from the device.
SI_STATUS SI_GetModemStatus(const HANDLE cyHandle, PBYTE pModemStatus)
Get the Modem Status from the device, including the modem pin states.
global data error
Definition: SiUSBXp.h:78
SI_STATUS
Definition: SiUSBXp.h:66
SI_STATUS SI_GetDLLVersion(DWORD *HighVersion, DWORD *LowVersion)
Reads and returns the DLL library version from the DLL.
SI_STATUS SI_GetTimeouts(LPDWORD lpdwReadTimeout, LPDWORD lpdwWriteTimeout)
Reads and returns the Read- and Write-timeouts.
SI_STATUS SI_CancelIo(const HANDLE cyHandle)
Cancels any pending IO on a device opened with an OVERLAPPED object.
Definition: SiUSBXp.h:169
SI_STATUS SI_Close(const HANDLE cyHandle)
Closes an open handle to the device.
a parameter was not valid
Definition: SiUSBXp.h:73
I/O pending.
Definition: SiUSBXp.h:82
#define SI_MAX_READ_SIZE
Max Read Size.
Definition: SiUSBXp.h:108
SI_STATUS SI_Open(const DWORD DeviceIndex, PHANDLE pcyHandle)
Opens a handle to the device.
SI_STATUS SI_SetLineControl(const HANDLE cyHandle, const WORD wLineControl)
Set the line control settings.
enum _SI_STATUS * PSI_STATUS
API Status return codes pointer.
SI_STATUS SI_ReadLatch(const HANDLE cyHandle, LPWORD lpwLatch)
Reads and returns the current port latch value from the device.
the specified device was not found
Definition: SiUSBXp.h:84
SI_STATUS SI_DeviceIOControl(const HANDLE cyHandle, const DWORD dwIoControlCode, LPVOID lpInBuffer, const DWORD dwBytesToRead, LPVOID lpOutBuffer, const DWORD dwBytesToWrite, LPDWORD lpdwBytesSucceeded)
Issue an I/O Control to the device.
SI_STATUS SI_CheckRXQueue(const HANDLE cyHandle, LPDWORD lpdwNumBytesInQueue, LPDWORD lpdwQueueStatus)
Retrieve receive queue status.
#define WINAPI
WINAPI defination.
Definition: SiUSBXp.h:61