From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNM9k-0001fb-NY for qemu-devel@nongnu.org; Sun, 24 Jan 2016 10:00:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aNM9j-0006aH-TZ for qemu-devel@nongnu.org; Sun, 24 Jan 2016 10:00:44 -0500 References: <7b18c0c2ca44c938a198f56094327ab695f09f9b.1453402860.git.digetx@gmail.com> From: Dmitry Osipenko Message-ID: <56A4E6E9.2010103@gmail.com> Date: Sun, 24 Jan 2016 17:59:53 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v11 7/7] arm_mptimer: Convert to use ptimer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: Peter Maydell , qemu-arm , QEMU Developers 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 1 If 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