mirror of
				https://github.com/espressif/esp-idf.git
				synced 2025-11-04 06:11:06 +00:00 
			
		
		
		
	Merge branch 'bugfix/fix_gpio_wakeup_related_issues_in_ssc_sleep_test_backport_v4.3' into 'release/v4.3'
sleep: fix gpio wakeup related issues(backport v4.3) See merge request espressif/esp-idf!22334
This commit is contained in:
		@@ -573,7 +573,7 @@ esp_err_t gpio_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type)
 | 
			
		||||
#endif
 | 
			
		||||
        portENTER_CRITICAL(&gpio_context.gpio_spinlock);
 | 
			
		||||
        gpio_hal_wakeup_enable(gpio_context.gpio_hal, gpio_num, intr_type);
 | 
			
		||||
#if SOC_GPIO_SUPPORT_SLP_SWITCH && CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND
 | 
			
		||||
#if CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND || CONFIG_PM_SLP_DISABLE_GPIO
 | 
			
		||||
        gpio_hal_sleep_sel_dis(gpio_context.gpio_hal, gpio_num);
 | 
			
		||||
#endif
 | 
			
		||||
        portEXIT_CRITICAL(&gpio_context.gpio_spinlock);
 | 
			
		||||
@@ -596,7 +596,7 @@ esp_err_t gpio_wakeup_disable(gpio_num_t gpio_num)
 | 
			
		||||
#endif
 | 
			
		||||
    portENTER_CRITICAL(&gpio_context.gpio_spinlock);
 | 
			
		||||
    gpio_hal_wakeup_disable(gpio_context.gpio_hal, gpio_num);
 | 
			
		||||
#if SOC_GPIO_SUPPORT_SLP_SWITCH && CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND
 | 
			
		||||
#if CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND || CONFIG_PM_SLP_DISABLE_GPIO
 | 
			
		||||
    gpio_hal_sleep_sel_en(gpio_context.gpio_hal, gpio_num);
 | 
			
		||||
#endif
 | 
			
		||||
    portEXIT_CRITICAL(&gpio_context.gpio_spinlock);
 | 
			
		||||
@@ -734,7 +734,6 @@ void gpio_iomux_out(uint8_t gpio_num, int func, bool oen_inv)
 | 
			
		||||
    gpio_hal_iomux_out(gpio_context.gpio_hal, gpio_num, func, (uint32_t)oen_inv);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if SOC_GPIO_SUPPORT_SLP_SWITCH
 | 
			
		||||
static esp_err_t gpio_sleep_pullup_en(gpio_num_t gpio_num)
 | 
			
		||||
{
 | 
			
		||||
    GPIO_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG);
 | 
			
		||||
@@ -906,7 +905,6 @@ esp_err_t gpio_sleep_pupd_config_unapply(gpio_num_t gpio_num)
 | 
			
		||||
    return ESP_OK;
 | 
			
		||||
}
 | 
			
		||||
#endif // CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
 | 
			
		||||
#endif // SOC_GPIO_SUPPORT_SLP_SWITCH
 | 
			
		||||
 | 
			
		||||
#if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP
 | 
			
		||||
esp_err_t gpio_deep_sleep_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t intr_type)
 | 
			
		||||
@@ -921,7 +919,7 @@ esp_err_t gpio_deep_sleep_wakeup_enable(gpio_num_t gpio_num, gpio_int_type_t int
 | 
			
		||||
    }
 | 
			
		||||
    portENTER_CRITICAL(&gpio_context.gpio_spinlock);
 | 
			
		||||
    gpio_hal_deepsleep_wakeup_enable(gpio_context.gpio_hal, gpio_num, intr_type);
 | 
			
		||||
#if SOC_GPIO_SUPPORT_SLP_SWITCH && CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND
 | 
			
		||||
#if CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND || CONFIG_PM_SLP_DISABLE_GPIO
 | 
			
		||||
    gpio_hal_sleep_sel_dis(gpio_context.gpio_hal, gpio_num);
 | 
			
		||||
#endif
 | 
			
		||||
    portEXIT_CRITICAL(&gpio_context.gpio_spinlock);
 | 
			
		||||
