mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-09-28 15:05:27 +00:00
Rearrange the pinout for the programmer to be a little more logical.
Provide hooks to support a buffered programmer, pin 6 is now used to enable a buffer that can be used to isolate the target system from the parallel port pins. This is important when programming the target in-system. Totally change the way the pin definitions are defined. Actually set/clear pins based on the way more intuitive pin number, instead of PPI data register, bit number combination. A table of pin data is used so that any hardware inversion done by the parallel port is accounted for, what you set is actually what appears at the pin. Retain the old method for handling Vcc, however, because the hold method is much easier to use when setting / retrieving multiple pins simultaneously. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@49 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
22
avr.c
22
avr.c
@@ -110,19 +110,16 @@ int avr_txrx_bit ( int fd, int bit )
|
||||
* read the result bit (it is either valid from a previous clock
|
||||
* pulse or it is ignored in the current context)
|
||||
*/
|
||||
r = ppi_get(fd, PPISTATUS, AVR_DATA);
|
||||
r = ppi_getpin(fd, PIN_AVR_MISO);
|
||||
|
||||
/* set the data input line as desired */
|
||||
if (bit)
|
||||
ppi_set(fd, PPIDATA, AVR_INSTR);
|
||||
else
|
||||
ppi_clr(fd, PPIDATA, AVR_INSTR);
|
||||
ppi_setpin(fd, PIN_AVR_MOSI, bit);
|
||||
|
||||
/*
|
||||
* pulse the clock line, clocking in the MOSI data, and clocking out
|
||||
* the next result bit
|
||||
*/
|
||||
ppi_pulse(fd, PPIDATA, AVR_CLOCK);
|
||||
ppi_pulsepin(fd, PIN_AVR_SCK);
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -400,7 +397,7 @@ int avr_signature ( int fd, unsigned char sig[4] )
|
||||
*/
|
||||
void avr_powerup ( int fd )
|
||||
{
|
||||
ppi_set(fd, PPIDATA, AVR_POWER); /* power up */
|
||||
ppi_set(fd, PPIDATA, PPI_AVR_VCC); /* power up */
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
@@ -410,7 +407,7 @@ void avr_powerup ( int fd )
|
||||
*/
|
||||
void avr_powerdown ( int fd )
|
||||
{
|
||||
ppi_clr(fd, PPIDATA, AVR_POWER); /* power down */
|
||||
ppi_clr(fd, PPIDATA, PPI_AVR_VCC); /* power down */
|
||||
}
|
||||
|
||||
|
||||
@@ -424,9 +421,10 @@ int avr_initialize ( int fd, struct avrpart * p )
|
||||
|
||||
avr_powerup(fd);
|
||||
|
||||
ppi_clr(fd, PPIDATA, AVR_CLOCK);
|
||||
ppi_clr(fd, PPIDATA, AVR_RESET);
|
||||
ppi_pulse(fd, PPIDATA, AVR_RESET);
|
||||
|
||||
ppi_setpin(fd, PIN_AVR_SCK, 0);
|
||||
ppi_setpin(fd, PIN_AVR_RESET, 0);
|
||||
ppi_pulsepin(fd, PIN_AVR_RESET);
|
||||
|
||||
usleep(20000); /* 20 ms XXX should be a per-chip parameter */
|
||||
|
||||
@@ -447,7 +445,7 @@ int avr_initialize ( int fd, struct avrpart * p )
|
||||
rc = avr_program_enable ( fd );
|
||||
if (rc == 0)
|
||||
break;
|
||||
ppi_pulse(fd, PPIDATA, AVR_CLOCK);
|
||||
ppi_pulsepin(fd, PIN_AVR_SCK);
|
||||
tries++;
|
||||
} while (tries < 32);
|
||||
|
||||
|
Reference in New Issue
Block a user