avrdude-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avrdude-dev] New pin definition data structure, updated ftdi_syncbb to


From: René Liebscher
Subject: [avrdude-dev] New pin definition data structure, updated ftdi_syncbb to support buff
Date: Sat, 04 May 2013 11:33:16 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

Hi,

as I already mentioned I checked in now the new pin definitions data structures.

All existing bitbang programmer should work as before as the convert the new data into the existing data fields. (See their initpgm functions.)

For ftdi_syncbb I use now the new format internally, so it uses now the pin numbers 0-based. Also it should now support the buff pins and inverted pins for all its supported pins. (This needs to be tested as my hardware has no need for a buff pin and any inverter.) Also there are currently more exit() in the code than I really want, but this will be changed next.

I guess avrftdi could be adapted very easy by changing the add_pins and set_pins functions (add_pin and set_pin might be removed). Another place to change is the pin setup in avrftdi_open. (Maybe looking at ft245r.c and its usage of the SET_BITS_0 macro and its check_pins function might help. )

BTW: I don't like the fact that in avrftdi the default pins are set if MOSI,MISO,SCK, or RESET does not fit the expectations. If some one has really connected the pins as he describes in the config file, than we should rather exit because of wrong connections, instead to change it by ourself and possible destroy the connected hardware. (Maybe he could still use synchronous bitbanging using ftdi_syncbb in this configuration.)

Also the add_pin(s) and set_pin(s) functions seem to use different return code for errors (1 vs. -1). Maybe we should introduce some generic defines in avrdude.h so it is really clear what the value for OK is, what values for error (any negative number? so you can code the reason in it?)


Kind regards

René


On 29.04.2013 20:51, René Liebscher wrote:
Hi,

I have here now a patch which introduces the new pin definition format into the programmer structure.

At the moment the config parser writes the new definitions and all bitbanging programmers call in their initpgm function a function which creates the corresponding values in the old pinno elements of the programmers structure.

So all existing code should run as usual and we can start to convert one programmer after another. If it uses the new format, we can remove then the call to the converter function, and if the last programmer removed it, we can also remove the old data field.

May be you want have a look in the patch if there are any obvious problems. Otherwise I will check in it the next days.

I think all changes should be done before releasing version 6 as we have changed already the config file format. When changing now the pin numbers for some programmers from 1-based to 0-based this will result in nobody having an old version 5 config file lying around which would be parsed without the need to manually correcting it. (Also the new programmers which would be 0-based (avrftdi,ftdi_syncbb,linuxgpio) would all be new in version 6.)


Kind regards

René Liebscher


On 05.01.2013 17:35, Hannes Weisbach wrote:
You have the same behaviour for ftdi based prgrammers, where you have to
write 4 when you actually mean ADBUS3.

I would prefer a much more general approach to this problem.

You have to remember that there are not only single pins but also list
of pins are possible for vcc and buf pin definitions. And these define
their pins as 1<< pin1 | 1 << pin2 | ... . So setting the default to -1
would set there all bits if there is no definition in the conf-file.

I would like to have the pin definition as follows:

typedef struct programmer_t {
...
  unsigned int pinno[N_PINS];
...
}

changed to

typedef struct programmer_t {
...
  pin_def_t pinno[N_PINS];
...
}

with pin_def_t defined as:

#define N_MAX_PINS 32 /* or 256 if GPIO is compiled in */

struct {
    uint32_t mask   [N_MAX_PINS/32];
    uint32_t inverse[N_MAX_PINS/32];
} pin_def_t;

Then you have a single pin defined as:
mask = { 0b0001000, .... }
inverse = { 0b0000000, .... }

an inverted pin as:

mask = { 0b0001000, .... }
inverse = { 0b0001000, .... }

pin lists as:

mask = { 0b0010110, .... }
inverse = { 0b0000000, .... }

and it would even be possible to define a mixed inverted pin list as
wished in bug #37727 Add support for LM3S811 dev board as a programmer

mask = { 0b0010110, .... }
inverse = { 0b0010010, .... }

However you had to change the code for the following programmer types
avrftdi, ftdi_syncbb, par and serbb. (These are the only ones which
currently use pin definitions in the config file.)

I would also propose to change then pin numbers of ftdi based
programmers to 0 based numbers in the config file. But leave them for
parallel and serial port 1-based as they correspond to real pins at
their connectors.
I think it's a good idea and would provide the necessary changes to avrftdi, if this proposal is generally accepted and you provide the definitions.

Best regards,
Hannes





reply via email to

[Prev in Thread] Current Thread [Next in Thread]