]> oss.titaniummirror.com Git - cp210x.git/commitdiff
Add defines for mode, latch and enhanced function bits, with documentation.
authorR. Steve McKown <rsmckown@gmail.com>
Mon, 17 May 2010 21:04:35 +0000 (15:04 -0600)
committerR. Steve McKown <rsmckown@gmail.com>
Thu, 20 May 2010 01:21:17 +0000 (19:21 -0600)
src/cp210x.h

index f3c96a801baa7a97e7221a227b549c1359fc4b3a..a2060e588baaf31ee7dd90076175dfec0a55b4cb 100644 (file)
 #define        CP210x_MAX_PRODUCT_STRLEN       126
 #define        CP210x_MAX_SERIAL_STRLEN        63
 
+/* Mode and latch bit to pin assignments. See AN223 from SiLabs:
+ * https://www.silabs.com/Support Documents/TechnicalDocs/an223.pdf
+ *
+ *  15 - /SUSPEND      Can't configure latch
+ *  14 - SUSPEND       Can't configure latch
+ *  13 - unused
+ *  12 - unused
+ *  11 - GPIO_3
+ *  10 - GPIO_2
+ *   9 - GPIO_1
+ *   8 - GPIO_0
+ *   7 - /CTS
+ *   6 - /RTS
+ *   5 - RXD   Note: set latch value to '1' for proper operation.
+ *   4 - TXD
+ *   3 - /DSR
+ *   2 - /DTR
+ *   1 - /DCD
+ *   0 - /RI
+ *
+ * Mode bit values:
+ *   1 - A value of one in a bit places the corresponding IO pin in push-
+ *       pull output mode.
+ *   0 - A value of zero in a bit places the corresponding IO pin in open-
+ *       drain output mode.
+ *
+ * Latch bit values:
+ *   1 - A value of one in a bit sets the corresponding IO pin's value to
+ *       output high.  If the mode is push-pull, the pin sources current
+ *       from VIO.  If the mode is open-drain, the pin driver is in high
+ *       impedance.
+ *   0 - A value of zero in a bit sets the corresponding IO pin's value to
+ *       output low.  In either mode, push-pull or open-drain, the pin
+ *       driver sinks current to ground.
+ */
+#define CP210x_CFG_nSUSPEND            0x8000
+#define CP210x_CFG_SUSPEND             0x4000
+#define CP210x_CFG_UNUSED13            0x2000
+#define CP210x_CFG_UNUSED12            0x1000
+#define CP210x_CFG_GPIO_3              0x0800
+#define CP210x_CFG_GPIO_2              0x0400
+#define CP210x_CFG_GPIO_1              0x0200
+#define CP210x_CFG_GPIO_0              0x0100
+#define CP210x_CFG_nCTS                        0x0080
+#define CP210x_CFG_nRTS                        0x0040
+#define CP210x_CFG_RXD                 0x0020
+#define CP210x_CFG_TXD                 0x0010
+#define CP210x_CFG_nDSR                        0x0008
+#define CP210x_CFG_nDTR                        0x0004
+#define CP210x_CFG_nDCD                        0x0002
+#define CP210x_CFG_nRI                 0x0001
+
+/* Enhanced function bits:
+ *   7 - GPIO dynamic suspend, for 4 GPIO signals
+ *   6 - Serial dynamic suspend, for 8 UART/Modem signals
+ *   5 - unused, leave zero
+ *   4 - Enable weak pull-ups
+ *   3 - unused, leave zero
+ *   2 - /RS485_TX on GPIO_2
+ *   1 - /RXLED on GPIO_1
+ *   0 - /TXLED on GPIO_0
+*/
+#define CP210x_ENH_GPIO_DYNSUSP                0x80
+#define CP210x_ENH_SERIAL_DYNSUSP      0x40
+#define CP210x_ENH_UNUSED5             0x20
+#define CP210x_ENH_PULLUPS             0x10
+#define CP210x_ENH_UNUSED3             0x08
+#define CP210x_ENH_nRS485_TX           0x04
+#define CP210x_ENH_nRXLED              0x02
+#define CP210x_ENH_nTXLED              0x01
+
 /* Used to pass variable sized buffers between user and kernel space (ioctls) */
 struct cp210x_buffer {
        __u8 *buf;