target/avr merger
PATCH 1/2 !fixup "hw/misc: Add limited support for AVR power device"
In reply to Philippe Mathieu-Daudé- convert DB_PRINT() to trace-events
- fix style/indentation
--- hw/misc/avr_power.c | 17 +++++++++-------- hw/misc/trace-events | 4 ++++ 2 files changed, 13 insertions(+), 8 deletions(-)
hw/misc/avr_power.c +9 -8
@@ -27,9 +27,7 @@#include "qemu/log.h" #include "hw/qdev-properties.h" #include "hw/irq.h" - -#define DB_PRINT(fmt, args...) /* Nothing */ -/*#define DB_PRINT(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)*/ +#include "trace.h" static void avr_mask_reset (DeviceState *dev) {
@@ -48,19 +46,20 @@ static uint64_t avr_mask_read(void *opaque, hwaddr offset, unsigned size)assert (offset ==0 );AVRMaskState *s = opaque; +trace_avr_power_read (s->val); +return (uint64_t )s->val; }static void avr_mask_write (void *opaque,hwaddr offset, -uint64_t val64,unsigned size) +uint64_t val64,unsigned size) {assert (size ==1 );assert (offset ==0 );AVRMaskState *s = opaque;uint8_t val8 = val64; -DB_PRINT ("write %d to offset %d" , val8, (uint8_t )offset); - +trace_avr_power_write (val8); s->val = val8;for (int i =0 ; i <8 ; i++) {qemu_set_irq (s->irq[i], (val8 & (1 << i)) !=0 );
@@ -71,7 +70,9 @@ static const MemoryRegionOps avr_mask_ops = { .read = avr_mask_read, .write = avr_mask_write, .endianness = DEVICE_NATIVE_ENDIAN, - .impl = {.max_access_size = 1} + .impl = { + .max_access_size = 1, + }, };static void avr_mask_init (Object *dev)
@@ -80,7 +81,7 @@ static void avr_mask_init(Object *dev)SysBusDevice *busdev =SYS_BUS_DEVICE (dev);memory_region_init_io (&s->iomem, dev, &avr_mask_ops, s,TYPE_AVR_MASK , -0x01 ); +0x01 );sysbus_init_mmio (busdev, &s->iomem);for (int i =0 ; i <8 ; i++) {
hw/misc/trace-events +4 -0
@@ -179,3 +179,7 @@ via1_rtc_cmd_pram_read(int addr, int value) "addr=%u value=0x%02x" via1_rtc_cmd_pram_write(int addr, int value) "addr=%u value=0x%02x" via1_rtc_cmd_pram_sect_read(int sector, int offset, int addr, int value) "sector=%u offset=%u addr=%d value=0x%02x" via1_rtc_cmd_pram_sect_write(int sector, int offset, int addr, int value) "sector=%u offset=%u addr=%d value=0x%02x" + +# avr_power.c +avr_power_read(uint8_t value) "power_reduc read value:%u" +avr_power_write(uint8_t value) "power_reduc write value:%u"
Signature · 1 line
2.21.1
Re: [PATCH 1/2] !fixup "hw/misc: Add limited support for AVR power device"
Quoted 35 lines · Philippe Mathieu-Daudé
- convert
DB_PRINT()to trace-events
- fix style/indentationSigned-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/misc/avr_power.c | 17 +++++++++-------- hw/misc/trace-events | 4 ++++ 2 files changed, 13 insertions(+), 8 deletions(-)hw/misc/avr_power.c +3
-4@@ -27,9 +27,7 @@#include "qemu/log.h" #include "hw/qdev-properties.h" #include "hw/irq.h" - -#define DB_PRINT(fmt, args...) /* Nothing */ -/*#define DB_PRINT(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)*/ +#include "trace.h" static void avr_mask_reset (DeviceState *dev) {@@ -48,19 +46,20 @@ static uint64_t avr_mask_read(void *opaque, hwaddr offset, unsigned size)assert (offset ==0 );AVRMaskState *s = opaque; +trace_avr_power_read (s->val); +return (uint64_t )s->val; } static void avr_mask_write(void *opaque, hwaddr offset, -uint64_t val64,unsigned size)
hw/misc/avr_power.c static uint64_t avr_mask_read(void *opaque, hwaddr offset, unsigned size) · line 62
Quoted 10 lines
hw/misc/avr_power.c +2
-2+ uint64_t val64, unsigned size) {assert (size ==1 );assert (offset ==0 );AVRMaskState *s = opaque;uint8_t val8 = val64; -DB_PRINT ("write %d to offset %d" , val8, (uint8_t )offset); - +trace_avr_power_write (val8);
You've dropped offset in this trace point which is probably worth keeping so you track where is being written to. Same with the read.
Quoted 35 lines
hw/misc/avr_power.c +4
-2s->val = val8;for (int i =0 ; i <8 ; i++) {qemu_set_irq (s->irq[i], (val8 & (1 << i)) !=0 );@@ -71,7 +70,9 @@ static const MemoryRegionOps avr_mask_ops = { .read = avr_mask_read, .write = avr_mask_write, .endianness = DEVICE_NATIVE_ENDIAN, - .impl = {.max_access_size = 1} + .impl = { + .max_access_size = 1, + }, };static void avr_mask_init (Object *dev)@@ -80,7 +81,7 @@ static void avr_mask_init(Object *dev)SysBusDevice *busdev =SYS_BUS_DEVICE (dev);memory_region_init_io (&s->iomem, dev, &avr_mask_ops, s,TYPE_AVR_MASK , -0x01 ); +0x01 );sysbus_init_mmio (busdev, &s->iomem);for (int i =0 ; i <8 ; i++) {hw/misc/trace-events +4
-0@@ -179,3 +179,7 @@ via1_rtc_cmd_pram_read(int addr, int value) "addr=%u value=0x%02x" via1_rtc_cmd_pram_write(int addr, int value) "addr=%u value=0x%02x" via1_rtc_cmd_pram_sect_read(int sector, int offset, int addr, int value) "sector=%u offset=%u addr=%d value=0x%02x" via1_rtc_cmd_pram_sect_write(int sector, int offset, int addr, int value) "sector=%u offset=%u addr=%d value=0x%02x" + +# avr_power.c +avr_power_read(uint8_t value) "power_reduc read value:%u" +avr_power_write(uint8_t value) "power_reduc write value:%u"
Signature · 1 line
Alex Bennée
Re: [PATCH 1/2] !fixup "hw/misc: Add limited support for AVR power device"
Quoted 44 lines · Alex Bennée
Quoted 42 lines · Philippe Mathieu-Daudé
- convert
DB_PRINT()to trace-events
- fix style/indentationSigned-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/misc/avr_power.c | 17 +++++++++-------- hw/misc/trace-events | 4 ++++ 2 files changed, 13 insertions(+), 8 deletions(-)hw/misc/avr_power.c +4
-4@@ -27,9 +27,7 @@#include "qemu/log.h" #include "hw/qdev-properties.h" #include "hw/irq.h" - -#define DB_PRINT(fmt, args...) /* Nothing */ -/*#define DB_PRINT(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)*/ +#include "trace.h" static void avr_mask_reset (DeviceState *dev) {@@ -48,19 +46,20 @@ static uint64_t avr_mask_read(void *opaque, hwaddr offset, unsigned size)assert (offset ==0 );AVRMaskState *s = opaque; +trace_avr_power_read (s->val); +return (uint64_t )s->val; }static void avr_mask_write (void *opaque,hwaddr offset, -uint64_t val64,unsigned size) +uint64_t val64,unsigned size) {assert (size ==1 );assert (offset ==0 );AVRMaskState *s = opaque;uint8_t val8 = val64;
Quoted 6 lines
hw/misc/avr_power.c static uint64_t avr_mask_read(void *opaque, hwaddr offset, unsigned size) · line 62
Quoted 3 lines
hw/misc/avr_power.c +1
-2-DB_PRINT ("write %d to offset %d" , val8, (uint8_t )offset); - +trace_avr_power_write (val8);You've dropped offset in this trace point which is probably worth keeping so you track where is being written to. Same with the read.
I dropped it because it is always 0x00, the register is 8bit wide. See below, memory_region_init_io(...,1).
I thought about adding a "name" property so each instance can display the device it belongs to, but this was too invasive, so I decided to keep this change for later.
Quoted 13 lines
Quoted 13 lines
hw/misc/avr_power.c +3
-1s->val = val8;for (int i =0 ; i <8 ; i++) {qemu_set_irq (s->irq[i], (val8 & (1 << i)) !=0 );@@ -71,7 +70,9 @@ static const MemoryRegionOps avr_mask_ops = { .read = avr_mask_read, .write = avr_mask_write, .endianness = DEVICE_NATIVE_ENDIAN, - .impl = {.max_access_size = 1} + .impl = { + .max_access_size = 1, + }, };
Quoted 7 lines
hw/misc/avr_power.c static void avr_mask_init(Object *dev) · line 84
Quoted 7 lines
hw/misc/avr_power.c +1
-1static void avr_mask_init (Object *dev)@@ -80,7 +81,7 @@ static void avr_mask_init(Object *dev)SysBusDevice *busdev =SYS_BUS_DEVICE (dev);memory_region_init_io (&s->iomem, dev, &avr_mask_ops, s,TYPE_AVR_MASK , -0x01 ); +0x01 );
^ Region has only 1 address: 0x00.
Quoted 20 lines
Quoted 8 lines
hw/misc/avr_power.c +0
-0sysbus_init_mmio (busdev, &s->iomem);for (int i =0 ; i <8 ; i++) {hw/misc/trace-events +0
-0hw/misc/trace-events via1_rtc_cmd_pram_read(int addr, int value) "addr=%u value=0x%02x" · line 185
Quoted 7 lines
hw/misc/trace-events +4
-0@@ -179,3 +179,7 @@ via1_rtc_cmd_pram_read(int addr, int value) "addr=%u value=0x%02x" via1_rtc_cmd_pram_write(int addr, int value) "addr=%u value=0x%02x" via1_rtc_cmd_pram_sect_read(int sector, int offset, int addr, int value) "sector=%u offset=%u addr=%d value=0x%02x" via1_rtc_cmd_pram_sect_write(int sector, int offset, int addr, int value) "sector=%u offset=%u addr=%d value=0x%02x" + +# avr_power.c +avr_power_read(uint8_t value) "power_reduc read value:%u" +avr_power_write(uint8_t value) "power_reduc write value:%u"--
Alex Bennée
Alex Bennée
Reviewed-byRe: [PATCH 1/2] !fixup "hw/misc: Add limited support for AVR power device"
Quoted 52 lines · Philippe Mathieu-Daudé
Quoted 44 lines · Alex Bennée
Quoted 42 lines · Philippe Mathieu-Daudé
- convert
DB_PRINT()to trace-events
- fix style/indentationSigned-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/misc/avr_power.c | 17 +++++++++-------- hw/misc/trace-events | 4 ++++ 2 files changed, 13 insertions(+), 8 deletions(-)hw/misc/avr_power.c +4
-4@@ -27,9 +27,7 @@#include "qemu/log.h" #include "hw/qdev-properties.h" #include "hw/irq.h" - -#define DB_PRINT(fmt, args...) /* Nothing */ -/*#define DB_PRINT(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)*/ +#include "trace.h" static void avr_mask_reset (DeviceState *dev) {@@ -48,19 +46,20 @@ static uint64_t avr_mask_read(void *opaque, hwaddr offset, unsigned size)assert (offset ==0 );AVRMaskState *s = opaque; +trace_avr_power_read (s->val); +return (uint64_t )s->val; }static void avr_mask_write (void *opaque,hwaddr offset, -uint64_t val64,unsigned size) +uint64_t val64,unsigned size) {assert (size ==1 );assert (offset ==0 );AVRMaskState *s = opaque;uint8_t val8 = val64;Quoted 6 lines
hw/misc/avr_power.c static uint64_t avr_mask_read(void *opaque, hwaddr offset, unsigned size) · line 62
Quoted 3 lines
hw/misc/avr_power.c +1
-2-DB_PRINT ("write %d to offset %d" , val8, (uint8_t )offset); - +trace_avr_power_write (val8);You've dropped offset in this trace point which is probably worth keeping so you track where is being written to. Same with the read.
Quoted 5 lines
I dropped it because it is always
0x00, the register is 8bit wide. See below,memory_region_init_io(...,1).
I thought about adding a "name" property so each instance can display the device it belongs to, but this was too invasive, so I decided to keep this change for later.
Ahh I did wonder (I was reviewing without applying). Might be worth mentioning in the commit then.
Quoted 44 lines
Quoted 14 lines
Quoted 14 lines
hw/misc/avr_power.c +3
-1s->val = val8;for (int i =0 ; i <8 ; i++) {qemu_set_irq (s->irq[i], (val8 & (1 << i)) !=0 );@@ -71,7 +70,9 @@ static const MemoryRegionOps avr_mask_ops = { .read = avr_mask_read, .write = avr_mask_write, .endianness = DEVICE_NATIVE_ENDIAN, - .impl = {.max_access_size = 1} + .impl = { + .max_access_size = 1, + }, };Quoted 7 lines
hw/misc/avr_power.c static void avr_mask_init(Object *dev) · line 84
Quoted 7 lines
hw/misc/avr_power.c +1
-1static void avr_mask_init (Object *dev)@@ -80,7 +81,7 @@ static void avr_mask_init(Object *dev)SysBusDevice *busdev =SYS_BUS_DEVICE (dev);memory_region_init_io (&s->iomem, dev, &avr_mask_ops, s,TYPE_AVR_MASK , -0x01 ); +0x01 );^ Region has only 1 address:
0x00.Quoted 20 lines
Quoted 8 lines
hw/misc/avr_power.c +0
-0sysbus_init_mmio (busdev, &s->iomem);for (int i =0 ; i <8 ; i++) {hw/misc/trace-events +0
-0hw/misc/trace-events via1_rtc_cmd_pram_read(int addr, int value) "addr=%u value=0x%02x" · line 185
Quoted 7 lines
hw/misc/trace-events +4
-0@@ -179,3 +179,7 @@ via1_rtc_cmd_pram_read(int addr, int value) "addr=%u value=0x%02x" via1_rtc_cmd_pram_write(int addr, int value) "addr=%u value=0x%02x" via1_rtc_cmd_pram_sect_read(int sector, int offset, int addr, int value) "sector=%u offset=%u addr=%d value=0x%02x" via1_rtc_cmd_pram_sect_write(int sector, int offset, int addr, int value) "sector=%u offset=%u addr=%d value=0x%02x" + +# avr_power.c +avr_power_read(uint8_t value) "power_reduc read value:%u" +avr_power_write(uint8_t value) "power_reduc write value:%u"--
Alex Bennée
Signature · 1 line
Alex Bennée
PATCH 2/2 !fixup "hw/timer: Add limited support for AVR 16-bit timer peripheral"
In reply to Philippe Mathieu-DaudéConvert DB_PRINT() to trace events.
--- hw/timer/avr_timer16.c | 25 +++++++++++++++---------- hw/timer/trace-events | 12 ++++++++++++ 2 files changed, 27 insertions(+), 10 deletions(-)
hw/timer/avr_timer16.c +15 -10
@@ -36,6 +36,7 @@#include "qemu/log.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "trace.h" /* Register offsets */ #define T16_CRA 0x0
@@ -104,7 +105,6 @@/* Helper macros */ #define VAL16 (l, h) ((h << 8) | l) #define DB_PRINT(fmt, args...) /* Nothing */ -/*#define DB_PRINT(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)*/ static inline int64_t avr_timer16_ns_to_ticks (AVRTimer16State *t16,int64_t t) {
@@ -168,8 +168,8 @@ static void avr_timer16_clksrc_update(AVRTimer16State *t16)if (divider) { t16->freq_hz = t16->cpu_freq_hz / divider; t16->period_ns =NANOSECONDS_PER_SECOND / t16->freq_hz; -DB_PRINT ("Timer frequency %" PRIu64" hz, period %" PRIu64" ns (%f s)" , - t16->freq_hz, t16->period_ns,1 / (double )t16->freq_hz); +trace_avr_timer16_clksrc_update (t16->freq_hz, t16->period_ns, + (uint64_t )(1e6 / t16->freq_hz)); } }
@@ -235,8 +235,7 @@ static void avr_timer16_set_alarm(AVRTimer16State *t16) t16->reset_time_ns + ((CNT (t16) + alarm_offset) * t16->period_ns);timer_mod (t16->timer, alarm_ns); -DB_PRINT ("next alarm %" PRIu64" ns from now" , - alarm_offset * t16->period_ns); +trace_avr_timer16_next_alarm (alarm_offset * t16->period_ns); }static void avr_timer16_interrupt (void *opaque)
@@ -253,11 +252,11 @@ static void avr_timer16_interrupt(void *opaque)return ; } -DB_PRINT ("interrupt, cnt = %d" ,CNT (t16)); +trace_avr_timer16_interrupt_count (CNT (t16));/* Counter overflow */ if (t16->next_interrupt ==OVERFLOW ) { -DB_PRINT ("0xffff overflow" ); +trace_avr_timer16_interrupt_overflow ("counter 0xffff" );avr_timer16_clock_reset (t16);if (t16->imsk &T16_INT_TOV ) { t16->ifr |=T16_INT_TOV ;
@@ -266,12 +265,12 @@ static void avr_timer16_interrupt(void *opaque) }/* Check for ocra overflow in CTC mode */ if (mode ==T16_MODE_CTC_OCRA && t16->next_interrupt ==COMPA ) { -DB_PRINT ("CTC OCRA overflow" ); +trace_avr_timer16_interrupt_overflow ("CTC OCRA" );avr_timer16_clock_reset (t16); }/* Check for icr overflow in CTC mode */ if (mode ==T16_MODE_CTC_ICR && t16->next_interrupt ==CAPT ) { -DB_PRINT ("CTC ICR overflow" ); +trace_avr_timer16_interrupt_overflow ("CTC ICR" );avr_timer16_clock_reset (t16);if (t16->imsk &T16_INT_IC ) { t16->ifr |=T16_INT_IC ;
@@ -367,6 +366,8 @@ static uint64_t avr_timer16_read(void *opaque, hwaddr offset, unsigned size)default :break ; } +trace_avr_timer16_read (offset, retval); +return (uint64_t )retval; }
@@ -378,7 +379,7 @@ static void avr_timer16_write(void *opaque, hwaddr offset,uint8_t val8 = (uint8_t )val64;uint8_t prev_clk_src =CLKSRC (t16); -DB_PRINT ("write %d to offset %d" , val8, (uint8_t )offset); +trace_avr_timer16_write (offset, val8);switch (offset) {case T16_CRA :
@@ -475,6 +476,7 @@ static uint64_t avr_timer16_imsk_read(void *opaque, {assert (size ==1 );AVRTimer16State *t16 = opaque; +trace_avr_timer16_read_imsk (offset ?0 : t16->imsk);if (offset !=0 ) {return 0 ; }
@@ -486,6 +488,7 @@ static void avr_timer16_imsk_write(void *opaque, hwaddr offset, {assert (size ==1 );AVRTimer16State *t16 = opaque; +trace_avr_timer16_write_imsk (val64);if (offset !=0 ) {return ; }
@@ -498,6 +501,7 @@ static uint64_t avr_timer16_ifr_read(void *opaque, {assert (size ==1 );AVRTimer16State *t16 = opaque; +trace_avr_timer16_read_ifr (offset ?0 : t16->ifr);if (offset !=0 ) {return 0 ; }
@@ -509,6 +513,7 @@ static void avr_timer16_ifr_write(void *opaque, hwaddr offset, {assert (size ==1 );AVRTimer16State *t16 = opaque; +trace_avr_timer16_write_imsk (val64);if (offset !=0 ) {return ; }
hw/timer/trace-events +12 -0
@@ -74,3 +74,15 @@ nrf51_timer_write(uint64_t addr, uint32_t value, unsigned size) "write addr 0x%" bcm2835_systmr_irq(bool enable) "timer irq state %u" bcm2835_systmr_read(uint64_t offset, uint64_t data) "timer read: offset 0x%" PRIx64 " data 0x%" PRIx64 bcm2835_systmr_write(uint64_t offset, uint64_t data) "timer write: offset 0x%" PRIx64 " data 0x%" PRIx64 + +# avr_timer16.c +avr_timer16_read(uint8_t addr, uint8_t value) "timer16 read addr:%u value:%u" +avr_timer16_read_ifr(uint8_t value) "timer16 read addr:ifr value:%u" +avr_timer16_read_imsk(uint8_t value) "timer16 read addr:imsk value:%u" +avr_timer16_write(uint8_t addr, uint8_t value) "timer16 write addr:%u value:%u" +avr_timer16_write_ifr(uint8_t value) "timer16 write addr:ifr value:%u" +avr_timer16_write_imsk(uint8_t value) "timer16 write addr:imsk value:%u" +avr_timer16_interrupt_count(uint8_t cnt) "count: %u" +avr_timer16_interrupt_overflow(const char *reason) "overflow: %s" +avr_timer16_next_alarm(uint64_t delay_ns) "next alarm: %" PRIu64 " ns from now" +avr_timer16_clksrc_update(uint64_t freq_hz, uint64_t period_ns, uint64_t delay_s) "timer frequency: %" PRIu64 " Hz, period: %" PRIu64 " ns (%" PRId64 " us)"
Signature · 1 line
2.21.1
Re: [PATCH 2/2] !fixup "hw/timer: Add limited support for AVR 16-bit timer peripheral"
Quoted 29 lines · Philippe Mathieu-Daudé
Convert
DB_PRINT()to trace events.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/timer/avr_timer16.c | 25 +++++++++++++++---------- hw/timer/trace-events | 12 ++++++++++++ 2 files changed, 27 insertions(+), 10 deletions(-)hw/timer/avr_timer16.c +1
-1@@ -36,6 +36,7 @@#include "qemu/log.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "trace.h" /* Register offsets */ #define T16_CRA 0x0@@ -104,7 +105,6 @@/* Helper macros */ #define VAL16 (l, h) ((h << 8) | l) #define DB_PRINT(fmt, args...) /* Nothing */ -/*#define DB_PRINT(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)*/ static inline int64_t avr_timer16_ns_to_ticks (AVRTimer16State *t16,int64_t t) {
hw/timer/avr_timer16.c static void avr_timer16_clksrc_update(AVRTimer16State *t16) · line 173
Quoted 8 lines
hw/timer/avr_timer16.c +2
-2@@ -168,8 +168,8 @@ static void avr_timer16_clksrc_update(AVRTimer16State *t16)if (divider) { t16->freq_hz = t16->cpu_freq_hz / divider; t16->period_ns =NANOSECONDS_PER_SECOND / t16->freq_hz; -DB_PRINT ("Timer frequency %" PRIu64" hz, period %" PRIu64" ns (%f s)" , - t16->freq_hz, t16->period_ns,1 / (double )t16->freq_hz); +trace_avr_timer16_clksrc_update (t16->freq_hz, t16->period_ns, + (uint64_t )(1e6 / t16->freq_hz));
Is it worth including a computed value here?
Quoted 29 lines
hw/timer/avr_timer16.c +3
-4} }@@ -235,8 +235,7 @@ static void avr_timer16_set_alarm(AVRTimer16State *t16) t16->reset_time_ns + ((CNT (t16) + alarm_offset) * t16->period_ns);timer_mod (t16->timer, alarm_ns); -DB_PRINT ("next alarm %" PRIu64" ns from now" , - alarm_offset * t16->period_ns); +trace_avr_timer16_next_alarm (alarm_offset * t16->period_ns); }static void avr_timer16_interrupt (void *opaque)@@ -253,11 +252,11 @@ static void avr_timer16_interrupt(void *opaque)return ; } -DB_PRINT ("interrupt, cnt = %d" ,CNT (t16)); +trace_avr_timer16_interrupt_count (CNT (t16));/* Counter overflow */ if (t16->next_interrupt ==OVERFLOW ) { -DB_PRINT ("0xffff overflow" ); +trace_avr_timer16_interrupt_overflow ("counter 0xffff" );avr_timer16_clock_reset (t16);if (t16->imsk &T16_INT_TOV ) { t16->ifr |=T16_INT_TOV ;@@ -266,12 +265,12 @@ static void avr_timer16_interrupt(void *opaque) }
hw/timer/avr_timer16.c static void avr_timer16_interrupt(void *opaque) · line 273
Quoted 10 lines
hw/timer/avr_timer16.c +2
-2/* Check for ocra overflow in CTC mode */ if (mode ==T16_MODE_CTC_OCRA && t16->next_interrupt ==COMPA ) { -DB_PRINT ("CTC OCRA overflow" ); +trace_avr_timer16_interrupt_overflow ("CTC OCRA" );avr_timer16_clock_reset (t16); }/* Check for icr overflow in CTC mode */ if (mode ==T16_MODE_CTC_ICR && t16->next_interrupt ==CAPT ) { -DB_PRINT ("CTC ICR overflow" ); +trace_avr_timer16_interrupt_overflow ("CTC ICR" );
Rather than spamming strings to the trace log I'd suggest expanding trace_avr_timer16_interrupt_count to include the mode and next_interrupt state as hex values.
Quoted 73 lines
hw/timer/avr_timer16.c +7
-1avr_timer16_clock_reset (t16);if (t16->imsk &T16_INT_IC ) { t16->ifr |=T16_INT_IC ;@@ -367,6 +366,8 @@ static uint64_t avr_timer16_read(void *opaque, hwaddr offset, unsigned size)default :break ; } +trace_avr_timer16_read (offset, retval); +return (uint64_t )retval; }@@ -378,7 +379,7 @@ static void avr_timer16_write(void *opaque, hwaddr offset,uint8_t val8 = (uint8_t )val64;uint8_t prev_clk_src =CLKSRC (t16); -DB_PRINT ("write %d to offset %d" , val8, (uint8_t )offset); +trace_avr_timer16_write (offset, val8);switch (offset) {case T16_CRA :@@ -475,6 +476,7 @@ static uint64_t avr_timer16_imsk_read(void *opaque, {assert (size ==1 );AVRTimer16State *t16 = opaque; +trace_avr_timer16_read_imsk (offset ?0 : t16->imsk);if (offset !=0 ) {return 0 ; }@@ -486,6 +488,7 @@ static void avr_timer16_imsk_write(void *opaque, hwaddr offset, {assert (size ==1 );AVRTimer16State *t16 = opaque; +trace_avr_timer16_write_imsk (val64);if (offset !=0 ) {return ; }@@ -498,6 +501,7 @@ static uint64_t avr_timer16_ifr_read(void *opaque, {assert (size ==1 );AVRTimer16State *t16 = opaque; +trace_avr_timer16_read_ifr (offset ?0 : t16->ifr);if (offset !=0 ) {return 0 ; }@@ -509,6 +513,7 @@ static void avr_timer16_ifr_write(void *opaque, hwaddr offset, {assert (size ==1 );AVRTimer16State *t16 = opaque; +trace_avr_timer16_write_imsk (val64);if (offset !=0 ) {return ; }hw/timer/trace-events +12
-0@@ -74,3 +74,15 @@ nrf51_timer_write(uint64_t addr, uint32_t value, unsigned size) "write addr 0x%" bcm2835_systmr_irq(bool enable) "timer irq state %u" bcm2835_systmr_read(uint64_t offset, uint64_t data) "timer read: offset 0x%" PRIx64 " data 0x%" PRIx64 bcm2835_systmr_write(uint64_t offset, uint64_t data) "timer write: offset 0x%" PRIx64 " data 0x%" PRIx64 + +# avr_timer16.c +avr_timer16_read(uint8_t addr, uint8_t value) "timer16 read addr:%u value:%u" +avr_timer16_read_ifr(uint8_t value) "timer16 read addr:ifr value:%u" +avr_timer16_read_imsk(uint8_t value) "timer16 read addr:imsk value:%u" +avr_timer16_write(uint8_t addr, uint8_t value) "timer16 write addr:%u value:%u" +avr_timer16_write_ifr(uint8_t value) "timer16 write addr:ifr value:%u" +avr_timer16_write_imsk(uint8_t value) "timer16 write addr:imsk value:%u" +avr_timer16_interrupt_count(uint8_t cnt) "count: %u" +avr_timer16_interrupt_overflow(const char *reason) "overflow: %s" +avr_timer16_next_alarm(uint64_t delay_ns) "next alarm: %" PRIu64 " ns from now" +avr_timer16_clksrc_update(uint64_t freq_hz, uint64_t period_ns, uint64_t delay_s) "timer frequency: %" PRIu64 " Hz, period: %" PRIu64 " ns (%" PRId64 " us)"
Signature · 1 line
Alex Bennée
Re: [PATCH 0/2] !fixup target/avr merger-rc4
In reply to Philippe Mathieu-DaudéQuoted 10 lines · Philippe Mathieu-Daudé
Aleksandar, I addressed Alex Bennée comment as fixup, so you can squash directly. See:
https://www.mail-archive.com/[email protected]/msg673846.html- convert
DB_PRINT()to trace-events
- fix style/indentationBased-on: <[email protected]>
That is great!
I am going to squash it into corresponding patches, and mention that in commit messages.
Then I guess some r-b (by Alex) can be added.
Cool!
Quoted 13 lines
Philippe Mathieu-Daudé (2):
!fixup "hw/misc: Add limited support for AVR power device" !fixup "hw/timer: Add limited support for AVR 16-bit timer peripheral"hw/misc/avr_power.c | 17 +++++++++-------- hw/timer/avr_timer16.c | 25 +++++++++++++++---------- hw/misc/trace-events | 4 ++++ hw/timer/trace-events | 12 ++++++++++++ 4 files changed, 40 insertions(+), 18 deletions(-)--
2.21.1