public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] ecos timer question
@ 2005-08-16 20:59 Ben Beasley
  2005-08-16 21:31 ` Andrew Lunn
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Beasley @ 2005-08-16 20:59 UTC (permalink / raw)
  To: ecos-discuss

Hi -
I'm trying to develop a system that is required to go to sleep in such a
manner that the OS and all system clocks are stopped, with the exception
of a background RTC.  When the system awakens, I need to be able to
adjust the eCos real time clock base to account for the time I calculate
has elapsed during sleep.  It would seem that I need to be able to use
void set_value( cyg_tick_count new_value);, but I don't know how to call
this function or how to treat it's arguments.  I'm guessing that this is
more complicated than I've suggested, but I am somewhat new to dealing
with this kernel stuff.

Is what I'm trying to do possible?  Can anyone help me out?

Thanks...
Ben

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ECOS] ecos timer question
  2005-08-16 20:59 [ECOS] ecos timer question Ben Beasley
@ 2005-08-16 21:31 ` Andrew Lunn
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Lunn @ 2005-08-16 21:31 UTC (permalink / raw)
  To: Ben Beasley; +Cc: ecos-discuss

On Tue, Aug 16, 2005 at 01:58:58PM -0700, Ben Beasley wrote:
> Hi -
> I'm trying to develop a system that is required to go to sleep in such a
> manner that the OS and all system clocks are stopped, with the exception
> of a background RTC.  When the system awakens, I need to be able to
> adjust the eCos real time clock base to account for the time I calculate
> has elapsed during sleep.  It would seem that I need to be able to use
> void set_value( cyg_tick_count new_value);, but I don't know how to call
> this function or how to treat it's arguments.  I'm guessing that this is
> more complicated than I've suggested, but I am somewhat new to dealing
> with this kernel stuff.

Just setting the value might not be what you want to do. If there are
any alarms which should go off during the time the clock is disabled
you might get into trouble when you suddenly jump the clock.

What might be better is something like:


cyg_clock_to_counter(cyg_real_time_clock(), counter_handle);
for (i=; i < missed ticks; i++) {
        cyg_counter_tick(counter_handle);
}

Doing it like this you run the timer at much faster than real time to
catch up while still alowing any alarms to go off.

        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-08-16 21:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-16 20:59 [ECOS] ecos timer question Ben Beasley
2005-08-16 21:31 ` Andrew Lunn

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 read-only IMAP folder(s) and NNTP newsgroup(s).