avrdude-dev
[Top][All Lists]
Advanced

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

Re: [avrdude-dev] Updated patch for Linux sysfs GPIO programmer type


From: René Liebscher
Subject: Re: [avrdude-dev] Updated patch for Linux sysfs GPIO programmer type
Date: Mon, 29 Apr 2013 20:51:02 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

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

Attachment: pins.patch
Description: Text Data


reply via email to

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