summaryrefslogtreecommitdiff
path: root/libcpu
diff options
context:
space:
mode:
Diffstat (limited to 'libcpu')
-rw-r--r--libcpu/risc-v/t-head/c906/tick.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libcpu/risc-v/t-head/c906/tick.c b/libcpu/risc-v/t-head/c906/tick.c
index 0cb3c79be3..79891adb0e 100644
--- a/libcpu/risc-v/t-head/c906/tick.c
+++ b/libcpu/risc-v/t-head/c906/tick.c
@@ -49,3 +49,22 @@ int rt_hw_tick_init(void)
return 0;
}
+
+/**
+ * This function will delay for some us.
+ *
+ * @param us the delay time of us
+ */
+void rt_hw_us_delay(rt_uint32_t us)
+{
+ unsigned long start_time;
+ unsigned long end_time;
+ unsigned long run_time;
+
+ start_time = get_ticks();
+ end_time = start_time + us * (TIMER_CLK_FREQ / 1000000);
+ do
+ {
+ run_time = get_ticks();
+ } while(run_time < end_time);
+} \ No newline at end of file