@@ -936,7 +934,7 @@ esp_err_t gpio_deep_sleep_wakeup_disable(gpio_num_t gpio_num)
 | 
			
		||||
    }
 | 
			
		||||
    portENTER_CRITICAL(&gpio_context.gpio_spinlock);
 | 
			
		||||
    gpio_hal_deepsleep_wakeup_disable(gpio_context.gpio_hal, gpio_num);
 | 
			
		||||
#if SOC_GPIO_SUPPORT_SLP_SWITCH && CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND
 | 
			
		||||
#if CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND || CONFIG_PM_SLP_DISABLE_GPIO
 | 
			
		||||
    gpio_hal_sleep_sel_en(gpio_context.gpio_hal, gpio_num);
 | 
			
		||||
#endif
 | 
			
		||||
    portEXIT_CRITICAL(&gpio_context.gpio_spinlock);
 | 
			
		||||
 
 | 
			
		||||
@@ -447,7 +447,6 @@ esp_err_t gpio_force_hold_all(void);
 | 
			
		||||
esp_err_t gpio_force_unhold_all(void);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if SOC_GPIO_SUPPORT_SLP_SWITCH
 | 
			
		||||
/**
 | 
			
		||||
  * @brief Enable SLP_SEL to change GPIO status automantically in lightsleep.
 | 
			
		||||
  * @param gpio_num GPIO number of the pad.
 | 
			
		||||
@@ -494,7 +493,6 @@ esp_err_t gpio_sleep_set_direction(gpio_num_t gpio_num, gpio_mode_t mode);
 | 
			
		||||
 *     - ESP_ERR_INVALID_ARG : Parameter error
 | 
			
		||||
 */
 | 
			
		||||
esp_err_t gpio_sleep_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -20,7 +20,6 @@
 | 
			
		||||
#include "soc/soc_caps.h"
 | 
			
		||||
#include "driver/gpio.h"
 | 
			
		||||
 | 
			
		||||
#if SOC_GPIO_SUPPORT_SLP_SWITCH
 | 
			
		||||
#if CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
 | 
			
		||||
/**
 | 
			
		||||
  * @brief Emulate ESP32S2 behaviour to backup FUN_PU, FUN_PD information
 | 
			
		||||
@@ -42,4 +41,3 @@ esp_err_t gpio_sleep_pupd_config_apply(gpio_num_t gpio_num);
 | 
			
		||||
  */
 | 
			
		||||
esp_err_t gpio_sleep_pupd_config_unapply(gpio_num_t gpio_num);
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -301,10 +301,6 @@ esp_err_t esp_pm_configure(const void* vconfig)
 | 
			
		||||
    s_config_changed = true;
 | 
			
		||||
    portEXIT_CRITICAL(&s_switch_lock);
 | 
			
		||||
 | 
			
		||||
#if CONFIG_PM_SLP_DISABLE_GPIO && SOC_GPIO_SUPPORT_SLP_SWITCH
 | 
			
		||||
    esp_sleep_enable_gpio_switch(config->light_sleep_enable);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if CONFIG_ESP_SYSTEM_PM_POWER_DOWN_CPU && SOC_PM_SUPPORT_CPU_PD
 | 
			
		||||
    esp_err_t ret = esp_sleep_cpu_pd_low_init(config->light_sleep_enable);
 | 
			
		||||
    if (config->light_sleep_enable && ret != ESP_OK) {
 | 
			
		||||
@@ -726,9 +722,6 @@ void esp_pm_impl_init(void)
 | 
			
		||||
    esp_pm_trace_init();
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if CONFIG_PM_SLP_DISABLE_GPIO && SOC_GPIO_SUPPORT_SLP_SWITCH
 | 
			
		||||
    esp_sleep_config_gpio_isolate();
 | 
			
		||||
#endif
 | 
			
		||||
    ESP_ERROR_CHECK(esp_pm_lock_create(ESP_PM_CPU_FREQ_MAX, 0, "rtos0",
 | 
			
		||||
            &s_rtos_lock_handle[0]));
 | 
			
		||||
    ESP_ERROR_CHECK(esp_pm_lock_acquire(s_rtos_lock_handle[0]));
 | 
			
		||||
 
 | 
			
		||||
@@ -460,7 +460,6 @@ void esp_default_wake_deep_sleep(void);
 | 
			
		||||
 */
 | 
			
		||||
void esp_deep_sleep_disable_rom_logging(void);
 | 
			
		||||
 | 
			
		||||
#if SOC_GPIO_SUPPORT_SLP_SWITCH
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Configure to isolate all GPIO pins in sleep state
 | 
			
		||||
 */
 | 
			
		||||
@@ -471,7 +470,6 @@ void esp_sleep_config_gpio_isolate(void);
 | 
			
		||||
 * @param enable decide whether to switch status or not
 | 
			
		||||
 */
 | 
			
		||||
void esp_sleep_enable_gpio_switch(bool enable);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if CONFIG_MAC_BB_PD
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -410,7 +410,6 @@ esp_err_t esp_sleep_cpu_pd_low_init(bool enable)
 | 
			
		||||
}
 | 
			
		||||
