xref: /haiku/src/add-ons/kernel/drivers/ports/usb_serial/FTDI.h (revision 909af08f4328301fbdef1ffb41f566c3b5bec0c7)
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 
21 const usb_serial_device kFTDIDevices[] = {
22 	{VENDOR_FTDI, 0x8372, "FTDI 8U100AX serial converter"},
23 	{VENDOR_FTDI, 0x6001, "FTDI 8U232AM serial converter"},
24 	{VENDOR_FTDI, 0x6006, "FTDI 8U232AM serial converter"},
25 	{VENDOR_FTDI, 0x6010, "FTDI 8U2232C serial converter"},
26 	{VENDOR_FTDI, 0x6011, "FTDI 4232H serial converter"},
27 	{VENDOR_FTDI, 0x6014, "FTDI 232H serial converter"},
28 	{VENDOR_FTDI, 0x6015, "FTDI FT231X serial converter"},
29 	{VENDOR_FTDI, 0x6040, "FTDI FT2233 serial converter"},
30 	{VENDOR_FTDI, 0x6041, "FTDI FT4233 serial converter"},
31 	{VENDOR_FTDI, 0x6042, "FTDI FT2232 serial converter"},
32 	{VENDOR_FTDI, 0x6043, "FTDI FT4232 serial converter"},
33 	{VENDOR_FTDI, 0x6044, "FTDI FT233 serial converter"},
34 	{VENDOR_FTDI, 0x6045, "FTDI FT232 serial converter"},
35 	{VENDOR_FTDI, 0x6048, "FTDI FT4232 serial converter"},
36 };
37 
38 #define FTDI_BUFFER_SIZE		64
39 
40 
41 class FTDIDevice : public SerialDevice {
42 public:
43 								FTDIDevice(usb_device device, uint16 vendorID,
44 									uint16 productID, const char *description);
45 
46 virtual	status_t				AddDevice(const usb_configuration_info *config);
47 
48 virtual	status_t				ResetDevice();
49 
50 virtual	status_t				SetLineCoding(usb_cdc_line_coding *coding);
51 virtual	status_t				SetControlLineState(uint16 state);
52 virtual	status_t				SetHardwareFlowControl(bool enable);
53 
54 virtual	void					OnRead(char **buffer, size_t *numBytes);
55 virtual	void					OnWrite(const char *buffer, size_t *numBytes,
56 									size_t *packetBytes);
57 
58 private:
59 		size_t					fHeaderLength;
60 		uint8					fStatusMSR;
61 		uint8					fStatusLSR;
62 };
63 
64 
65 #endif //_USB_FTDI_H_
66