From: Michel Pollet Date: Mon, 2 Aug 2010 21:38:44 +0000 (+0100) Subject: timer: Fix for older AVRs & tinies X-Git-Tag: v1.0a5~6 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=0d3f95abd5081d99eee487223c01ff31311d3f0b;p=sx%2Fsimavr.git timer: Fix for older AVRs & tinies They lack WGM bits Signed-off-by: Michel Pollet --- 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