summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2007-07-05 18:01:15 +0200
committerSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-07-05 18:01:15 +0200
commit363266d818c3504458fe005ef0308ea48f71e7ca (patch)
treefa11b8ab9cb69096d9482eda32d2d0be400810ee /common
parentfecf0fd93e63938080c6a86c7e0918ab9f310908 (diff)
downloadbarebox-363266d818c3504458fe005ef0308ea48f71e7ca.tar.gz
barebox-363266d818c3504458fe005ef0308ea48f71e7ca.tar.xz
svn_rev_033
change to clocksource api
Diffstat (limited to 'common')
-rw-r--r--common/clock.c10
-rw-r--r--common/cmd_misc.c11
-rw-r--r--common/exports.c2
3 files changed, 13 insertions, 10 deletions
diff --git a/common/clock.c b/common/clock.c
index 2e4e9d7dfc..d500e5c539 100644
--- a/common/clock.c
+++ b/common/clock.c
@@ -57,17 +57,23 @@ uint32_t clocksource_hz2mult(uint32_t hz, uint32_t shift_constant)
int is_timeout(uint64_t start_ns, uint64_t time_offset_ns)
{
+ if (ctrlc ())
+ return -1;
+
if (start_ns + time_offset_ns < get_time_ns())
return 1;
else
return 0;
}
-void udelay(unsigned long usecs)
+int udelay(unsigned long usecs)
{
uint64_t start = get_time_ns();
- while(!is_timeout(start, usecs * 1000));
+ while(!is_timeout(start, usecs * 1000))
+ if (ctrlc ())
+ return -1;
+ return 0;
}
void mdelay(unsigned long msecs)
diff --git a/common/cmd_misc.c b/common/cmd_misc.c
index 67ee9e8a83..968291abb0 100644
--- a/common/cmd_misc.c
+++ b/common/cmd_misc.c
@@ -26,12 +26,13 @@
*/
#include <common.h>
#include <command.h>
+#include <clock.h>
#if (CONFIG_COMMANDS & CFG_CMD_MISC)
int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- ulong start = get_timer(0);
+ uint64_t start;
ulong delay;
if (argc != 2) {
@@ -41,12 +42,8 @@ int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
delay = simple_strtoul(argv[1], NULL, 10) * CFG_HZ;
- while (get_timer(start) < delay) {
- if (ctrlc ()) {
- return (-1);
- }
- udelay (100);
- }
+ start = get_time_ns();
+ while (!is_timeout(start, delay * 1000000));
return 0;
}
diff --git a/common/exports.c b/common/exports.c
index 0cb4396ea4..70b9c7fe1d 100644
--- a/common/exports.c
+++ b/common/exports.c
@@ -25,7 +25,7 @@ void jumptable_init (void)
gd->jt[XF_free] = (void *) free;
gd->jt[XF_getenv] = (void *) getenv;
gd->jt[XF_setenv] = (void *) setenv;
- gd->jt[XF_get_timer] = (void *) get_timer;
+// gd->jt[XF_get_timer] = (void *) get_timer;
gd->jt[XF_simple_strtoul] = (void *) simple_strtoul;
gd->jt[XF_udelay] = (void *) udelay;
#if defined(CONFIG_I386) || defined(CONFIG_PPC)