public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH] adds ndelay function (just like udelay)
@ 2007-07-03 16:40 eran.liberty at gmail.com
  2007-07-03 17:32 ` Grant Likely
  0 siblings, 1 reply; 2+ messages in thread
From: eran.liberty at gmail.com @ 2007-07-03 16:40 UTC (permalink / raw)
  To: u-boot

Though most cpu's do not support delay of such resolution it is prudent 
to insert this delay where the hardware specs demands it.

Signed-off-by: Eran Liberty <eran.liberty@gmail.com>

Index: lib_ppc/time.c
===================================================================
--- lib_ppc/time.c	(.../tags/trunk/20070620_2_merge_to_exsw6000)	(revision 69)
+++ lib_ppc/time.c	(.../branches/exsw6000)	(revision 69)
@@ -53,8 +53,17 @@
  */
 void udelay(unsigned long usec)
 {
-	ulong ticks = usec2ticks (usec);
+	ulong ticks = usec2ticks(usec);
 
+	wait_ticks(ticks);
+}
+
+/* ------------------------------------------------------------------------- */
+
+void ndelay (unsigned long nsec)
+{
+	ulong ticks = usec2ticks (1) * nsec / 1000 + 1;
+
 	wait_ticks (ticks);
 }
 
Index: include/exports.h
===================================================================
--- include/exports.h	(.../tags/trunk/20070620_2_merge_to_exsw6000)	(revision 69)
+++ include/exports.h	(.../branches/exsw6000)	(revision 69)
@@ -17,6 +17,7 @@
 void *malloc(size_t);
 void free(void*);
 void udelay(unsigned long);
+void ndelay(unsigned long);
 unsigned long get_timer(unsigned long);
 void vprintf(const char *, va_list);
 void do_reset (void);
Index: include/common.h
===================================================================
--- include/common.h	(.../tags/trunk/20070620_2_merge_to_exsw6000)	(revision 69)
+++ include/common.h	(.../branches/exsw6000)	(revision 69)
@@ -559,6 +559,7 @@
 
 /* lib_$(ARCH)/time.c */
 void	udelay	      (unsigned long);
+void ndelay(unsigned long);
 ulong	usec2ticks    (unsigned long usec);
 ulong	ticks2usec    (unsigned long ticks);
 int	init_timebase (void);

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

end of thread, other threads:[~2007-07-03 17:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-03 16:40 [U-Boot-Users] [PATCH] adds ndelay function (just like udelay) eran.liberty at gmail.com
2007-07-03 17:32 ` Grant Likely

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