From 8bb00ace5090804804f6011a02e097176fa63bb8 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 2 Apr 2012 11:32:11 +0200 Subject: bsps: More accurate PowerPC clock driver The clock driver used previously the bsp_clicks_per_usec value. For a 33333333Hz time base frequency this leads to a relative error of one per cent for example due to integer truncation. --- c/src/lib/libbsp/powerpc/tqm8xx/startup/bspstart.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'c/src/lib/libbsp/powerpc/tqm8xx/startup/bspstart.c') diff --git a/c/src/lib/libbsp/powerpc/tqm8xx/startup/bspstart.c b/c/src/lib/libbsp/powerpc/tqm8xx/startup/bspstart.c index cfd99e2fa2..9eba18839e 100644 --- a/c/src/lib/libbsp/powerpc/tqm8xx/startup/bspstart.c +++ b/c/src/lib/libbsp/powerpc/tqm8xx/startup/bspstart.c @@ -40,8 +40,12 @@ /* Configuration parameters for console driver, ... */ uint32_t BSP_bus_frequency; -/* Configuration parameters for clock driver, ... */ +/* Configuration parameter for clock driver */ +uint32_t bsp_time_base_frequency; + +/* Legacy */ uint32_t bsp_clicks_per_usec; /* for PIT driver: OSCCLK */ + /* for timer: */ uint32_t bsp_timer_average_overhead; /* Average overhead of timer in ticks */ uint32_t bsp_timer_least_valid; /* Least valid number from timer */ @@ -173,7 +177,8 @@ void bsp_start( void) BSP_panic("Cannot determine BUS frequency\n"); } - bsp_clicks_per_usec = BSP_bus_frequency/1000000/16; + bsp_time_base_frequency = BSP_bus_frequency / 16; + bsp_clicks_per_usec = bsp_time_base_frequency / 1000000; bsp_timer_least_valid = 3; bsp_timer_average_overhead = 3; -- cgit v1.2.3