diff options
author | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-12-17 18:21:57 +0000 |
---|---|---|
committer | blueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-12-17 18:21:57 +0000 |
commit | 6240d6467077a12c24878bab645d8e2983e4975a (patch) | |
tree | b3f7252df491fd7f2b1c3c23680c0a65669aa3db /hw/slavio_timer.c | |
parent | 19f8e5dd2bf6f4093988b13c424a7ba35f39071d (diff) | |
download | qemu-6240d6467077a12c24878bab645d8e2983e4975a.zip qemu-6240d6467077a12c24878bab645d8e2983e4975a.tar.gz qemu-6240d6467077a12c24878bab645d8e2983e4975a.tar.bz2 |
Fix setting counter limit to 0 (Robert Reif)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3834 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/slavio_timer.c')
-rw-r--r-- | hw/slavio_timer.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/hw/slavio_timer.c b/hw/slavio_timer.c index 1018f70..f98647f 100644 --- a/hw/slavio_timer.c +++ b/hw/slavio_timer.c @@ -175,7 +175,6 @@ static void slavio_timer_mem_writel(void *opaque, target_phys_addr_t addr, { SLAVIO_TIMERState *s = opaque; uint32_t saddr; - int reload = 0; DPRINTF("write " TARGET_FMT_plx " %08x\n", addr, val); saddr = (addr & TIMER_MAXADDR) >> 2; @@ -191,9 +190,10 @@ static void slavio_timer_mem_writel(void *opaque, target_phys_addr_t addr, // set limit, reset counter qemu_irq_lower(s->irq); s->limit = val & TIMER_MAX_COUNT32; - if (!s->limit) - s->limit = TIMER_MAX_COUNT32; - ptimer_set_limit(s->timer, s->limit >> 9, 1); + if (s->limit == 0) /* free-run */ + ptimer_set_limit(s->timer, LIMIT_TO_PERIODS(TIMER_MAX_COUNT32), 1); + else + ptimer_set_limit(s->timer, LIMIT_TO_PERIODS(s->limit), 1); } break; case TIMER_COUNTER: @@ -209,9 +209,10 @@ static void slavio_timer_mem_writel(void *opaque, target_phys_addr_t addr, case TIMER_COUNTER_NORST: // set limit without resetting counter s->limit = val & TIMER_MAX_COUNT32; - if (!s->limit) - s->limit = TIMER_MAX_COUNT32; - ptimer_set_limit(s->timer, LIMIT_TO_PERIODS(s->limit), reload); + if (s->limit == 0) /* free-run */ + ptimer_set_limit(s->timer, LIMIT_TO_PERIODS(TIMER_MAX_COUNT32), 0); + else + ptimer_set_limit(s->timer, LIMIT_TO_PERIODS(s->limit), 0); break; case TIMER_STATUS: if (slavio_timer_is_user(s)) { |