88#define DT_DRV_COMPAT espressif_esp32_gpio
99
1010/* Include esp-idf headers first to avoid redefining BIT() macro */
11- #ifndef CONFIG_SOC_ESP32C3
12- #include <soc/dport_reg.h>
13- #endif
1411#include <soc/gpio_reg.h>
1512#include <soc/io_mux_reg.h>
1613#include <soc/soc.h>
1714#include <hal/gpio_ll.h>
1815#include <esp_attr.h>
1916
17+ #include <soc.h>
2018#include <errno.h>
2119#include <device.h>
2220#include <drivers/gpio.h>
@@ -37,15 +35,15 @@ LOG_MODULE_REGISTER(gpio_esp32, CONFIG_LOG_DEFAULT_LEVEL);
3735#define DEV_CFG (_dev ) ((struct gpio_esp32_config *const)(_dev)->config)
3836
3937#ifdef CONFIG_SOC_ESP32C3
40- /* gpio structs in esp32c3 series are diferent from xtensa ones */
38+ /* gpio structs in esp32c3 series are different from xtensa ones */
4139#define out out.data
4240#define in in.data
4341#define out_w1ts out_w1ts.val
4442#define out_w1tc out_w1tc.val
4543/* arch_curr_cpu() is not available for riscv based chips */
4644#define CPU_ID () 0
4745#define ISR_HANDLER isr_handler_t
48- #else
46+ #else
4947#define CPU_ID () arch_curr_cpu()->id
5048#define ISR_HANDLER intr_handler_t
5149#endif
@@ -293,6 +291,7 @@ static int gpio_esp32_pin_interrupt_configure(const struct device *port,
293291
294292 key = irq_lock ();
295293 gpio_ll_set_intr_type (cfg -> gpio_base , io_pin , intr_trig_mode );
294+ gpio_ll_intr_enable_on_core (cfg -> gpio_base , CPU_ID (), io_pin );
296295 irq_unlock (key );
297296
298297 return 0 ;
@@ -357,7 +356,12 @@ static int gpio_esp32_init(const struct device *dev)
357356 }
358357
359358 if (!isr_connected ) {
360- esp_intr_alloc (DT_IRQN (DT_NODELABEL (gpio0 )), 0 , (ISR_HANDLER )gpio_esp32_isr , (void * )dev , NULL );
359+ esp_intr_alloc (DT_IRQN (DT_NODELABEL (gpio0 )),
360+ 0 ,
361+ (ISR_HANDLER )gpio_esp32_isr ,
362+ (void * )dev ,
363+ NULL );
364+
361365 isr_connected = true;
362366 }
363367
0 commit comments