ftdi.c - description
-------------------
begin : Fri Apr 4 2003
- copyright : (C) 2003-2017 by Intra2net AG and the libftdi developers
+ copyright : (C) 2003-2020 by Intra2net AG and the libftdi developers
email : opensource@intra2net.com
SPDX-License-Identifier: LGPL-2.1-only
***************************************************************************/
AM Type chips have only four fractional subdivisors at value[15:14]
for subdivisors 0, 0.5, 0.25, 0.125
*/
-static int ftdi_to_clkbits(int baudrate, unsigned int clk, int clk_div, unsigned long *encoded_divisor)
+static int ftdi_to_clkbits(int baudrate, int clk, int clk_div, unsigned long *encoded_divisor)
{
static const char frac_code[8] = {0, 3, 2, 4, 1, 5, 6, 7};
int best_baud = 0;
\retval -2: No struct ftdi_eeprom
\retval -3: No connected device or device not yet opened
*/
-int ftdi_eeprom_initdefaults(struct ftdi_context *ftdi, char * manufacturer,
- char * product, char * serial)
+int ftdi_eeprom_initdefaults(struct ftdi_context *ftdi, const char * manufacturer,
+ const char * product, const char * serial)
{
struct ftdi_eeprom *eeprom;
case TYPE_2232H:
case TYPE_4232H:
i += 2;
+ /* Fall through*/
case TYPE_R:
i += 2;
+ /* Fall through*/
case TYPE_2232C:
i += 2;
+ /* Fall through*/
case TYPE_AM:
case TYPE_BM:
i += 0x94;
output[0x00] = type2bit(eeprom->channel_a_type, TYPE_R);
if (eeprom->high_current)
output[0x00] |= HIGH_CURRENT_DRIVE_R;
+
+ /* Field is inverted for TYPE_R: Bit 00.3 set to 1 is D2XX, VCP is 0 */
if (eeprom->channel_a_driver)
+ output[0x00] &= ~DRIVER_VCP;
+ else
output[0x00] |= DRIVER_VCP;
+
if (eeprom->external_oscillator)
output[0x00] |= 0x02;
output[0x01] = 0x40; /* Hard coded Endpoint Size*/
set_ft232h_cbus(eeprom, output);
output[0x1e] = eeprom->chip;
- fprintf(stderr,"FIXME: Build FT232H specific EEPROM settings\n");
+ /* FIXME: Build FT232H specific EEPROM settings */
break;
case TYPE_230X:
output[0x00] = 0x80; /* Actually, leave the default value */
{
case TYPE_230X:
free_start += 2;
+ /* Fall through*/
case TYPE_232H:
free_start += 6;
+ /* Fall through*/
case TYPE_2232H:
case TYPE_4232H:
free_start += 2;
+ /* Fall through*/
case TYPE_R:
free_start += 2;
+ /* Fall through*/
case TYPE_2232C:
free_start++;
+ /* Fall through*/
case TYPE_AM:
case TYPE_BM:
free_start += 0x14;