summaryrefslogtreecommitdiff
path: root/src/class/cdc/serial/cp210x.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/class/cdc/serial/cp210x.h')
-rw-r--r--src/class/cdc/serial/cp210x.h56
1 files changed, 54 insertions, 2 deletions
diff --git a/src/class/cdc/serial/cp210x.h b/src/class/cdc/serial/cp210x.h
index 2c749f522..a0eff9e40 100644
--- a/src/class/cdc/serial/cp210x.h
+++ b/src/class/cdc/serial/cp210x.h
@@ -28,9 +28,10 @@
// Protocol details can be found at AN571: CP210x Virtual COM Port Interface
// https://www.silabs.com/documents/public/application-notes/AN571.pdf
-#define TU_CP210X_VID 0x10C4
+// parts are overtaken from vendors driver
+// https://www.silabs.com/documents/public/software/cp210x-3.1.0.tar.gz
-/* Config request codes */
+// Config request codes
#define CP210X_IFC_ENABLE 0x00
#define CP210X_SET_BAUDDIV 0x01
#define CP210X_GET_BAUDDIV 0x02
@@ -59,4 +60,55 @@
#define CP210X_SET_BAUDRATE 0x1E
#define CP210X_VENDOR_SPECIFIC 0xFF // GPIO, Recipient must be Device
+// SILABSER_IFC_ENABLE_REQUEST_CODE
+#define CP210X_UART_ENABLE 0x0001
+#define CP210X_UART_DISABLE 0x0000
+
+// SILABSER_SET_BAUDDIV_REQUEST_CODE
+#define CP210X_BAUD_RATE_GEN_FREQ 0x384000
+
+// SILABSER_SET_LINE_CTL_REQUEST_CODE
+#define CP210X_BITS_DATA_MASK 0x0f00
+#define CP210X_BITS_DATA_5 0x0500
+#define CP210X_BITS_DATA_6 0x0600
+#define CP210X_BITS_DATA_7 0x0700
+#define CP210X_BITS_DATA_8 0x0800
+#define CP210X_BITS_DATA_9 0x0900
+
+#define CP210X_BITS_PARITY_MASK 0x00f0
+#define CP210X_BITS_PARITY_NONE 0x0000
+#define CP210X_BITS_PARITY_ODD 0x0010
+#define CP210X_BITS_PARITY_EVEN 0x0020
+#define CP210X_BITS_PARITY_MARK 0x0030
+#define CP210X_BITS_PARITY_SPACE 0x0040
+
+#define CP210X_BITS_STOP_MASK 0x000f
+#define CP210X_BITS_STOP_1 0x0000
+#define CP210X_BITS_STOP_1_5 0x0001
+#define CP210X_BITS_STOP_2 0x0002
+
+// SILABSER_SET_BREAK_REQUEST_CODE
+#define CP210X_BREAK_ON 0x0001
+#define CP210X_BREAK_OFF 0x0000
+
+// SILABSER_SET_MHS_REQUEST_CODE
+#define CP210X_MCR_DTR 0x0001
+#define CP210X_MCR_RTS 0x0002
+#define CP210X_MCR_ALL 0x0003
+#define CP210X_MSR_CTS 0x0010
+#define CP210X_MSR_DSR 0x0020
+#define CP210X_MSR_RING 0x0040
+#define CP210X_MSR_DCD 0x0080
+#define CP210X_MSR_ALL 0x00F0
+
+#define CP210X_CONTROL_WRITE_DTR 0x0100UL
+#define CP210X_CONTROL_WRITE_RTS 0x0200UL
+
+#define CP210X_LSR_BREAK 0x0001
+#define CP210X_LSR_FRAMING_ERROR 0x0002
+#define CP210X_LSR_HW_OVERRUN 0x0004
+#define CP210X_LSR_QUEUE_OVERRUN 0x0008
+#define CP210X_LSR_PARITY_ERROR 0x0010
+#define CP210X_LSR_ALL 0x001F
+
#endif //TUSB_CP210X_H