From ca8bfc6c22196e5d16c6d2625c65d6b50c04daaf Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Fri, 5 Jun 2009 17:48:08 +0000 Subject: Add programmer-specific delay functions Add external programmer delay functions so external programmers can handle the delay on their own if needed. Corresponding to flashrom svn r578. Signed-off-by: Carl-Daniel Hailfinger Acked-by: Uwe Hermann Acked-by: Urja Rannikko --- internal.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'internal.c') diff --git a/internal.c b/internal.c index c2d8f6bad..d24bb3456 100644 --- a/internal.c +++ b/internal.c @@ -195,6 +195,18 @@ uint32_t mmio_readl(void *addr) return *(volatile uint32_t *) addr; } +void internal_delay(int usecs) +{ + /* If the delay is >1 s, use usleep because timing does not need to + * be so precise. + */ + if (usecs > 1000000) { + usleep(usecs); + } else { + myusec_delay(usecs); + } +} + /* Fallback map() for programmers which don't need special handling */ void *fallback_map(const char *descr, unsigned long phys_addr, size_t len) { -- cgit v1.2.3