Major improvements to the ch341 driver
From: Grigori Goronzy
Date: Sat Apr 02 2016 - 13:19:40 EST
Hi,
this patchset consists of several improvements and cleanups to the
ch341 driver, which has been mostly unmaintained for the last few
years, despite major shortcomings. For instance, there is no support
at all for parity, which is an often used feature. Other settings
are missing too, as is hardware flow control.
Here's a summary of changes:
- Restructured initialization and configuration, which makes CH341A hardware
work for the first time and is the basis for some following additions.
- Support for the different parity modes, including mark/space
- Support for two stop bits
- Support for 5, 6 and 7 bit transfers
- Support for RTS/CTS hardware flow control
- Improved handling of B0 and DTR/RTS lines
- Added tx_empty callback
- Extracted magic numbers into definitions
- Cleaned up code style and debug/error messages
This has been tested on several different CH340G dongles and a
CH341A adapter which is designed for EEPROM programming (but still
supports UART). Functionality of the different configurations has
been verified with a logic analyzer. In addition I did some quick
interoperability tests with a CP2102 UART. My original motivation
for this work was parity support which I needed for stcgal [1],
and it works fine with that software too, of course.
Please review. I would also appreciate to get some more testing
done. In particular, I would like to make the sure the restructured
initialization does not break anything.
If you wonder, this is v2 because I initially sent it to the wrong list.
Best regards
Grigori
[1] https://github.com/grigorig/stcgal