This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
ppc40x hal_delay_us patch
- From: Peter Korsgaard <jacmet at sunsite dot dk>
- To: ecos-patches at ecos dot sourceware dot org
- Date: Wed, 18 May 2005 20:48:02 +0200
- Subject: ppc40x hal_delay_us patch
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.
Index: packages/hal/powerpc/ppc40x/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/powerpc/ppc40x/current/ChangeLog,v
retrieving revision 1.16
diff -u -u -r1.16 ChangeLog
--- packages/hal/powerpc/ppc40x/current/ChangeLog 6 May 2005 12:11:28 -0000 1.16
+++ packages/hal/powerpc/ppc40x/current/ChangeLog 18 May 2005 15:50:23 -0000
@@ -1,3 +1,9 @@
+2005-05-18 Peter Korsgaard <jacmet@sunsite.dk>
+
+ * src/var_misc.c (hal_ppc40x_delay_us): Removed double
+ initialization of delay_period. Work correctly for system clock !=
+ 100Hz.
+
2005-05-04 Peter Korsgaard <jacmet@sunsite.dk>
* include/var_io.h: Only define PCI macros if 405GP PCI support is
Index: packages/hal/powerpc/ppc40x/current/src/var_misc.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/powerpc/ppc40x/current/src/var_misc.c,v
retrieving revision 1.7
diff -u -u -r1.7 var_misc.c
--- packages/hal/powerpc/ppc40x/current/src/var_misc.c 19 Sep 2003 17:11:30 -0000 1.7
+++ packages/hal/powerpc/ppc40x/current/src/var_misc.c 18 May 2005 15:50:23 -0000
@@ -224,8 +224,8 @@
cyg_uint32 delay_period, delay, diff;
cyg_uint32 pit_val1, pit_val2;
- delay_period = (_period * us) / 10000;
- delay_period = ((_period / 10000) * us);
+ delay_period = (_period * us) /
+ (CYGNUM_HAL_RTC_NUMERATOR / (CYGNUM_HAL_RTC_DENOMINATOR*1000));
delay = 0;
CYGARC_MFSPR(SPR_PIT, pit_val1);
while (delay < delay_period) {
--
Bye, Peter Korsgaard