[ECOS] eCos heartbeat function handler

Christophe Coutand ccoutand@stmi.com
Sun Jul 19 14:47:00 GMT 2009


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

-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org [mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Nodir Qodirov
Sent: Sunday, July 19, 2009 4:07 PM
To: Nodir Qodirov; ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] eCos heartbeat function handler

Thank you Andrew!

I think your answer is from eCos application programmer's view, I want
to know tick handler function from system designer/developer point of
view.

For example in the example which you gave at

http://ecos.sourceware.org/docs-latest/user-guide/clocks-and-alarm-handlers.html

I initialize alarm and it will be called whenever it reaches given clock ticks.
In this case
cyg_alarm_initialize(test_alarmH, cyg_current_time()+1, 1);
I'm just creating timer with the period of one tick and asking
re-trigger this alarm periodically. If I run this example (at
clocks-and-alarm-handlers.html) on my i386 board, it works fine, but
there is some function which is receiving hardware ticks and making
all eCos alarms to work. What is that function?

Maybe I can paraphrase my question simple as: which function in eCos
kernel is handling hardware clock tick (or clock tick interrupts) ?


2009/7/19 Andrew Lunn <andrew@lunn.ch>:
>> 2) Where should I specify (some assembler file...) which function to
>> call on each heartbeat?
>
> Take a look at:
>
> http://ecos.sourceware.org/docs-latest/user-guide/clocks-and-alarm-handlers.html
>
> Call
> cyg_alarm_initialize(test_alarmH, cyg_current_time()+1, 1);
>
> and you alarm function will be called every tick.
>
>    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


--
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