Skip to content

Commit

Permalink
Added CH341 and updated header file
Browse files Browse the repository at this point in the history
  • Loading branch information
tr1p1ea authored and adriweb committed Dec 4, 2023
1 parent d083a5d commit ed71da9
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 9 deletions.
8 changes: 7 additions & 1 deletion src/srldrvce/srldrvce.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,7 @@ start_write:
; Vendor match table
; Each table consists of a set of paramters to check to confirm a device
vendor_device_match_table:
db 18 ; total number of devices in table (8-bits for now)
db 19 ; total number of devices in table (8-bits for now)
dl .device_id_ftdi_sio
dl .device_id_ftdi_ft232a
dl .device_id_ftdi_ft232b
Expand All @@ -1565,6 +1565,7 @@ vendor_device_match_table:
dl .device_id_ftdi_ft232hp
dl .device_id_ftdi_ft4232ha
dl .device_id_ch340
dl .device_id_ch341
dl .device_id_cp2102

.device_id_ftdi_sio:
Expand Down Expand Up @@ -1653,6 +1654,11 @@ vendor_device_match_table:
devchk srl_device.idvendor, mtEquals, $1A86 ; paramter to check, match mode (equal, greater than, less than), value to check against
devchk srl_device.idproduct, mtEquals, $7523
db SRL_TYPE_CH34X, SRL_SUBTYPE_CH340, BAUD_TYPE_CH34X ; device data if matched: type, sub type and baud type
.device_id_ch341:
db 2 ; number of conditional checks to perform
devchk srl_device.idvendor, mtEquals, $1A86 ; paramter to check, match mode (equal, greater than, less than), value to check against
devchk srl_device.idproduct, mtEquals, $5523
db SRL_TYPE_CH34X, SRL_SUBTYPE_CH341, BAUD_TYPE_CH34X ; device data if matched: type, sub type and baud type
.device_id_cp2102:
db 2
devchk srl_device.idvendor, mtEquals, $10C4
Expand Down
53 changes: 45 additions & 8 deletions src/srldrvce/srldrvce.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,60 @@ enum {
SRL_TYPE_HOST, /**< Calc is acting as a device */
SRL_TYPE_CDC, /**< CDC device */
SRL_TYPE_FTDI, /**< FTDI device */
SRL_TYPE_PL2303 /**< PL2303 device */
SRL_TYPE_PL2303, /**< PL2303 device */
SRL_TYPE_CH34X, /**< CH34X device */
SRL_TYPE_CP210X /**< CP210X device */
};

typedef uint8_t srl_device_type_t;

enum {
SRL_SUBTYPE_FTDI_UNKNOWN = 0,
SRL_SUBTYPE_SIO,
SRL_SUBTYPE_FT8U232AM,
SRL_SUBTYPE_FT232BM,
SRL_SUBTYPE_FT232A,
SRL_SUBTYPE_FT232B,
SRL_SUBTYPE_FT2232C,
SRL_SUBTYPE_FT232RL,
SRL_SUBTYPE_FTX,
SRL_SUBTYPE_FT232R,
SRL_SUBTYPE_FT232H,
SRL_SUBTYPE_FT2232H,
SRL_SUBTYPE_FT4232H,
SRL_SUBTYPE_FT232H,
SRL_SUBTYPE_FT4232HA,
SRL_SUBTYPE_FT232HP,
SRL_SUBTYPE_FT233HP,
SRL_SUBTYPE_FT2232HP,
SRL_SUBTYPE_FT2233HP,
SRL_SUBTYPE_FT4232HP,
SRL_SUBTYPE_FT4233HP,
SRL_SUBTYPE_FTX
};

enum {
SRL_SUBTYPE_PL2303_01 = 0,
SRL_SUBTYPE_PL2303_HX,
SRL_SUBTYPE_PL2303_HX
};

enum {
SRL_SUBTYPE_CH340 = 0,
SRL_SUBTYPE_CH341
};

enum {
SRL_SUBTYPE_CP2101 = 0,
SRL_SUBTYPE_CP2102,
SRL_SUBTYPE_CP2103
};

enum {
BAUD_TYPE_UNKNOWN = 0,
BAUD_TYPE_HOST,
BAUD_TYPE_CDC,
BAUD_TYPE_FTDI_SIO,
BAUD_TYPE_FTDI_AM,
BAUD_TYPE_FTDI_BM,
BAUD_TYPE_FTDI_H,
BAUD_TYPE_PL2303,
BAUD_TYPE_CH34X,
BAUD_TYPE_CP210X
};

typedef uint8_t srl_device_subtype_t;
Expand Down Expand Up @@ -77,10 +110,14 @@ typedef struct {
uint8_t tx_addr;
srl_device_type_t type;
srl_device_subtype_t subtype;
uint16_t idvendor;
uint16_t idproduct;
uint16_t bcddevice;
uint8_t baudtype;
ring_buf_ctrl_t rx_buf;
ring_buf_ctrl_t tx_buf;
srl_error_t err;
uint8_t reserved[16];
uint8_t reserved[23];
} srl_device_t;

#define SRL_INTERFACE_ANY 0xFF
Expand Down

0 comments on commit ed71da9

Please sign in to comment.