fix(esp_hw_support): update LACT clock prescale immediately when APB changes on esp32

This commit is contained in:
wuzhenghui
2025-05-16 16:30:11 +08:00
parent be89fa36aa
commit 2931aa23b6
5 changed files with 58 additions and 37 deletions

View File

@@ -10,6 +10,7 @@
#pragma once
#include <stdbool.h>
#include "esp_attr.h"
#include "hal/assert.h"
#include "hal/misc.h"
#include "hal/timer_types.h"
@@ -331,6 +332,19 @@ static inline volatile void *timer_ll_get_intr_status_reg(timg_dev_t *hw)
return &hw->int_st_timers.val;
}
/**
* @brief Set clock prescale for LACT timer
*
* @param hw Timer Group register base address
* @param timer_num Timer number in the group
* @param divider Prescale value (0 and 1 are not valid)
*/
FORCE_INLINE_ATTR void timer_ll_set_lact_clock_prescale(timg_dev_t *hw, uint32_t divider)
{
HAL_ASSERT(divider>=2);
HAL_FORCE_MODIFY_U32_REG_FIELD(hw->lactconfig, lact_divider, divider);
}
#ifdef __cplusplus
}
#endif