aboutsummaryrefslogtreecommitdiff
path: root/hw/mcf5208.c
diff options
context:
space:
mode:
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2007-06-03 12:54:38 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2007-06-03 12:54:38 +0000
commit6d9db39cd9c31084ab782f6ffd2d67e606fb0802 (patch)
treed6046b44d8f1faeb0a221529e744007bd67c4134 /hw/mcf5208.c
parentd315c8886b72b6ff8abfd43471449ac59da1f35a (diff)
MCF5208 timer fix.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2926 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/mcf5208.c')
-rw-r--r--hw/mcf5208.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/hw/mcf5208.c b/hw/mcf5208.c
index 49108e0929..886688f28d 100644
--- a/hw/mcf5208.c
+++ b/hw/mcf5208.c
@@ -62,9 +62,9 @@ static void m5208_timer_write(m5208_timer_state *s, int offset,
prescale = 1 << ((s->pcsr & PCSR_PRE_MASK) >> PCSR_PRE_SHIFT);
ptimer_set_freq(s->timer, (SYS_FREQ / 2) / prescale);
if (s->pcsr & PCSR_RLD)
- limit = 0xffff;
- else
limit = s->pmr;
+ else
+ limit = 0xffff;
ptimer_set_limit(s->timer, limit, 0);
if (s->pcsr & PCSR_EN)
@@ -73,9 +73,12 @@ static void m5208_timer_write(m5208_timer_state *s, int offset,
case 2:
s->pmr = value;
s->pcsr &= ~PCSR_PIF;
- if (s->pcsr & PCSR_RLD)
- value = 0xffff;
- ptimer_set_limit(s->timer, value, s->pcsr & PCSR_OVW);
+ if ((s->pcsr & PCSR_RLD) == 0) {
+ if (s->pcsr & PCSR_OVW)
+ ptimer_set_count(s->timer, value);
+ } else {
+ ptimer_set_limit(s->timer, value, s->pcsr & PCSR_OVW);
+ }
break;
case 4:
break;