فهرست منبع

change(hal): rewrite gpio_ll_set_iomux_pin_ctrl api

wuzhenghui 2 سال پیش
والد
کامیت
1f10c84a4f

+ 3 - 3
components/driver/i2s/i2s_common.c

@@ -746,13 +746,13 @@ esp_err_t i2s_check_set_mclk(i2s_port_t id, int gpio_num, i2s_clock_src_t clk_sr
     bool is_apll = clk_src == I2S_CLK_SRC_APLL;
     if (gpio_num == GPIO_NUM_0) {
         gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0_CLK_OUT1);
-        gpio_ll_iomux_pin_ctrl(is_apll ? 0xFFF6 : (is_i2s0 ? 0xFFF0 : 0xFFFF));
+        gpio_ll_set_iomux_pin_ctrl(is_apll ? 0xFFF6 : (is_i2s0 ? 0xFFF0 : 0xFFFF), 0xFFFFFFFF, 0);
     } else if (gpio_num == GPIO_NUM_1) {
         gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_CLK_OUT3);
-        gpio_ll_iomux_pin_ctrl(is_apll ? 0xF6F6 : (is_i2s0 ? 0xF0F0 : 0xF0FF));
+        gpio_ll_set_iomux_pin_ctrl(is_apll ? 0xF6F6 : (is_i2s0 ? 0xF0F0 : 0xF0FF), 0xFFFFFFFF, 0);
     } else {
         gpio_hal_iomux_func_sel(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_CLK_OUT2);
-        gpio_ll_iomux_pin_ctrl(is_apll ? 0xFF66 : (is_i2s0 ? 0xFF00 : 0xFF0F));
+        gpio_ll_set_iomux_pin_ctrl(is_apll ? 0xFF66 : (is_i2s0 ? 0xFF00 : 0xFF0F), 0xFFFFFFFF, 0);
     }
 #else
     ESP_RETURN_ON_FALSE(GPIO_IS_VALID_GPIO(gpio_num), ESP_ERR_INVALID_ARG, TAG, "mck_io_num invalid");

+ 5 - 3
components/hal/esp32/include/hal/gpio_ll.h

