mirror of
https://github.com/espressif/esp-idf.git
synced 2026-06-11 11:42:39 +02:00
Merge branch 'refactor/strip_systimer_hal_layer' into 'master'
refactor HAL driver of systimer to a common systimer_hal Closes IDF-2996 See merge request espressif/esp-idf!13027
This commit is contained in:
@@ -147,17 +147,19 @@ void vPortExitCritical(void)
|
||||
*/
|
||||
void vPortSetupTimer(void)
|
||||
{
|
||||
/* Systimer HAL layer object */
|
||||
static systimer_hal_context_t systimer_hal;
|
||||
/* set system timer interrupt vector */
|
||||
ESP_ERROR_CHECK(esp_intr_alloc(ETS_SYSTIMER_TARGET0_EDGE_INTR_SOURCE, ESP_INTR_FLAG_IRAM, vPortSysTickHandler, NULL, NULL));
|
||||
ESP_ERROR_CHECK(esp_intr_alloc(ETS_SYSTIMER_TARGET0_EDGE_INTR_SOURCE, ESP_INTR_FLAG_IRAM, vPortSysTickHandler, &systimer_hal, NULL));
|
||||
|
||||
/* configure the timer */
|
||||
systimer_hal_init();
|
||||
systimer_hal_connect_alarm_counter(SYSTIMER_ALARM_0, SYSTIMER_COUNTER_1);
|
||||
systimer_hal_enable_counter(SYSTIMER_COUNTER_1);
|
||||
systimer_hal_counter_can_stall_by_cpu(SYSTIMER_COUNTER_1, 0, true);
|
||||
systimer_hal_set_alarm_period(SYSTIMER_ALARM_0, 1000000UL / CONFIG_FREERTOS_HZ);
|
||||
systimer_hal_select_alarm_mode(SYSTIMER_ALARM_0, SYSTIMER_ALARM_MODE_PERIOD);
|
||||
systimer_hal_enable_alarm_int(SYSTIMER_ALARM_0);
|
||||
systimer_hal_init(&systimer_hal);
|
||||
systimer_hal_connect_alarm_counter(&systimer_hal, SYSTIMER_LL_ALARM_OS_TICK_CORE0, SYSTIMER_LL_COUNTER_OS_TICK);
|
||||
systimer_hal_enable_counter(&systimer_hal, SYSTIMER_LL_COUNTER_OS_TICK);
|
||||
systimer_hal_counter_can_stall_by_cpu(&systimer_hal, SYSTIMER_LL_COUNTER_OS_TICK, 0, true);
|
||||
systimer_hal_set_alarm_period(&systimer_hal, SYSTIMER_LL_ALARM_OS_TICK_CORE0, 1000000UL / CONFIG_FREERTOS_HZ);
|
||||
systimer_hal_select_alarm_mode(&systimer_hal, SYSTIMER_LL_ALARM_OS_TICK_CORE0, SYSTIMER_ALARM_MODE_PERIOD);
|
||||
systimer_hal_enable_alarm_int(&systimer_hal, SYSTIMER_LL_ALARM_OS_TICK_CORE0);
|
||||
}
|
||||
|
||||
void prvTaskExitError(void)
|
||||
@@ -227,7 +229,7 @@ StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, TaskFunction_t pxC
|
||||
extern char _thread_local_start, _thread_local_end, _flash_rodata_start;
|
||||
|
||||
/* Byte pointer, so that subsequent calculations don't depend on sizeof(StackType_t). */
|
||||
uint8_t* sp = (uint8_t*) pxTopOfStack;
|
||||
uint8_t *sp = (uint8_t *) pxTopOfStack;
|
||||
|
||||
/* Set up TLS area.
|
||||
* The following diagram illustrates the layout of link-time and run-time
|
||||
@@ -293,9 +295,9 @@ StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, TaskFunction_t pxC
|
||||
|
||||
IRAM_ATTR void vPortSysTickHandler(void *arg)
|
||||
{
|
||||
(void)arg;
|
||||
systimer_hal_context_t *systimer_hal = (systimer_hal_context_t *)arg;
|
||||
|
||||
systimer_ll_clear_alarm_int(SYSTIMER_ALARM_0);
|
||||
systimer_ll_clear_alarm_int(systimer_hal->dev, SYSTIMER_LL_ALARM_OS_TICK_CORE0);
|
||||
|
||||
#ifdef CONFIG_PM_TRACE
|
||||
ESP_PM_TRACE_ENTER(TICK, xPortGetCoreID());
|
||||
@@ -380,8 +382,9 @@ void vPortSetStackWatchpoint(void *pxStackStart)
|
||||
esp_cpu_set_watchpoint(STACK_WATCH_POINT_NUMBER, (char *)addr, STACK_WATCH_AREA_SIZE, ESP_WATCHPOINT_STORE);
|
||||
}
|
||||
|
||||
uint32_t xPortGetTickRateHz(void) {
|
||||
return (uint32_t)configTICK_RATE_HZ;
|
||||
uint32_t xPortGetTickRateHz(void)
|
||||
{
|
||||
return (uint32_t)configTICK_RATE_HZ;
|
||||
}
|
||||
|
||||
BaseType_t xPortInIsrContext(void)
|
||||
|
||||
Reference in New Issue
Block a user