mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-10-27 20:24:50 +08:00
feat(esp8266): refactor CCOMPARE timer and system time by microseconds
old: CCOMPARE timer triggers when CCOUNT increase to equal to CCOMPARE, then ISR will increase integer of "_xt_tick_divisor"
to CCOMPARE and wait for next interrupt triggering
now: CCOMPARE timer triggers when CCOUNT increase to equal to CCOMPARE, then ISR will reset CCOUNT to be 0 and reset CCOMPARE
to be integer of "_xt_tick_divisor", then wait for next interrupt triggering
Using the new method, we may get the CCOUNT value without considing if it has overflowed.
System running microseconds = g_os_ticks * microseconds per tick + CCOUNT.
This commit is contained in:
@ -158,8 +158,11 @@ NVIC value of 255. */
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
|
||||
|
||||
#ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_CPU_CLK
|
||||
#ifndef __ASSEMBLER__
|
||||
extern uint64_t g_esp_os_cpu_clk;
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() g_esp_os_cpu_clk
|
||||
#endif
|
||||
/* Fine resolution time */
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() xthal_get_ccount()
|
||||
#elif defined(CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER)
|
||||
/* Coarse resolution time (us) */
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
Reference in New Issue
Block a user