添加cpu时钟周期延时
This commit is contained in:
@@ -65,6 +65,26 @@ void IRAM_ATTR iot_delay_us_cpu_cycle(uint32_t us)
|
||||
}
|
||||
}
|
||||
|
||||
void IRAM_ATTR iot_delay_cpu_cycle(uint32_t c)
|
||||
{
|
||||
uint64_t start, now;
|
||||
uint64_t cycle = c;
|
||||
|
||||
start = cpu_get_mcycle();
|
||||
|
||||
while(1) {
|
||||
now = cpu_get_mcycle();
|
||||
if (now >= start) {
|
||||
if((now - start) > cycle)
|
||||
break;
|
||||
} else {
|
||||
if(((uint64_t)(-1) - start + now) > cycle)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void system_cpu_sleep(bool_t tick)
|
||||
{
|
||||
clk_sys_sleep(tick);
|
||||
|
Reference in New Issue
Block a user