Replace eeprom->rs232_inversion with eeprom->invert.
authorFlorian Preinstorfer <fp@xell.at>
Thu, 23 Oct 2014 06:08:07 +0000 (08:08 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Tue, 28 Oct 2014 08:32:32 +0000 (09:32 +0100)
Summary:
 * The field eeprom->rs232_inversion reads and writes to the same
   location as eeprom->invert already does.
 * The configuration values invert_*, as read by ftdi_eeprom, are
   working ootb with FT230X chips. No configuration values were
   available for rs232_inversion.

I tested this commit with FT231X which identifies itself as VID 0x0403
and PID 0x6015.

src/ftdi.c
src/ftdi.h
src/ftdi_i.h

index ad9e20e..0a6dfb5 100644 (file)
@@ -3065,7 +3065,7 @@ int ftdi_eeprom_build(struct ftdi_context *ftdi)
             {
                 output[0x1a + j] = eeprom->cbus_function[j];
             }
-            output[0x0b] = eeprom->rs232_inversion;
+            output[0x0b] = eeprom->invert;
             break;
     }
 
@@ -3391,7 +3391,7 @@ int ftdi_eeprom_decode(struct ftdi_context *ftdi, int verbose)
         eeprom->group1_schmitt = (buf[0x0c] >> 4) & IS_SCHMITT;
         eeprom->group1_slew    = (buf[0x0c] >> 4) & SLOW_SLEW;
 
-        eeprom->rs232_inversion = buf[0xb];
+        eeprom->invert = buf[0xb];
     }
 
     if (verbose)
@@ -3515,7 +3515,7 @@ int ftdi_eeprom_decode(struct ftdi_context *ftdi, int verbose)
                 if (eeprom->cbus_function[i]<= CBUSH_AWAKE)
                     fprintf(stdout,"CBUS%d Function: %s\n", i, cbush_mux[eeprom->cbus_function[i]]);
             }
-            if(eeprom->rs232_inversion ) {
+            if(eeprom->invert ) {
                 struct bitnames {
                     int mask;
                     char *name;
@@ -3535,7 +3535,7 @@ int ftdi_eeprom_decode(struct ftdi_context *ftdi, int verbose)
                 int n = 0;
                 printf("Inversion on ");
                 for (i=0; invbitlist[i].mask;i++) {
-                    if(eeprom->rs232_inversion & invbitlist[i].mask) {
+                    if(eeprom->invert & invbitlist[i].mask) {
                         if (n++) printf (",");
                         printf (" %s", invbitlist[i].name);
                     }
@@ -3764,9 +3764,6 @@ int ftdi_get_eeprom_value(struct ftdi_context *ftdi, enum ftdi_eeprom_value valu
         case CHIP_SIZE:
             *value = ftdi->eeprom->size;
             break;
-        case RS232_INVERSION:
-            *value = ftdi->eeprom->rs232_inversion;
-            break;
         default:
             ftdi_error_return(-1, "Request for unknown EEPROM value");
     }
@@ -3957,9 +3954,6 @@ int ftdi_set_eeprom_value(struct ftdi_context *ftdi, enum ftdi_eeprom_value valu
         case CHIP_SIZE:
             ftdi_error_return(-2, "EEPROM Value can't be changed");
             break;
-        case RS232_INVERSION:
-            ftdi->eeprom->rs232_inversion = value;
-            break;
 
         default :
             ftdi_error_return(-1, "Request to unknown EEPROM value");
index e192a66..07fcd71 100644 (file)
@@ -332,7 +332,6 @@ enum ftdi_eeprom_value
     CHANNEL_C_RS485    = 53,
     CHANNEL_D_RS485    = 54,
     RELEASE_NUMBER     = 55,
-    RS232_INVERSION    = 56,
 };
 
 /**
index 066790b..19d8dd5 100644 (file)
@@ -123,11 +123,6 @@ struct ftdi_eeprom
     int data_order;
     int flow_control;
 
-    /* FT-X Device and Peripheral control
-     * Fixme: Decode byte[0xa]
-     */
-    int rs232_inversion;
-
     /** eeprom size in bytes. This doesn't get stored in the eeprom
         but is the only way to pass it to ftdi_eeprom_build. */
     int size;