From 0d3f95abd5081d99eee487223c01ff31311d3f0b Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Mon, 2 Aug 2010 22:38:44 +0100 Subject: [PATCH] timer: Fix for older AVRs & tinies They lack WGM bits Signed-off-by: Michel Pollet --- simavr/sim/avr_timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/simavr/sim/avr_timer.c b/simavr/sim/avr_timer.c index 5d658a5..be21338 100644 --- a/simavr/sim/avr_timer.c +++ b/simavr/sim/avr_timer.c @@ -407,7 +407,8 @@ void avr_timer_init(avr_t * avr, avr_timer_t * p) avr_register_vector(avr, &p->overflow); avr_register_vector(avr, &p->icr); - avr_register_io_write(avr, p->wgm[0].reg, avr_timer_write, p); + if (p->wgm[0].reg) // these are not present on older AVRs + avr_register_io_write(avr, p->wgm[0].reg, avr_timer_write, p); avr_register_io_write(avr, p->cs[0].reg, avr_timer_write, p); // this assumes all the "pending" interrupt bits are in the same -- 2.39.5