17 #if !defined(__CDCFTDI_H__) 22 #define bmREQ_FTDI_OUT 0x40 23 #define bmREQ_FTDI_IN 0xc0 28 #define FTDI_VID 0x0403 // FTDI VID 29 #define FTDI_PID 0x6001 // FTDI PID 31 #define FT232AM 0x0200 32 #define FT232BM 0x0400 37 #define FTDI_SIO_RESET 0 38 #define FTDI_SIO_MODEM_CTRL 1 39 #define FTDI_SIO_SET_FLOW_CTRL 2 40 #define FTDI_SIO_SET_BAUD_RATE 3 41 #define FTDI_SIO_SET_DATA 4 42 #define FTDI_SIO_GET_MODEM_STATUS 5 43 #define FTDI_SIO_SET_EVENT_CHAR 6 44 #define FTDI_SIO_SET_ERROR_CHAR 7 45 #define FTDI_SIO_SET_LATENCY_TIMER 9 46 #define FTDI_SIO_GET_LATENCY_TIMER 10 48 #define FTDI_SIO_RESET_SIO 0 49 #define FTDI_SIO_RESET_PURGE_RX 1 50 #define FTDI_SIO_RESET_PURGE_TX 2 52 #define FTDI_SIO_SET_DATA_PARITY_NONE (0x0 << 8 ) 53 #define FTDI_SIO_SET_DATA_PARITY_ODD (0x1 << 8 ) 54 #define FTDI_SIO_SET_DATA_PARITY_EVEN (0x2 << 8 ) 55 #define FTDI_SIO_SET_DATA_PARITY_MARK (0x3 << 8 ) 56 #define FTDI_SIO_SET_DATA_PARITY_SPACE (0x4 << 8 ) 57 #define FTDI_SIO_SET_DATA_STOP_BITS_1 (0x0 << 11) 58 #define FTDI_SIO_SET_DATA_STOP_BITS_15 (0x1 << 11) 59 #define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11) 60 #define FTDI_SIO_SET_BREAK (0x1 << 14) 62 #define FTDI_SIO_SET_DTR_MASK 0x1 63 #define FTDI_SIO_SET_DTR_HIGH ( 1 | ( FTDI_SIO_SET_DTR_MASK << 8)) 64 #define FTDI_SIO_SET_DTR_LOW ( 0 | ( FTDI_SIO_SET_DTR_MASK << 8)) 65 #define FTDI_SIO_SET_RTS_MASK 0x2 66 #define FTDI_SIO_SET_RTS_HIGH ( 2 | ( FTDI_SIO_SET_RTS_MASK << 8 )) 67 #define FTDI_SIO_SET_RTS_LOW ( 0 | ( FTDI_SIO_SET_RTS_MASK << 8 )) 69 #define FTDI_SIO_DISABLE_FLOW_CTRL 0x0 70 #define FTDI_SIO_RTS_CTS_HS (0x1 << 8) 71 #define FTDI_SIO_DTR_DSR_HS (0x2 << 8) 72 #define FTDI_SIO_XON_XOFF_HS (0x4 << 8) 74 #define FTDI_SIO_CTS_MASK 0x10 75 #define FTDI_SIO_DSR_MASK 0x20 76 #define FTDI_SIO_RI_MASK 0x40 77 #define FTDI_SIO_RLSD_MASK 0x80 84 virtual uint8_t
OnInit(
FTDI *pftdi __attribute__((unused))) {
96 #define FTDI_MAX_ENDPOINTS 3 99 static const uint8_t epDataInIndex;
100 static const uint8_t epDataOutIndex;
101 static const uint8_t epInterruptInIndex;
109 uint32_t qNextPollTime;
110 volatile bool bPollEnable;
122 uint8_t SetBaudRate(uint32_t baud);
123 uint8_t SetModemControl(uint16_t control);
124 uint8_t SetFlowControl(uint8_t protocol, uint8_t xon = 0x11, uint8_t xoff = 0x13);
125 uint8_t SetData(uint16_t databm);
126 uint8_t SetLatency(uint8_t l);
127 uint8_t GetLatency(uint8_t *l);
130 uint8_t RcvData(uint16_t *bytes_rcvd, uint8_t *dataptr);
131 uint8_t SndData(uint16_t nbytes, uint8_t *dataptr);
134 uint8_t Init(uint8_t parent, uint8_t port,
bool lowspeed);
143 void EndpointXtract(uint8_t conf, uint8_t iface, uint8_t alt, uint8_t proto,
const USB_ENDPOINT_DESCRIPTOR *ep);
145 virtual bool VIDPIDOK(uint16_t vid, uint16_t pid) {
154 #endif // __CDCFTDI_H__ virtual bool VIDPIDOK(uint16_t vid, uint16_t pid)
virtual uint8_t OnInit(FTDI *pftdi)
virtual uint8_t GetAddress()
virtual uint8_t OnRelease(FTDI *pftdi)
#define FTDI_MAX_ENDPOINTS