@@ -679,11 +679,13 @@ static inline __attribute__((always_inline)) void gpio_ll_iomux_func_sel(uint32_
 /**
  * @brief  Control the pin in the IOMUX
  *
- * @param  val Control value
+ * @param  bmap   write mask of control value
+ * @param  val    Control value
+ * @param  shift  write mask shift of control value
  */
-static inline __attribute__((always_inline)) void gpio_ll_iomux_pin_ctrl(uint32_t val)
+static inline __attribute__((always_inline)) void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift)
 {
-    WRITE_PERI_REG(PIN_CTRL, val);
+    SET_PERI_REG_BITS(PIN_CTRL, bmap, val, shift);
 }
 
 /**

+ 12 - 0
components/hal/esp32c2/include/hal/gpio_ll.h

@@ -492,6 +492,18 @@ static inline __attribute__((always_inline)) void gpio_ll_iomux_func_sel(uint32_
     PIN_FUNC_SELECT(pin_name, func);
 }
 
+/**
+ * @brief  Control the pin in the IOMUX
+ *
+ * @param  bmap   write mask of control value
+ * @param  val    Control value
+ * @param  shift  write mask shift of control value
+ */
+static inline __attribute__((always_inline)) void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift)
+{
+    SET_PERI_REG_BITS(PIN_CTRL, bmap, val, shift);
+}
+
 /**
   * @brief Set peripheral output to an GPIO pad through the IOMUX.
   *

+ 12 - 0
components/hal/esp32c3/include/hal/gpio_ll.h

@@ -508,6 +508,18 @@ static inline __attribute__((always_inline)) void gpio_ll_iomux_func_sel(uint32_
     PIN_FUNC_SELECT(pin_name, func);
 }
 
+/**
+ * @brief  Control the pin in the IOMUX
+ *
+ * @param  bmap   write mask of control value
+ * @param  val    Control value
+ * @param  shift  write mask shift of control value
+ */
+static inline __attribute__((always_inline)) void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift)
+{
+    SET_PERI_REG_BITS(PIN_CTRL, bmap, val, shift);
+}
+
 /**
   * @brief Set peripheral output to an GPIO pad through the IOMUX.
   *

+ 12 - 0
components/hal/esp32c6/include/hal/gpio_ll.h

@@ -458,6 +458,18 @@ static inline void gpio_ll_iomux_func_sel(uint32_t pin_name, uint32_t func)
     PIN_FUNC_SELECT(pin_name, func);
 }
 
+/**
+ * @brief  Control the pin in the IOMUX
+ *
+ * @param  bmap   write mask of control value
+ * @param  val    Control value
+ * @param  shift  write mask shift of control value
+ */
+static inline __attribute__((always_inline)) void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift)
+{
+    SET_PERI_REG_BITS(PIN_CTRL, bmap, val, shift);
+}
+
 /**
  * @brief  Select a function for the pin in the IOMUX
  *

+ 12 - 0
components/hal/esp32h2/include/hal/gpio_ll.h

@@ -534,6 +534,18 @@ static inline void gpio_ll_iomux_out(gpio_dev_t *hw, uint8_t gpio_num, int func,
     gpio_ll_func_sel(hw, gpio_num, func);
 }
 
+/**
+ * @brief  Control the pin in the IOMUX
+ *
+ * @param  bmap   write mask of control value
+ * @param  val    Control value
+ * @param  shift  write mask shift of control value
+ */
+static inline __attribute__((always_inline)) void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift)
+{
+    SET_PERI_REG_BITS(PIN_CTRL, bmap, val, shift);
+}
+
 /**
  * @brief Set clock source of IO MUX module
  *

+ 11 - 0
components/hal/esp32p4/include/hal/gpio_ll.h

@@ -579,6 +579,17 @@ static inline void gpio_ll_iomux_func_sel(uint32_t pin_name, uint32_t func)
     PIN_FUNC_SELECT(pin_name, func);
 }
 
+/**
+ * @brief  Control the pin in the IOMUX
+ *
+ * @param  bmap   write mask of control value
+ * @param  val    Control value
+ * @param  shift  write mask shift of control value
+ */
+static inline __attribute__((always_inline)) void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift)
+{
+    // TODO: IDF-8226
+}
 /**
  * @brief  Select a function for the pin in the IOMUX
  *

+ 11 - 0
components/hal/esp32s2/include/hal/gpio_ll.h

@@ -507,6 +507,17 @@ static inline __attribute__((always_inline)) void gpio_ll_iomux_func_sel(uint32_
     PIN_FUNC_SELECT(pin_name, func);
 }
 
+/**
+ * @brief  Control the pin in the IOMUX
+ *
+ * @param  bmap   write mask of control value
+ * @param  val    Control value
+ * @param  shift  write mask shift of control value
+ */
+static inline __attribute__((always_inline)) void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift)
+{
+    SET_PERI_REG_BITS(PIN_CTRL, bmap, val, shift);
+}
 /**
   * @brief Set peripheral output to an GPIO pad through the IOMUX.
   *

+ 12 - 0
components/hal/esp32s3/include/hal/gpio_ll.h

@@ -526,6 +526,18 @@ static inline __attribute__((always_inline)) void gpio_ll_iomux_func_sel(uint32_
     PIN_FUNC_SELECT(pin_name, func);
 }
 
+/**
+ * @brief  Control the pin in the IOMUX
+ *
+ * @param  bmap   write mask of control value
+ * @param  val    Control value
+ * @param  shift  write mask shift of control value
+ */
+static inline __attribute__((always_inline)) void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift)
+{
+    SET_PERI_REG_BITS(PIN_CTRL, bmap, val, shift);
+}
+
 /**
   * @brief Set peripheral output to an GPIO pad through the IOMUX.
   *