From mboxrd@z Thu Jan 1 00:00:00 1970 From: eran.liberty at gmail.com Date: Tue, 03 Jul 2007 16:40:36 -0000 Subject: [U-Boot-Users] [PATCH] adds ndelay function (just like udelay) Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 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);