From 6483e65ab1f7e88e4c736766448dbfdf6173e80b Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Sun, 1 Sep 2013 20:48:17 +0000 Subject: [PATCH] Add more trace output, by now only to the TPI functions. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1190 81a1dc3b-b13d-400b-aceb-764788c761c2 --- ChangeLog | 5 +++++ usbasp.c | 29 ++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 28987125..8e6fa860 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-09-01 Joerg Wunsch + + * usbasp.c: Add more trace output, by now only for the TPI + functions. + 2013-08-31 Joerg Wunsch * usbasp.c (usbasp_transmit): Add -vvvv trace output. diff --git a/usbasp.c b/usbasp.c index c4d77740..41d29b77 100644 --- a/usbasp.c +++ b/usbasp.c @@ -928,14 +928,24 @@ static int usbasp_tpi_nvm_waitbusy(PROGRAMMER * pgm) { int retry; + if (verbose > 2) + fprintf(stderr, "%s: usbasp_tpi_nvm_waitbusy() ...", progname); for(retry=50; retry>0; retry--) { usbasp_tpi_send_byte(pgm, TPI_OP_SIN(NVMCSR)); if(usbasp_tpi_recv_byte(pgm) & NVMCSR_BSY) continue; + + if (verbose > 2) + fprintf(stderr, " ready\n"); + return 0; } + + if (verbose > 2) + fprintf(stderr, " failure\n"); + return -1; } @@ -949,7 +959,9 @@ static int usbasp_tpi_program_enable(PROGRAMMER * pgm, AVRPART * p) { int retry; - + if (verbose > 2) + fprintf(stderr, "%s: usbasp_tpi_program_enable()\n", progname); + /* change guard time */ usbasp_tpi_send_byte(pgm, TPI_OP_SSTCS(TPIPCR)); usbasp_tpi_send_byte(pgm, TPIPCR_GT_2b); @@ -987,6 +999,9 @@ static int usbasp_tpi_program_enable(PROGRAMMER * pgm, AVRPART * p) static int usbasp_tpi_chip_erase(PROGRAMMER * pgm, AVRPART * p) { + if (verbose > 2) + fprintf(stderr, "%s: usbasp_tpi_chip_erase()\n", progname); + /* Set PR to flash */ usbasp_tpi_send_byte(pgm, TPI_OP_SSTPR(0)); usbasp_tpi_send_byte(pgm, 0x01); @@ -1016,6 +1031,10 @@ static int usbasp_tpi_paged_load(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, uint16_t pr; + if (verbose > 2) + fprintf(stderr, "%s: usbasp_tpi_paged_load(\"%s\", 0x%0x, %d)\n", + progname, m->desc, addr, n_bytes); + dptr = m->buf; pr = addr + m->offset; readed = 0; @@ -1057,6 +1076,10 @@ static int usbasp_tpi_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, uint16_t pr; + if (verbose > 2) + fprintf(stderr, "%s: usbasp_tpi_paged_write(\"%s\", 0x%0x, %d)\n", + progname, m->desc, addr, n_bytes); + sptr = m->buf; pr = addr + m->offset; writed = 0; @@ -1135,6 +1158,10 @@ static int usbasp_tpi_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m, unsig uint16_t pr; + if (verbose > 2) + fprintf(stderr, "%s: usbasp_tpi_read_byte(\"%s\", 0x%0lx)\n", + progname, m->desc, addr); + pr = m->offset + addr; /* READBLOCK */