patchAVR Downloader/UploaDEr - Patches: patch #7718, Merge global data of avrftdi in a...


You are not allowed to post comments on this tracker with your current authentication level.

patch #7718: Merge global data of avrftdi in a private data structure

Submitted by:  Hannes Weisbach <hweisbach>
Submitted on:  Sun 05 Feb 2012 10:52:43 AM UTC  
Category:  None Priority:  7 - High
Status:  Ready For Test Privacy:  Public
Assigned to:  Rene Liebscher <rliebscher> Open/Closed:  Closed

Sat 11 Feb 2012 07:56:11 PM UTC, comment #4:

Integrated in svn revision 1068

Rene Liebscher <rliebscher>
Project MemberIn charge of this item.
Sun 05 Feb 2012 09:18:05 PM UTC, comment #3:

Ok, I implemented also setup and teardown functions. avrftdi.h is also cleaned up.
Additionally I implemented a proper reset state as recommended by FTDI.
This means simply calling ftdi_set_bitmode() with BITMODE_RESET and a direction value of 0.
Patch against SVN rev 1065 is attached.

(file #24991)

Hannes Weisbach <hweisbach>
Project Member
Sun 05 Feb 2012 04:07:29 PM UTC, comment #2:

Yes, basically the patches are the same. The setup/teardown functions used by #7635 are nice.
However, #7635 does have the problem, that data is written to the FTDI before the ftdi_context struct is properly initialised, neither does it use the appropriate allocation function ftdi_new() to allocate memory for the ftdi_context struct.
I also created a separate function to check the pin limit which reduces code duplication in add_pin() and add_pins() functions.

Hannes Weisbach <hweisbach>
Project Member
Sun 05 Feb 2012 12:26:40 PM UTC, comment #1:

see also patch #7635 Fix avrftdi.c/h Random lockup/moved globals to private data against 5.11.1

This other patch uses pgm_setup/teardown to create and free the private data block (as all other programmers do.)
Also this moves the private defines from the header to the C file.

Could you please check if the other patch is basically the same as yours, then we can close the other too when applying this one.

Rene Liebscher <rliebscher>
Project MemberIn charge of this item.
Sun 05 Feb 2012 10:52:43 AM UTC, original submission:

avrftdi has a lot of static variables and someone (Joerg, I believe) expressed the whish those variables should be merged into a private data structure attached to the PROGRAMMER data structure.

This is what the attached patch accomplishes. I tested it with my 4232H and 2232C on OS X 10.6.8. Because the patch is rather big I think it's a good idea if someone tests it on Linux and *BSD.

The patch also fixes an programming mistake, where in avrftdi_open() write_flush() - and hence ftdi_write_data() is called before ftdi_set_bitmode().
ftdi_write_data() sends MPSSE commands, but the interface is not yet in MPSSE mode.

I had the problem that the FTDI reported bad opcodes (returns 0xfa) and was out of sync. Since the change, everything seems fine.

Hannes Weisbach <hweisbach>
Project Member


Attached Files
file #24991:  avrftdi_pdata2.patch added by hweisbach (20KiB - application/octet-stream)
file #24984:  avrftdi_pdata.patch added by hweisbach (19KiB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rliebscher (Posted a comment)
  • -email is unavailable- added by hweisbach (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-09-03 rliebscher Open/ClosedOpen => Closed
    2012-02-11 rliebscher StatusNone => Ready For Test
        Assigned toNone => rliebscher
    2012-02-05 hweisbach Attached File- => Added avrftdi_pdata2.patch, #24991
    2012-02-05 hweisbach Attached File- => Added avrftdi_pdata.patch, #24984

    Back to the top

    Powered by Savane 3.3