Add logic to handle inverted signals for parallel ports as well, using
a tilde in avrdude.conf. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@577 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
a37080cc24
commit
6f06530404
29
par.c
29
par.c
|
@ -81,7 +81,9 @@ struct ppipins_t ppipins[] = {
|
|||
|
||||
static int par_setpin(PROGRAMMER * pgm, int pin, int value)
|
||||
{
|
||||
int inverted;
|
||||
|
||||
inverted = pin & PIN_INVERSE;
|
||||
pin &= PIN_MASK;
|
||||
|
||||
if (pin < 1 || pin > 17)
|
||||
|
@ -90,6 +92,9 @@ static int par_setpin(PROGRAMMER * pgm, int pin, int value)
|
|||
pin--;
|
||||
|
||||
if (ppipins[pin].inverted)
|
||||
inverted = !inverted;
|
||||
|
||||
if (inverted)
|
||||
value = !value;
|
||||
|
||||
if (value)
|
||||
|
@ -108,7 +113,9 @@ static int par_setpin(PROGRAMMER * pgm, int pin, int value)
|
|||
static int par_getpin(PROGRAMMER * pgm, int pin)
|
||||
{
|
||||
int value;
|
||||
int inverted;
|
||||
|
||||
inverted = pin & PIN_INVERSE;
|
||||
pin &= PIN_MASK;
|
||||
|
||||
if (pin < 1 || pin > 17)
|
||||
|
@ -122,6 +129,9 @@ static int par_getpin(PROGRAMMER * pgm, int pin)
|
|||
value = 1;
|
||||
|
||||
if (ppipins[pin].inverted)
|
||||
inverted = !inverted;
|
||||
|
||||
if (inverted)
|
||||
value = !value;
|
||||
|
||||
return value;
|
||||
|
@ -130,12 +140,30 @@ static int par_getpin(PROGRAMMER * pgm, int pin)
|
|||
|
||||
static int par_highpulsepin(PROGRAMMER * pgm, int pin)
|
||||
{
|
||||
int inverted;
|
||||
|
||||
inverted = pin & PIN_INVERSE;
|
||||
pin &= PIN_MASK;
|
||||
|
||||
if (pin < 1 || pin > 17)
|
||||
return -1;
|
||||
|
||||
pin--;
|
||||
|
||||
if (ppipins[pin].inverted)
|
||||
inverted = !inverted;
|
||||
|
||||
if (inverted) {
|
||||
ppi_clr(pgm->fd, ppipins[pin].reg, ppipins[pin].bit);
|
||||
#if SLOW_TOGGLE
|
||||
usleep(1000);
|
||||
#endif
|
||||
ppi_set(pgm->fd, ppipins[pin].reg, ppipins[pin].bit);
|
||||
|
||||
#if SLOW_TOGGLE
|
||||
usleep(1000);
|
||||
#endif
|
||||
} else {
|
||||
ppi_set(pgm->fd, ppipins[pin].reg, ppipins[pin].bit);
|
||||
#if SLOW_TOGGLE
|
||||
usleep(1000);
|
||||
|
@ -145,6 +173,7 @@ static int par_highpulsepin(PROGRAMMER * pgm, int pin)
|
|||
#if SLOW_TOGGLE
|
||||
usleep(1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue