1 [CCode (cprefix = "FTDI_", lower_case_prefix = "ftdi_", cheader_filename = "ftdi.h")]
4 public const int DEFAULT_EEPROM_SIZE;
6 [CCode (cname = "enum ftdi_chip_type", cprefix = "TYPE_")]
14 [CCode (cname = "enum ftdi_parity_type", cprefix = "")]
15 public enum ParityType {
23 [CCode (cname = "enum ftdi_stopbits_type", cprefix = "STOP_")]
24 public enum StopBitsType {
30 [CCode (cname = "enum ftdi_bits_type", cprefix = "")]
31 public enum BitsType {
36 [CCode (cname = "enum ftdi_break_type", cprefix="BREAK_")]
37 public enum BreakType {
42 [CCode (cprefix = "BITMODE_", cname = "ftdi_mpsse_mode")]
43 public enum MPSSEMode {
53 [CCode (cname = "enum ftdi_interface", cprefix = "INTERFACE_")]
54 public enum Interface {
60 [CCode (cprefix="MPSSE_")]
61 namespace ShiftingCommands {
62 public const int WRITE_NEG;
63 public const int BITMODE;
64 public const int READ_NEG;
66 public const int DO_WRITE;
67 public const int DO_READ;
68 public const int WRITE_TMS;
72 namespace MPSSECommands {
73 public const int SET_BITS_LOW;
74 public const int SET_BITS_HIGH;
75 public const int GET_BITS_LOW;
76 public const int GET_BITS_HIGH;
77 public const int LOOPBACK_START;
78 public const int LOOPBACK_END;
79 public const int TCK_DIVISOR;
80 public const int SEND_IMMEDIATE;
81 public const int WAIT_ON_HIGH;
82 public const int WAIT_ON_LOW;
85 [CCode (cname="DIV_VALUE")]
86 public int div_value (int rate);
89 namespace HostEmultationModeCommands {
90 public const int SEND_IMMEDIATE;
91 public const int WAIT_ON_HIGH;
92 public const int WAIT_ON_LOW;
93 public const int READ_SHORT;
94 public const int READ_EXTENDED;
95 public const int WRITE_SHORT;
96 public const int WRITE_EXTENDED;
99 [CCode (cprefix="SIO_")]
100 public const int RESET;
101 [CCode (cprefix="SIO_")]
102 public const int MODEM_CTRL;
103 [CCode (cprefix="SIO_")]
104 public const int SET_FLOW_CTRL;
105 [CCode (cprefix="SIO_")]
106 public const int SET_BAUD_RATE;
107 [CCode (cprefix="SIO_")]
108 public const int SET_DATA;
109 [CCode (cprefix="SIO_")]
110 public const int RESET_REQUEST_TYPE;
111 [CCode (cprefix="SIO_")]
112 public const int RESET_REQUEST;
113 [CCode (cprefix="SIO_")]
114 public const int RESET_SIO;
115 [CCode (cprefix="SIO_")]
116 public const int RESET_PURGE_RX;
117 [CCode (cprefix="SIO_")]
118 public const int RESET_PURGE_TX;
119 [CCode (cprefix="SIO_")]
120 public const int SET_BAUDRATE_REQUEST_TYPE;
121 [CCode (cprefix="SIO_")]
122 public const int SET_BAUDRATE_REQUEST;
123 [CCode (cprefix="SIO_")]
124 public const int SET_DATA_REQUEST_TYPE;
125 [CCode (cprefix="SIO_")]
126 public const int SET_DATA_REQUEST;
127 [CCode (cprefix="SIO_")]
128 public const int SET_FLOW_CTRL_REQUEST;
129 [CCode (cprefix="SIO_")]
130 public const int SET_FLOW_CTRL_REQUEST_TYPE;
131 [CCode (cprefix="SIO_")]
132 public const int DISABLE_FLOW_CTRL;
133 [CCode (cprefix="SIO_")]
134 public const int RTS_CTS_HS;
135 [CCode (cprefix="SIO_")]
136 public const int DTR_DSR_HS;
137 [CCode (cprefix="SIO_")]
138 public const int XON_XOFF_HS;
139 [CCode (cprefix="SIO_")]
140 public const int SET_MODEM_CTRL_REQUEST_TYPE;
141 [CCode (cprefix="SIO_")]
142 public const int SET_MODEM_CTRL_REQUEST;
143 [CCode (cprefix="SIO_")]
144 public const int SET_DTR_MASK;
145 [CCode (cprefix="SIO_")]
146 public const int SET_DTR_HIGH;
147 [CCode (cprefix="SIO_")]
148 public const int SET_DTR_LOW;
149 [CCode (cprefix="SIO_")]
150 public const int SET_RTS_MASK;
151 [CCode (cprefix="SIO_")]
152 public const int SET_RTS_HIGH;
153 [CCode (cprefix="SIO_")]
154 public const int SET_RTS_LOW;
156 public const int URB_USERCONTEXT_COOKIE;
158 [CCode (cname = "struct ftdi_device_list", destroy_function = "ftdi_list_free")]
159 public struct DeviceList {
160 public DeviceList* next;
161 public USB.Device* dev;
164 [CCode (cname = "struct ftdi_eeprom", cprefix="ftdi_eeprom_")]
165 public struct EEPROM {
166 public int vendor_id;
167 public int product_id;
168 public int self_powered;
169 public int remote_wakeup;
170 public int BM_type_chip;
171 public int in_is_isochronous;
172 public int out_is_isochronous;
173 public int suspend_pull_downs;
174 public int use_serial;
175 public int change_usb_version;
176 public int usb_version;
177 public int max_power;
178 public unowned string manufacturer;
179 public unowned string product;
180 public unowned string serial;
182 public void initdefaults ();
183 public int build ([CCode (array_length = false)] uchar[] output);
184 public int decode (uchar[] buffer);
188 [CCode (cname = "struct ftdi_context", cprefix ="ftdi_", free_function="ftdi_free")]
189 public class Context {
190 [CCode (cname = "ftdi_new")]
193 public void deinit ();
194 public int set_interface (Interface iface);
195 public void set_usbdev (USB.DeviceHandle usbdev);
196 public int usb_find_all (out DeviceList devlist, int vendor, int product);
197 public int usb_get_strings (USB.Device usbdev, [CCode (array_length = false)] char[] manufacturer, int manufacturer_len, [CCode (array_length = false)] char[] description, int description_len, [CCode (array_length = false)] char[] serial, int serial_len);
198 public int usb_open_dev (USB.Device usbdev);
199 public int usb_open (int vendor, int product);
200 public int usb_open_desc (int vendor, int product, string description, string serial);
201 public int usb_reset ();
202 public int usb_purge_rx_buffers ();
203 public int usb_purge_tx_buffers ();
204 public int usb_purge_buffers ();
205 public int usb_close ();
206 public int set_baudrate (int baudrate);
207 public int set_line_property (BitsType bits, StopBitsType sbit, ParityType parity);
208 public int set_line_property2 (BitsType bits, StopBitsType sbit, ParityType parity, BreakType break_type);
209 public int write_data (uchar[] buf);
210 public int write_data_set_chunksize (int chunksize);
211 public int write_data_get_chunksize (out int chunksize);
212 public int read_data (uchar[] buf);
213 public int read_data_set_chunksize (int chunksize);
214 public int read_data_get_chunksize (out int chunksize);
215 public int write_data_async (uchar[] buf);
216 public void async_complete (int wait_for_more);
217 public int enable_bitbang (uchar bitmask);
218 public int disable_bitbang ();
219 public int set_bitmode (uchar bitmask, uchar mode);
220 public int read_pins (out uchar pins);
221 public int set_latency_timer (uchar latency);
222 public int get_latency_timer (out uchar latency);
223 public int poll_modem_status (out ushort status);
224 public int setflowctrl (int flowctrl);
225 public int setdtr_rts (int dtr, int rts);
226 public int setdtr (int state);
227 public int setrts (int state);
228 public int set_event_char (uchar eventch, uchar enable);
229 public int set_error_char (uchar errorch, uchar enable);
230 public void eeprom_setsize (EEPROM eeprom, int size);
231 public int read_eeprom ([CCode (array_length = false)] uchar[] eeprom);
232 public int read_chipid (out uint chipid);
233 public int read_eeprom_getsize (uchar[] eeprom);
234 public int write_eeprom ([CCode (array_length = false)] uchar[] eeprom);
235 public int erase_eeprom ();
236 public unowned string get_error_string ();
238 public USB.DeviceHandle usb_dev;
239 public int usb_read_timeout;
240 public int usb_write_timeout;
241 public ChipType type;
243 public uchar bitbang_enabled;
244 [CCode (array_length = false)]
245 public uchar[] readbuffer;
246 public uint readbuffer_offset;
247 public uint readbuffer_remaining;
248 public uint readbuffer_chunksize;
249 public uint writebuffer_chunksize;
250 public int @interface;
254 public uchar bitbang_mode;
255 public int eeprom_size;
256 public unowned string error_str;
257 [CCode (array_length_cname = "async_usb_buffer_size")]
258 public char[] async_usb_buffer;