1/* 2 * Copyright (c) 2007-2008 by Michael Lotz 3 * Heavily based on the original usb_serial driver which is: 4 * 5 * Copyright (c) 2003 by Siarzhuk Zharski <imker@gmx.li> 6 * Distributed under the terms of the MIT License. 7 * 8 * Authors: 9 * Alexander von Gluck IV, kallisti5@unixzen.com 10 */ 11#ifndef _USB_FTDI_H_ 12#define _USB_FTDI_H_ 13 14 15#include "SerialDevice.h" 16 17 18/* supported vendor and product ids */ 19#define VENDOR_FTDI 0x0403 20 21const usb_serial_device kFTDIDevices[] = { 22 {VENDOR_FTDI, 0x8372, "FTDI 8U100AX serial converter"}, 23 {VENDOR_FTDI, 0x6001, "FTDI 8U232AM serial converter"}, 24 {VENDOR_FTDI, 0x6015, "FTDI FT231X serial converter"} 25}; 26 27#define FTDI_BUFFER_SIZE 64 28 29 30class FTDIDevice : public SerialDevice { 31public: 32 FTDIDevice(usb_device device, uint16 vendorID, 33 uint16 productID, const char *description); 34 35virtual status_t AddDevice(const usb_configuration_info *config); 36 37virtual status_t ResetDevice(); 38 39virtual status_t SetLineCoding(usb_cdc_line_coding *coding); 40virtual status_t SetControlLineState(uint16 state); 41virtual status_t SetHardwareFlowControl(bool enable); 42 43virtual void OnRead(char **buffer, size_t *numBytes); 44virtual void OnWrite(const char *buffer, size_t *numBytes, 45 size_t *packetBytes); 46 47private: 48 size_t fHeaderLength; 49 uint8 fStatusMSR; 50 uint8 fStatusLSR; 51}; 52 53 54#endif //_USB_FTDI_H_ 55