mirror of
https://github.com/raspberrypi/pico-sdk.git
synced 2025-12-10 07:14:36 +01:00
Add busy_wait_at_leasy_cycles to host (#1925)
This commit is contained in:
parent
42e234f8f3
commit
6500c59d70
2 changed files with 12 additions and 2 deletions
|
|
@ -148,7 +148,11 @@ uint get_core_num();
|
||||||
|
|
||||||
static inline uint __get_current_exception(void) {
|
static inline uint __get_current_exception(void) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void busy_wait_at_least_cycles(uint32_t minimum_cycles);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "pico.h"
|
#include "pico.h"
|
||||||
|
#include "hardware/timer.h"
|
||||||
|
|
||||||
PICO_WEAK_FUNCTION_DEF(tight_loop_contents)
|
PICO_WEAK_FUNCTION_DEF(tight_loop_contents)
|
||||||
|
|
||||||
void PICO_WEAK_FUNCTION_IMPL_NAME(tight_loop_contents)() {
|
void PICO_WEAK_FUNCTION_IMPL_NAME(tight_loop_contents)() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -45,4 +45,10 @@ void __breakpoint() {
|
||||||
#else
|
#else
|
||||||
__builtin_trap();
|
__builtin_trap();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue