avrdude-dev
[Top][All Lists]
Advanced

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

[avrdude-dev] [bug #35186] inverting pins with "~" doesn't work for pin


From: Rene Liebscher
Subject: [avrdude-dev] [bug #35186] inverting pins with "~" doesn't work for pin lists (i.e. vcc)
Date: Sun, 22 Jan 2012 14:11:10 +0000
User-agent: Mozilla/5.0 (Ubuntu; X11; Linux i686; rv:9.0.1) Gecko/20100101 Firefox/9.0.1

Follow-up Comment #1, bug #35186 (project avrdude):

This patch does not work if the pin list contains pin 8 as the current
definition of PIN_INVERSE (in pindefs.h) is as follows:

#define PIN_INVERSE 0x80 /* flag for inverted pin in serbb */
#define PIN_MASK    0x7f


Better we change the definition to:

#include <limits.h>

#define PIN_INVERSE (1<<(WORD_BIT-1))
#define PIN_MASK    (~(PIN_INVERSE))

OR

#define PIN_MASK    (UINT_MAX>>1)
#define PIN_INVERSE (~(PIN_MASK))


WORD_BIT is the number of bits in an int. (This is 32 or even more. In case it
is only 16 this would break a lot more things in avrdude.)
UINT_MAX is 0xFFFFFFFF for 32 bit unsigned integer.

---

Also I think extending the grammar to allow "~ (1,2,3)" instead of the
proposed "~ 1,2,3" would be safer in case there will be implemented later pin
lists with only some pins inverted. Then the proposed solution would potential
break the connected hardware if pin lists are not corrected in the config
file.



    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?35186>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

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