summaryrefslogtreecommitdiff
path: root/src/class/cdc/serial
diff options
context:
space:
mode:
authorhathach <[email protected]>2024-01-17 14:45:09 +0700
committerhathach <[email protected]>2024-01-17 14:45:09 +0700
commitf221c0fb6683fc552febbb9a52300d66f031d275 (patch)
tree2b47cf7b3a2537fe2b8f7a6d45d20f33f787a914 /src/class/cdc/serial
parent482a8068a51025ee8c31ccdb4355801c185172cc (diff)
more clean up
Diffstat (limited to 'src/class/cdc/serial')
-rw-r--r--src/class/cdc/serial/ch34x.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/class/cdc/serial/ch34x.h b/src/class/cdc/serial/ch34x.h
index 557e093a9..54b5b3560 100644
--- a/src/class/cdc/serial/ch34x.h
+++ b/src/class/cdc/serial/ch34x.h
@@ -27,6 +27,10 @@
#ifndef _CH34X_H_
#define _CH34X_H_
+// There is no official documentation for the CH34x chips. Reference can be found
+// - https://github.com/WCHSoftGroup/ch341ser_linux
+// - https://github.com/torvalds/linux/blob/master/drivers/usb/serial/ch341.c
+
// set line_coding @ enumeration
#ifdef CFG_TUH_CDC_LINE_CODING_ON_ENUM
#define CFG_TUH_CDC_LINE_CODING_ON_ENUM_CH34X CFG_TUH_CDC_LINE_CODING_ON_ENUM
@@ -41,6 +45,15 @@
#define CH34X_REQ_SERIAL_INIT 0xA1 // dec 161
#define CH34X_REQ_MODEM_CTRL 0xA4 // dev 164
+#define CH34X_REG_BREAK 0x05
+#define CH34X_REG_PRESCALER 0x12
+#define CH34X_REG_DIVISOR 0x13
+#define CH34X_REG_LCR 0x18
+#define CH34X_REG_LCR2 0x25
+#define CH34X_REG_MCR_MSR 0x06
+#define CH34X_REG_MCR_MSR2 0x07
+#define CH34X_NBREAK_BITS 0x01
+
// modem control bits
#define CH34X_BIT_RTS ( 1 << 6 )
#define CH34X_BIT_DTR ( 1 << 5 )