Merge branch 'contrib/github_pr_14923' into 'master'

GPIO: Add gpio_get_io_config(). (GitHub PR)

Closes IDFGH-14117 and IDFGH-14127

See merge request espressif/esp-idf!35266
This commit is contained in:
Song Ruo Jing 2024-12-19 21:02:50 +08:00
commit 4535c27224
21 changed files with 577 additions and 149 deletions

View File

@ -590,6 +590,28 @@ esp_err_t gpio_deep_sleep_wakeup_disable(gpio_num_t gpio_num);
*/ */
esp_err_t gpio_dump_io_configuration(FILE *out_stream, uint64_t io_bit_mask); esp_err_t gpio_dump_io_configuration(FILE *out_stream, uint64_t io_bit_mask);
/**
* @brief Get the configuration for an IO
*
* @param gpio_num GPIO number
* @param pu Pointer to accept the status of pull-up enabled or not, passing in NULL if this info is unwanted
* @param pd Pointer to accept the status of pull-down enabled or not, passing in NULL if this info is unwanted
* @param ie Pointer to accept the status of input enabled or not, passing in NULL if this info is unwanted
* @param oe Pointer to accept the status of output enabled or not, passing in NULL if this info is unwanted
* @param od Pointer to accept the status of open-drain enabled or not, passing in NULL if this info is unwanted
* @param drv Pointer to accept the value of drive strength, passing in NULL if this info is unwanted
* @param fun_sel Pointer to accept the value of IOMUX function selection, passing in NULL if this info is unwanted
* @param sig_out Pointer to accept the index of outputting peripheral signal, passing in NULL if this info is unwanted
* @param slp_sel Pointer to accept the status of pin sleep mode enabled or not, passing in NULL if this info is unwanted
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG Parameter error
*/
esp_err_t gpio_get_io_config(gpio_num_t gpio_num,
bool *pu, bool *pd, bool *ie, bool *oe, bool *od, uint32_t *drv,
uint32_t *fun_sel, uint32_t *sig_out, bool *slp_sel);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -75,7 +75,7 @@ static gpio_context_t gpio_context = {
esp_err_t gpio_pullup_en(gpio_num_t gpio_num) esp_err_t gpio_pullup_en(gpio_num_t gpio_num)
{ {
GPIO_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG); GPIO_CHECK(GPIO_IS_VALID_OUTPUT_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG);
if (!rtc_gpio_is_valid_gpio(gpio_num) || SOC_GPIO_SUPPORT_RTC_INDEPENDENT) { if (!rtc_gpio_is_valid_gpio(gpio_num) || SOC_GPIO_SUPPORT_RTC_INDEPENDENT) {
portENTER_CRITICAL(&gpio_context.gpio_spinlock); portENTER_CRITICAL(&gpio_context.gpio_spinlock);
@ -113,7 +113,7 @@ esp_err_t gpio_pullup_dis(gpio_num_t gpio_num)
esp_err_t gpio_pulldown_en(gpio_num_t gpio_num) esp_err_t gpio_pulldown_en(gpio_num_t gpio_num)
{ {
GPIO_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG); GPIO_CHECK(GPIO_IS_VALID_OUTPUT_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG);
if (!rtc_gpio_is_valid_gpio(gpio_num) || SOC_GPIO_SUPPORT_RTC_INDEPENDENT) { if (!rtc_gpio_is_valid_gpio(gpio_num) || SOC_GPIO_SUPPORT_RTC_INDEPENDENT) {
portENTER_CRITICAL(&gpio_context.gpio_spinlock); portENTER_CRITICAL(&gpio_context.gpio_spinlock);
@ -1017,6 +1017,29 @@ esp_err_t gpio_deep_sleep_wakeup_disable(gpio_num_t gpio_num)
} }
#endif // SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP && SOC_DEEP_SLEEP_SUPPORTED #endif // SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP && SOC_DEEP_SLEEP_SUPPORTED
esp_err_t gpio_get_io_config(gpio_num_t gpio_num,
bool *pu, bool *pd, bool *ie, bool *oe, bool *od, uint32_t *drv,
uint32_t *fun_sel, uint32_t *sig_out, bool *slp_sel)
{
GPIO_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG);
gpio_hal_get_io_config(gpio_context.gpio_hal, gpio_num, pu, pd, ie, oe, od, drv, fun_sel, sig_out, slp_sel);
#if !SOC_GPIO_SUPPORT_RTC_INDEPENDENT && SOC_RTCIO_PIN_COUNT > 0
if (rtc_gpio_is_valid_gpio(gpio_num)) {
int rtcio_num = rtc_io_number_get(gpio_num);
if (pu) {
*pu = rtcio_hal_is_pullup_enabled(rtcio_num);
}
if (pd) {
*pd = rtcio_hal_is_pulldown_enabled(rtcio_num);
}
if (drv) {
*drv = rtcio_hal_get_drive_capability(rtcio_num);
}
}
#endif
return ESP_OK;
}
esp_err_t gpio_dump_io_configuration(FILE *out_stream, uint64_t io_bit_mask) esp_err_t gpio_dump_io_configuration(FILE *out_stream, uint64_t io_bit_mask)
{ {
ESP_RETURN_ON_FALSE(out_stream, ESP_ERR_INVALID_ARG, GPIO_TAG, "out_stream error"); ESP_RETURN_ON_FALSE(out_stream, ESP_ERR_INVALID_ARG, GPIO_TAG, "out_stream error");
@ -1027,9 +1050,16 @@ esp_err_t gpio_dump_io_configuration(FILE *out_stream, uint64_t io_bit_mask)
uint32_t gpio_num = __builtin_ffsll(io_bit_mask) - 1; uint32_t gpio_num = __builtin_ffsll(io_bit_mask) - 1;
io_bit_mask &= ~(1ULL << gpio_num); io_bit_mask &= ~(1ULL << gpio_num);
bool pu, pd, ie, oe, od, slp_sel; bool pu = 0;
uint32_t drv, fun_sel, sig_out; bool pd = 0;
gpio_hal_get_io_config(gpio_context.gpio_hal, gpio_num, &pu, &pd, &ie, &oe, &od, &drv, &fun_sel, &sig_out, &slp_sel); bool ie = 0;
bool oe = 0;
bool od = 0;
bool slp_sel = 0;
uint32_t drv = 0;
uint32_t fun_sel = 0;
uint32_t sig_out = 0;
gpio_get_io_config(gpio_num, &pu, &pd, &ie, &oe, &od, &drv, &fun_sel, &sig_out, &slp_sel);
fprintf(out_stream, "IO[%"PRIu32"]%s -\n", gpio_num, esp_gpio_is_reserved(BIT64(gpio_num)) ? " **RESERVED**" : ""); fprintf(out_stream, "IO[%"PRIu32"]%s -\n", gpio_num, esp_gpio_is_reserved(BIT64(gpio_num)) ? " **RESERVED**" : "");
fprintf(out_stream, " Pullup: %d, Pulldown: %d, DriveCap: %"PRIu32"\n", pu, pd, drv); fprintf(out_stream, " Pullup: %d, Pulldown: %d, DriveCap: %"PRIu32"\n", pu, pd, drv);
@ -1055,7 +1085,7 @@ esp_err_t gpio_dump_io_configuration(FILE *out_stream, uint64_t io_bit_mask)
fprintf(out_stream, " SleepSelEn: %d\n", slp_sel); fprintf(out_stream, " SleepSelEn: %d\n", slp_sel);
fprintf(out_stream, "\n"); fprintf(out_stream, "\n");
} }
fprintf(out_stream, "=================IO DUMP End==================\n"); fprintf(out_stream, "=================IO DUMP End=================\n");
return ESP_OK; return ESP_OK;
} }

View File

@ -10,7 +10,7 @@
#include "esp_bit_defs.h" #include "esp_bit_defs.h"
#include "esp_private/esp_gpio_reserve.h" #include "esp_private/esp_gpio_reserve.h"
static _Atomic uint64_t s_reserved_pin_mask = ATOMIC_VAR_INIT(~(SOC_GPIO_VALID_OUTPUT_GPIO_MASK)); static _Atomic uint64_t s_reserved_pin_mask = ATOMIC_VAR_INIT(~(SOC_GPIO_VALID_GPIO_MASK));
uint64_t esp_gpio_reserve(uint64_t gpio_mask) uint64_t esp_gpio_reserve(uint64_t gpio_mask)
{ {

View File

@ -64,15 +64,33 @@ static inline void gpio_ll_get_io_config(gpio_dev_t *hw, uint32_t gpio_num,
uint32_t bit_shift = (gpio_num < 32) ? gpio_num : (gpio_num - 32); uint32_t bit_shift = (gpio_num < 32) ? gpio_num : (gpio_num - 32);
uint32_t bit_mask = 1 << bit_shift; uint32_t bit_mask = 1 << bit_shift;
uint32_t iomux_reg_val = REG_READ(GPIO_PIN_MUX_REG[gpio_num]); uint32_t iomux_reg_val = REG_READ(GPIO_PIN_MUX_REG[gpio_num]);
*pu = (iomux_reg_val & FUN_PU_M) >> FUN_PU_S; if (pu) {
*pd = (iomux_reg_val & FUN_PD_M) >> FUN_PD_S; *pu = (iomux_reg_val & FUN_PU_M) >> FUN_PU_S;
*ie = (iomux_reg_val & FUN_IE_M) >> FUN_IE_S; }
*oe = (((gpio_num < 32) ? hw->enable : hw->enable1.val) & bit_mask) >> bit_shift; if (pd) {
*od = hw->pin[gpio_num].pad_driver; *pd = (iomux_reg_val & FUN_PD_M) >> FUN_PD_S;
*drv = (iomux_reg_val & FUN_DRV_M) >> FUN_DRV_S; }
*fun_sel = (iomux_reg_val & MCU_SEL_M) >> MCU_SEL_S; if (ie) {
*sig_out = hw->func_out_sel_cfg[gpio_num].func_sel; *ie = (iomux_reg_val & FUN_IE_M) >> FUN_IE_S;
*slp_sel = (iomux_reg_val & SLP_SEL_M) >> SLP_SEL_S; }
if (oe) {
*oe = (((gpio_num < 32) ? hw->enable : hw->enable1.val) & bit_mask) >> bit_shift;
}
if (od) {
*od = hw->pin[gpio_num].pad_driver;
}
if (drv) {
*drv = (iomux_reg_val & FUN_DRV_M) >> FUN_DRV_S;
}
if (fun_sel) {
*fun_sel = (iomux_reg_val & MCU_SEL_M) >> MCU_SEL_S;
}
if (sig_out) {
*sig_out = hw->func_out_sel_cfg[gpio_num].func_sel;
}
if (slp_sel) {
*slp_sel = (iomux_reg_val & SLP_SEL_M) >> SLP_SEL_S;
}
} }
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -12,6 +12,7 @@
#pragma once #pragma once
#include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include "soc/rtc_io_struct.h" #include "soc/rtc_io_struct.h"
#include "soc/rtc_io_reg.h" #include "soc/rtc_io_reg.h"
@ -24,7 +25,7 @@ extern "C" {
#endif #endif
typedef enum { typedef enum {
RTCIO_LL_FUNC_RTC = 0x0, /*!< The pin controled by RTC module. */ RTCIO_LL_FUNC_RTC = 0x0, /*!< The pin controlled by RTC module. */
RTCIO_LL_FUNC_DIGITAL = 0x1, /*!< The pin controlled by DIGITAL module. */ RTCIO_LL_FUNC_DIGITAL = 0x1, /*!< The pin controlled by DIGITAL module. */
} rtcio_ll_func_t; } rtcio_ll_func_t;
@ -194,6 +195,21 @@ static inline void rtcio_ll_pullup_disable(int rtcio_num)
} }
} }
/**
* @brief Get RTC GPIO pad pullup status.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
* @return Whether the pullup of the pad is enabled or not.
*/
static inline bool rtcio_ll_is_pullup_enabled(int rtcio_num)
{
if (rtc_io_desc[rtcio_num].pullup) {
return GET_PERI_REG_MASK(rtc_io_desc[rtcio_num].reg, rtc_io_desc[rtcio_num].pullup);
} else {
return false;
}
}
/** /**
* RTC GPIO pulldown enable. * RTC GPIO pulldown enable.
* *
@ -218,6 +234,21 @@ static inline void rtcio_ll_pulldown_disable(int rtcio_num)
} }
} }
/**
* @brief Get RTC GPIO pad pulldown status.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
* @return Whether the pulldown of the pad is enabled or not.
*/
static inline bool rtcio_ll_is_pulldown_enabled(int rtcio_num)
{
if (rtc_io_desc[rtcio_num].pulldown) {
return GET_PERI_REG_MASK(rtc_io_desc[rtcio_num].reg, rtc_io_desc[rtcio_num].pulldown);
} else {
return false;
}
}
/** /**
* Enable force hold function on an RTC IO pad. * Enable force hold function on an RTC IO pad.
* *

View File

@ -53,15 +53,33 @@ static inline void gpio_ll_get_io_config(gpio_dev_t *hw, uint32_t gpio_num,
{ {
uint32_t bit_mask = 1 << gpio_num; uint32_t bit_mask = 1 << gpio_num;
uint32_t iomux_reg_val = REG_READ(GPIO_PIN_MUX_REG[gpio_num]); uint32_t iomux_reg_val = REG_READ(GPIO_PIN_MUX_REG[gpio_num]);
*pu = (iomux_reg_val & FUN_PU_M) >> FUN_PU_S; if (pu) {
*pd = (iomux_reg_val & FUN_PD_M) >> FUN_PD_S; *pu = (iomux_reg_val & FUN_PU_M) >> FUN_PU_S;
*ie = (iomux_reg_val & FUN_IE_M) >> FUN_IE_S; }
*oe = (hw->enable.val & bit_mask) >> gpio_num; if (pd) {
*od = hw->pin[gpio_num].pad_driver; *pd = (iomux_reg_val & FUN_PD_M) >> FUN_PD_S;
*drv = (iomux_reg_val & FUN_DRV_M) >> FUN_DRV_S; }
*fun_sel = (iomux_reg_val & MCU_SEL_M) >> MCU_SEL_S; if (ie) {
*sig_out = hw->func_out_sel_cfg[gpio_num].func_sel; *ie = (iomux_reg_val & FUN_IE_M) >> FUN_IE_S;
*slp_sel = (iomux_reg_val & SLP_SEL_M) >> SLP_SEL_S; }
if (oe) {
*oe = (hw->enable.val & bit_mask) >> gpio_num;
}
if (od) {
*od = hw->pin[gpio_num].pad_driver;
}
if (drv) {
*drv = (iomux_reg_val & FUN_DRV_M) >> FUN_DRV_S;
}
if (fun_sel) {
*fun_sel = (iomux_reg_val & MCU_SEL_M) >> MCU_SEL_S;
}
if (sig_out) {
*sig_out = hw->func_out_sel_cfg[gpio_num].func_sel;
}
if (slp_sel) {
*slp_sel = (iomux_reg_val & SLP_SEL_M) >> SLP_SEL_S;
}
} }
/** /**

View File

@ -34,38 +34,6 @@ extern "C" {
#define GPIO_LL_PRO_CPU_INTR_ENA (BIT(0)) #define GPIO_LL_PRO_CPU_INTR_ENA (BIT(0))
#define GPIO_LL_PRO_CPU_NMI_INTR_ENA (BIT(1)) #define GPIO_LL_PRO_CPU_NMI_INTR_ENA (BIT(1))
/**
* @brief Get the configuration for an IO
*
* @param hw Peripheral GPIO hardware instance address.
* @param gpio_num GPIO number
* @param pu Pull-up enabled or not
* @param pd Pull-down enabled or not
* @param ie Input enabled or not
* @param oe Output enabled or not
* @param od Open-drain enabled or not
* @param drv Drive strength value
* @param fun_sel IOMUX function selection value
* @param sig_out Outputting peripheral signal index
* @param slp_sel Pin sleep mode enabled or not
*/
static inline void gpio_ll_get_io_config(gpio_dev_t *hw, uint32_t gpio_num,
bool *pu, bool *pd, bool *ie, bool *oe, bool *od, uint32_t *drv,
uint32_t *fun_sel, uint32_t *sig_out, bool *slp_sel)
{
uint32_t bit_mask = 1 << gpio_num;
uint32_t iomux_reg_val = REG_READ(GPIO_PIN_MUX_REG[gpio_num]);
*pu = (iomux_reg_val & FUN_PU_M) >> FUN_PU_S;
*pd = (iomux_reg_val & FUN_PD_M) >> FUN_PD_S;
*ie = (iomux_reg_val & FUN_IE_M) >> FUN_IE_S;
*oe = (hw->enable.val & bit_mask) >> gpio_num;
*od = hw->pin[gpio_num].pad_driver;
*drv = (iomux_reg_val & FUN_DRV_M) >> FUN_DRV_S;
*fun_sel = (iomux_reg_val & MCU_SEL_M) >> MCU_SEL_S;
*sig_out = hw->func_out_sel_cfg[gpio_num].func_sel;
*slp_sel = (iomux_reg_val & SLP_SEL_M) >> SLP_SEL_S;
}
/** /**
* @brief Enable pull-up on GPIO. * @brief Enable pull-up on GPIO.
* *
@ -760,6 +728,56 @@ static inline bool gpio_ll_deepsleep_wakeup_is_enabled(gpio_dev_t *hw, uint32_t
return GET_PERI_REG_MASK(RTC_CNTL_GPIO_WAKEUP_REG, 1 << (RTC_CNTL_GPIO_PIN0_WAKEUP_ENABLE_S - gpio_num)); return GET_PERI_REG_MASK(RTC_CNTL_GPIO_WAKEUP_REG, 1 << (RTC_CNTL_GPIO_PIN0_WAKEUP_ENABLE_S - gpio_num));
} }
/**
* @brief Get the configuration for an IO
*
* @param hw Peripheral GPIO hardware instance address.
* @param gpio_num GPIO number
* @param pu Pull-up enabled or not
* @param pd Pull-down enabled or not
* @param ie Input enabled or not
* @param oe Output enabled or not
* @param od Open-drain enabled or not
* @param drv Drive strength value
* @param fun_sel IOMUX function selection value
* @param sig_out Outputting peripheral signal index
* @param slp_sel Pin sleep mode enabled or not
*/
static inline void gpio_ll_get_io_config(gpio_dev_t *hw, uint32_t gpio_num,
bool *pu, bool *pd, bool *ie, bool *oe, bool *od, uint32_t *drv,
uint32_t *fun_sel, uint32_t *sig_out, bool *slp_sel)
{
uint32_t bit_mask = 1 << gpio_num;
uint32_t iomux_reg_val = REG_READ(GPIO_PIN_MUX_REG[gpio_num]);
if (pu) {
*pu = (iomux_reg_val & FUN_PU_M) >> FUN_PU_S;
}
if (pd) {
*pd = (iomux_reg_val & FUN_PD_M) >> FUN_PD_S;
}
if (ie) {
*ie = (iomux_reg_val & FUN_IE_M) >> FUN_IE_S;
}
if (oe) {
*oe = (hw->enable.val & bit_mask) >> gpio_num;
}
if (od) {
*od = hw->pin[gpio_num].pad_driver;
}
if (drv) {
gpio_ll_get_drive_capability(hw, gpio_num, (gpio_drive_cap_t *)drv); // specific workaround in the LL
}
if (fun_sel) {
*fun_sel = (iomux_reg_val & MCU_SEL_M) >> MCU_SEL_S;
}
if (sig_out) {
*sig_out = hw->func_out_sel_cfg[gpio_num].func_sel;
}
if (slp_sel) {
*slp_sel = (iomux_reg_val & SLP_SEL_M) >> SLP_SEL_S;
}
}
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -37,7 +37,6 @@ extern "C" {
#define GPIO_LL_GET_HW(num) (((num) == 0) ? (&GPIO) : NULL) #define GPIO_LL_GET_HW(num) (((num) == 0) ? (&GPIO) : NULL)
#define GPIO_LL_PRO_CPU_INTR_ENA (BIT(0)) #define GPIO_LL_PRO_CPU_INTR_ENA (BIT(0))
#define GPIO_LL_PRO_CPU_NMI_INTR_ENA (BIT(1))
/** /**
* @brief Get the configuration for an IO * @brief Get the configuration for an IO
@ -58,15 +57,33 @@ static inline void gpio_ll_get_io_config(gpio_dev_t *hw, uint32_t gpio_num,
bool *pu, bool *pd, bool *ie, bool *oe, bool *od, uint32_t *drv, bool *pu, bool *pd, bool *ie, bool *oe, bool *od, uint32_t *drv,
uint32_t *fun_sel, uint32_t *sig_out, bool *slp_sel) uint32_t *fun_sel, uint32_t *sig_out, bool *slp_sel)
{ {
*pu = IO_MUX.gpio[gpio_num].fun_wpu; if (pu) {
*pd = IO_MUX.gpio[gpio_num].fun_wpd; *pu = IO_MUX.gpio[gpio_num].fun_wpu;
*ie = IO_MUX.gpio[gpio_num].fun_ie; }
*oe = (hw->enable.val & (1 << gpio_num)) >> gpio_num; if (pd) {
*od = hw->pin[gpio_num].pad_driver; *pd = IO_MUX.gpio[gpio_num].fun_wpd;
*drv = IO_MUX.gpio[gpio_num].fun_drv; }
*fun_sel = IO_MUX.gpio[gpio_num].mcu_sel; if (ie) {
*sig_out = hw->func_out_sel_cfg[gpio_num].out_sel; *ie = IO_MUX.gpio[gpio_num].fun_ie;
*slp_sel = IO_MUX.gpio[gpio_num].slp_sel; }
if (oe) {
*oe = (hw->enable.val & (1 << gpio_num)) >> gpio_num;
}
if (od) {
*od = hw->pin[gpio_num].pad_driver;
}
if (drv) {
*drv = IO_MUX.gpio[gpio_num].fun_drv;
}
if (fun_sel) {
*fun_sel = IO_MUX.gpio[gpio_num].mcu_sel;
}
if (sig_out) {
*sig_out = hw->func_out_sel_cfg[gpio_num].out_sel;
}
if (slp_sel) {
*slp_sel = IO_MUX.gpio[gpio_num].slp_sel;
}
} }
/** /**

View File

@ -229,6 +229,17 @@ static inline void rtcio_ll_pullup_disable(int rtcio_num)
LP_IO_MUX.gpion[rtcio_num].gpion_fun_wpu = 0; LP_IO_MUX.gpion[rtcio_num].gpion_fun_wpu = 0;
} }
/**
* @brief Get RTC GPIO pad pullup status.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
* @return Whether the pullup of the pad is enabled or not.
*/
static inline bool rtcio_ll_is_pullup_enabled(int rtcio_num)
{
return LP_IO_MUX.gpion[rtcio_num].gpion_fun_wpu;
}
/** /**
* RTC GPIO pulldown enable. * RTC GPIO pulldown enable.
* *
@ -251,6 +262,17 @@ static inline void rtcio_ll_pulldown_disable(int rtcio_num)
LP_IO_MUX.gpion[rtcio_num].gpion_fun_wpd = 0; LP_IO_MUX.gpion[rtcio_num].gpion_fun_wpd = 0;
} }
/**
* @brief Get RTC GPIO pad pulldown status.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
* @return Whether the pulldown of the pad is enabled or not.
*/
static inline bool rtcio_ll_is_pulldown_enabled(int rtcio_num)
{
return LP_IO_MUX.gpion[rtcio_num].gpion_fun_wpd;
}
/** /**
* Enable force hold function for an RTC IO pad. * Enable force hold function for an RTC IO pad.
* *

View File

@ -59,15 +59,33 @@ static inline void gpio_ll_get_io_config(gpio_dev_t *hw, uint32_t gpio_num,
{ {
uint32_t bit_mask = 1 << gpio_num; uint32_t bit_mask = 1 << gpio_num;
uint32_t iomux_reg_val = REG_READ(IO_MUX_GPIO0_REG + (gpio_num * 4)); uint32_t iomux_reg_val = REG_READ(IO_MUX_GPIO0_REG + (gpio_num * 4));
*pu = (iomux_reg_val & FUN_PU_M) >> FUN_PU_S; if (pu) {
*pd = (iomux_reg_val & FUN_PD_M) >> FUN_PD_S; *pu = (iomux_reg_val & FUN_PU_M) >> FUN_PU_S;
*ie = (iomux_reg_val & FUN_IE_M) >> FUN_IE_S; }
*oe = (hw->enable.val & bit_mask) >> gpio_num; if (pd) {
*od = hw->pin[gpio_num].pad_driver; *pd = (iomux_reg_val & FUN_PD_M) >> FUN_PD_S;
*drv = (iomux_reg_val & FUN_DRV_M) >> FUN_DRV_S; }
*fun_sel = (iomux_reg_val & MCU_SEL_M) >> MCU_SEL_S; if (ie) {
*sig_out = hw->func_out_sel_cfg[gpio_num].out_sel; *ie = (iomux_reg_val & FUN_IE_M) >> FUN_IE_S;
*slp_sel = (iomux_reg_val & SLP_SEL_M) >> SLP_SEL_S; }
if (oe) {
*oe = (hw->enable.val & bit_mask) >> gpio_num;
}
if (od) {
*od = hw->pin[gpio_num].pad_driver;
}
if (drv) {
*drv = (iomux_reg_val & FUN_DRV_M) >> FUN_DRV_S;
}
if (fun_sel) {
*fun_sel = (iomux_reg_val & MCU_SEL_M) >> MCU_SEL_S;
}
if (sig_out) {
*sig_out = hw->func_out_sel_cfg[gpio_num].out_sel;
}
if (slp_sel) {
*slp_sel = (iomux_reg_val & SLP_SEL_M) >> SLP_SEL_S;
}
} }
/** /**

View File

@ -228,6 +228,17 @@ static inline void rtcio_ll_pullup_disable(int rtcio_num)
LP_IO.gpio[rtcio_num].fun_wpu = 0; LP_IO.gpio[rtcio_num].fun_wpu = 0;
} }
/**
* @brief Get RTC GPIO pad pullup status.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
* @return Whether the pullup of the pad is enabled or not.
*/
static inline bool rtcio_ll_is_pullup_enabled(int rtcio_num)
{
return LP_IO.gpio[rtcio_num].fun_wpu;
}
/** /**
* RTC GPIO pulldown enable. * RTC GPIO pulldown enable.
* *
@ -250,6 +261,17 @@ static inline void rtcio_ll_pulldown_disable(int rtcio_num)
LP_IO.gpio[rtcio_num].fun_wpd = 0; LP_IO.gpio[rtcio_num].fun_wpd = 0;
} }
/**
* @brief Get RTC GPIO pad pulldown status.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
* @return Whether the pulldown of the pad is enabled or not.
*/
static inline bool rtcio_ll_is_pulldown_enabled(int rtcio_num)
{
return LP_IO.gpio[rtcio_num].fun_wpd;
}
/** /**
* Enable force hold function for an RTC IO pad. * Enable force hold function for an RTC IO pad.
* *

View File

@ -57,15 +57,33 @@ static inline void gpio_ll_get_io_config(gpio_dev_t *hw, uint32_t gpio_num,
bool *pu, bool *pd, bool *ie, bool *oe, bool *od, uint32_t *drv, bool *pu, bool *pd, bool *ie, bool *oe, bool *od, uint32_t *drv,
uint32_t *fun_sel, uint32_t *sig_out, bool *slp_sel) uint32_t *fun_sel, uint32_t *sig_out, bool *slp_sel)
{ {
*pu = IO_MUX.gpion[gpio_num].gpion_fun_wpu; if (pu) {
*pd = IO_MUX.gpion[gpio_num].gpion_fun_wpd; *pu = IO_MUX.gpion[gpio_num].gpion_fun_wpu;
*ie = IO_MUX.gpion[gpio_num].gpion_fun_ie; }
*oe = (hw->enable.val & (1 << gpio_num)) >> gpio_num; if (pd) {
*od = hw->pinn[gpio_num].pinn_pad_driver; *pd = IO_MUX.gpion[gpio_num].gpion_fun_wpd;
*drv = IO_MUX.gpion[gpio_num].gpion_fun_drv; }
*fun_sel = IO_MUX.gpion[gpio_num].gpion_mcu_sel; if (ie) {
*sig_out = hw->funcn_out_sel_cfg[gpio_num].funcn_out_sel; *ie = IO_MUX.gpion[gpio_num].gpion_fun_ie;
*slp_sel = IO_MUX.gpion[gpio_num].gpion_slp_sel; }
if (oe) {
*oe = (hw->enable.val & (1 << gpio_num)) >> gpio_num;
}
if (od) {
*od = hw->pinn[gpio_num].pinn_pad_driver;
}
if (drv) {
*drv = IO_MUX.gpion[gpio_num].gpion_fun_drv;
}
if (fun_sel) {
*fun_sel = IO_MUX.gpion[gpio_num].gpion_mcu_sel;
}
if (sig_out) {
*sig_out = hw->funcn_out_sel_cfg[gpio_num].funcn_out_sel;
}
if (slp_sel) {
*slp_sel = IO_MUX.gpion[gpio_num].gpion_slp_sel;
}
} }
/** /**

View File

@ -229,6 +229,17 @@ static inline void rtcio_ll_pullup_disable(int rtcio_num)
LP_IO_MUX.gpion[rtcio_num].gpion_fun_wpu = 0; LP_IO_MUX.gpion[rtcio_num].gpion_fun_wpu = 0;
} }
/**
* @brief Get RTC GPIO pad pullup status.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
* @return Whether the pullup of the pad is enabled or not.
*/
static inline bool rtcio_ll_is_pullup_enabled(int rtcio_num)
{
return LP_IO_MUX.gpion[rtcio_num].gpion_fun_wpu;
}
/** /**
* RTC GPIO pulldown enable. * RTC GPIO pulldown enable.
* *
@ -251,6 +262,17 @@ static inline void rtcio_ll_pulldown_disable(int rtcio_num)
LP_IO_MUX.gpion[rtcio_num].gpion_fun_wpd = 0; LP_IO_MUX.gpion[rtcio_num].gpion_fun_wpd = 0;
} }
/**
* @brief Get RTC GPIO pad pulldown status.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
* @return Whether the pulldown of the pad is enabled or not.
*/
static inline bool rtcio_ll_is_pulldown_enabled(int rtcio_num)
{
return LP_IO_MUX.gpion[rtcio_num].gpion_fun_wpd;
}
/** /**
* Enable force hold function for an RTC IO pad. * Enable force hold function for an RTC IO pad.
* *

View File

@ -59,15 +59,33 @@ static inline void gpio_ll_get_io_config(gpio_dev_t *hw, uint32_t gpio_num,
{ {
uint32_t bit_mask = 1 << gpio_num; uint32_t bit_mask = 1 << gpio_num;
uint32_t iomux_reg_val = REG_READ(IO_MUX_GPIO0_REG + (gpio_num * 4)); uint32_t iomux_reg_val = REG_READ(IO_MUX_GPIO0_REG + (gpio_num * 4));
*pu = (iomux_reg_val & FUN_PU_M) >> FUN_PU_S; if (pu) {
*pd = (iomux_reg_val & FUN_PD_M) >> FUN_PD_S; *pu = (iomux_reg_val & FUN_PU_M) >> FUN_PU_S;
*ie = (iomux_reg_val & FUN_IE_M) >> FUN_IE_S; }
*oe = (hw->enable.val & bit_mask) >> gpio_num; if (pd) {
*od = hw->pin[gpio_num].pad_driver; *pd = (iomux_reg_val & FUN_PD_M) >> FUN_PD_S;
*drv = (iomux_reg_val & FUN_DRV_M) >> FUN_DRV_S; }
*fun_sel = (iomux_reg_val & MCU_SEL_M) >> MCU_SEL_S; if (ie) {
*sig_out = hw->func_out_sel_cfg[gpio_num].out_sel; *ie = (iomux_reg_val & FUN_IE_M) >> FUN_IE_S;
*slp_sel = (iomux_reg_val & SLP_SEL_M) >> SLP_SEL_S; }
if (oe) {
*oe = (hw->enable.val & bit_mask) >> gpio_num;
}
if (od) {
*od = hw->pin[gpio_num].pad_driver;
}
if (drv) {
*drv = (iomux_reg_val & FUN_DRV_M) >> FUN_DRV_S;
}
if (fun_sel) {
*fun_sel = (iomux_reg_val & MCU_SEL_M) >> MCU_SEL_S;
}
if (sig_out) {
*sig_out = hw->func_out_sel_cfg[gpio_num].out_sel;
}
if (slp_sel) {
*slp_sel = (iomux_reg_val & SLP_SEL_M) >> SLP_SEL_S;
}
} }
/** /**

View File

@ -64,15 +64,33 @@ static inline void gpio_ll_get_io_config(gpio_dev_t *hw, uint32_t gpio_num,
{ {
uint32_t bit_shift = (gpio_num < 32) ? gpio_num : (gpio_num - 32); uint32_t bit_shift = (gpio_num < 32) ? gpio_num : (gpio_num - 32);
uint32_t bit_mask = 1 << bit_shift; uint32_t bit_mask = 1 << bit_shift;
*pu = IO_MUX.gpio[gpio_num].fun_wpu; if (pu) {
*pd = IO_MUX.gpio[gpio_num].fun_wpd; *pu = IO_MUX.gpio[gpio_num].fun_wpu;
*ie = IO_MUX.gpio[gpio_num].fun_ie; }
*oe = (((gpio_num < 32) ? hw->enable.val : hw->enable1.val) & bit_mask) >> bit_shift; if (pd) {
*od = hw->pin[gpio_num].pad_driver; *pd = IO_MUX.gpio[gpio_num].fun_wpd;
*drv = IO_MUX.gpio[gpio_num].fun_drv; }
*fun_sel = IO_MUX.gpio[gpio_num].mcu_sel; if (ie) {
*sig_out = hw->func_out_sel_cfg[gpio_num].out_sel; *ie = IO_MUX.gpio[gpio_num].fun_ie;
*slp_sel = IO_MUX.gpio[gpio_num].slp_sel; }
if (oe) {
*oe = (((gpio_num < 32) ? hw->enable.val : hw->enable1.val) & bit_mask) >> bit_shift;
}
if (od) {
*od = hw->pin[gpio_num].pad_driver;
}
if (drv) {
*drv = IO_MUX.gpio[gpio_num].fun_drv;
}
if (fun_sel) {
*fun_sel = IO_MUX.gpio[gpio_num].mcu_sel;
}
if (sig_out) {
*sig_out = hw->func_out_sel_cfg[gpio_num].out_sel;
}
if (slp_sel) {
*slp_sel = IO_MUX.gpio[gpio_num].slp_sel;
}
} }
/** /**

View File

@ -267,6 +267,17 @@ static inline void rtcio_ll_pullup_disable(int rtcio_num)
LP_IOMUX.pad[rtcio_num].rue = 0; LP_IOMUX.pad[rtcio_num].rue = 0;
} }
/**
* @brief Get RTC GPIO pad pullup status.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
* @return Whether the pullup of the pad is enabled or not.
*/
static inline bool rtcio_ll_is_pullup_enabled(int rtcio_num)
{
return LP_IOMUX.pad[rtcio_num].rue;
}
/** /**
* @brief RTC GPIO pulldown enable. * @brief RTC GPIO pulldown enable.
* *
@ -289,6 +300,17 @@ static inline void rtcio_ll_pulldown_disable(int rtcio_num)
LP_IOMUX.pad[rtcio_num].rde = 0; LP_IOMUX.pad[rtcio_num].rde = 0;
} }
/**
* @brief Get RTC GPIO pad pulldown status.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
* @return Whether the pulldown of the pad is enabled or not.
*/
static inline bool rtcio_ll_is_pulldown_enabled(int rtcio_num)
{
return LP_IOMUX.pad[rtcio_num].rde;
}
/** /**
* @brief Enable force hold function for an RTC IO pad. * @brief Enable force hold function for an RTC IO pad.
* *

View File

@ -55,15 +55,33 @@ static inline void gpio_ll_get_io_config(gpio_dev_t *hw, uint32_t gpio_num,
uint32_t bit_shift = (gpio_num < 32) ? gpio_num : (gpio_num - 32); uint32_t bit_shift = (gpio_num < 32) ? gpio_num : (gpio_num - 32);
uint32_t bit_mask = 1 << bit_shift; uint32_t bit_mask = 1 << bit_shift;
uint32_t iomux_reg_val = REG_READ(GPIO_PIN_MUX_REG[gpio_num]); uint32_t iomux_reg_val = REG_READ(GPIO_PIN_MUX_REG[gpio_num]);
*pu = (iomux_reg_val & FUN_PU_M) >> FUN_PU_S; if (pu) {
*pd = (iomux_reg_val & FUN_PD_M) >> FUN_PD_S; *pu = (iomux_reg_val & FUN_PU_M) >> FUN_PU_S;
*ie = (iomux_reg_val & FUN_IE_M) >> FUN_IE_S; }
*oe = (((gpio_num < 32) ? hw->enable : hw->enable1.val) & bit_mask) >> bit_shift; if (pd) {
*od = hw->pin[gpio_num].pad_driver; *pd = (iomux_reg_val & FUN_PD_M) >> FUN_PD_S;
*drv = (iomux_reg_val & FUN_DRV_M) >> FUN_DRV_S; }
*fun_sel = (iomux_reg_val & MCU_SEL_M) >> MCU_SEL_S; if (ie) {
*sig_out = hw->func_out_sel_cfg[gpio_num].func_sel; *ie = (iomux_reg_val & FUN_IE_M) >> FUN_IE_S;
*slp_sel = (iomux_reg_val & SLP_SEL_M) >> SLP_SEL_S; }
if (oe) {
*oe = (((gpio_num < 32) ? hw->enable : hw->enable1.val) & bit_mask) >> bit_shift;
}
if (od) {
*od = hw->pin[gpio_num].pad_driver;
}
if (drv) {
*drv = (iomux_reg_val & FUN_DRV_M) >> FUN_DRV_S;
}
if (fun_sel) {
*fun_sel = (iomux_reg_val & MCU_SEL_M) >> MCU_SEL_S;
}
if (sig_out) {
*sig_out = hw->func_out_sel_cfg[gpio_num].func_sel;
}
if (slp_sel) {
*slp_sel = (iomux_reg_val & SLP_SEL_M) >> SLP_SEL_S;
}
} }
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -12,6 +12,7 @@
#pragma once #pragma once
#include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include "soc/rtc_io_struct.h" #include "soc/rtc_io_struct.h"
#include "soc/rtc_io_reg.h" #include "soc/rtc_io_reg.h"
@ -25,7 +26,7 @@ extern "C" {
#endif #endif
typedef enum { typedef enum {
RTCIO_LL_FUNC_RTC = 0x0, /*!< The pin controled by RTC module. */ RTCIO_LL_FUNC_RTC = 0x0, /*!< The pin controlled by RTC module. */
RTCIO_LL_FUNC_DIGITAL = 0x1, /*!< The pin controlled by DIGITAL module. */ RTCIO_LL_FUNC_DIGITAL = 0x1, /*!< The pin controlled by DIGITAL module. */
} rtcio_ll_func_t; } rtcio_ll_func_t;
@ -197,6 +198,21 @@ static inline void rtcio_ll_pullup_disable(int rtcio_num)
} }
} }
/**
* @brief Get RTC GPIO pad pullup status.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
* @return Whether the pullup of the pad is enabled or not.
*/
static inline bool rtcio_ll_is_pullup_enabled(int rtcio_num)
{
if (rtc_io_desc[rtcio_num].pullup) {
return GET_PERI_REG_MASK(rtc_io_desc[rtcio_num].reg, rtc_io_desc[rtcio_num].pullup);
} else {
return false;
}
}
/** /**
* RTC GPIO pulldown enable. * RTC GPIO pulldown enable.
* *
@ -221,6 +237,21 @@ static inline void rtcio_ll_pulldown_disable(int rtcio_num)
} }
} }
/**
* @brief Get RTC GPIO pad pulldown status.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
* @return Whether the pulldown of the pad is enabled or not.
*/
static inline bool rtcio_ll_is_pulldown_enabled(int rtcio_num)
{
if (rtc_io_desc[rtcio_num].pulldown) {
return GET_PERI_REG_MASK(rtc_io_desc[rtcio_num].reg, rtc_io_desc[rtcio_num].pulldown);
} else {
return false;
}
}
/** /**
* Enable force hold function on an RTC IO pad. * Enable force hold function on an RTC IO pad.
* *

View File

@ -34,39 +34,6 @@ extern "C" {
#define GPIO_LL_INTR_ENA (BIT(0)) #define GPIO_LL_INTR_ENA (BIT(0))
#define GPIO_LL_NMI_INTR_ENA (BIT(1)) #define GPIO_LL_NMI_INTR_ENA (BIT(1))
/**
* @brief Get the configuration for an IO
*
* @param hw Peripheral GPIO hardware instance address.
* @param gpio_num GPIO number
* @param pu Pull-up enabled or not
* @param pd Pull-down enabled or not
* @param ie Input enabled or not
* @param oe Output enabled or not
* @param od Open-drain enabled or not
* @param drv Drive strength value
* @param fun_sel IOMUX function selection value
* @param sig_out Outputting peripheral signal index
* @param slp_sel Pin sleep mode enabled or not
*/
static inline void gpio_ll_get_io_config(gpio_dev_t *hw, uint32_t gpio_num,
bool *pu, bool *pd, bool *ie, bool *oe, bool *od, uint32_t *drv,
uint32_t *fun_sel, uint32_t *sig_out, bool *slp_sel)
{
uint32_t bit_shift = (gpio_num < 32) ? gpio_num : (gpio_num - 32);
uint32_t bit_mask = 1 << bit_shift;
uint32_t iomux_reg_val = REG_READ(GPIO_PIN_MUX_REG[gpio_num]);
*pu = (iomux_reg_val & FUN_PU_M) >> FUN_PU_S;
*pd = (iomux_reg_val & FUN_PD_M) >> FUN_PD_S;
*ie = (iomux_reg_val & FUN_IE_M) >> FUN_IE_S;
*oe = (((gpio_num < 32) ? hw->enable : hw->enable1.val) & bit_mask) >> bit_shift;
*od = hw->pin[gpio_num].pad_driver;
*drv = (iomux_reg_val & FUN_DRV_M) >> FUN_DRV_S;
*fun_sel = (iomux_reg_val & MCU_SEL_M) >> MCU_SEL_S;
*sig_out = hw->func_out_sel_cfg[gpio_num].func_sel;
*slp_sel = (iomux_reg_val & SLP_SEL_M) >> SLP_SEL_S;
}
/** /**
* @brief Enable pull-up on GPIO. * @brief Enable pull-up on GPIO.
* *
@ -727,6 +694,57 @@ static inline void gpio_ll_sleep_output_enable(gpio_dev_t *hw, uint32_t gpio_num
PIN_SLP_OUTPUT_ENABLE(GPIO_PIN_MUX_REG[gpio_num]); PIN_SLP_OUTPUT_ENABLE(GPIO_PIN_MUX_REG[gpio_num]);
} }
/**
* @brief Get the configuration for an IO
*
* @param hw Peripheral GPIO hardware instance address.
* @param gpio_num GPIO number
* @param pu Pull-up enabled or not
* @param pd Pull-down enabled or not
* @param ie Input enabled or not
* @param oe Output enabled or not
* @param od Open-drain enabled or not
* @param drv Drive strength value
* @param fun_sel IOMUX function selection value
* @param sig_out Outputting peripheral signal index
* @param slp_sel Pin sleep mode enabled or not
*/
static inline void gpio_ll_get_io_config(gpio_dev_t *hw, uint32_t gpio_num,
bool *pu, bool *pd, bool *ie, bool *oe, bool *od, uint32_t *drv,
uint32_t *fun_sel, uint32_t *sig_out, bool *slp_sel)
{
uint32_t bit_shift = (gpio_num < 32) ? gpio_num : (gpio_num - 32);
uint32_t bit_mask = 1 << bit_shift;
uint32_t iomux_reg_val = REG_READ(GPIO_PIN_MUX_REG[gpio_num]);
if (pu) {
*pu = (iomux_reg_val & FUN_PU_M) >> FUN_PU_S;
}
if (pd) {
*pd = (iomux_reg_val & FUN_PD_M) >> FUN_PD_S;
}
if (ie) {
*ie = (iomux_reg_val & FUN_IE_M) >> FUN_IE_S;
}
if (oe) {
*oe = (((gpio_num < 32) ? hw->enable : hw->enable1.val) & bit_mask) >> bit_shift;
}
if (od) {
*od = hw->pin[gpio_num].pad_driver;
}
if (drv) {
gpio_ll_get_drive_capability(hw, gpio_num, (gpio_drive_cap_t *)drv); // specific workaround in the LL
}
if (fun_sel) {
*fun_sel = (iomux_reg_val & MCU_SEL_M) >> MCU_SEL_S;
}
if (sig_out) {
*sig_out = hw->func_out_sel_cfg[gpio_num].func_sel;
}
if (slp_sel) {
*slp_sel = (iomux_reg_val & SLP_SEL_M) >> SLP_SEL_S;
}
}
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -12,6 +12,7 @@
#pragma once #pragma once
#include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include "soc/rtc_io_struct.h" #include "soc/rtc_io_struct.h"
#include "soc/rtc_io_reg.h" #include "soc/rtc_io_reg.h"
@ -224,6 +225,21 @@ static inline void rtcio_ll_pullup_disable(int rtcio_num)
} }
} }
/**
* @brief Get RTC GPIO pad pullup status.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
* @return Whether the pullup of the pad is enabled or not.
*/
static inline bool rtcio_ll_is_pullup_enabled(int rtcio_num)
{
if (rtc_io_desc[rtcio_num].pullup) {
return GET_PERI_REG_MASK(rtc_io_desc[rtcio_num].reg, rtc_io_desc[rtcio_num].pullup);
} else {
return false;
}
}
/** /**
* RTC GPIO pulldown enable. * RTC GPIO pulldown enable.
* *
@ -248,6 +264,21 @@ static inline void rtcio_ll_pulldown_disable(int rtcio_num)
} }
} }
/**
* @brief Get RTC GPIO pad pulldown status.
*
* @param rtcio_num The index of rtcio. 0 ~ MAX(rtcio).
* @return Whether the pulldown of the pad is enabled or not.
*/
static inline bool rtcio_ll_is_pulldown_enabled(int rtcio_num)
{
if (rtc_io_desc[rtcio_num].pulldown) {
return GET_PERI_REG_MASK(rtc_io_desc[rtcio_num].reg, rtc_io_desc[rtcio_num].pulldown);
} else {
return false;
}
}
/** /**
* Enable force hold function on an RTC IO pad. * Enable force hold function on an RTC IO pad.
* *

View File

@ -160,6 +160,14 @@ void rtcio_hal_set_direction_in_sleep(int rtcio_num, rtc_gpio_mode_t mode);
*/ */
#define rtcio_hal_pullup_disable(rtcio_num) rtcio_ll_pullup_disable(rtcio_num) #define rtcio_hal_pullup_disable(rtcio_num) rtcio_ll_pullup_disable(rtcio_num)
/**
* @brief Get RTC GPIO pad pullup status.
*
* @param rtcio_num The index of rtcio. 0 ~ SOC_RTCIO_PIN_COUNT.
* @return Whether the pullup of the pad is enabled or not.
*/
#define rtcio_hal_is_pullup_enabled(rtcio_num) rtcio_ll_is_pullup_enabled(rtcio_num)
/** /**
* RTC GPIO pulldown enable. * RTC GPIO pulldown enable.
* *
@ -174,6 +182,14 @@ void rtcio_hal_set_direction_in_sleep(int rtcio_num, rtc_gpio_mode_t mode);
*/ */
#define rtcio_hal_pulldown_disable(rtcio_num) rtcio_ll_pulldown_disable(rtcio_num) #define rtcio_hal_pulldown_disable(rtcio_num) rtcio_ll_pulldown_disable(rtcio_num)
/**
* @brief Get RTC GPIO pad pulldown status.
*
* @param rtcio_num The index of rtcio. 0 ~ SOC_RTCIO_PIN_COUNT.
* @return Whether the pulldown of the pad is enabled or not.
*/
#define rtcio_hal_is_pulldown_enabled(rtcio_num) rtcio_ll_is_pulldown_enabled(rtcio_num)
/** /**
* Select a RTC IOMUX function for the RTC IO * Select a RTC IOMUX function for the RTC IO
* *