mirror of
https://github.com/espressif/esp-idf.git
synced 2026-05-19 23:45:28 +02:00
freertos(esp32s3): SysTick uses systimer
This commit is contained in:
committed by
Zim Kalinowski
parent
b5f9149399
commit
29f581fc70
+14
-14
@@ -31,7 +31,7 @@
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#if __XTENSA__
|
||||
#if CONFIG_FREERTOS_SYSTICK_USES_CCOUNT
|
||||
#include "freertos/xtensa_timer.h"
|
||||
#include "xtensa/core-macros.h"
|
||||
#endif
|
||||
@@ -68,7 +68,7 @@
|
||||
|
||||
#define MHZ (1000000)
|
||||
|
||||
#if __XTENSA__
|
||||
#ifdef CONFIG_FREERTOS_SYSTICK_USES_CCOUNT
|
||||
/* CCOMPARE update timeout, in CPU cycles. Any value above ~600 cycles will work
|
||||
* for the purpose of detecting a deadlock.
|
||||
*/
|
||||
@@ -78,7 +78,7 @@
|
||||
* than this. This is to prevent setting CCOMPARE below CCOUNT.
|
||||
*/
|
||||
#define CCOMPARE_MIN_CYCLES_IN_FUTURE 1000
|
||||
#endif
|
||||
#endif // CONFIG_FREERTOS_SYSTICK_USES_CCOUNT
|
||||
|
||||
/* When light sleep is used, wake this number of microseconds earlier than
|
||||
* the next tick.
|
||||
@@ -184,7 +184,7 @@ static const char* s_mode_names[] = {
|
||||
};
|
||||
#endif // WITH_PROFILING
|
||||
|
||||
#if __XTENSA__
|
||||
#ifdef CONFIG_FREERTOS_SYSTICK_USES_CCOUNT
|
||||
/* Indicates to the ISR hook that CCOMPARE needs to be updated on the given CPU.
|
||||
* Used in conjunction with cross-core interrupt to update CCOMPARE on the other CPU.
|
||||
*/
|
||||
@@ -197,7 +197,7 @@ static uint32_t s_ccount_div;
|
||||
static uint32_t s_ccount_mul;
|
||||
|
||||
static void update_ccompare(void);
|
||||
#endif // __XTENSA__
|
||||
#endif // CONFIG_FREERTOS_SYSTICK_USES_CCOUNT
|
||||
|
||||
static const char* TAG = "pm";
|
||||
|
||||
@@ -425,7 +425,7 @@ static void IRAM_ATTR on_freq_update(uint32_t old_ticks_per_us, uint32_t ticks_p
|
||||
esp_timer_private_update_apb_freq(apb_ticks_per_us);
|
||||
}
|
||||
|
||||
#if __XTENSA__
|
||||
#ifdef CONFIG_FREERTOS_SYSTICK_USES_CCOUNT
|
||||
#ifdef XT_RTOS_TIMER_INT
|
||||
/* Calculate new tick divisor */
|
||||
_xt_tick_divisor = ticks_per_us * MHZ / XT_TICK_PER_SEC;
|
||||
@@ -462,7 +462,7 @@ static void IRAM_ATTR on_freq_update(uint32_t old_ticks_per_us, uint32_t ticks_p
|
||||
s_ccount_div = 0;
|
||||
ESP_PM_TRACE_EXIT(CCOMPARE_UPDATE, core_id);
|
||||
}
|
||||
#endif // __XTENSA__
|
||||
#endif // CONFIG_FREERTOS_SYSTICK_USES_CCOUNT
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -484,7 +484,7 @@ static void IRAM_ATTR do_switch(pm_mode_t new_mode)
|
||||
portEXIT_CRITICAL_ISR(&s_switch_lock);
|
||||
return;
|
||||
}
|
||||
#if __XTENSA__
|
||||
#ifdef CONFIG_FREERTOS_SYSTICK_USES_CCOUNT
|
||||
if (s_need_update_ccompare[core_id]) {
|
||||
s_need_update_ccompare[core_id] = false;
|
||||
}
|
||||
@@ -529,7 +529,7 @@ static void IRAM_ATTR do_switch(pm_mode_t new_mode)
|
||||
portEXIT_CRITICAL_ISR(&s_switch_lock);
|
||||
}
|
||||
|
||||
#if __XTENSA__
|
||||
#ifdef CONFIG_FREERTOS_SYSTICK_USES_CCOUNT
|
||||
/**
|
||||
* @brief Calculate new CCOMPARE value based on s_ccount_{mul,div}
|
||||
*
|
||||
@@ -550,7 +550,7 @@ static void IRAM_ATTR update_ccompare(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // __XTENSA__
|
||||
#endif // CONFIG_FREERTOS_SYSTICK_USES_CCOUNT
|
||||
|
||||
static void IRAM_ATTR leave_idle(void)
|
||||
{
|
||||
@@ -656,7 +656,7 @@ void IRAM_ATTR vApplicationSleep( TickType_t xExpectedIdleTime )
|
||||
/* Adjust RTOS tick count based on the amount of time spent in sleep */
|
||||
vTaskStepTick(slept_ticks);
|
||||
|
||||
#if __XTENSA__
|
||||
#ifdef CONFIG_FREERTOS_SYSTICK_USES_CCOUNT
|
||||
/* Trigger tick interrupt, since sleep time was longer
|
||||
* than portTICK_PERIOD_MS. Note that setting INTSET does not
|
||||
* work for timer interrupt, and changing CCOMPARE would clear
|
||||
@@ -666,7 +666,7 @@ void IRAM_ATTR vApplicationSleep( TickType_t xExpectedIdleTime )
|
||||
while (!(XTHAL_GET_INTERRUPT() & BIT(XT_TIMER_INTNUM))) {
|
||||
;
|
||||
}
|
||||
#elif __riscv
|
||||
#else
|
||||
portYIELD_WITHIN_API();
|
||||
#endif
|
||||
}
|
||||
@@ -810,7 +810,7 @@ void IRAM_ATTR esp_pm_impl_isr_hook(void)
|
||||
* from happening in this section, since they will also call into esp_pm_impl_isr_hook.
|
||||
*/
|
||||
uint32_t state = portENTER_CRITICAL_NESTED();
|
||||
#if __XTENSA__ && (portNUM_PROCESSORS == 2)
|
||||
#if defined(CONFIG_FREERTOS_SYSTICK_USES_CCOUNT) && (portNUM_PROCESSORS == 2)
|
||||
if (s_need_update_ccompare[core_id]) {
|
||||
update_ccompare();
|
||||
s_need_update_ccompare[core_id] = false;
|
||||
@@ -819,7 +819,7 @@ void IRAM_ATTR esp_pm_impl_isr_hook(void)
|
||||
}
|
||||
#else
|
||||
leave_idle();
|
||||
#endif // portNUM_PROCESSORS == 2
|
||||
#endif // CONFIG_FREERTOS_SYSTICK_USES_CCOUNT && portNUM_PROCESSORS == 2
|
||||
portEXIT_CRITICAL_NESTED(state);
|
||||
ESP_PM_TRACE_EXIT(ISR_HOOK, core_id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user