mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-04 05:04:33 +02:00
Merge branch 'bugfix/unicore_systimer_generate_rtos_tick' into 'master'
freertos: Fix settings of systimer for SysTicks in case Unicore Closes IDF-3692 See merge request espressif/esp-idf!14735
This commit is contained in:
@@ -48,14 +48,11 @@ void vPortSetupTimer(void)
|
|||||||
|
|
||||||
#elif CONFIG_FREERTOS_SYSTICK_USES_SYSTIMER
|
#elif CONFIG_FREERTOS_SYSTICK_USES_SYSTIMER
|
||||||
|
|
||||||
|
_Static_assert(SOC_CPU_CORES_NUM <= SOC_SYSTIMER_ALARM_NUM - 1, "the number of cores must match the number of core alarms in SYSTIMER");
|
||||||
|
|
||||||
void SysTickIsrHandler(void *arg);
|
void SysTickIsrHandler(void *arg);
|
||||||
|
|
||||||
#ifdef CONFIG_FREERTOS_UNICORE
|
static uint32_t s_handled_systicks[portNUM_PROCESSORS] = { 0 };
|
||||||
static uint32_t s_handled_systicks[1] = { 0 };
|
|
||||||
#else
|
|
||||||
static uint32_t s_handled_systicks[2] = { 0 };
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SYSTICK_INTR_ID (ETS_SYSTIMER_TARGET0_EDGE_INTR_SOURCE)
|
#define SYSTICK_INTR_ID (ETS_SYSTIMER_TARGET0_EDGE_INTR_SOURCE)
|
||||||
|
|
||||||
@@ -73,11 +70,6 @@ void vPortSetupTimer(void)
|
|||||||
const unsigned level = ESP_INTR_FLAG_LEVEL3;
|
const unsigned level = ESP_INTR_FLAG_LEVEL3;
|
||||||
#else
|
#else
|
||||||
const unsigned level = ESP_INTR_FLAG_LEVEL1;
|
const unsigned level = ESP_INTR_FLAG_LEVEL1;
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_FREERTOS_UNICORE
|
|
||||||
const unsigned max_cpu = 1;
|
|
||||||
#else
|
|
||||||
const unsigned max_cpu = 2;
|
|
||||||
#endif
|
#endif
|
||||||
/* Systimer HAL layer object */
|
/* Systimer HAL layer object */
|
||||||
static systimer_hal_context_t systimer_hal;
|
static systimer_hal_context_t systimer_hal;
|
||||||
@@ -89,7 +81,11 @@ void vPortSetupTimer(void)
|
|||||||
systimer_ll_set_counter_value(systimer_hal.dev, SYSTIMER_LL_COUNTER_OS_TICK, 0);
|
systimer_ll_set_counter_value(systimer_hal.dev, SYSTIMER_LL_COUNTER_OS_TICK, 0);
|
||||||
systimer_ll_apply_counter_value(systimer_hal.dev, SYSTIMER_LL_COUNTER_OS_TICK);
|
systimer_ll_apply_counter_value(systimer_hal.dev, SYSTIMER_LL_COUNTER_OS_TICK);
|
||||||
|
|
||||||
for (cpuid = 0; cpuid < max_cpu; ++cpuid) {
|
for (cpuid = 0; cpuid < SOC_CPU_CORES_NUM; cpuid++) {
|
||||||
|
systimer_hal_counter_can_stall_by_cpu(&systimer_hal, SYSTIMER_LL_COUNTER_OS_TICK, cpuid, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (cpuid = 0; cpuid < portNUM_PROCESSORS; ++cpuid) {
|
||||||
uint32_t alarm_id = SYSTIMER_LL_ALARM_OS_TICK_CORE0 + cpuid;
|
uint32_t alarm_id = SYSTIMER_LL_ALARM_OS_TICK_CORE0 + cpuid;
|
||||||
|
|
||||||
/* configure the timer */
|
/* configure the timer */
|
||||||
@@ -100,8 +96,10 @@ void vPortSetupTimer(void)
|
|||||||
if (cpuid == 0) {
|
if (cpuid == 0) {
|
||||||
systimer_hal_enable_alarm_int(&systimer_hal, alarm_id);
|
systimer_hal_enable_alarm_int(&systimer_hal, alarm_id);
|
||||||
systimer_hal_enable_counter(&systimer_hal, SYSTIMER_LL_COUNTER_OS_TICK);
|
systimer_hal_enable_counter(&systimer_hal, SYSTIMER_LL_COUNTER_OS_TICK);
|
||||||
|
#ifndef CONFIG_FREERTOS_UNICORE
|
||||||
// SysTick of core 0 and core 1 are shifted by half of period
|
// SysTick of core 0 and core 1 are shifted by half of period
|
||||||
systimer_hal_counter_value_advance(&systimer_hal, SYSTIMER_LL_COUNTER_OS_TICK, 1000000UL / CONFIG_FREERTOS_HZ / 2);
|
systimer_hal_counter_value_advance(&systimer_hal, SYSTIMER_LL_COUNTER_OS_TICK, 1000000UL / CONFIG_FREERTOS_HZ / 2);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user