This is the mail archive of the ecos-discuss@sources.redhat.com 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: Timer mechanism


Giovanni Perbellini wrote:



Ok, but why do I get a very big number, even if I execute the
cyg_current_time() when the eCos starts?



What is the version of eCos your are using and on what type of HW ?



I'm using eCos 2.0 for a property MIPS target platform. I have worked with Synthetic Target ant it works fine (as you suggest), but when I use my Board I get a wrong value (I'll investigate).



I just ran the following code on the synthetic target:

while (1)
{
   diag_printf("%d\n", cyg_current_time());
   cyg_thread_delay(100);
}

and the output is:

0
100
200
300
400
500
600
700
800
900
1000

after 10 seconds.



The timing device is usually a hardware timer which can generate an
interrupt after a
specified amount of internal ticks. This timer gets initialized with
HAL_CLOCK_PERIOD
which "is" 10ms (by default) in hw timer ticks. The HAL_CLOCK_READ macro
returns
the number of hw timer internal ticks elapsed since the last interrupt.




Is HAL_CLOCK_PERIOD the time between two interrupts or two internal


ticks?


HAL_CLOCK_PERIOD is the number of hw timer internal ticks between two RTC
interrupts. And it is a platform dependent value, because it depends on
the frequency of
hw timer.




Therefore,  after an amount of internal ticks a Interrupt is generated;
when the interrupt occurs, I think that will be named  the
Cyg_RealTimeClock::ISR and the Cyg_RealTimeClock::DSR methods.
What do they do?

Let me first explain about the terms I used. With tick I mean eCos tick, with hw timer internal tick
I mean the hw pulses driving the timer device.


The RTC interrupt ISR needs to restart the timing device in case it can't generate periodical interrupts.
DSR calls RTC clock counter tick which incremants eCos tick counter and takes care of alarms, then
it calls the scheduler to do its timeslicing.


savin


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


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