From: Michel Pollet Date: Thu, 9 Jan 2014 08:54:07 +0000 (+0000) Subject: timer: Tweak traces X-Git-Tag: v1.2~49 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=3232ce764c7f9815a49f7a6a6239cf80bff489c2;p=sx%2Fsimavr.git timer: Tweak traces Display the period in uS as well as cycles Signed-off-by: Michel Pollet --- diff --git a/simavr/sim/avr_timer.c b/simavr/sim/avr_timer.c index 6e1d8cc..9518e2f 100644 --- a/simavr/sim/avr_timer.c +++ b/simavr/sim/avr_timer.c @@ -27,6 +27,7 @@ #include #include "avr_timer.h" #include "avr_ioport.h" +#include "sim_time.h" /* * The timers are /always/ 16 bits here, if the higher byte register @@ -193,8 +194,9 @@ static void avr_timer_configure(avr_timer_t * p, uint32_t clock, uint32_t top) p->tov_cycles = frequency / t; // avr_hz_to_cycles(frequency, t); - AVR_LOG(p->io.avr, LOG_TRACE, "TIMER: %s-%c TOP %.2fHz = %d cycles\n", - __FUNCTION__, p->name, t, (int)p->tov_cycles); + AVR_LOG(p->io.avr, LOG_TRACE, "TIMER: %s-%c TOP %.2fHz = %d cycles = %dusec\n", + __FUNCTION__, p->name, t, (int)p->tov_cycles, + (int)avr_cycles_to_usec(p->io.avr, p->tov_cycles)); for (int compi = 0; compi < AVR_TIMER_COMP_COUNT; compi++) { if (!p->comp[compi].r_ocr) @@ -207,7 +209,8 @@ static void avr_timer_configure(avr_timer_t * p, uint32_t clock, uint32_t top) if (ocr && ocr <= top) { p->comp[compi].comp_cycles = frequency / fc; // avr_hz_to_cycles(p->io.avr, fa); - AVR_LOG(p->io.avr, LOG_TRACE, "TIMER: %s-%c %c %.2fHz = %d cycles\n", __FUNCTION__, p->name, + AVR_LOG(p->io.avr, LOG_TRACE, "TIMER: %s-%c %c %.2fHz = %d cycles\n", + __FUNCTION__, p->name, 'A'+compi, fc, (int)p->comp[compi].comp_cycles); } }