diff --git a/src/host/pico_platform/include/pico/platform.h b/src/host/pico_platform/include/pico/platform.h index 6d04065a9..ab7c031f0 100644 --- a/src/host/pico_platform/include/pico/platform.h +++ b/src/host/pico_platform/include/pico/platform.h @@ -148,7 +148,11 @@ uint get_core_num(); static inline uint __get_current_exception(void) { return 0; + } + +void busy_wait_at_least_cycles(uint32_t minimum_cycles); + #ifdef __cplusplus } #endif diff --git a/src/host/pico_platform/platform_base.c b/src/host/pico_platform/platform_base.c index 25acbf1db..f7d2c95ff 100644 --- a/src/host/pico_platform/platform_base.c +++ b/src/host/pico_platform/platform_base.c @@ -7,9 +7,9 @@ #include #include "pico.h" +#include "hardware/timer.h" PICO_WEAK_FUNCTION_DEF(tight_loop_contents) - void PICO_WEAK_FUNCTION_IMPL_NAME(tight_loop_contents)() { } @@ -45,4 +45,10 @@ void __breakpoint() { #else __builtin_trap(); #endif -} \ No newline at end of file +} + +PICO_WEAK_FUNCTION_DEF(busy_wait_at_least_cycles) +void PICO_WEAK_FUNCTION_IMPL_NAME(busy_wait_at_least_cycles)(uint32_t cycles) { + // fairly arbitrary; we'll use 125Mhz as a reference + busy_wait_us((cycles + 124)/125); +}