[U-Boot-Users] [PATCH] Adds ndelay() common function (like udelay)
eran liberty
eran.liberty at gmail.com
Thu Jun 21 08:27:51 CEST 2007
Signed-off-by: Eran Liberty
diff -x .svn -Nuar
u-boot.git-5ffa76a032279bc6d3230b703eda32d13305ba13/include/common.h
u-boot.exsw6000/include/common.h
--- u-boot.git-5ffa76a032279bc6d3230b703eda32d13305ba13/include/common.h 2007-06-18
22:38:46.000000000 +0300
+++ u-boot.exsw6000/include/common.h 2007-06-20 19:04:44.000000000 +0300
@@ -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);
diff -x .svn -Nuar
u-boot.git-5ffa76a032279bc6d3230b703eda32d13305ba13/include/exports.h
u-boot.exsw6000/include/exports.h
--- u-boot.git-5ffa76a032279bc6d3230b703eda32d13305ba13/include/exports.h 2007-06-18
22:38:46.000000000 +0300
+++ u-boot.exsw6000/include/exports.h 2007-06-20 19:04:44.000000000 +0300
@@ -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);
diff -x .svn -Nuar
u-boot.git-5ffa76a032279bc6d3230b703eda32d13305ba13/lib_ppc/time.c
u-boot.exsw6000/lib_ppc/time.c
--- u-boot.git-5ffa76a032279bc6d3230b703eda32d13305ba13/lib_ppc/time.c 2007-06-18
22:38:46.000000000 +0300
+++ u-boot.exsw6000/lib_ppc/time.c 2007-06-20 19:04:39.000000000 +0300
@@ -60,6 +60,15 @@
/* ------------------------------------------------------------------------- */
+void ndelay(unsigned long nsec)
+{
+ ulong ticks = usec2ticks(1)*nsec/1000 +1;
+
+ wait_ticks (ticks);
+}
+
+/* ------------------------------------------------------------------------- */
+
unsigned long ticks2usec(unsigned long ticks)
{
ulong tbclk = get_tbclk();
More information about the U-Boot
mailing list