From 190fca12fae231e8015f64953e51205ea3996bdf Mon Sep 17 00:00:00 2001 From: Stephan Linz Date: Thu, 13 Aug 2015 12:03:29 +0200 Subject: [PATCH] ftdi_eeprom: support channel configuration Previously, the channels could not be configured and were hard set to type UART and driver VCP and further to no RS485 functionality on chips with support for this feature. With the new 'chX_*' config file options the ftdi_eeprom tool is now abel to change the channel type, set the driver autoload decision (VCP od D2XX) and enable or disable RS485. The new config file options are: * ch[a,b]_type - string of: UART, FIFO, OPTO, CPU, FT1284 * ch[a,b,c,d]_vcp - bool: true for VCP, false for D2XX * ch[a,b,c,d]_rs485 - bool: true for RS485 enabled Signed-off-by: Stephan Linz --- ftdi_eeprom/main.c | 65 +++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 57 insertions(+), 8 deletions(-) diff --git a/ftdi_eeprom/main.c b/ftdi_eeprom/main.c index b279223..edcfad7 100644 --- a/ftdi_eeprom/main.c +++ b/ftdi_eeprom/main.c @@ -109,6 +109,35 @@ static int parse_cbusx(cfg_t *cfg, cfg_opt_t *opt, const char *value, void *resu return -1; } +static int parse_chtype(cfg_t *cfg, cfg_opt_t *opt, const char *value, void *result) +{ + static const struct + { + char* key; + int opt; + } options[] = + { + { "UART", CHANNEL_IS_UART }, + { "FIFO", CHANNEL_IS_FIFO }, + { "OPTO", CHANNEL_IS_OPTO }, + { "CPU", CHANNEL_IS_CPU }, + { "FT1284", CHANNEL_IS_FT1284} + }; + + int i; + for (i=0; i