time.c 480 B

12345678910111213141516171819202122
  1. /*
  2. * (C) Copyright 2003, Psyent Corporation <www.psyent.com>
  3. * Scott McNutt <smcnutt@psyent.com>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. #include <watchdog.h>
  9. extern void dly_clks( unsigned long ticks );
  10. void __udelay(unsigned long usec)
  11. {
  12. /* The Nios core doesn't have a timebase, so we do our
  13. * best for now and call a low-level loop that counts
  14. * cpu clocks.
  15. */
  16. unsigned long cnt = (CONFIG_SYS_CLK_FREQ/1000000) * usec;
  17. dly_clks (cnt);
  18. }