#endif // SOC_PM_SUPPORT_CPU_PD
 | 
			
		||||
 | 
			
		||||
#if SOC_GPIO_SUPPORT_SLP_SWITCH
 | 
			
		||||
#if CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
 | 
			
		||||
static inline void gpio_sleep_mode_config_apply(void)
 | 
			
		||||
{
 | 
			
		||||
@@ -461,7 +460,6 @@ void esp_sleep_enable_gpio_switch(bool enable)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
#endif // SOC_GPIO_SUPPORT_SLP_SWITCH
 | 
			
		||||
 | 
			
		||||
static IRAM_ATTR void esp_sleep_isolate_digital_gpio(void)
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -407,7 +407,7 @@ IRAM_ATTR ESP_SYSTEM_INIT_FN(init_components0, BIT(0))
 | 
			
		||||
{
 | 
			
		||||
    esp_timer_init();
 | 
			
		||||
 | 
			
		||||
#if CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND && !CONFIG_PM_SLP_DISABLE_GPIO
 | 
			
		||||
#if CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND || CONFIG_PM_SLP_DISABLE_GPIO
 | 
			
		||||
    /* Configure to isolate (disable the Input/Output/Pullup/Pulldown
 | 
			
		||||
     * function of the pin) all GPIO pins in sleep state
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -486,6 +486,116 @@ static inline void gpio_ll_force_unhold_all(void)
 | 
			
		||||
    SET_PERI_REG_MASK(RTC_CNTL_DIG_ISO_REG, RTC_CNTL_CLR_DG_PAD_AUTOHOLD);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  * @brief Enable GPIO pin used for wakeup from sleep.
 | 
			
		||||
  *
 | 
			
		||||
  * @param hw Peripheral GPIO hardware instance address.
 | 
			
		||||
  * @param gpio_num GPIO number
 | 
			
		||||
  */
 | 
			
		||||
static inline void gpio_ll_sleep_sel_en(gpio_dev_t *hw, gpio_num_t gpio_num)
 | 
			
		||||
{
 | 
			
		||||
    PIN_SLP_SEL_ENABLE(GPIO_PIN_MUX_REG[gpio_num]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  * @brief Disable GPIO pin used for wakeup from sleep.
 | 
			
		||||
  *
 | 
			
		||||
  * @param hw Peripheral GPIO hardware instance address.
 | 
			
		||||
  * @param gpio_num GPIO number
 | 
			
		||||
  */
 | 
			
		||||
static inline void gpio_ll_sleep_sel_dis(gpio_dev_t *hw, gpio_num_t gpio_num)
 | 
			
		||||
{
 | 
			
		||||
    PIN_SLP_SEL_DISABLE(GPIO_PIN_MUX_REG[gpio_num]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  * @brief Disable GPIO pull-up in sleep mode.
 | 
			
		||||
  *
 | 
			
		||||
  * @param hw Peripheral GPIO hardware instance address.
 | 
			
		||||
  * @param gpio_num GPIO number
 | 
			
		||||
  */
 | 
			
		||||
static inline void gpio_ll_sleep_pullup_dis(gpio_dev_t *hw, gpio_num_t gpio_num)
 | 
			
		||||
{
 | 
			
		||||
    PIN_SLP_PULLUP_DISABLE(GPIO_PIN_MUX_REG[gpio_num]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  * @brief Enable GPIO pull-up in sleep mode.
 | 
			
		||||
  *
 | 
			
		||||
  * @param hw Peripheral GPIO hardware instance address.
 | 
			
		||||
  * @param gpio_num GPIO number
 | 
			
		||||
  */
 | 
			
		||||
static inline void gpio_ll_sleep_pullup_en(gpio_dev_t *hw, gpio_num_t gpio_num)
 | 
			
		||||
{
 | 
			
		||||
    PIN_SLP_PULLUP_ENABLE(GPIO_PIN_MUX_REG[gpio_num]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  * @brief Enable GPIO pull-down in sleep mode.
 | 
			
		||||
  *
 | 
			
		||||
  * @param hw Peripheral GPIO hardware instance address.
 | 
			
		||||
  * @param gpio_num GPIO number
 | 
			
		||||
  */
 | 
			
		||||
static inline void gpio_ll_sleep_pulldown_en(gpio_dev_t *hw, gpio_num_t gpio_num)
 | 
			
		||||
{
 | 
			
		||||
    PIN_SLP_PULLDOWN_ENABLE(GPIO_PIN_MUX_REG[gpio_num]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  * @brief Disable GPIO pull-down in sleep mode.
 | 
			
		||||
  *
 | 
			
		||||
  * @param hw Peripheral GPIO hardware instance address.
 | 
			
		||||
  * @param gpio_num GPIO number
 | 
			
		||||
  */
 | 
			
		||||
static inline void gpio_ll_sleep_pulldown_dis(gpio_dev_t *hw, gpio_num_t gpio_num)
 | 
			
		||||
{
 | 
			
		||||
    PIN_SLP_PULLDOWN_DISABLE(GPIO_PIN_MUX_REG[gpio_num]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  * @brief Disable GPIO input in sleep mode.
 | 
			
		||||
  *
 | 
			
		||||
  * @param hw Peripheral GPIO hardware instance address.
 | 
			
		||||
  * @param gpio_num GPIO number
 | 
			
		||||
  */
 | 
			
		||||
static inline void gpio_ll_sleep_input_disable(gpio_dev_t *hw, gpio_num_t gpio_num)
 | 
			
		||||
{
 | 
			
		||||
    PIN_SLP_INPUT_DISABLE(GPIO_PIN_MUX_REG[gpio_num]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  * @brief Enable GPIO input in sleep mode.
 | 
			
		||||
  *
 | 
			
		||||
  * @param hw Peripheral GPIO hardware instance address.
 | 
			
		||||
  * @param gpio_num GPIO number
 | 
			
		||||
  */
 | 
			
		||||
static inline void gpio_ll_sleep_input_enable(gpio_dev_t *hw, gpio_num_t gpio_num)
 | 
			
		||||
{
 | 
			
		||||
    PIN_SLP_INPUT_ENABLE(GPIO_PIN_MUX_REG[gpio_num]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  * @brief Disable GPIO output in sleep mode.
 | 
			
		||||
  *
 | 
			
		||||
  * @param hw Peripheral GPIO hardware instance address.
 | 
			
		||||
  * @param gpio_num GPIO number
 | 
			
		||||
  */
 | 
			
		||||
static inline void gpio_ll_sleep_output_disable(gpio_dev_t *hw, gpio_num_t gpio_num)
 | 
			
		||||
{
 | 
			
		||||
    PIN_SLP_OUTPUT_DISABLE(GPIO_PIN_MUX_REG[gpio_num]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  * @brief Enable GPIO output in sleep mode.
 | 
			
		||||
  *
 | 
			
		||||
  * @param hw Peripheral GPIO hardware instance address.
 | 
			
		||||
  * @param gpio_num GPIO number
 | 
			
		||||
  */
 | 
			
		||||
static inline void gpio_ll_sleep_output_enable(gpio_dev_t *hw, gpio_num_t gpio_num)
 | 
			
		||||
{
 | 
			
		||||
    PIN_SLP_OUTPUT_ENABLE(GPIO_PIN_MUX_REG[gpio_num]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -374,7 +374,6 @@ void gpio_hal_intr_disable(gpio_hal_context_t *hal, gpio_num_t gpio_num);
 | 
			
		||||
#define gpio_hal_force_unhold_all() gpio_ll_force_unhold_all()
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if SOC_GPIO_SUPPORT_SLP_SWITCH
 | 
			
		||||
/**
 | 
			
		||||
  * @brief Enable pull-up on GPIO when system sleep.
 | 
			
		||||
  *
 | 
			
		||||
@@ -472,7 +471,6 @@ void gpio_hal_sleep_pupd_config_apply(gpio_hal_context_t *hal, gpio_num_t gpio_n
 | 
			
		||||
 */
 | 
			
		||||
void gpio_hal_sleep_pupd_config_unapply(gpio_hal_context_t *hal, gpio_num_t gpio_num);
 | 
			
		||||
#endif // CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL
 | 
			
		||||
#endif //SOC_GPIO_SUPPORT_SLP_SWITCH
 | 
			
		||||
 | 
			
		||||
#if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -124,9 +124,6 @@
 | 
			
		||||
// digital I/O pad powered by VDD3P3_CPU or VDD_SPI(GPIO_NUM: 1, 3, 5, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19, 21, 22, 23)
 | 
			
		||||
#define SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK 0xEF0FEAULL
 | 
			
		||||
 | 
			
		||||
// Support to configure slept status
 | 
			
		||||
#define SOC_GPIO_SUPPORT_SLP_SWITCH  (1)
 | 
			
		||||
 | 
			
		||||
/*-------------------------- I2C CAPS ----------------------------------------*/
 | 
			
		||||
// ESP32 have 2 I2C.
 | 
			
		||||
#define SOC_I2C_NUM             (2)
 | 
			
		||||
 
 | 
			
		||||
@@ -89,9 +89,6 @@
 | 
			
		||||
// digital I/O pad powered by VDD3P3_CPU or VDD_SPI(GPIO_NUM_6~GPIO_NUM_21)
 | 
			
		||||
#define SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK 0x00000000003FFFC0ULL
 | 
			
		||||
 | 
			
		||||
// Support to configure sleep status
 | 
			
		||||
#define SOC_GPIO_SUPPORT_SLP_SWITCH  (1)
 | 
			
		||||
 | 
			
		||||
/*-------------------------- I2C CAPS ----------------------------------------*/
 | 
			
		||||
// ESP32-C3 have 2 I2C.
 | 
			
		||||
#define SOC_I2C_NUM                 (1)
 | 
			
		||||
 
 | 
			
		||||
@@ -111,9 +111,6 @@
 | 
			
		||||
// digital I/O pad powered by VDD3P3_CPU or VDD_SPI(GPIO_NUM_26~GPIO_NUM_46)
 | 
			
		||||
#define SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK  0x00007FFFFC000000ULL
 | 
			
		||||
 | 
			
		||||
// Support to configure slept status
 | 
			
		||||
#define SOC_GPIO_SUPPORT_SLP_SWITCH  (1)
 | 
			
		||||
 | 
			
		||||
/*-------------------------- Dedicated GPIO CAPS ---------------------------------------*/
 | 
			
		||||
#define SOC_DEDIC_GPIO_OUT_CHANNELS_NUM (8) /*!< 8 outward channels on each CPU core */
 | 
			
		||||
#define SOC_DEDIC_GPIO_IN_CHANNELS_NUM  (8) /*!< 8 inward channels on each CPU core */
 | 
			
		||||
 
 | 
			
		||||
@@ -72,14 +72,25 @@
 | 
			
		||||
#define MCU_SEL_V 0x7
 | 
			
		||||
#define MCU_SEL_S 12
 | 
			
		||||
 | 
			
		||||
#define PIN_INPUT_ENABLE(PIN_NAME)               SET_PERI_REG_MASK(PIN_NAME,FUN_IE)
 | 
			
		||||
#define PIN_INPUT_DISABLE(PIN_NAME)              CLEAR_PERI_REG_MASK(PIN_NAME,FUN_IE)
 | 
			
		||||
#define PIN_SET_DRV(PIN_NAME, drv)            REG_SET_FIELD(PIN_NAME, FUN_DRV, (drv));
 | 
			
		||||
#define PIN_PULLUP_DIS(PIN_NAME)                 REG_CLR_BIT(PIN_NAME, FUN_PU)
 | 
			
		||||
#define PIN_PULLUP_EN(PIN_NAME)                  REG_SET_BIT(PIN_NAME, FUN_PU)
 | 
			
		||||
#define PIN_PULLDWN_DIS(PIN_NAME)             REG_CLR_BIT(PIN_NAME, FUN_PD)
 | 
			
		||||
#define PIN_PULLDWN_EN(PIN_NAME)              REG_SET_BIT(PIN_NAME, FUN_PD)
 | 
			
		||||
#define PIN_FUNC_SELECT(PIN_NAME, FUNC)      REG_SET_FIELD(PIN_NAME, MCU_SEL, FUNC)
 | 
			
		||||
#define PIN_INPUT_ENABLE(PIN_NAME)          SET_PERI_REG_MASK(PIN_NAME,FUN_IE)
 | 
			
		||||
#define PIN_INPUT_DISABLE(PIN_NAME)         CLEAR_PERI_REG_MASK(PIN_NAME,FUN_IE)
 | 
			
		||||
#define PIN_SET_DRV(PIN_NAME, drv)          REG_SET_FIELD(PIN_NAME, FUN_DRV, (drv));
 | 
			
		||||
#define PIN_PULLUP_DIS(PIN_NAME)            REG_CLR_BIT(PIN_NAME, FUN_PU)
 | 
			
		||||
#define PIN_PULLUP_EN(PIN_NAME)             REG_SET_BIT(PIN_NAME, FUN_PU)
 | 
			
		||||
#define PIN_PULLDWN_DIS(PIN_NAME)           REG_CLR_BIT(PIN_NAME, FUN_PD)
 | 
			
		||||
#define PIN_PULLDWN_EN(PIN_NAME)            REG_SET_BIT(PIN_NAME, FUN_PD)
 | 
			
		||||
#define PIN_FUNC_SELECT(PIN_NAME, FUNC)     REG_SET_FIELD(PIN_NAME, MCU_SEL, FUNC)
 | 
			
		||||
 | 
			
		||||
#define PIN_SLP_INPUT_ENABLE(PIN_NAME)      SET_PERI_REG_MASK(PIN_NAME,SLP_IE)
 | 
			
		||||
#define PIN_SLP_INPUT_DISABLE(PIN_NAME)     CLEAR_PERI_REG_MASK(PIN_NAME,SLP_IE)
 | 
			
		||||
#define PIN_SLP_OUTPUT_ENABLE(PIN_NAME)     SET_PERI_REG_MASK(PIN_NAME,SLP_OE)
 | 
			
		||||
#define PIN_SLP_OUTPUT_DISABLE(PIN_NAME)    CLEAR_PERI_REG_MASK(PIN_NAME,SLP_OE)
 | 
			
		||||
#define PIN_SLP_PULLUP_ENABLE(PIN_NAME)     SET_PERI_REG_MASK(PIN_NAME,SLP_PU)
 | 
			
		||||
#define PIN_SLP_PULLUP_DISABLE(PIN_NAME)    CLEAR_PERI_REG_MASK(PIN_NAME,SLP_PU)
 | 
			
		||||
#define PIN_SLP_PULLDOWN_ENABLE(PIN_NAME)   SET_PERI_REG_MASK(PIN_NAME,SLP_PD)
 | 
			
		||||
#define PIN_SLP_PULLDOWN_DISABLE(PIN_NAME)  CLEAR_PERI_REG_MASK(PIN_NAME,SLP_PD)
 | 
			
		||||
#define PIN_SLP_SEL_ENABLE(PIN_NAME)        SET_PERI_REG_MASK(PIN_NAME,SLP_SEL)
 | 
			
		||||
#define PIN_SLP_SEL_DISABLE(PIN_NAME)       CLEAR_PERI_REG_MASK(PIN_NAME,SLP_SEL)
 | 
			
		||||
 | 
			
		||||
#define IO_MUX_GPIO0_REG        PERIPHS_IO_MUX_GPIO0_U
 | 
			
		||||
#define IO_MUX_GPIO1_REG        PERIPHS_IO_MUX_GPIO1_U
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user