libftdi Archives

Subject: Re: [EEPROM branch] "size_check" init value

From: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Fri, 24 Sep 2010 13:03:57 +0200
On Friday, 24. September 2010 11:04:44 Uwe Bonnes wrote:
> >>>>> "Thomas" == Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx> writes:
>     Thomas> Hello Uwe, looking at this code:
> 
>     Thomas> int ftdi_eeprom_build(struct ftdi_context *ftdi) { ...  if
>     Thomas> ((eeprom->chip == 0x56) || (eeprom->chip == 0x66))
>     eeprom-> size = 0x100;
>     Thomas>     else
>     eeprom-> size = 0x80;
> 
>     Thomas> ...  ...  size_check = 0x80;
> 
> 
>     Thomas> Shouldn't we init "size_check" with eeprom->size?
> 
> No!
> 
> The strings may only take up 0x80 bytes. This is how I interprete AN_121
> "accessing the EEPROM User Area". And with the data layout in a 56/66
> chip, string data would then end above 0xff.

Hmm, if I read AN_121 correctly, the complete storage area
for all strings is only 96 bytes / 0x60 - for all chip types/eeprom sizes.

Could you check with MProg if they limit all strings to a total of 96 bytes?
If yes, we can greatly simplify our "size_check" code like this:

if (manfacturer_size*2 + product_size*2 + serial_size*2) > 96)
        explode_and_die();

AN_121 also mentions the "manufacturer ID" string additionally
to the "manufacturer" string. Any idea what that is?

Thomas

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread