[ECOS] eCos heartbeat function handler

Christophe Coutand ccoutand@stmi.com
Tue Jul 21 07:27:00 GMT 2009


Commonly the DSRs routines are supplied with a count value which is the number of time the ISR was called before the DSR is actually served. This is the reason for having the while loop.

The tick counter is incremented inside the while loop:
counter += increment;

increment is initialized to 1.

Christophe

-----Original Message-----
From: Nodir Qodirov [mailto:nodir.qodirov@gmail.com] 
Sent: Tuesday, July 21, 2009 8:52 AM
To: Christophe Coutand
Cc: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] eCos heartbeat function handler

Thank you Christophe! This is exactly the same which I was looking for!

After further analyze I got answer to several my questions, including
responsibility of Cyg_RealTimeClock class.

But there is one more question, where I'm having little difficulty.
That is: after h/w tick interrupt - first ISR of that interrupt then
DSR is called. And as you told:

> The tick value is incremented from the DSR:
>
> void Cyg_RealTimeClock::dsr(cyg_vector vector, cyg_ucount32 count, CYG_ADDRWORD data)
>    rtc->tick( count );

and in tick( cyg_uint32 ticks ) function there is loop
(\kernel\current\src\common\clock.cxx) :

while( ticks-- )
{
...
}

where *ticks* is the value provided by call from DSR. So, my confusion
is what is value of this *ticks* and why we need decrement it in
*while* loop?

There is comment in source code:

// Increment the counter in a loop so we process
// each tick separately. This is easier than trying
// to cope with a range of increments.

but, couldn't get any idea.


2009/7/19 Christophe Coutand <ccoutand@stmi.com>:
> I believe what you are looking for is located in:
>
> kernel\current\src\common\clock.cxx
>
> The clock is created here and attached to the HW interrupt:
>
> Cyg_RealTimeClock::Cyg_RealTimeClock()
>    : Cyg_Clock(rtc_resolution),
>      interrupt(CYGNUM_HAL_INTERRUPT_RTC,
>                CYGNUM_KERNEL_COUNTERS_CLOCK_ISR_PRIORITY,
>                (CYG_ADDRWORD)this, isr, dsr)
> {
>    CYG_REPORT_FUNCTION();
>    HAL_CLOCK_INITIALIZE( CYGNUM_KERNEL_COUNTERS_RTC_PERIOD);
>    interrupt.attach();
>    interrupt.unmask_interrupt(CYGNUM_HAL_INTERRUPT_RTC);
>    Cyg_Clock::real_time_clock = this;
> }
>
> The tick value is incremented from the DSR:
>
> void Cyg_RealTimeClock::dsr(cyg_vector vector, cyg_ucount32 count, CYG_ADDRWORD data)
>    rtc->tick( count );
>
> The period of the RTC clock is configurable from your .ecc file.
>
> Christophe
>

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



More information about the Ecos-discuss mailing list