X-Git-Url: http://developer.intra2net.com/git/?p=libftdi;a=blobdiff_plain;f=src%2Fftdi.h;h=7d5c2126415d4f077b54d12804519bc994607dd0;hp=ff72d05853c52ea1db6aaf95c97f913ea0a22f54;hb=c201f80faf4857b59b424c254f360524e50aa3ba;hpb=026e82d0ddd1fb19ebe9c0ef9c9ab1ba4f0473f1 diff --git a/src/ftdi.h b/src/ftdi.h index ff72d05..7d5c212 100644 --- a/src/ftdi.h +++ b/src/ftdi.h @@ -19,6 +19,8 @@ #include +#define FTDI_DEFAULT_EEPROM_SIZE 128 + /// FTDI chip type enum ftdi_chip_type { TYPE_AM=0, TYPE_BM=1, TYPE_2232C=2, TYPE_R=3 }; /// Parity mode for ftdi_set_line_property() @@ -162,6 +164,9 @@ struct ftdi_context { /// Bitbang mode. 1: (default) Normal bitbang mode, 2: FT2232C SPI bitbang mode unsigned char bitbang_mode; + /// EEPROM size. Default is 128 bytes for 232BM and 245BM chips + int eeprom_size; + /// String representation of last error char *error_str; @@ -219,6 +224,10 @@ struct ftdi_eeprom { char *product; /// serial number char *serial; + + /// 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; }; #ifdef __cplusplus @@ -271,6 +280,9 @@ extern "C" { int ftdi_set_latency_timer(struct ftdi_context *ftdi, unsigned char latency); int ftdi_get_latency_timer(struct ftdi_context *ftdi, unsigned char *latency); + // set eeprom size + void ftdi_eeprom_setsize(struct ftdi_context *ftdi, struct ftdi_eeprom *eeprom, int size); + // init and build eeprom from ftdi_eeprom structure void ftdi_eeprom_initdefaults(struct ftdi_eeprom *eeprom); int ftdi_eeprom_build(struct ftdi_eeprom *eeprom, unsigned char *output); @@ -279,6 +291,7 @@ extern "C" { // the checksum of the eeprom is valided int ftdi_read_eeprom(struct ftdi_context *ftdi, unsigned char *eeprom); int ftdi_read_chipid(struct ftdi_context *ftdi, unsigned int *chipid); + int ftdi_read_eeprom_getsize(struct ftdi_context *ftdi, unsigned char *eeprom, int maxsize); int ftdi_write_eeprom(struct ftdi_context *ftdi, unsigned char *eeprom); int ftdi_erase_eeprom(struct ftdi_context *ftdi);