From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32478 invoked by alias); 21 Jul 2009 06:52:10 -0000 Received: (qmail 32470 invoked by uid 22791); 21 Jul 2009 06:52:09 -0000 X-SWARE-Spam-Status: No, hits=-0.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-yx0-f195.google.com (HELO mail-yx0-f195.google.com) (209.85.210.195) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 21 Jul 2009 06:51:58 +0000 Received: by yxe33 with SMTP id 33so4743830yxe.28 for ; Mon, 20 Jul 2009 23:51:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.133.2 with SMTP id g2mr7503786and.23.1248159116000; Mon, 20 Jul 2009 23:51:56 -0700 (PDT) In-Reply-To: References: <186ad4050907190707w790c7bdcxda0d58ed32392e7d@mail.gmail.com> Date: Tue, 21 Jul 2009 06:52:00 -0000 Message-ID: <186ad4050907202351k2d2d30ffk70928e4046279cd6@mail.gmail.com> From: Nodir Qodirov To: Christophe Coutand Cc: ecos-discuss@ecos.sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] eCos heartbeat function handler X-SW-Source: 2009-07/txt/msg00174.txt.bz2 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_AD= DRWORD 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 : > 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() > =A0 =A0: Cyg_Clock(rtc_resolution), > =A0 =A0 =A0interrupt(CYGNUM_HAL_INTERRUPT_RTC, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0CYGNUM_KERNEL_COUNTERS_CLOCK_ISR_PRIORITY, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(CYG_ADDRWORD)this, isr, dsr) > { > =A0 =A0CYG_REPORT_FUNCTION(); > =A0 =A0HAL_CLOCK_INITIALIZE( CYGNUM_KERNEL_COUNTERS_RTC_PERIOD); > =A0 =A0interrupt.attach(); > =A0 =A0interrupt.unmask_interrupt(CYGNUM_HAL_INTERRUPT_RTC); > =A0 =A0Cyg_Clock::real_time_clock =3D this; > } > > The tick value is incremented from the DSR: > > void Cyg_RealTimeClock::dsr(cyg_vector vector, cyg_ucount32 count, CYG_AD= DRWORD data) > =A0 =A0rtc->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