Offload the programming interface info from part->flags to part->prog_modes

flags now just hold parameters of the JTAG interface and some secondary
serial, parallel, pseudo parallel info. This separation brings clarity. It
used to be hard to augur whether a part has an ISP interface:

   (part->flags & (AVRPART_HAS_PDI | AVRPART_AVR32 | AVRPART_HAS_TPI
    | AVRPART_HAS_UPDI)) == 0 && (part->flags & AVRPART_SERIALOK) != 0

or had HVSP or HVPP capability, for that matter. Now it is just, eg,

  part->prog_modes & PM_ISP
  part->prog_modes & PM_HVPP
This commit is contained in:
Stefan Rueger
2022-08-30 16:33:42 +01:00
parent 0756b8e3ad
commit b0198a319f
18 changed files with 144 additions and 187 deletions

View File

@@ -454,7 +454,7 @@ static int usbtiny_initialize (const PROGRAMMER *pgm, const AVRPART *p ) {
// Let the device wake up.
usleep(50000);
if (p->flags & AVRPART_HAS_TPI) {
if (p->prog_modes & PM_TPI) {
/* Since there is a single TPIDATA line, MOSI and MISO must be
linked together through a 1kOhm resistor. Verify that
everything we send on MOSI gets mirrored back on MISO. */
@@ -605,7 +605,7 @@ static int usbtiny_spi(const PROGRAMMER *pgm, const unsigned char *cmd, unsigned
static int usbtiny_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) {
unsigned char res[4];
if (p->flags & AVRPART_HAS_TPI)
if (p->prog_modes & PM_TPI)
return avr_tpi_chip_erase(pgm, p);
if (p->op[AVR_OP_CHIP_ERASE] == NULL) {
@@ -773,7 +773,7 @@ static int usbtiny_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AV
static int usbtiny_program_enable(const PROGRAMMER *pgm, const AVRPART *p) {
unsigned char buf[4];
if (p->flags & AVRPART_HAS_TPI)
if (p->prog_modes & PM_TPI)
return avr_tpi_program_enable(pgm, p, TPIPCR_GT_0b);
else
return usbtiny_avr_op(pgm, p, AVR_OP_PGM_ENABLE, buf);