refactor(gptimer): use group_id in clock ctrl functions

This commit is contained in:
Chen Jichang
2025-04-02 11:39:42 +08:00
parent faacaaaf8f
commit 2cbc297969
19 changed files with 105 additions and 98 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -129,11 +129,11 @@ static inline void _timer_ll_reset_register(int group_id)
/**
* @brief Set clock source for timer
*
* @param hw Timer Group register base address
* @param group_id Group ID
* @param timer_num Timer number in the group
* @param clk_src Clock source
*/
static inline void timer_ll_set_clock_source(timg_dev_t *hw, uint32_t timer_num, gptimer_clock_source_t clk_src)
static inline void timer_ll_set_clock_source(int group_id, uint32_t timer_num, gptimer_clock_source_t clk_src)
{
uint8_t clk_id = 0;
switch (clk_src) {
@@ -150,7 +150,7 @@ static inline void timer_ll_set_clock_source(timg_dev_t *hw, uint32_t timer_num,
HAL_ASSERT(false);
break;
}
if (hw == &TIMERG0) {
if (group_id == 0) {
if (timer_num == 0) {
HP_SYS_CLKRST.peri_clk_ctrl20.reg_timergrp0_t0_src_sel = clk_id;
} else {
@@ -172,13 +172,13 @@ static inline void timer_ll_set_clock_source(timg_dev_t *hw, uint32_t timer_num,
/**
* @brief Enable Timer Group (GPTimer) module clock
*
* @param hw Timer Group register base address
* @param group_id Group ID
* @param timer_num Timer index in the group
* @param en true to enable, false to disable
*/
static inline void _timer_ll_enable_clock(timg_dev_t *hw, uint32_t timer_num, bool en)
static inline void _timer_ll_enable_clock(int group_id, uint32_t timer_num, bool en)
{
if (hw == &TIMERG0) {
if (group_id == 0) {
if (timer_num == 0) {
HP_SYS_CLKRST.peri_clk_ctrl20.reg_timergrp0_t0_clk_en = en;
} else {