public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] OCOTEA get_timer() bug
@ 2005-03-28 19:25 Andrew Wozniak
  2005-03-28 19:58 ` Wolfgang Denk
  2005-04-05 14:08 ` Travis B. Sawyer
  0 siblings, 2 replies; 10+ messages in thread
From: Andrew Wozniak @ 2005-03-28 19:25 UTC (permalink / raw)
  To: u-boot

I found this bug a while ago and have finally gotten around to looking 
at it because I needed its service.

In previous posts to this email list, Wolfgang had mentioned that the 
"time unit" returned by get_timer() is 1 msec.  Close examination of 
interrupt_init_cpu() at cpu/ppc4xx/interrupts.c suggests a timer 
interval setup of 10 msec!

A quick experiment via u-boot application, shows this to be true:

printf("...tic\n");
tic = get_timer(0);
udelay(2000000);     /* 2sec delay so that I can "see" it */
toc = get_timer(0);
printf("...toc\n %d %d\n", tic, toc);

run it:
...tic
...toc
1278 1478

therefore:
200 = delta
2sec/200 = 10msec time unit from get_timer()

I've tested the following and propose it as a fix, replace this:
   val = gd->bd->bi_intfreq/100;	 /* 10 msec */
with:
   val = gd->bd->bi_intfreq/1000; /* 1 msec */

I've also tested some of the network related functions to insure that no 
timeout conditions have appeared.

I want to post this patch but would prefer a code review from those that 
are more familiar with get_timer() use within the OCOTEA codebase.

Sorry for the long post, Andrew

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-04-05 22:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-28 19:25 [U-Boot-Users] OCOTEA get_timer() bug Andrew Wozniak
2005-03-28 19:58 ` Wolfgang Denk
2005-03-29  6:26   ` Stefan Roese
2005-03-29 23:17     ` Andrew Wozniak
2005-03-30  7:13       ` Stefan Roese
2005-03-31 18:26         ` Andrew Wozniak
2005-04-04 17:35           ` Travis B. Sawyer
2005-04-05 13:26     ` Travis B. Sawyer
2005-04-05 14:08 ` Travis B. Sawyer
2005-04-05 22:52   ` Andrew Wozniak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox