This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Re: ppc40x hal_delay_us patch
- From: Gary Thomas <gary at mlbassoc dot com>
- To: Peter Korsgaard <jacmet at sunsite dot dk>
- Cc: eCos patches <ecos-patches at ecos dot sourceware dot org>
- Date: Thu, 19 May 2005 07:25:19 -0600
- Subject: Re: ppc40x hal_delay_us patch
- Organization: MLB Associates
- References: <873bskz7z1.fsf@p4.48ers.dk>
On Wed, 2005-05-18 at 20:48 +0200, Peter Korsgaard wrote:
> Hi,
>
> The following little patch removes a double initialization in
> hal_ppc40x_delay_us and makes it work correctly if system clock is
> different than 100 Hz.
I like it this way better - the calculations will end up exactly
the same as before and the way it's written tells you why it's
being done this way:
delay_period = ((_period / ((CYGNUM_HAL_RTC_NUMERATOR/1000) / CYGNUM_HAL_RTC_DENOMINATOR)) * us);
_period = timer value for system clock (represented in ns)
(CYGNUM_HAL_RTC_NUMERATOR/1000) = scale to us (raw value is ns)
_period/CLOCK_CALCULATION = timer value for 1 us
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------