From: R. Steve McKown Date: Mon, 17 May 2010 21:04:35 +0000 (-0600) Subject: Add defines for mode, latch and enhanced function bits, with documentation. X-Git-Tag: debian/0.11.3-3tmi~10 X-Git-Url: https://oss.titaniummirror.com/gitweb?p=cp210x.git;a=commitdiff_plain;h=3c0ea1205a69103a17f39f9b0a96d99207fe0451 Add defines for mode, latch and enhanced function bits, with documentation. --- diff --git a/src/cp210x.h b/src/cp210x.h index f3c96a8..a2060e5 100644 --- a/src/cp210x.h +++ b/src/cp210x.h @@ -50,6 +50,77 @@ #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;