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: how can I create real time clock interrupt?


On Tue, Sep 24, 2002 at 01:18:08AM +0000, li hui wrote:
> In my program ,I want to count in every real time interrupt.but it seems 
> that alarm just can count at least 10ms. how can I get RTC interrupt 
> counts?

The RTC will be set to 10ms intervals. This is done automagically by
the HAL and kernel. The details can vary a little from HAL to HAL, but
normally there is a function hal_clock_initilize() which starts the
clock. The kernel registers the interrupt in
packages/kernel/current/src/common/clock.cxx and the ISR is in that
file as well.

cyg_current_time() will give you the number of ticks since system
start, which will be the same as counting RTC ticks.

       Andrew

> 
> On the other hand , I prefer to revise kernel, but I don't know where the 
> RTC interrupt are first Created,and its ISR routine?
> 
> 
> >From: Andrew Lunn <andrew.lunn@ascom.ch>
> >To: li hui <lhbyron@hotmail.com>
> >CC: ecos-discuss@sources.redhat.com
> >Subject: Re: [ECOS] how can I create real time clock interrupt?
> >Date: Mon, 23 Sep 2002 12:32:32 +0200
> >
> >eCos will have already installed an interrupt handler on the
> >RTC. Thats what its using for all its own clock generation. This means
> >the clock source is already running and active. Its interrupt will be
> >enabled. As soon as you call cyg_interrupt_create, your do_count
> >function is active. If its broken in anyway, it will cause the crash
> >you are seeing.
> >
> >Do you really want to take away eCos's clock source? Wouldn't it be
> >better to use eCos's alarm functions to do what you want?
> >
> >       Andrew
> >
> >On Mon, Sep 23, 2002 at 09:49:46AM +0000, li hui wrote:
> >> I try to create a interrupt attach to RTC,but I failed.the code I wrote 
> as
> >> below:
> >> cyg_handle_t timer_intr_handle;
> >> 	cyg_interrupt timer_intr;
> >>
> >> 	cyg_interrupt_create(CYGNUM_HAL_INTERRUPT_RTC, 1, 0, do_count, 0,
> >> &timer_intr_handle, &timer_intr);
> >> 	cyg_interrupt_enable();
> >> 	cyg_interrupt_attach(timer_intr_handle);
> >>
> >> I download my code to target, and using GDB(insight) debug my 
> code,.When
> >> program run to the  cyg_interrupt_create(...) sentence, the GDB warning 
> me
> >> it "program recieve a signal SIGSEGV, segmentation fault"  and then
> >> terminate the program.
> >>
> >> please tell me how to solve this problem!thanks in advance!
> >>
> >>
> >>               li.hui@263.net
> >>                  2002-09-18
> >>
> >>
> >>
> >> _________________________________________________________________
> >> 免费下载 MSN Explorer: http://explorer.msn.com/lccn/
> >>
> >>
> >> --
> >> Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> >> and search the list archive: http://sources.redhat.com/ml/ecos-discuss
> >>
> 
> 
> 
> 
> _________________________________________________________________
> 与联机的朋友进行交流,请使用 MSN Messenger: 
> http://messenger.microsoft.com/cn/
> 
> 
> -- 
> Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> and search the list archive: http://sources.redhat.com/ml/ecos-discuss
> 

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