]> git.ipfire.org Git - thirdparty/u-boot.git/blame - lib/time.c
examples: enable gc-sections option
[thirdparty/u-boot.git] / lib / time.c
CommitLineData
3eb90bad
IL
1/*
2 * (C) Copyright 2000-2009
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
1a459660 5 * SPDX-License-Identifier: GPL-2.0+
3eb90bad
IL
6 */
7
8#include <common.h>
9#include <watchdog.h>
10
2108f4c4
RH
11#if CONFIG_SYS_HZ != 1000
12#warning "CONFIG_SYS_HZ must be 1000 and should not be defined by platforms"
13#endif
14
3eb90bad
IL
15#ifndef CONFIG_WD_PERIOD
16# define CONFIG_WD_PERIOD (10 * 1000 * 1000) /* 10 seconds default*/
17#endif
18
19/* ------------------------------------------------------------------------- */
20
21void udelay(unsigned long usec)
22{
23 ulong kv;
24
25 do {
26 WATCHDOG_RESET();
27 kv = usec > CONFIG_WD_PERIOD ? CONFIG_WD_PERIOD : usec;
28 __udelay (kv);
29 usec -= kv;
30 } while(usec);
31}
c4c9fbeb
AG
32
33void mdelay(unsigned long msec)
34{
35 while (msec--)
36 udelay(1000);
37}