mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-18 23:54:39 +00:00
feat(dedic_gpio): add reset and clock control functions
This commit is contained in:
37
components/hal/esp32s3/include/hal/dedic_gpio_ll.h
Normal file
37
components/hal/esp32s3/include/hal/dedic_gpio_ll.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "soc/system_struct.h"
|
||||
|
||||
static inline void _dedic_gpio_ll_enable_bus_clock(bool enable)
|
||||
{
|
||||
SYSTEM.cpu_peri_clk_en.clk_en_dedicated_gpio = enable;
|
||||
}
|
||||
|
||||
/// use a macro to wrap the function, force the caller to use it in a critical section
|
||||
/// the critical section needs to declare the __DECLARE_RCC_ATOMIC_ENV variable in advance
|
||||
#define dedic_gpio_ll_enable_bus_clock(...) (void)__DECLARE_RCC_ATOMIC_ENV; _dedic_gpio_ll_enable_bus_clock(__VA_ARGS__)
|
||||
|
||||
static inline void _dedic_gpio_ll_reset_register(void)
|
||||
{
|
||||
SYSTEM.cpu_peri_rst_en.rst_en_dedicated_gpio = 1;
|
||||
SYSTEM.cpu_peri_rst_en.rst_en_dedicated_gpio = 0;
|
||||
}
|
||||
|
||||
/// use a macro to wrap the function, force the caller to use it in a critical section
|
||||
/// the critical section needs to declare the __DECLARE_RCC_ATOMIC_ENV variable in advance
|
||||
#define dedic_gpio_ll_reset_register(...) (void)__DECLARE_RCC_ATOMIC_ENV; _dedic_gpio_ll_reset_register(__VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user