public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Christophe Coutand" <ccoutand@stmi.com>
To: "Nodir Qodirov" <nodir.qodirov@gmail.com>,
			<ecos-discuss@ecos.sourceware.org>
Subject: RE: [ECOS] eCos heartbeat function handler
Date: Sun, 19 Jul 2009 14:47:00 -0000	[thread overview]
Message-ID: <D6050C555CC56940A7AF326522830276021E7DD5@mail2.STMIRV01.COM> (raw)
In-Reply-To: <186ad4050907190707w790c7bdcxda0d58ed32392e7d@mail.gmail.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

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

  reply	other threads:[~2009-07-19 14:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-19  8:08 Nodir Qodirov
2009-07-19  8:18 ` Andrew Lunn
2009-07-19 14:07   ` Nodir Qodirov
2009-07-19 14:47     ` Christophe Coutand [this message]
2009-07-21  6:52       ` Nodir Qodirov
2009-07-21  7:27         ` Christophe Coutand
2009-08-05 11:22   ` Ormund Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D6050C555CC56940A7AF326522830276021E7DD5@mail2.STMIRV01.COM \
    --to=ccoutand@stmi.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=nodir.qodirov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).