diff options
author | Marian Balakowicz <m8@semihalf.com> | 2008-02-29 13:56:44 +0100 |
---|---|---|
committer | Marian Balakowicz <m8@semihalf.com> | 2008-02-29 13:56:44 +0100 |
commit | e18489e8c27e843e337258fb00f2652ff0f43b92 (patch) | |
tree | 2a3b2afa224e61cb7f1206a1641007e526d25160 /cpu/arm926ejs | |
parent | 75fa002c47171b73fb4c1f2c2fe4d6391c136276 (diff) | |
parent | b29661fc1151077776454288051bc9a488351ce8 (diff) | |
download | u-boot-imx-e18489e8c27e843e337258fb00f2652ff0f43b92.zip u-boot-imx-e18489e8c27e843e337258fb00f2652ff0f43b92.tar.gz u-boot-imx-e18489e8c27e843e337258fb00f2652ff0f43b92.tar.bz2 |
Merge branch 'master' of git://www.denx.de/git/u-boot into new-image
Diffstat (limited to 'cpu/arm926ejs')
-rw-r--r-- | cpu/arm926ejs/davinci/timer.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/cpu/arm926ejs/davinci/timer.c b/cpu/arm926ejs/davinci/timer.c index 4a1a54d..8bb8b45 100644 --- a/cpu/arm926ejs/davinci/timer.c +++ b/cpu/arm926ejs/davinci/timer.c @@ -61,10 +61,12 @@ davinci_timer *timer = (davinci_timer *)CFG_TIMERBASE; #define TIMER_LOAD_VAL (CFG_HZ_CLOCK / CFG_HZ) #define READ_TIMER timer->tim34 -/* Timer runs with CFG_HZ_CLOCK, currently 27MHz. To avoid wrap - around of timestamp already after min ~159s, divide it, e.g. by 16. - timestamp will then wrap around all min ~42min */ -#define DIV(x) ((x) >> 4) +/* + * Timer runs with CFG_HZ_CLOCK, currently 27MHz. To avoid wrap + * around of timestamp already after min ~159s, divide it, e.g. by 16. + * timestamp will then wrap around all min ~42min + */ +#define DIV(x) ((x) >> 4) static ulong timestamp; static ulong lastinc; @@ -106,20 +108,20 @@ void udelay(unsigned long usec) void reset_timer_masked(void) { - lastinc = DIV(READ_TIMER); + lastinc = DIV(READ_TIMER); timestamp = 0; } ulong get_timer_raw(void) { - ulong now = DIV(READ_TIMER); + ulong now = DIV(READ_TIMER); if (now >= lastinc) { /* normal mode */ timestamp += now - lastinc; } else { /* overflow ... */ - timestamp += now + DIV(TIMER_LOAD_VAL) - lastinc; + timestamp += now + DIV(TIMER_LOAD_VAL) - lastinc; } lastinc = now; return timestamp; @@ -127,7 +129,7 @@ ulong get_timer_raw(void) ulong get_timer_masked(void) { - return(get_timer_raw() / DIV(TIMER_LOAD_VAL)); + return(get_timer_raw() / DIV(TIMER_LOAD_VAL)); } void udelay_masked(unsigned long usec) |