Silicon Labs Host Libraries
SLABCP2110.h
1 // SLABCP2110.h
3 // For SLABHIDtoUART.dll
4 // and Silicon Labs CP2110 HID to UART
6 #ifndef SLAB_CP2110_H
7 #define SLAB_CP2110_H
8 
10 // Includes
12 
13 #include "SLABHIDtoUART.h"
14 #include "silabs_sal.h"
15 
17 // Pin Definitions
19 
21 #if defined(NOT_YET)
22 typedef enum _CP2110_PIN_CONFIG_INDEX {
23  CP2110_PIN_CONFIG_INDEX_GPIO_0_CLK = 0
24  , CP2110_PIN_CONFIG_INDEX_GPIO_1_RTS = 1
25  , CP2110_PIN_CONFIG_INDEX_GPIO_2_CTS = 2
26  , CP2110_PIN_CONFIG_INDEX_GPIO_3_RS485 = 3
27  , CP2110_PIN_CONFIG_INDEX_GPIO_4_TX_TOGGLE = 4
28  , CP2110_PIN_CONFIG_INDEX_GPIO_5_RX_TOGGLE = 5
29  , CP2110_PIN_CONFIG_INDEX_GPIO_6 = 6
30  , CP2110_PIN_CONFIG_INDEX_GPIO_7 = 7
31  , CP2110_PIN_CONFIG_INDEX_GPIO_8 = 8
32  , CP2110_PIN_CONFIG_INDEX_GPIO_9 = 9
33  , CP2110_PIN_CONFIG_INDEX_TX = 10
34  , CP2110_PIN_CONFIG_INDEX_SUSPEND = 11
35  , CP2110_PIN_CONFIG_INDEX_SUSPEND_BAR = 12
36  , CP2110_INDEXES_NUMBER_OF_INDEXES
37 } CP2110_PIN_CONFIG_INDEX, *PCP2110_PIN_CONFIG_INDEX;
38 #else // defined(NOT_YET)
39 #define CP2110_INDEX_GPIO_0_CLK 0
42 #define CP2110_INDEX_GPIO_1_RTS 1
43 #define CP2110_INDEX_GPIO_2_CTS 2
44 #define CP2110_INDEX_GPIO_3_RS485 3
45 #define CP2110_INDEX_GPIO_4_TX_TOGGLE 4
46 #define CP2110_INDEX_GPIO_5_RX_TOGGLE 5
47 #define CP2110_INDEX_GPIO_6 6
48 #define CP2110_INDEX_GPIO_7 7
49 #define CP2110_INDEX_GPIO_8 8
50 #define CP2110_INDEX_GPIO_9 9
51 #define CP2110_INDEX_TX 10
52 #define CP2110_INDEX_SUSPEND 11
53 #define CP2110_INDEX_SUSPEND_BAR 12
54 // Size of the above array pointed to by pinConfig parameter in @ref HidUart_SetPinConfig() and @ref HidUart_GetPinConfig()
55 #define CP2110_PIN_CONFIG_SIZE 13
56 #endif // defined(NOT_YET)
58 
62 // TODO: Enstone: typedef enum _CP2110_BITMASK_FOR_SUSPEND { } CP2110_BITMASK_FOR_SUSPEND, *PCP2110_BITMASK_FOR_SUSPEND;
63 #define CP2110_MASK_GPIO_0_CLK 0x0001
64 #define CP2110_MASK_GPIO_1_RTS 0x0002
65 #define CP2110_MASK_GPIO_2_CTS 0x0004
66 #define CP2110_MASK_GPIO_3_RS485 0x0008
67 #define CP2110_MASK_TX 0x0010
68 #define CP2110_MASK_RX 0x0020
69 #define CP2110_MASK_GPIO_4_TX_TOGGLE 0x0040
70 #define CP2110_MASK_GPIO_5_RX_TOGGLE 0x0080
71 #define CP2110_MASK_SUSPEND_BAR 0x0100
72 #define CP2110_MASK_NA 0x0200
73 #define CP2110_MASK_GPIO_6 0x0400
74 #define CP2110_MASK_GPIO_7 0x0800
75 #define CP2110_MASK_GPIO_8 0x1000
76 #define CP2110_MASK_GPIO_9 0x2000
77 #define CP2110_MASK_SUSPEND 0x4000
78 #define CP2110_MASK_NAII 0x8000
79 
81 // Exported Library Functions
84 
85 #ifdef __cplusplus
86 extern "C" {
87 #endif // __cplusplus
88 
89 // HidUart_SetPinConfig
105 _Check_return_
107 _Success_(return == HID_UART_SUCCESS)
109 HidUart_SetPinConfig(
110  _In_ _Pre_defensive_ const HID_UART_DEVICE device,
111  _In_reads_bytes_(CP2110_PIN_CONFIG_SIZE) _Pre_defensive_ BYTE* pinConfig,
112  _In_ _Pre_defensive_ const BOOL useSuspendValues,
113  _In_ _Pre_defensive_ const WORD suspendValue,
114  _In_ _Pre_defensive_ const WORD suspendMode,
115  _In_ _Pre_defensive_ const BYTE rs485Level,
116  _In_ _Pre_defensive_ const BYTE clkDiv
117 );
118 
119 // HidUart_GetPinConfig
135 _Check_return_
137 _Success_(return == HID_UART_SUCCESS)
139 HidUart_GetPinConfig(
140  _In_ _Pre_defensive_ const HID_UART_DEVICE device,
141  _Out_writes_bytes_(CP2110_PIN_CONFIG_SIZE) _Pre_defensive_ BYTE* pinConfig,
142  _Out_writes_bytes_(sizeof(BOOL)) _Pre_defensive_ BOOL* useSuspendValues,
143  _Out_writes_bytes_(sizeof(WORD)) _Pre_defensive_ WORD* suspendValue,
144  _Out_writes_bytes_(sizeof(WORD)) _Pre_defensive_ WORD* suspendMode,
145  _Out_writes_bytes_(sizeof(BYTE)) _Pre_defensive_ BYTE* rs485Level,
146  _Out_writes_bytes_(sizeof(BYTE)) _Pre_defensive_ BYTE* clkDiv
147 );
148 
149 #ifdef __cplusplus
150 }
151 #endif // __cplusplus
152 
153 #endif // SLAB_CP2110_H
HID_UART_STATUS
Definition: SLABHIDtoUART.h:85
This value should never be returned.
Definition: SLABHIDtoUART.h:104
Success.
Definition: SLABHIDtoUART.h:86
#define WINAPI
WINAPI.
Definition: CP210xManufacturingDLL.h:70
#define HID_TO_UART_API
HID to UART API.
Definition: SLABHIDtoUART.h:72
unsigned char BYTE
Byte definition.
Definition: silabs_defs.h:41
#define CP2110_PIN_CONFIG_SIZE
Config size, number of indexes.
Definition: SLABCP2110.h:55
void * HID_UART_DEVICE
HID to UART device.
Definition: SLABHIDtoUART.h:345