This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ecos timer question


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]