X-Git-Url: http://developer.intra2net.com/git/?p=libftdi;a=blobdiff_plain;f=src%2Fftdi.c;h=c19810b417f4fa214f8cb8b242468d069954470c;hp=3a51b26c79c7547cb686b60603c27871d4f130ba;hb=HEAD;hpb=2080e757c936392ae390c4accd1ae02a52b2f2d8 diff --git a/src/ftdi.c b/src/ftdi.c index 3a51b26..534e3dd 100644 --- a/src/ftdi.c +++ b/src/ftdi.c @@ -2218,6 +2218,24 @@ int ftdi_set_bitmode(struct ftdi_context *ftdi, unsigned char bitmask, unsigned } /** + Set module detach mode. + + \param ftdi pointer to ftdi_context + \param mode detach mode to use. + + \retval 0: all fine + \retval -1: can't enable bitbang mode +*/ +int ftdi_set_module_detach_mode(struct ftdi_context *ftdi, enum ftdi_module_detach_mode mode) +{ + if (ftdi == NULL) + ftdi_error_return(-1, "FTDI context invalid"); + + ftdi->module_detach_mode = mode; + return 0; +} + +/** Disable bitbang mode. \param ftdi pointer to ftdi_context @@ -3049,7 +3067,7 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi) // Dynamic content // Strings start at 0x94 (TYPE_AM, TYPE_BM) // 0x96 (TYPE_2232C), 0x98 (TYPE_R) and 0x9a (TYPE_x232H) - // 0xa0 (TYPE_232H) + // 0xa0 (TYPE_232H, TYPE_230X) i = 0; switch (ftdi->type) { @@ -3125,6 +3143,8 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi) i++; output[i & eeprom_size_mask] = eeprom->is_not_pnp; /* as seen when written with FTD2XX */ i++; + output[i & eeprom_size_mask] = 0x00; + i++; } if (ftdi->type > TYPE_AM) /* use_serial not used in AM devices */ @@ -3503,6 +3523,8 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi) i = 0x50; } value = data; + output[i * 2] = data; + output[(i * 2) + 1] = data >> 8; } else { value = output[i*2]; @@ -3876,11 +3898,18 @@ int ftdi_eeprom_decode(struct ftdi_context *ftdi, int verbose) (eeprom->data_order)?"LSB":"MSB", (eeprom->flow_control)?"":"No "); } - if ((ftdi->type == TYPE_2232H) || (ftdi->type == TYPE_4232H)) + if ((ftdi->type == TYPE_2232H) || (ftdi->type == TYPE_4232H) || (ftdi->type == TYPE_2232C)) fprintf(stdout,"Channel B has Mode %s%s%s\n", channel_mode[eeprom->channel_b_type], (eeprom->channel_b_driver)?" VCP":"", (eeprom->high_current_b)?" High Current IO":""); + if (ftdi->type == TYPE_4232H) + { + fprintf(stdout,"Channel C has Mode UART%s\n", + (eeprom->channel_c_driver)?" VCP":""); + fprintf(stdout,"Channel D has Mode UART%s\n", + (eeprom->channel_d_driver)?" VCP":""); + } if (((ftdi->type == TYPE_BM) || (ftdi->type == TYPE_2232C)) && eeprom->use_usb_version) fprintf(stdout,"Use explicit USB Version %04x\n",eeprom->usb_version); @@ -4172,6 +4201,9 @@ int ftdi_get_eeprom_value(struct ftdi_context *ftdi, enum ftdi_eeprom_value valu case EXTERNAL_OSCILLATOR: *value = ftdi->eeprom->external_oscillator; break; + case USER_DATA_ADDR: + *value = ftdi->eeprom->user_data_addr; + break; default: ftdi_error_return(-1, "Request for unknown EEPROM value"); }