Fix setting counter limit to 0 (Robert Reif)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3834 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
19f8e5dd2b
commit
6240d64670
|
@ -175,7 +175,6 @@ static void slavio_timer_mem_writel(void *opaque, target_phys_addr_t addr,
|
||||||
{
|
{
|
||||||
SLAVIO_TIMERState *s = opaque;
|
SLAVIO_TIMERState *s = opaque;
|
||||||
uint32_t saddr;
|
uint32_t saddr;
|
||||||
int reload = 0;
|
|
||||||
|
|
||||||
DPRINTF("write " TARGET_FMT_plx " %08x\n", addr, val);
|
DPRINTF("write " TARGET_FMT_plx " %08x\n", addr, val);
|
||||||
saddr = (addr & TIMER_MAXADDR) >> 2;
|
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
|
// set limit, reset counter
|
||||||
qemu_irq_lower(s->irq);
|
qemu_irq_lower(s->irq);
|
||||||
s->limit = val & TIMER_MAX_COUNT32;
|
s->limit = val & TIMER_MAX_COUNT32;
|
||||||
if (!s->limit)
|
if (s->limit == 0) /* free-run */
|
||||||
s->limit = TIMER_MAX_COUNT32;
|
ptimer_set_limit(s->timer, LIMIT_TO_PERIODS(TIMER_MAX_COUNT32), 1);
|
||||||
ptimer_set_limit(s->timer, s->limit >> 9, 1);
|
else
|
||||||
|
ptimer_set_limit(s->timer, LIMIT_TO_PERIODS(s->limit), 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TIMER_COUNTER:
|
case TIMER_COUNTER:
|
||||||
|
@ -209,9 +209,10 @@ static void slavio_timer_mem_writel(void *opaque, target_phys_addr_t addr,
|
||||||
case TIMER_COUNTER_NORST:
|
case TIMER_COUNTER_NORST:
|
||||||
// set limit without resetting counter
|
// set limit without resetting counter
|
||||||
s->limit = val & TIMER_MAX_COUNT32;
|
s->limit = val & TIMER_MAX_COUNT32;
|
||||||
if (!s->limit)
|
if (s->limit == 0) /* free-run */
|
||||||
s->limit = TIMER_MAX_COUNT32;
|
ptimer_set_limit(s->timer, LIMIT_TO_PERIODS(TIMER_MAX_COUNT32), 0);
|
||||||
ptimer_set_limit(s->timer, LIMIT_TO_PERIODS(s->limit), reload);
|
else
|
||||||
|
ptimer_set_limit(s->timer, LIMIT_TO_PERIODS(s->limit), 0);
|
||||||
break;
|
break;
|
||||||
case TIMER_STATUS:
|
case TIMER_STATUS:
|
||||||
if (slavio_timer_is_user(s)) {
|
if (slavio_timer_is_user(s)) {
|
||||||
|
|
Loading…
Reference in a new issue