From: Jun Sun <jsun@mvista.com>
To: Richard Zidlicky <rz@linux-m68k.org>
Cc: Roman Zippel <zippel@linux-m68k.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
"Maciej W. Rozycki" <macro@ds2.pg.gda.pl>,
Linux/MIPS Development <linux-mips@oss.sgi.com>,
Linux/m68k <linux-m68k@lists.linux-m68k.org>,
Linux/PPC Development <linuxppc-dev@lists.linuxppc.org>
Subject: Re: [RFC] generic MIPS RTC driver
Date: Thu, 15 Nov 2001 09:41:13 -0800 [thread overview]
Message-ID: <3BF3FE39.34C541EB@mvista.com> (raw)
In-Reply-To: 20011114110842.A473@linux-m68k.org
Richard Zidlicky wrote:
>
> On Tue, Nov 13, 2001 at 09:58:45AM -0800, Jun Sun wrote:
> > Richard Zidlicky wrote:
> >
> > > Btw the interrupt need not to be hardware, for the Q40 I test
> > > a rtc register once per jiffie and generate a "soft interrupt".
> > > It could be done generic at least for m68k.
> > >
> >
> > I have written an experiemntal ptimer driver to do just this and potential
> > more. Such a device is useful for real-time programming (e.g., when you try
> > to implement a periodic user task).
> >
> > See http://linux.junsun.net/realtime-linux/preemption-test
> >
> > The driver is architecture independent (i.e., linux-common code)
> >
> > Due to the different programming needs behind periodic timers (or user-level
> > timer) and RTC operations, my vote for future work is to leave them as two
> > separate drivers. To me, RTC is really just to read/write RTC clock.
>
> RTC_UIE is needed (or at least very useful) to set the clock, so it belongs
> into a rtc driver if it can be implemented. General purpose timers are
> different story, btw what is wrong with setitimer that you have chosen
> to implement an additional driver for it?
Easy of implmentation and more features.
Here is the pseudo code to do a real-time periodic task with /dev/ptimer:
void periodic_task(void)
{
fd=open("/dev/ptimer", O_RDONLY);
ioctl(fd, PTIMER_SET_PERIOD, PERIOD);
ioctl(fd, PTIMER_SET_PHASE, PHASE);
/* become realtime process */
start_realtime();
for(;;) {
/* read won't return until next instance release point */
read(fd, &count, sizeof(count));
/* do the job */
...
}
}
Anybody who has used setitimer() would konw this is even simpler than the
setup of itimer, let alone with itimer you still need to deal with SIGALRM
signals plus some multi-thread signal handling considerations.
On the feature side, ptimer offers the exact control of phase. For example,
you can have two tasks with period of 100ms, with one starting *exactly* at
time t and the other starting *exactly* at t+50 ms later.
Some unimplemented features allow you to control the behavior when missing
deadlines.
Jun
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
prev parent reply other threads:[~2001-11-15 17:41 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20011110231746.B4342@mvista.com>
2001-11-11 10:14 ` [RFC] generic MIPS RTC driver Geert Uytterhoeven
2001-11-12 12:59 ` Maciej W. Rozycki
2001-11-12 13:11 ` Geert Uytterhoeven
2001-11-12 13:29 ` Maciej W. Rozycki
2001-11-12 16:14 ` Pete Popov
2001-11-12 18:26 ` Jun Sun
2001-11-12 18:56 ` Jun Sun
2001-11-12 21:51 ` Tom Rini
2001-11-12 18:24 ` Jun Sun
2001-11-12 19:04 ` Maciej W. Rozycki
2001-11-12 19:21 ` Jun Sun
2001-11-12 18:19 ` Jun Sun
2001-11-12 18:55 ` Maciej W. Rozycki
2001-11-12 19:13 ` Jun Sun
2001-11-12 20:02 ` Geert Uytterhoeven
2001-11-12 20:54 ` Roman Zippel
2001-11-13 1:31 ` Tom Rini
2001-11-13 6:20 ` Geert Uytterhoeven
2001-11-13 14:44 ` Tom Rini
2001-11-13 14:47 ` Geert Uytterhoeven
2001-11-13 15:30 ` Roman Zippel
2001-11-13 13:42 ` Richard Zidlicky
2001-11-13 15:32 ` Roman Zippel
2001-11-14 9:46 ` Richard Zidlicky
2001-11-13 17:58 ` Jun Sun
2001-11-14 10:08 ` Richard Zidlicky
2001-11-15 17:41 ` Jun Sun [this message]
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=3BF3FE39.34C541EB@mvista.com \
--to=jsun@mvista.com \
--cc=geert@linux-m68k.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-mips@oss.sgi.com \
--cc=linuxppc-dev@lists.linuxppc.org \
--cc=macro@ds2.pg.gda.pl \
--cc=rz@linux-m68k.org \
--cc=zippel@linux-m68k.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).