libftdi Archives

Subject: Re: [EEPROM branch] Dynamic string offset calculation

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Fri, 24 Sep 2010 11:34:03 +0200
>>>>> "Thomas" == Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx> writes:

    Thomas> On Friday, 24. September 2010 10:43:36 Thomas Jarosch wrote:
    >> For a FT245BM type chip, the eeprom->size will be 0x80.  This results
    >> in
    >> i = 0x94; k = 127;
    >> "i++ & k" will result in 0x14. The length of the manufacturer string
    >> is stored in 0x0f, so this is wrong for the BM type chips. Luckily it
    >> will be overwritten later on.
    >> Can you enlighten me why the offset for the "length of the
    >> manufacturer string descriptor" is calculated dynamically? Atleast
    >> for the FT245BM and the FT2232C, it's always at 0x0F. Cut'n'paste
    >> typo?

    Thomas> Forget about it, it's the actual string length.

    Thomas> I still have trouble reading the code because of the "k" bitmask
    Thomas> wraparound magic. Maybe we find a better name for it, like
    Thomas> "eeprom_size_limit"?

It is used as a mask, either 0x7f on 46 type chips or 0xff for 56/66 type
chips, what about "eeprom_size_mask". 

But I agree, sensible names are the A and O of good documentation, but are
hard to get by..
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

libftdi - see for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread