Mercurial > nand-ecoscentric
changeset 1973:d00e4aed2aa2
Improve clock calculation for hal_delay_us so it works with system clock of other than 10ms - from Peter Korsgaard
| author | gthomas |
|---|---|
| date | Thu, 19 May 2005 13:26:39 +0000 |
| parents | 87342fcfea2d |
| children | 3038ada9d671 |
| files | packages/hal/powerpc/ppc40x/current/ChangeLog packages/hal/powerpc/ppc40x/current/src/var_misc.c |
| diffstat | 2 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/hal/powerpc/ppc40x/current/ChangeLog +++ b/packages/hal/powerpc/ppc40x/current/ChangeLog @@ -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
--- a/packages/hal/powerpc/ppc40x/current/src/var_misc.c +++ b/packages/hal/powerpc/ppc40x/current/src/var_misc.c @@ -224,8 +224,7 @@ hal_ppc40x_delay_us(int us) 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 / ((CYGNUM_HAL_RTC_NUMERATOR/1000) / CYGNUM_HAL_RTC_DENOMINATOR)) * us); delay = 0; CYGARC_MFSPR(SPR_PIT, pit_val1); while (delay < delay_period) {
