summaryrefslogtreecommitdiff
path: root/libhw/rp2040_bootclock.c
diff options
context:
space:
mode:
Diffstat (limited to 'libhw/rp2040_bootclock.c')
-rw-r--r--libhw/rp2040_bootclock.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libhw/rp2040_bootclock.c b/libhw/rp2040_bootclock.c
new file mode 100644
index 0000000..0484910
--- /dev/null
+++ b/libhw/rp2040_bootclock.c
@@ -0,0 +1,13 @@
+/* libhw/rp2040_bootclock.c - <libhw/generic/bootclock.h> implementation for pico-sdk
+ *
+ * Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com>
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+#include <hardware/timer.h> /* pico-sdk:hardware_timer */
+
+#include <libhw/generic/bootclock.h>
+
+uint64_t bootclock_get_ns(void) {
+ return time_us_64()*(NS_PER_S/US_PER_S);
+}