19 #if !defined(__CDC_XR21B1411_H__)
20 #define __CDC_XR21B1411_H__
24 #define XR_REG_CUSTOM_DRIVER (0x020DU)
25 #define XR_REG_CUSTOM_DRIVER_ACTIVE (0x0001U)
27 #define XR_REG_ACM_FLOW_CTL (0x0216U)
28 #define XR_REG_FLOW_CTL (0x0C06U)
29 #define XR_REG_FLOW_CTL_HALF_DPLX (0x0008U)
30 #define XR_REG_FLOW_CTL_MODE_MASK (0x0007U)
31 #define XR_REG_FLOW_CTL_NONE (0x0000U)
32 #define XR_REG_FLOW_CTL_HW (0x0001U)
33 #define XR_REG_FLOW_CTL_SW (0x0002U)
34 #define XR_REG_FLOW_CTL_MMMRX (0x0003U)
35 #define XR_REG_FLOW_CTL_MMMRXTX (0x0004U)
37 #define XR_REG_ACM_GPIO_MODE (0x0217U)
38 #define XR_REG_GPIO_MODE (0x0C0CU)
39 #define XR_REG_GPIO_MODE_GPIO (0x0000U)
40 #define XR_REG_GPIO_MODE_FC_RTSCTS (0x0001U)
41 #define XR_REG_GPIO_MODE_FC_DTRDSR (0x0002U)
42 #define XR_REG_GPIO_MODE_ATE (0x0003U)
43 #define XR_REG_GPIO_MODE_ATE_ADDRESS (0x0004U)
45 #define XR_REG_ACM_GPIO_DIR (0x0218U)
46 #define XR_REG_GPIO_DIR (0x0C0DU)
48 #define XR_REG_ACM_GPIO_INT (0x0219U)
49 #define XR_REG_GPIO_INT (0x0C11U)
50 #define XR_REG_GPIO_MASK (0x001FU)
52 #define XR_REG_UART_ENABLE (0x0C00U)
53 #define XR_REG_UART_ENABLE_RX (0x0002U)
54 #define XR_REG_UART_ENABLE_TX (0x0001U)
56 #define XR_REG_ERROR_STATUS (0x0C09U)
57 #define XR_REG_ERROR_STATUS_MASK (0x00F8U)
58 #define XR_REG_ERROR_STATUS_ERROR (0x0070U)
59 #define XR_REG_ERROR_STATUS_BREAK (0x0008U)
60 #define XR_REG_ERROR_STATUS_OVERRUN (0x0010U)
61 #define XR_REG_ERROR_STATUS_PARITY (0x0020U)
62 #define XR_REG_ERROR_STATUS_FRAME (0x0040U)
63 #define XR_REG_ERROR_STATUS_BREAKING (0x0080U)
65 #define XR_REG_TX_BREAK (0x0C0AU)
67 #define XR_REG_XCVR_EN_DELAY (0x0C0BU)
69 #define XR_REG_GPIO_SET (0x0C0EU)
71 #define XR_REG_GPIO_CLR (0x0C0FU)
73 #define XR_REG_GPIO_STATUS (0x0C10U)
75 #define XR_REG_CUSTOMISED_INT (0x0C12U)
77 #define XR_REG_PIN_PULLUP_ENABLE (0x0C14U)
79 #define XR_REG_PIN_PULLDOWN_ENABLE (0x0C15U)
81 #define XR_REG_LOOPBACK (0x0C16U)
83 #define XR_REG_RX_FIFO_LATENCY (0x0CC2U)
84 #define XR_REG_RX_FIFO_LATENCY_ENABLE (0x0001U)
86 #define XR_REG_WIDE_MODE (0x0D02U)
87 #define XR_REG_WIDE_MODE_ENABLE (0x0001U)
89 #define XR_REG_XON_CHAR (0x0C07U)
90 #define XR_REG_XOFF_CHAR (0x0C08U)
92 #define XR_REG_TX_FIFO_RESET (0x0C80U)
93 #define XR_REG_TX_FIFO_COUNT (0x0C81U)
94 #define XR_REG_RX_FIFO_RESET (0x0CC0U)
95 #define XR_REG_RX_FIFO_COUNT (0x0CC1U)
97 #define XR_WRITE_REQUEST_TYPE (0x40U)
99 #define XR_READ_REQUEST_TYPE (0xC0U)
101 #define XR_MAX_ENDPOINTS 4
115 virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
116 return (((vid == 0x2890U) && (pid == 0x0201U)) || ((vid == 0x04e2U) && (pid == 0x1411U)));
119 uint8_t
Init(uint8_t parent, uint8_t port,
bool lowspeed);
133 return (
pUsb->
ctrlReq(
bAddress, 0,
XR_READ_REQUEST_TYPE, 1, 0, 0, reg, 2, 2, (uint8_t *)val, NULL));
137 return (
pUsb->
ctrlReq(
bAddress, 0,
XR_WRITE_REQUEST_TYPE, 0,
BGRAB0(val),
BGRAB1(val), reg, 0, 0, NULL, NULL));
#define XR_REG_FLOW_CTL_HW
#define XR_REG_ACM_FLOW_CTL
#define XR_REG_FLOW_CTL_HALF_DPLX
#define XR_REG_GPIO_MODE_FC_DTRDSR
#define XR_REG_GPIO_MODE_GPIO
#define XR_READ_REQUEST_TYPE
#define XR_REG_FLOW_CTL_SW
#define XR_WRITE_REQUEST_TYPE
#define XR_REG_FLOW_CTL_MODE_MASK
#define XR_REG_ACM_GPIO_MODE
uint8_t SetLineCoding(const LINE_CODING *dataptr)
tty_features _enhanced_status
uint8_t GetLineCoding(LINE_CODING *dataptr)
uint8_t ctrlReq(uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t *dataptr, USBReadParser *p)
virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
virtual tty_features enhanced_features(void)
virtual void autoflowXON(bool s)
virtual void autoflowDSR(bool s)
virtual void autoflowRTS(bool s)
uint8_t write_register(uint16_t reg, uint16_t val)
XR21B1411(USB *pusb, CDCAsyncOper *pasync)
uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed)
uint8_t read_register(uint16_t reg, uint16_t *val)
virtual void half_duplex(bool s)