mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-12-13 17:34:56 +00:00
Make the code compile warning-free:
- declare a dummy "struct timezone" for some Win32 systems (MinGW) - fix a few printf() argument types - get rid off the prevailing "all filedescriptors are of type int" attitude The last item required a large sweep across the code, in order to replace all "int fd"s by "struct filedescriptor *fd"s, and pass pointers (as we cannot pass a union directly). In return, the code is now supposed to be fully 64-bit safe, rather than relying on a 64-bit pointer being converted to a (32-bit) int and back to a pointer as we did previously. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@694 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
30
par.c
30
par.c
@@ -96,9 +96,9 @@ static int par_setpin(PROGRAMMER * pgm, int pin, int value)
|
||||
value = !value;
|
||||
|
||||
if (value)
|
||||
ppi_set(pgm->fd, ppipins[pin].reg, ppipins[pin].bit);
|
||||
ppi_set(&pgm->fd, ppipins[pin].reg, ppipins[pin].bit);
|
||||
else
|
||||
ppi_clr(pgm->fd, ppipins[pin].reg, ppipins[pin].bit);
|
||||
ppi_clr(&pgm->fd, ppipins[pin].reg, ppipins[pin].bit);
|
||||
|
||||
if (pgm->ispdelay > 1)
|
||||
bitbang_delay(pgm->ispdelay);
|
||||
@@ -129,7 +129,7 @@ static int par_getpin(PROGRAMMER * pgm, int pin)
|
||||
|
||||
pin--;
|
||||
|
||||
value = ppi_get(pgm->fd, ppipins[pin].reg, ppipins[pin].bit);
|
||||
value = ppi_get(&pgm->fd, ppipins[pin].reg, ppipins[pin].bit);
|
||||
|
||||
if (value)
|
||||
value = 1;
|
||||
@@ -160,19 +160,19 @@ static int par_highpulsepin(PROGRAMMER * pgm, int pin)
|
||||
inverted = !inverted;
|
||||
|
||||
if (inverted) {
|
||||
ppi_clr(pgm->fd, ppipins[pin].reg, ppipins[pin].bit);
|
||||
ppi_clr(&pgm->fd, ppipins[pin].reg, ppipins[pin].bit);
|
||||
if (pgm->ispdelay > 1)
|
||||
bitbang_delay(pgm->ispdelay);
|
||||
|
||||
ppi_set(pgm->fd, ppipins[pin].reg, ppipins[pin].bit);
|
||||
ppi_set(&pgm->fd, ppipins[pin].reg, ppipins[pin].bit);
|
||||
if (pgm->ispdelay > 1)
|
||||
bitbang_delay(pgm->ispdelay);
|
||||
} else {
|
||||
ppi_set(pgm->fd, ppipins[pin].reg, ppipins[pin].bit);
|
||||
ppi_set(&pgm->fd, ppipins[pin].reg, ppipins[pin].bit);
|
||||
if (pgm->ispdelay > 1)
|
||||
bitbang_delay(pgm->ispdelay);
|
||||
|
||||
ppi_clr(pgm->fd, ppipins[pin].reg, ppipins[pin].bit);
|
||||
ppi_clr(&pgm->fd, ppipins[pin].reg, ppipins[pin].bit);
|
||||
if (pgm->ispdelay > 1)
|
||||
bitbang_delay(pgm->ispdelay);
|
||||
}
|
||||
@@ -250,8 +250,8 @@ static int par_open(PROGRAMMER * pgm, char * port)
|
||||
|
||||
bitbang_check_prerequisites(pgm);
|
||||
|
||||
pgm->fd = ppi_open(port);
|
||||
if (pgm->fd < 0) {
|
||||
ppi_open(port, &pgm->fd);
|
||||
if (pgm->fd.ifd < 0) {
|
||||
fprintf(stderr, "%s: failed to open parallel port \"%s\"\n\n",
|
||||
progname, port);
|
||||
exit(1);
|
||||
@@ -260,14 +260,14 @@ static int par_open(PROGRAMMER * pgm, char * port)
|
||||
/*
|
||||
* save pin values, so they can be restored when device is closed
|
||||
*/
|
||||
rc = ppi_getall(pgm->fd, PPIDATA);
|
||||
rc = ppi_getall(&pgm->fd, PPIDATA);
|
||||
if (rc < 0) {
|
||||
fprintf(stderr, "%s: error reading status of ppi data port\n", progname);
|
||||
return -1;
|
||||
}
|
||||
pgm->ppidata = rc;
|
||||
|
||||
rc = ppi_getall(pgm->fd, PPICTRL);
|
||||
rc = ppi_getall(&pgm->fd, PPICTRL);
|
||||
if (rc < 0) {
|
||||
fprintf(stderr, "%s: error reading status of ppi ctrl port\n", progname);
|
||||
return -1;
|
||||
@@ -285,8 +285,8 @@ static void par_close(PROGRAMMER * pgm)
|
||||
* Restore pin values before closing,
|
||||
* but ensure that buffers are turned off.
|
||||
*/
|
||||
ppi_setall(pgm->fd, PPIDATA, pgm->ppidata);
|
||||
ppi_setall(pgm->fd, PPICTRL, pgm->ppictrl);
|
||||
ppi_setall(&pgm->fd, PPIDATA, pgm->ppidata);
|
||||
ppi_setall(&pgm->fd, PPICTRL, pgm->ppictrl);
|
||||
|
||||
par_setpin(pgm, pgm->pinno[PPI_AVR_BUFF], 1);
|
||||
|
||||
@@ -320,8 +320,8 @@ static void par_close(PROGRAMMER * pgm)
|
||||
break;
|
||||
}
|
||||
|
||||
ppi_close(pgm->fd);
|
||||
pgm->fd = -1;
|
||||
ppi_close(&pgm->fd);
|
||||
pgm->fd.ifd = -1;
|
||||
}
|
||||
|
||||
static void par_display(PROGRAMMER * pgm, char * p)
|
||||
|
||||
Reference in New Issue
Block a user