src/app/host-serial/libftdi/ftdi.c
int ftdi_get_eeprom_value(struct ftdi_context *ftdi, enum ftdi_eeprom_value value_name, int* value)
{
    switch (value_name)
    {
        case VENDOR_ID:
            *value = ftdi->eeprom->vendor_id;
            break;
        case PRODUCT_ID:
            *value = ftdi->eeprom->product_id;
            break;
        case RELEASE_NUMBER:
            *value = ftdi->eeprom->release_number;
            break;
        case SELF_POWERED:
            *value = ftdi->eeprom->self_powered;
            break;
        case REMOTE_WAKEUP:
            *value = ftdi->eeprom->remote_wakeup;
            break;
        case IS_NOT_PNP:
            *value = ftdi->eeprom->is_not_pnp;
            break;
        case SUSPEND_DBUS7:
            *value = ftdi->eeprom->suspend_dbus7;
            break;
        case IN_IS_ISOCHRONOUS:
            *value = ftdi->eeprom->in_is_isochronous;
            break;
        case OUT_IS_ISOCHRONOUS:
            *value = ftdi->eeprom->out_is_isochronous;
            break;
        case SUSPEND_PULL_DOWNS:
            *value = ftdi->eeprom->suspend_pull_downs;
            break;
        case USE_SERIAL:
            *value = ftdi->eeprom->use_serial;
            break;
        case USB_VERSION:
            *value = ftdi->eeprom->usb_version;
            break;
        case USE_USB_VERSION:
            *value = ftdi->eeprom->use_usb_version;
            break;
        case MAX_POWER:
            *value = ftdi->eeprom->max_power;
            break;
        case CHANNEL_A_TYPE:
            *value = ftdi->eeprom->channel_a_type;
            break;
        case CHANNEL_B_TYPE:
            *value = ftdi->eeprom->channel_b_type;
            break;
        case CHANNEL_A_DRIVER:
            *value = ftdi->eeprom->channel_a_driver;
            break;
        case CHANNEL_B_DRIVER:
            *value = ftdi->eeprom->channel_b_driver;
            break;
        case CHANNEL_C_DRIVER:
            *value = ftdi->eeprom->channel_c_driver;
            break;
        case CHANNEL_D_DRIVER:
            *value = ftdi->eeprom->channel_d_driver;
            break;
        case CHANNEL_A_RS485:
            *value = ftdi->eeprom->channel_a_rs485enable;
            break;
        case CHANNEL_B_RS485:
            *value = ftdi->eeprom->channel_b_rs485enable;
            break;
        case CHANNEL_C_RS485:
            *value = ftdi->eeprom->channel_c_rs485enable;
            break;
        case CHANNEL_D_RS485:
            *value = ftdi->eeprom->channel_d_rs485enable;
            break;
        case CBUS_FUNCTION_0:
            *value = ftdi->eeprom->cbus_function[0];
            break;
        case CBUS_FUNCTION_1:
            *value = ftdi->eeprom->cbus_function[1];
            break;
        case CBUS_FUNCTION_2:
            *value = ftdi->eeprom->cbus_function[2];
            break;
        case CBUS_FUNCTION_3:
            *value = ftdi->eeprom->cbus_function[3];
            break;
        case CBUS_FUNCTION_4:
            *value = ftdi->eeprom->cbus_function[4];
            break;
        case CBUS_FUNCTION_5:
            *value = ftdi->eeprom->cbus_function[5];
            break;
        case CBUS_FUNCTION_6:
            *value = ftdi->eeprom->cbus_function[6];
            break;
        case CBUS_FUNCTION_7:
            *value = ftdi->eeprom->cbus_function[7];
            break;
        case CBUS_FUNCTION_8:
            *value = ftdi->eeprom->cbus_function[8];
            break;
        case CBUS_FUNCTION_9:
            *value = ftdi->eeprom->cbus_function[8];
            break;
        case HIGH_CURRENT:
            *value = ftdi->eeprom->high_current;
            break;
        case HIGH_CURRENT_A:
            *value = ftdi->eeprom->high_current_a;
            break;
        case HIGH_CURRENT_B:
            *value = ftdi->eeprom->high_current_b;
            break;
        case INVERT:
            *value = ftdi->eeprom->invert;
            break;
        case GROUP0_DRIVE:
            *value = ftdi->eeprom->group0_drive;
            break;
        case GROUP0_SCHMITT:
            *value = ftdi->eeprom->group0_schmitt;
            break;
        case GROUP0_SLEW:
            *value = ftdi->eeprom->group0_slew;
            break;
        case GROUP1_DRIVE:
            *value = ftdi->eeprom->group1_drive;
            break;
        case GROUP1_SCHMITT:
            *value = ftdi->eeprom->group1_schmitt;
            break;
        case GROUP1_SLEW:
            *value = ftdi->eeprom->group1_slew;
            break;
        case GROUP2_DRIVE:
            *value = ftdi->eeprom->group2_drive;
            break;
        case GROUP2_SCHMITT:
            *value = ftdi->eeprom->group2_schmitt;
            break;
        case GROUP2_SLEW:
            *value = ftdi->eeprom->group2_slew;
            break;
        case GROUP3_DRIVE:
            *value = ftdi->eeprom->group3_drive;
            break;
        case GROUP3_SCHMITT:
            *value = ftdi->eeprom->group3_schmitt;
            break;
        case GROUP3_SLEW:
            *value = ftdi->eeprom->group3_slew;
            break;
        case POWER_SAVE:
            *value = ftdi->eeprom->powersave;
            break;
        case CLOCK_POLARITY:
            *value = ftdi->eeprom->clock_polarity;
            break;
        case DATA_ORDER:
            *value = ftdi->eeprom->data_order;
            break;
        case FLOW_CONTROL:
            *value = ftdi->eeprom->flow_control;
            break;
        case CHIP_TYPE:
            *value = ftdi->eeprom->chip;
            break;
        case CHIP_SIZE:
            *value = ftdi->eeprom->size;
            break;
        default:
            ftdi_error_return(-1, "Request for unknown EEPROM value");
    }
    return 0;
}
/**
   Get a value from the decoded EEPROM structure

   \param ftdi pointer to ftdi_context
   \param value_name Enum of the value to query
   \param value Pointer to store read value

   \retval 0: all fine
   \retval -1: Value doesn't exist
*/
Get a value from the decoded EEPROM structure
\param ftdi pointer to ftdi_context
\param value_name Enum of the value to query
\param value Pointer to store read value

\retval 0: all fine
\retval -1: Value doesn't exist
Get a value from the decoded EEPROM structure \ param ftdi pointer to ftdi_context \ param value_name Enum of the value to query \ param value Pointer to store read value \ retval 0 : all fine \ retval - 1 : Value doesn ' t exist
int ftdi_get_eeprom_value(struct ftdi_context *ftdi, enum ftdi_eeprom_value value_name, int* value)
{
    switch (value_name)
    {
        case VENDOR_ID:
            *value = ftdi->eeprom->vendor_id;
            break;
        case PRODUCT_ID:
            *value = ftdi->eeprom->product_id;
            break;
        case RELEASE_NUMBER:
            *value = ftdi->eeprom->release_number;
            break;
        case SELF_POWERED:
            *value = ftdi->eeprom->self_powered;
            break;
        case REMOTE_WAKEUP:
            *value = ftdi->eeprom->remote_wakeup;
            break;
        case IS_NOT_PNP:
            *value = ftdi->eeprom->is_not_pnp;
            break;
        case SUSPEND_DBUS7:
            *value = ftdi->eeprom->suspend_dbus7;
            break;
        case IN_IS_ISOCHRONOUS:
            *value = ftdi->eeprom->in_is_isochronous;
            break;
        case OUT_IS_ISOCHRONOUS:
            *value = ftdi->eeprom->out_is_isochronous;
            break;
        case SUSPEND_PULL_DOWNS:
            *value = ftdi->eeprom->suspend_pull_downs;
            break;
        case USE_SERIAL:
            *value = ftdi->eeprom->use_serial;
            break;
        case USB_VERSION:
            *value = ftdi->eeprom->usb_version;
            break;
        case USE_USB_VERSION:
            *value = ftdi->eeprom->use_usb_version;
            break;
        case MAX_POWER:
            *value = ftdi->eeprom->max_power;
            break;
        case CHANNEL_A_TYPE:
            *value = ftdi->eeprom->channel_a_type;
            break;
        case CHANNEL_B_TYPE:
            *value = ftdi->eeprom->channel_b_type;
            break;
        case CHANNEL_A_DRIVER:
            *value = ftdi->eeprom->channel_a_driver;
            break;
        case CHANNEL_B_DRIVER:
            *value = ftdi->eeprom->channel_b_driver;
            break;
        case CHANNEL_C_DRIVER:
            *value = ftdi->eeprom->channel_c_driver;
            break;
        case CHANNEL_D_DRIVER:
            *value = ftdi->eeprom->channel_d_driver;
            break;
        case CHANNEL_A_RS485:
            *value = ftdi->eeprom->channel_a_rs485enable;
            break;
        case CHANNEL_B_RS485:
            *value = ftdi->eeprom->channel_b_rs485enable;
            break;
        case CHANNEL_C_RS485:
            *value = ftdi->eeprom->channel_c_rs485enable;
            break;
        case CHANNEL_D_RS485:
            *value = ftdi->eeprom->channel_d_rs485enable;
            break;
        case CBUS_FUNCTION_0:
            *value = ftdi->eeprom->cbus_function[0];
            break;
        case CBUS_FUNCTION_1:
            *value = ftdi->eeprom->cbus_function[1];
            break;
        case CBUS_FUNCTION_2:
            *value = ftdi->eeprom->cbus_function[2];
            break;
        case CBUS_FUNCTION_3:
            *value = ftdi->eeprom->cbus_function[3];
            break;
        case CBUS_FUNCTION_4:
            *value = ftdi->eeprom->cbus_function[4];
            break;
        case CBUS_FUNCTION_5:
            *value = ftdi->eeprom->cbus_function[5];
            break;
        case CBUS_FUNCTION_6:
            *value = ftdi->eeprom->cbus_function[6];
            break;
        case CBUS_FUNCTION_7:
            *value = ftdi->eeprom->cbus_function[7];
            break;
        case CBUS_FUNCTION_8:
            *value = ftdi->eeprom->cbus_function[8];
            break;
        case CBUS_FUNCTION_9:
            *value = ftdi->eeprom->cbus_function[8];
            break;
        case HIGH_CURRENT:
            *value = ftdi->eeprom->high_current;
            break;
        case HIGH_CURRENT_A:
            *value = ftdi->eeprom->high_current_a;
            break;
        case HIGH_CURRENT_B:
            *value = ftdi->eeprom->high_current_b;
            break;
        case INVERT:
            *value = ftdi->eeprom->invert;
            break;
        case GROUP0_DRIVE:
            *value = ftdi->eeprom->group0_drive;
            break;
        case GROUP0_SCHMITT:
            *value = ftdi->eeprom->group0_schmitt;
            break;
        case GROUP0_SLEW:
            *value = ftdi->eeprom->group0_slew;
            break;
        case GROUP1_DRIVE:
            *value = ftdi->eeprom->group1_drive;
            break;
        case GROUP1_SCHMITT:
            *value = ftdi->eeprom->group1_schmitt;
            break;
        case GROUP1_SLEW:
            *value = ftdi->eeprom->group1_slew;
            break;
        case GROUP2_DRIVE:
            *value = ftdi->eeprom->group2_drive;
            break;
        case GROUP2_SCHMITT:
            *value = ftdi->eeprom->group2_schmitt;
            break;
        case GROUP2_SLEW:
            *value = ftdi->eeprom->group2_slew;
            break;
        case GROUP3_DRIVE:
            *value = ftdi->eeprom->group3_drive;
            break;
        case GROUP3_SCHMITT:
            *value = ftdi->eeprom->group3_schmitt;
            break;
        case GROUP3_SLEW:
            *value = ftdi->eeprom->group3_slew;
            break;
        case POWER_SAVE:
            *value = ftdi->eeprom->powersave;
            break;
        case CLOCK_POLARITY:
            *value = ftdi->eeprom->clock_polarity;
            break;
        case DATA_ORDER:
            *value = ftdi->eeprom->data_order;
            break;
        case FLOW_CONTROL:
            *value = ftdi->eeprom->flow_control;
            break;
        case CHIP_TYPE:
            *value = ftdi->eeprom->chip;
            break;
        case CHIP_SIZE:
            *value = ftdi->eeprom->size;
            break;
        default:
            ftdi_error_return(-1, "Request for unknown EEPROM value");
    }
    return 0;
}
int ftdi_get_eeprom_value ( struct ftdi_context * ftdi , enum ftdi_eeprom_value value_name , int * value ) { switch ( value_name ) { case VENDOR_ID : * value = ftdi -> eeprom -> vendor_id ; break ; case PRODUCT_ID : * value = ftdi -> eeprom -> product_id ; break ; case RELEASE_NUMBER : * value = ftdi -> eeprom -> release_number ; break ; case SELF_POWERED : * value = ftdi -> eeprom -> self_powered ; break ; case REMOTE_WAKEUP : * value = ftdi -> eeprom -> remote_wakeup ; break ; case IS_NOT_PNP : * value = ftdi -> eeprom -> is_not_pnp ; break ; case SUSPEND_DBUS7 : * value = ftdi -> eeprom -> suspend_dbus7 ; break ; case IN_IS_ISOCHRONOUS : * value = ftdi -> eeprom -> in_is_isochronous ; break ; case OUT_IS_ISOCHRONOUS : * value = ftdi -> eeprom -> out_is_isochronous ; break ; case SUSPEND_PULL_DOWNS : * value = ftdi -> eeprom -> suspend_pull_downs ; break ; case USE_SERIAL : * value = ftdi -> eeprom -> use_serial ; break ; case USB_VERSION : * value = ftdi -> eeprom -> usb_version ; break ; case USE_USB_VERSION : * value = ftdi -> eeprom -> use_usb_version ; break ; case MAX_POWER : * value = ftdi -> eeprom -> max_power ; break ; case CHANNEL_A_TYPE : * value = ftdi -> eeprom -> channel_a_type ; break ; case CHANNEL_B_TYPE : * value = ftdi -> eeprom -> channel_b_type ; break ; case CHANNEL_A_DRIVER : * value = ftdi -> eeprom -> channel_a_driver ; break ; case CHANNEL_B_DRIVER : * value = ftdi -> eeprom -> channel_b_driver ; break ; case CHANNEL_C_DRIVER : * value = ftdi -> eeprom -> channel_c_driver ; break ; case CHANNEL_D_DRIVER : * value = ftdi -> eeprom -> channel_d_driver ; break ; case CHANNEL_A_RS485 : * value = ftdi -> eeprom -> channel_a_rs485enable ; break ; case CHANNEL_B_RS485 : * value = ftdi -> eeprom -> channel_b_rs485enable ; break ; case CHANNEL_C_RS485 : * value = ftdi -> eeprom -> channel_c_rs485enable ; break ; case CHANNEL_D_RS485 : * value = ftdi -> eeprom -> channel_d_rs485enable ; break ; case CBUS_FUNCTION_0 : * value = ftdi -> eeprom -> cbus_function [ 0 ] ; break ; case CBUS_FUNCTION_1 : * value = ftdi -> eeprom -> cbus_function [ 1 ] ; break ; case CBUS_FUNCTION_2 : * value = ftdi -> eeprom -> cbus_function [ 2 ] ; break ; case CBUS_FUNCTION_3 : * value = ftdi -> eeprom -> cbus_function [ 3 ] ; break ; case CBUS_FUNCTION_4 : * value = ftdi -> eeprom -> cbus_function [ 4 ] ; break ; case CBUS_FUNCTION_5 : * value = ftdi -> eeprom -> cbus_function [ 5 ] ; break ; case CBUS_FUNCTION_6 : * value = ftdi -> eeprom -> cbus_function [ 6 ] ; break ; case CBUS_FUNCTION_7 : * value = ftdi -> eeprom -> cbus_function [ 7 ] ; break ; case CBUS_FUNCTION_8 : * value = ftdi -> eeprom -> cbus_function [ 8 ] ; break ; case CBUS_FUNCTION_9 : * value = ftdi -> eeprom -> cbus_function [ 8 ] ; break ; case HIGH_CURRENT : * value = ftdi -> eeprom -> high_current ; break ; case HIGH_CURRENT_A : * value = ftdi -> eeprom -> high_current_a ; break ; case HIGH_CURRENT_B : * value = ftdi -> eeprom -> high_current_b ; break ; case INVERT : * value = ftdi -> eeprom -> invert ; break ; case GROUP0_DRIVE : * value = ftdi -> eeprom -> group0_drive ; break ; case GROUP0_SCHMITT : * value = ftdi -> eeprom -> group0_schmitt ; break ; case GROUP0_SLEW : * value = ftdi -> eeprom -> group0_slew ; break ; case GROUP1_DRIVE : * value = ftdi -> eeprom -> group1_drive ; break ; case GROUP1_SCHMITT : * value = ftdi -> eeprom -> group1_schmitt ; break ; case GROUP1_SLEW : * value = ftdi -> eeprom -> group1_slew ; break ; case GROUP2_DRIVE : * value = ftdi -> eeprom -> group2_drive ; break ; case GROUP2_SCHMITT : * value = ftdi -> eeprom -> group2_schmitt ; break ; case GROUP2_SLEW : * value = ftdi -> eeprom -> group2_slew ; break ; case GROUP3_DRIVE : * value = ftdi -> eeprom -> group3_drive ; break ; case GROUP3_SCHMITT : * value = ftdi -> eeprom -> group3_schmitt ; break ; case GROUP3_SLEW : * value = ftdi -> eeprom -> group3_slew ; break ; case POWER_SAVE : * value = ftdi -> eeprom -> powersave ; break ; case CLOCK_POLARITY : * value = ftdi -> eeprom -> clock_polarity ; break ; case DATA_ORDER : * value = ftdi -> eeprom -> data_order ; break ; case FLOW_CONTROL : * value = ftdi -> eeprom -> flow_control ; break ; case CHIP_TYPE : * value = ftdi -> eeprom -> chip ; break ; case CHIP_SIZE : * value = ftdi -> eeprom -> size ; break ; default : ftdi_error_return ( -1 , " " ) ; } return 0 ; }
Get a value from the decoded EEPROM structure
\param ftdi pointer to ftdi_context
\param value_name Enum of the value to query
\param value Pointer to store read value
Get a value from the decoded EEPROM structure \ param ftdi pointer to ftdi_context \ param value_name Enum of the value to query \ param value Pointer to store read value