feat(gptimer): make start and stop function idempotent

Closes https://github.com/espressif/esp-idf/issues/12325
Closes https://github.com/espressif/esp-idf/issues/13486
This commit is contained in:
morris
2025-02-14 16:36:49 +08:00
parent 5f2a7f4d29
commit 9822433957
16 changed files with 128 additions and 100 deletions

View File

@@ -1,18 +1,14 @@
/*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <sys/lock.h>
#include "esp_check.h"
#include "esp_clk_tree.h"
#include "esp_private/esp_clk_tree_common.h"
#include "esp_private/gptimer.h"
#include "gptimer_priv.h"
#include "soc/soc_caps.h"
static const char *TAG = "gptimer";
#include "esp_private/esp_clk_tree_common.h"
typedef struct gptimer_platform_t {
_lock_t mutex; // platform level mutex lock
@@ -182,3 +178,11 @@ int gptimer_get_group_id(gptimer_handle_t timer, int *group_id)
*group_id = timer->group->group_id;
return ESP_OK;
}
#if CONFIG_GPTIMER_ENABLE_DEBUG_LOG
__attribute__((constructor))
static void gptimer_override_default_log_level(void)
{
esp_log_level_set(TAG, ESP_LOG_VERBOSE);
}
#endif