Commit 6d9db39cd9c31084ab782f6ffd2d67e606fb0802

Authored by pbrook
1 parent d315c888

MCF5208 timer fix.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2926 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 8 additions and 5 deletions
hw/mcf5208.c
... ... @@ -62,9 +62,9 @@ static void m5208_timer_write(m5208_timer_state *s, int offset,
62 62 prescale = 1 << ((s->pcsr & PCSR_PRE_MASK) >> PCSR_PRE_SHIFT);
63 63 ptimer_set_freq(s->timer, (SYS_FREQ / 2) / prescale);
64 64 if (s->pcsr & PCSR_RLD)
65   - limit = 0xffff;
66   - else
67 65 limit = s->pmr;
  66 + else
  67 + limit = 0xffff;
68 68 ptimer_set_limit(s->timer, limit, 0);
69 69  
70 70 if (s->pcsr & PCSR_EN)
... ... @@ -73,9 +73,12 @@ static void m5208_timer_write(m5208_timer_state *s, int offset,
73 73 case 2:
74 74 s->pmr = value;
75 75 s->pcsr &= ~PCSR_PIF;
76   - if (s->pcsr & PCSR_RLD)
77   - value = 0xffff;
78   - ptimer_set_limit(s->timer, value, s->pcsr & PCSR_OVW);
  76 + if ((s->pcsr & PCSR_RLD) == 0) {
  77 + if (s->pcsr & PCSR_OVW)
  78 + ptimer_set_count(s->timer, value);
  79 + } else {
  80 + ptimer_set_limit(s->timer, value, s->pcsr & PCSR_OVW);
  81 + }
79 82 break;
80 83 case 4:
81 84 break;
... ...