soc: introduce hal function for cpu delay

This commit is contained in:
Renz Bagaporo 2020-03-03 12:10:38 +08:00 committed by Angus Gratton
parent cf155161c4
commit 39ef904fba
2 changed files with 20 additions and 0 deletions

View file

@ -107,6 +107,13 @@ void cpu_hal_set_watchpoint(int id, const void* addr, size_t size, watchpoint_tr
*/
void cpu_hal_clear_watchpoint(int id);
/*
* Insert a delay.
*
* @param delay_us length of delay in microseconds
*/
void cpu_hal_delay_us(uint32_t delay_us);
#endif // SOC_CPU_WATCHPOINTS_NUM > 0
/**

View file

@ -22,6 +22,14 @@
#include "soc/cpu_caps.h"
#include "sdkconfig.h"
#if CONFIG_IDF_TARGET_ESP32
#include "esp32/rom/ets_sys.h"
#elif CONFIG_IDF_TARGET_ESP32S2
#include "esp32s2/rom/ets_sys.h"
#endif
#if SOC_CPU_BREAKPOINTS_NUM > 0
void cpu_hal_set_breakpoint(int id, const void* addr)
{
@ -60,3 +68,8 @@ void cpu_hal_set_vecbase(const void* base)
{
cpu_ll_set_vecbase(base);
}
void cpu_hal_delay_us(uint32_t delay_us)
{
ets_delay_us(delay_us);
}