xref: /haiku/src/add-ons/kernel/drivers/ports/usb_serial/FTDI.h (revision 83b1a68c52ba3e0e8796282759f694b7fdddf06d)
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 };
25 
26 #define FTDI_BUFFER_SIZE		64
27 
28 
29 class FTDIDevice : public SerialDevice {
30 public:
31 								FTDIDevice(usb_device device, uint16 vendorID,
32 									uint16 productID, const char *description);
33 
34 virtual	status_t				AddDevice(const usb_configuration_info *config);
35 
36 virtual	status_t				ResetDevice();
37 
38 virtual	status_t				SetLineCoding(usb_cdc_line_coding *coding);
39 virtual	status_t				SetControlLineState(uint16 state);
40 
41 virtual	void					OnRead(char **buffer, size_t *numBytes);
42 virtual	void					OnWrite(const char *buffer, size_t *numBytes,
43 									size_t *packetBytes);
44 
45 private:
46 		size_t					fHeaderLength;
47 		uint8					fStatusMSR;
48 		uint8					fStatusLSR;
49 };
50 
51 
52 #endif //_USB_FTDI_H_
53