|
From: | Dmitry Osipenko |
Subject: | Re: [Qemu-devel] [PATCH v11 7/7] arm_mptimer: Convert to use ptimer |
Date: | Sun, 24 Jan 2016 17:59:53 +0300 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
Hello Peter, 24.01.2016 08:25, Peter Crosthwaite пишет: [snip]
+ timerblock_run(tb->timer, control, (value != 0) && (control & 1)); break; case 8: /* Control. */ - old = tb->control; - tb->control = value; - if (value & 1) { - if ((old & 1) && (tb->count != 0)) { - /* Do nothing if timer is ticking right now. */ - break; + if ((value & 1) && (control & 3) != (value & 3)) { + uint64_t count = (value & 0xff00) ? 1 : ptimer_get_count(tb->timer); + if ((count == 0) && (value & 2)) { + timerblock_set_count(tb->timer, value, &count);This looks like a weird corner-case, what does it do exactly? I can't follow it so it needs a comment :)
It does the following: mode | prescaler | reload if counter == 0 | tick immediately if counter == 0 -------------------------------------------------------------------------------- oneshot == 0 0 0 oneshot != 0 0 1 periodic == 0 1 0 periodic != 0 0 1If writing control register with prescaler = 0, then for one-shot timer with counter == 0 or periodic timer with load = counter == 0 this is NOP. Will add a comment.
Thanks for review! -- Dmitry
[Prev in Thread] | Current Thread | [Next in Thread] |