This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: HW Timer shared between ecos RTC & hal_delay_us()
- From: Nick Garnett <nickg at ecoscentric dot com>
- To: "Michael Anburaj" <embeddedeng at hotmail dot com>
- Cc: ecos-discuss at sources dot redhat dot com
- Date: 10 Jul 2003 15:02:39 +0100
- Subject: Re: [ECOS] HW Timer shared between ecos RTC & hal_delay_us()
- References: <Law15-F24176RbFGIUU00031f25@hotmail.com>
"Michael Anburaj" <embeddedeng@hotmail.com> writes:
> Can the same HW timer, used for ecos RTC be used by hal_delay_us()?
Short answer: yes
>
> --- End of short description ---------
>
> --- Long description ---------
>
> When I looked at different platform implementations of different
> architectures, I see most of the platforms using a different, separate
> HW timer for hal_delay_us() in polling mode. And some platforms
> (EDB7xxx & MIPS platforms) share the same ecos RTC HW timer. It should
> not affect when Redboot is running, but what will happen when ecos is
> running?
>
> Issue 1 with hal_delay_us() sharing the RTC HW timer:
> Wheh this routine polls the shared HW timer Count register, the timer
> may reach the ecos RTC period & would jump to the RTC Interrupt
> handler (may stretch the delay produced by hal_delay_us()) . But, this
> shouldnt be a concern, because even if 2 separate HW timers are used
> for RTC & hal_delay_us(), still the hal_delay_us() routine would get
> interrupted by the RTC event.
>
> So, Is there any other concern about hal_delay_us(), sharing the RTC
> HW timer?
Long answer:
So long as the timer is initialized in the same way by both eCos and
RedBoot then the timer can be used by both. Only eCos will get
interrupts, but both RedBoot and low-level eCos code can read the
timer registers to drive the us delay loop.
As for your issue 1: interrupts can happen during the loop. The code
in hal_if.c goes to some efforts to account for this.
--
Nick Garnett eCos Kernel Architect
http://www.ecoscentric.com/ The eCos and RedBoot experts
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss