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: Re: In trouble of timer operations


> I expected  there are ways to synchronize with these ticks,and get as 
> close as 10ms delay.

Simple

cyg_thread_delay(1);

cyg_thread_delay(1);

The second call will be roughly synchronised to the tick. The first
call will block until the tick. The second call will start shortly
after the tick and last until shortly after the next system tick.

I say roughly, because this is a RTOS. Any higher priority thread
which wakes up at this system tick will get to run first and so delay
when this thread gets to run.

> And another thing.What I want to do is that I display time before calling 
> delay func(like cyg_thread_delay),
> and display time again after returned from delay function.
> Would you teach me how to do it.

I suggest you use a different hardware timer which is free
running. Set the period much higher so you don't have to deal with it
wrapping around every 10ms. 

         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]