code style and clean up CDC serial header files
This commit is contained in:
@@ -24,8 +24,8 @@
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
#ifndef _CH34X_H_
|
||||
#define _CH34X_H_
|
||||
#ifndef TUSB_CH34X_H
|
||||
#define TUSB_CH34X_H
|
||||
|
||||
// There is no official documentation for the CH34x (CH340, CH341) chips. Reference can be found
|
||||
// - https://github.com/WCHSoftGroup/ch341ser_linux
|
||||
@@ -81,4 +81,4 @@
|
||||
#define CH34X_LCR_CS5 0x00
|
||||
#define CH34X_LCR_CS_MASK 0x03 // all CSx bits
|
||||
|
||||
#endif /* _CH34X_H_ */
|
||||
#endif // TUSB_CH34X_H
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
// 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
|
||||
@@ -60,14 +60,14 @@
|
||||
#define CP210X_SET_BAUDRATE 0x1E
|
||||
#define CP210X_VENDOR_SPECIFIC 0xFF // GPIO, Recipient must be Device
|
||||
|
||||
/* SILABSER_IFC_ENABLE_REQUEST_CODE */
|
||||
// SILABSER_IFC_ENABLE_REQUEST_CODE
|
||||
#define CP210X_UART_ENABLE 0x0001
|
||||
#define CP210X_UART_DISABLE 0x0000
|
||||
|
||||
/* SILABSER_SET_BAUDDIV_REQUEST_CODE */
|
||||
// SILABSER_SET_BAUDDIV_REQUEST_CODE
|
||||
#define CP210X_BAUD_RATE_GEN_FREQ 0x384000
|
||||
|
||||
/*SILABSER_SET_LINE_CTL_REQUEST_CODE */
|
||||
// SILABSER_SET_LINE_CTL_REQUEST_CODE
|
||||
#define CP210X_BITS_DATA_MASK 0x0f00
|
||||
#define CP210X_BITS_DATA_5 0x0500
|
||||
#define CP210X_BITS_DATA_6 0x0600
|
||||
@@ -87,11 +87,11 @@
|
||||
#define CP210X_BITS_STOP_1_5 0x0001
|
||||
#define CP210X_BITS_STOP_2 0x0002
|
||||
|
||||
/* SILABSER_SET_BREAK_REQUEST_CODE */
|
||||
// SILABSER_SET_BREAK_REQUEST_CODE
|
||||
#define CP210X_BREAK_ON 0x0001
|
||||
#define CP210X_BREAK_OFF 0x0000
|
||||
|
||||
/* SILABSER_SET_MHS_REQUEST_CODE */
|
||||
// SILABSER_SET_MHS_REQUEST_CODE
|
||||
#define CP210X_MCR_DTR 0x0001
|
||||
#define CP210X_MCR_RTS 0x0002
|
||||
#define CP210X_MCR_ALL 0x0003
|
||||
|
||||
@@ -87,8 +87,8 @@ enum ftdi_sio_baudrate {
|
||||
#define FTDI_SIO_SET_DATA_PARITY_EVEN (0x2 << 8)
|
||||
#define FTDI_SIO_SET_DATA_PARITY_MARK (0x3 << 8)
|
||||
#define FTDI_SIO_SET_DATA_PARITY_SPACE (0x4 << 8)
|
||||
#define FTDI_SIO_SET_DATA_STOP_BITS_1 (0x0 << 11)
|
||||
#define FTDI_SIO_SET_DATA_STOP_BITS_15 (0x1 << 11)
|
||||
#define FTDI_SIO_SET_DATA_STOP_BITS_1 (0x0 << 11) // same coding as ACM
|
||||
#define FTDI_SIO_SET_DATA_STOP_BITS_15 (0x1 << 11) // 1.5 not supported, for future use?
|
||||
#define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11)
|
||||
#define FTDI_SIO_SET_BREAK (0x1 << 14)
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
#ifndef _PL2303_H_
|
||||
#define _PL2303_H_
|
||||
#ifndef TUSB_PL2303_H
|
||||
#define TUSB_PL2303_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
@@ -36,12 +36,12 @@
|
||||
// https://github.com/torvalds/linux/blob/master/drivers/usb/serial/pl2303.c
|
||||
// - https://github.com/freebsd/freebsd-src/blob/main/sys/dev/usb/serial/uplcom.c
|
||||
|
||||
/* quirks */
|
||||
// quirks
|
||||
#define PL2303_QUIRK_UART_STATE_IDX0 1
|
||||
#define PL2303_QUIRK_LEGACY 2
|
||||
#define PL2303_QUIRK_ENDPOINT_HACK 4
|
||||
|
||||
/* requests and bits */
|
||||
// requests and bits
|
||||
#define PL2303_SET_LINE_REQUEST_TYPE 0x21 // class request host to device interface
|
||||
#define PL2303_SET_LINE_REQUEST 0x20 // dec 32
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
#define PL2303_CLEAR_HALT_REQUEST_TYPE 0x02 // standard request host to device endpoint
|
||||
|
||||
/* registers via vendor read/write requests */
|
||||
// registers via vendor read/write requests
|
||||
#define PL2303_READ_TYPE_HX_STATUS 0x8080
|
||||
|
||||
#define PL2303_HXN_RESET_REG 0x07
|
||||
@@ -95,7 +95,7 @@
|
||||
#define PL2303_HXN_FLOWCTRL_RTS_CTS 0x18
|
||||
#define PL2303_HXN_FLOWCTRL_XON_XOFF 0x0c
|
||||
|
||||
/* type data */
|
||||
// type data
|
||||
enum pl2303_type {
|
||||
TYPE_H,
|
||||
TYPE_HX,
|
||||
@@ -146,7 +146,7 @@ struct pl2303_type_data {
|
||||
.no_divisors = true, \
|
||||
}
|
||||
|
||||
/* private data types */
|
||||
// private data types
|
||||
struct pl2303_serial_private {
|
||||
const struct pl2303_type_data* type;
|
||||
uint8_t quirks;
|
||||
@@ -157,16 +157,16 @@ typedef struct TU_ATTR_PACKED {
|
||||
bool supports_hx_status;
|
||||
} pl2303_private_t;
|
||||
|
||||
/* buffer sizes for line coding data */
|
||||
// buffer sizes for line coding data
|
||||
#define PL2303_LINE_CODING_BUFSIZE 7
|
||||
#define PL2303_LINE_CODING_BAUDRATE_BUFSIZE 4
|
||||
|
||||
/* bulk endpoints */
|
||||
// bulk endpoints
|
||||
#define PL2303_OUT_EP 0x02
|
||||
#define PL2303_IN_EP 0x83
|
||||
|
||||
/* return values of pl2303_detect_type() */
|
||||
// return values of pl2303_detect_type()
|
||||
#define PL2303_SUPPORTS_HX_STATUS_TRIGGERED -1
|
||||
#define PL2303_DETECT_TYPE_FAILED -2
|
||||
|
||||
#endif /* _PL2303_H_ */
|
||||
#endif // TUSB_PL2303_H
|
||||
|
||||
Reference in New Issue
Block a user