aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-02-21 21:56:01 -0700
committerChristian Cunningham <cc@localhost>2022-02-21 21:56:01 -0700
commit3b883c24da327036a049a0430bd00ebfdffd5c8f (patch)
treea266169da94b95f8c1b156285c2f3504c89cd5f3 /src/util
parent6c7bdd85bbe8d2b791e0fe52f93f5e75e8beea2d (diff)
Added wait
Diffstat (limited to 'src/util')
-rw-r--r--src/util/time.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/util/time.c b/src/util/time.c
index 0ae3ccf..abb9c8d 100644
--- a/src/util/time.c
+++ b/src/util/time.c
@@ -67,3 +67,10 @@ unsigned long long get_time(void)
t.tvalb.high = *(unsigned long*)SYS_TIMER_CHI;
return t.tval;
}
+
+void wait_msec(unsigned int n)
+{
+ unsigned long start = *(volatile unsigned long*)SYS_TIMER_CHI;
+ while (*(volatile unsigned long*)SYS_TIMER_CHI - start < n)
+ asm volatile("nop");
+}