summaryrefslogtreecommitdiff
path: root/components/libc/compilers/common/delay.c
diff options
context:
space:
mode:
authorMeco Man <[email protected]>2021-06-16 14:02:43 +0800
committerMeco Man <[email protected]>2021-06-16 14:15:31 +0800
commit56e3571e8a8ede72b9aec00c968ace7b2bbe548c (patch)
treec66a7f92ce0bd8381dc976e3f9d03184bba43845 /components/libc/compilers/common/delay.c
parentac50f5193ea8c11bf1d509a860d7989c51c53aea (diff)
implement delay.c/.h
Diffstat (limited to 'components/libc/compilers/common/delay.c')
-rw-r--r--components/libc/compilers/common/delay.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/components/libc/compilers/common/delay.c b/components/libc/compilers/common/delay.c
new file mode 100644
index 0000000000..4666258d3b
--- /dev/null
+++ b/components/libc/compilers/common/delay.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2021-05-07 Meco Man first Version
+ */
+#include <rtthread.h>
+#include <rthw.h>
+
+void msleep(unsigned int msecs)
+{
+ rt_thread_mdelay(msecs);
+}
+RTM_EXPORT(msleep);
+
+void ssleep(unsigned int seconds)
+{
+ msleep(seconds * 1000);
+}
+RTM_EXPORT(ssleep);
+
+void mdelay(unsigned long msecs)
+{
+ rt_hw_us_delay(msecs * 1000);
+}
+RTM_EXPORT(mdelay);
+
+void udelay(unsigned long usecs)
+{
+ rt_hw_us_delay(usecs);
+}
+RTM_EXPORT(udelay);
+
+void ndelay(unsigned long nsecs)
+{
+ rt_hw_us_delay(1);
+}
+RTM_EXPORT(ndelay);