e7355aa10cdde4bebdf65059c9b0f3165e3e9bd2
[libftdi] / src / ftdi_i.h
1 /***************************************************************************
2                           ftdi_i.h  -  description
3                              -------------------
4     begin                : Don Sep 9 2011
5     copyright            : (C) 2003-2017 by Intra2net AG and the libftdi developers
6     email                : opensource@intra2net.com
7     SPDX-License-Identifier: LGPL-2.1-only
8  ***************************************************************************/
9
10 /***************************************************************************
11  *                                                                         *
12  *   This program is free software; you can redistribute it and/or modify  *
13  *   it under the terms of the GNU Lesser General Public License           *
14  *   version 2.1 as published by the Free Software Foundation;             *
15  *                                                                         *
16  ***************************************************************************
17
18  Non public definitions here
19
20 */
21
22 /* Even on 93xx66 at max 256 bytes are used (AN_121)*/
23 #define FTDI_MAX_EEPROM_SIZE 256
24
25 /** Max Power adjustment factor. */
26 #define MAX_POWER_MILLIAMP_PER_UNIT 2
27
28 /**
29     \brief FTDI eeprom structure
30 */
31 struct ftdi_eeprom
32 {
33     /** vendor id */
34     int vendor_id;
35     /** product id */
36     int product_id;
37
38     /** Was the eeprom structure initialized for the actual
39         connected device? **/
40     int initialized_for_connected_device;
41
42     /** self powered */
43     int self_powered;
44     /** remote wakeup */
45     int remote_wakeup;
46
47     int is_not_pnp;
48
49     /* Suspend on DBUS7 Low */
50     int suspend_dbus7;
51
52     /** input in isochronous transfer mode */
53     int in_is_isochronous;
54     /** output in isochronous transfer mode */
55     int out_is_isochronous;
56     /** suspend pull downs */
57     int suspend_pull_downs;
58
59     /** use serial */
60     int use_serial;
61     /** usb version */
62     int usb_version;
63     /** Use usb version on FT2232 devices*/
64     int use_usb_version;
65     /** maximum power */
66     int max_power;
67
68     /** manufacturer name */
69     char *manufacturer;
70     /** product name */
71     char *product;
72     /** serial number */
73     char *serial;
74
75     /* 2232D/H specific */
76     /* Hardware type, 0 = RS232 Uart, 1 = 245 FIFO, 2 = CPU FIFO,
77        4 = OPTO Isolate */
78     int channel_a_type;
79     int channel_b_type;
80     /*  Driver Type, 1 = VCP */
81     int channel_a_driver;
82     int channel_b_driver;
83     int channel_c_driver;
84     int channel_d_driver;
85     /* 4232H specific */
86     int channel_a_rs485enable;
87     int channel_b_rs485enable;
88     int channel_c_rs485enable;
89     int channel_d_rs485enable;
90
91     /* Special function of FT232R/FT232H devices (and possibly others as well) */
92     /** CBUS pin function. See CBUS_xxx defines. */
93     int cbus_function[10];
94     /** Select hight current drive on R devices. */
95     int high_current;
96     /** Select hight current drive on A channel (2232C */
97     int high_current_a;
98     /** Select hight current drive on B channel (2232C). */
99     int high_current_b;
100     /** Select inversion of data lines (bitmask). */
101     int invert;
102     /** Enable external oscillator. */
103     int external_oscillator;
104
105     /*2232H/4432H Group specific values */
106     /* Group0 is AL on 2322H and A on 4232H
107        Group1 is AH on 2232H and B on 4232H
108        Group2 is BL on 2322H and C on 4232H
109        Group3 is BH on 2232H and C on 4232H*/
110     int group0_drive;
111     int group0_schmitt;
112     int group0_slew;
113     int group1_drive;
114     int group1_schmitt;
115     int group1_slew;
116     int group2_drive;
117     int group2_schmitt;
118     int group2_slew;
119     int group3_drive;
120     int group3_schmitt;
121     int group3_slew;
122
123     int powersave;
124
125     int clock_polarity;
126     int data_order;
127     int flow_control;
128
129     /** user data **/
130     int user_data_addr;
131     int user_data_size;
132     const char *user_data;
133
134     /** eeprom size in bytes. This doesn't get stored in the eeprom
135         but is the only way to pass it to ftdi_eeprom_build. */
136     int size;
137     /* EEPROM Type 0x46 for 93xx46, 0x56 for 93xx56 and 0x66 for 93xx66*/
138     int chip;
139     unsigned char buf[FTDI_MAX_EEPROM_SIZE];
140
141     /** device release number */
142     int release_number;
143 };
144