From: Paul Brook <paul@codesourcery.com>
To: Peter Crosthwaite <peter.crosthwaite@petalogix.com>
Cc: peter.maydell@linaro.org, monstr@monstr.eu,
edgar.iglesias@petalogix.com, qemu-devel@nongnu.org,
John Linn <john.linn@xilinx.com>,
duyl@xilinx.com, linnj@xilinx.com, afaerber@suse.de,
john.williams@petalogix.com
Subject: Re: [Qemu-devel] [RFC PATCH v2 2/4] cadence_ttc: initial version of device model
Date: Wed, 8 Feb 2012 12:35:13 +0000 [thread overview]
Message-ID: <201202081235.13824.paul@codesourcery.com> (raw)
In-Reply-To: <CAEgOgz7naoJVNnSk8EYq-0BmpC9zDzeKq62__mrFWE8VOMacGw@mail.gmail.com>
> > - When are interrupts raised. You mention a user specified match value.
> > Do we also get an interrupt on wraparound?
>
> Yes, an interrupts occur on wrap around of the 16 bit timer value. There
> are three match registers which correspond to three more
> (separately maskable) interrupts which are risen when the timer crosses
> that value. My implementation will figure out which of the three events (or
> the wraparound) will occur next, and one shot the corresponding period of
> time. Note that a match can occur an raise an interrupt without a wrap or
> reset occuring. E.G. i could set my timer counting up from 0 and when the
> value hits BEEF, i get an interrupt, but the timer still counts all the way
> to FFFF before wrapping.
Ok. I'd missed that there are 3 matches per timer.
> > If you've got independent wrap and match events then I guess yes, a
> > periodic
> > wrap plus a oneshot match event is probably appropriate.
>
> Yes this is the case. I will look into making it happen.
It's probably not worth using ptimer at all.
Instead use QEMUTimer/qemu_mod_timer directly. The trick is to call
qemu_get_clock_ns when the timer is started and calculate all deadlines
incrementally from that, not from the time when the last timeout happened to
fire. See ptimer.c:ptimer_reload/tick or stellaris.c:gptm_reload/tick for
examples.
ptimer.c provides a common implementation of a simple periodic timer.
Previously we had a dozen different implementations, most of which were broken
in one way or annother. For more complicated devices you need to know what
you're doing anyway :-)
Paul
next prev parent reply other threads:[~2012-02-08 12:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-07 6:19 [Qemu-devel] [RFC PATCH v2 0/4]Zynq-7000 EPP platform model Peter A. G. Crosthwaite
2012-02-07 6:19 ` [Qemu-devel] [RFC PATCH v2 1/4] cadence_uart: initial version of device model Peter A. G. Crosthwaite
2012-02-07 6:19 ` [Qemu-devel] [RFC PATCH v2 2/4] cadence_ttc: " Peter A. G. Crosthwaite
2012-02-07 11:28 ` Paul Brook
2012-02-08 7:27 ` Peter Crosthwaite
2012-02-08 10:15 ` Paul Brook
2012-02-08 10:35 ` Peter Crosthwaite
2012-02-08 12:35 ` Paul Brook [this message]
2012-02-08 12:47 ` Peter Crosthwaite
2012-02-07 6:19 ` [Qemu-devel] [RFC PATCH v2 3/4] cadence_gem: " Peter A. G. Crosthwaite
2012-02-07 6:19 ` [Qemu-devel] [RFC PATCH v2 4/4] xilinx_zynq: machine model initial version Peter A. G. Crosthwaite
2012-02-07 11:25 ` [Qemu-devel] [RFC PATCH v2 0/4]Zynq-7000 EPP platform model Paul Brook
2012-02-08 8:24 ` Peter Crosthwaite
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201202081235.13824.paul@codesourcery.com \
--to=paul@codesourcery.com \
--cc=afaerber@suse.de \
--cc=duyl@xilinx.com \
--cc=edgar.iglesias@petalogix.com \
--cc=john.linn@xilinx.com \
--cc=john.williams@petalogix.com \
--cc=linnj@xilinx.com \
--cc=monstr@monstr.eu \
--cc=peter.crosthwaite@petalogix.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).