drivers: esp32: Interrupts flags configuration
Allows configuring interrupts flags in the device tree for ESP32 devices. Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
This commit is contained in:
parent
bb746cdcc5
commit
90c6106926
19 changed files with 74 additions and 27 deletions
|
|
@ -72,6 +72,7 @@ struct can_esp32_twai_config {
|
|||
const clock_control_subsys_t clock_subsys;
|
||||
int irq_source;
|
||||
int irq_priority;
|
||||
int irq_flags;
|
||||
#ifndef CONFIG_SOC_SERIES_ESP32
|
||||
/* 32-bit variant of output clock divider register required for non-ESP32 MCUs */
|
||||
uint32_t cdr32;
|
||||
|
|
@ -204,7 +205,8 @@ static int can_esp32_twai_init(const struct device *dev)
|
|||
#endif /* !CONFIG_SOC_SERIES_ESP32 */
|
||||
|
||||
err = esp_intr_alloc(twai_config->irq_source,
|
||||
ESP_PRIO_TO_FLAGS(twai_config->irq_priority) | ESP_INTR_FLAG_IRAM,
|
||||
ESP_PRIO_TO_FLAGS(twai_config->irq_priority) |
|
||||
ESP_INT_FLAGS_CHECK(twai_config->irq_flags) | ESP_INTR_FLAG_IRAM,
|
||||
can_esp32_twai_isr, (void *)dev, NULL);
|
||||
|
||||
if (err != 0) {
|
||||
|
|
@ -280,6 +282,7 @@ const struct can_driver_api can_esp32_twai_driver_api = {
|
|||
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \
|
||||
.irq_source = DT_INST_IRQ_BY_IDX(inst, 0, irq), \
|
||||
.irq_priority = DT_INST_IRQ_BY_IDX(inst, 0, priority), \
|
||||
.irq_flags = DT_INST_IRQ_BY_IDX(inst, 0, flags), \
|
||||
TWAI_CDR32_INIT(inst) \
|
||||
}; \
|
||||
CAN_ESP32_TWAI_ASSERT_CLKOUT_DIVIDER(inst); \
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ struct counter_esp32_config {
|
|||
struct counter_config_info counter_info;
|
||||
int irq_source;
|
||||
int irq_priority;
|
||||
int irq_flags;
|
||||
const struct device *clock_dev;
|
||||
};
|
||||
|
||||
|
|
@ -57,14 +58,14 @@ static int counter_esp32_init(const struct device *dev)
|
|||
const struct counter_esp32_config *cfg = dev->config;
|
||||
struct counter_esp32_data *data = dev->data;
|
||||
|
||||
|
||||
/* RTC_SLOW_CLK is the default clk source */
|
||||
clock_control_get_rate(cfg->clock_dev,
|
||||
(clock_control_subsys_t)ESP32_CLOCK_CONTROL_SUBSYS_RTC_SLOW,
|
||||
&data->clk_src_freq);
|
||||
|
||||
int ret = esp_intr_alloc(cfg->irq_source,
|
||||
ESP_PRIO_TO_FLAGS(cfg->irq_priority),
|
||||
ESP_PRIO_TO_FLAGS(cfg->irq_priority) |
|
||||
ESP_INT_FLAGS_CHECK(cfg->irq_flags),
|
||||
(ESP32_COUNTER_RTC_ISR_HANDLER)counter_esp32_isr,
|
||||
(void *)dev,
|
||||
NULL);
|
||||
|
|
@ -206,7 +207,8 @@ static const struct counter_esp32_config counter_config = {
|
|||
},
|
||||
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(0)),
|
||||
.irq_source = DT_INST_IRQ_BY_IDX(0, 0, irq),
|
||||
.irq_priority = DT_INST_IRQ_BY_IDX(0, 0, priority)
|
||||
.irq_priority = DT_INST_IRQ_BY_IDX(0, 0, priority),
|
||||
.irq_flags = DT_INST_IRQ_BY_IDX(0, 0, flags)
|
||||
};
|
||||
|
||||
static const struct counter_driver_api rtc_timer_esp32_api = {
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ struct counter_esp32_config {
|
|||
timer_idx_t index;
|
||||
int irq_source;
|
||||
int irq_priority;
|
||||
int irq_flags;
|
||||
};
|
||||
|
||||
struct counter_esp32_data {
|
||||
|
|
@ -99,7 +100,8 @@ static int counter_esp32_init(const struct device *dev)
|
|||
k_spin_unlock(&lock, key);
|
||||
|
||||
int ret = esp_intr_alloc(cfg->irq_source,
|
||||
ESP_PRIO_TO_FLAGS(cfg->irq_priority),
|
||||
ESP_PRIO_TO_FLAGS(cfg->irq_priority) |
|
||||
ESP_INT_FLAGS_CHECK(cfg->irq_flags),
|
||||
(ISR_HANDLER)counter_esp32_isr, (void *)dev, NULL);
|
||||
|
||||
if (ret != 0) {
|
||||
|
|
@ -264,7 +266,8 @@ static void counter_esp32_isr(void *arg)
|
|||
.group = DT_INST_PROP(idx, group), \
|
||||
.index = DT_INST_PROP(idx, index), \
|
||||
.irq_source = DT_INST_IRQ_BY_IDX(idx, 0, irq), \
|
||||
.irq_priority = DT_INST_IRQ_BY_IDX(idx, 0, priority) \
|
||||
.irq_priority = DT_INST_IRQ_BY_IDX(idx, 0, priority), \
|
||||
.irq_flags = DT_INST_IRQ_BY_IDX(idx, 0, flags) \
|
||||
}; \
|
||||
\
|
||||
\
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ enum dma_channel_dir {
|
|||
struct irq_config {
|
||||
uint8_t irq_source;
|
||||
uint8_t irq_priority;
|
||||
int irq_flags;
|
||||
};
|
||||
|
||||
struct dma_esp32_channel {
|
||||
|
|
@ -548,10 +549,11 @@ static int dma_esp32_configure_irq(const struct device *dev)
|
|||
|
||||
for (uint8_t i = 0; i < config->irq_size; i++) {
|
||||
int ret = esp_intr_alloc(irq_cfg[i].irq_source,
|
||||
ESP_PRIO_TO_FLAGS(irq_cfg[i].irq_priority) | ESP_INTR_FLAG_IRAM,
|
||||
(ISR_HANDLER)config->irq_handlers[i],
|
||||
(void *)dev,
|
||||
NULL);
|
||||
ESP_PRIO_TO_FLAGS(irq_cfg[i].irq_priority) |
|
||||
ESP_INT_FLAGS_CHECK(irq_cfg[i].irq_flags) | ESP_INTR_FLAG_IRAM,
|
||||
(ISR_HANDLER)config->irq_handlers[i],
|
||||
(void *)dev,
|
||||
NULL);
|
||||
if (ret != 0) {
|
||||
LOG_ERR("Could not allocate interrupt handler");
|
||||
return ret;
|
||||
|
|
@ -670,8 +672,10 @@ static void *irq_handlers[] = {
|
|||
};
|
||||
|
||||
#define IRQ_NUM(idx) DT_NUM_IRQS(DT_DRV_INST(idx))
|
||||
#define IRQ_ENTRY(n, idx) \
|
||||
{ DT_INST_IRQ_BY_IDX(idx, n, irq), DT_INST_IRQ_BY_IDX(idx, n, priority) },
|
||||
#define IRQ_ENTRY(n, idx) { \
|
||||
DT_INST_IRQ_BY_IDX(idx, n, irq), \
|
||||
DT_INST_IRQ_BY_IDX(idx, n, priority), \
|
||||
DT_INST_IRQ_BY_IDX(idx, n, flags) },
|
||||
|
||||
#define DMA_ESP32_INIT(idx) \
|
||||
static struct irq_config irq_config_##idx[] = { \
|
||||
|
|
|
|||
|
|
@ -263,6 +263,7 @@ int eth_esp32_initialize(const struct device *dev)
|
|||
/* Configure ISR */
|
||||
res = esp_intr_alloc(DT_IRQ_BY_IDX(DT_NODELABEL(eth), 0, irq),
|
||||
ESP_PRIO_TO_FLAGS(DT_IRQ_BY_IDX(DT_NODELABEL(eth), 0, priority)) |
|
||||
ESP_INT_FLAGS_CHECK(DT_IRQ_BY_IDX(DT_NODELABEL(eth), 0, flags)) |
|
||||
ESP_INTR_FLAG_IRAM,
|
||||
eth_esp32_isr,
|
||||
(void *)dev,
|
||||
|
|
|
|||
|
|
@ -479,7 +479,8 @@ static int gpio_esp32_init(const struct device *dev)
|
|||
|
||||
if (!isr_connected) {
|
||||
int ret = esp_intr_alloc(DT_IRQ_BY_IDX(DT_NODELABEL(gpio0), 0, irq),
|
||||
ESP_PRIO_TO_FLAGS(DT_IRQ_BY_IDX(DT_NODELABEL(gpio0), 0, priority)),
|
||||
ESP_PRIO_TO_FLAGS(DT_IRQ_BY_IDX(DT_NODELABEL(gpio0), 0, priority)) |
|
||||
ESP_INT_FLAGS_CHECK(DT_IRQ_BY_IDX(DT_NODELABEL(gpio0), 0, flags)),
|
||||
(ISR_HANDLER)gpio_esp32_isr,
|
||||
(void *)dev,
|
||||
NULL);
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ struct i2c_esp32_config {
|
|||
|
||||
int irq_source;
|
||||
int irq_priority;
|
||||
int irq_flags;
|
||||
|
||||
const uint32_t bitrate;
|
||||
const uint32_t scl_timeout;
|
||||
|
|
@ -763,7 +764,8 @@ static int IRAM_ATTR i2c_esp32_init(const struct device *dev)
|
|||
clock_control_on(config->clock_dev, config->clock_subsys);
|
||||
|
||||
ret = esp_intr_alloc(config->irq_source,
|
||||
ESP_PRIO_TO_FLAGS(config->irq_priority) | ESP_INTR_FLAG_IRAM,
|
||||
ESP_PRIO_TO_FLAGS(config->irq_priority) |
|
||||
ESP_INT_FLAGS_CHECK(config->irq_flags) | ESP_INTR_FLAG_IRAM,
|
||||
i2c_esp32_isr,
|
||||
(void *)dev,
|
||||
NULL);
|
||||
|
|
@ -834,6 +836,7 @@ static int IRAM_ATTR i2c_esp32_init(const struct device *dev)
|
|||
}, \
|
||||
.irq_source = DT_INST_IRQ_BY_IDX(idx, 0, irq), \
|
||||
.irq_priority = DT_INST_IRQ_BY_IDX(idx, 0, priority), \
|
||||
.irq_flags = DT_INST_IRQ_BY_IDX(idx, 0, flags), \
|
||||
.bitrate = I2C_FREQUENCY(idx), \
|
||||
.scl_timeout = I2C_ESP32_TIMEOUT(idx), \
|
||||
}; \
|
||||
|
|
|
|||
|
|
@ -164,8 +164,9 @@ static esp_err_t esp32_rtc_isr_install(intr_handler_t intr_handler, const void *
|
|||
REG_WRITE(RTC_CNTL_INT_CLR_REG, UINT32_MAX);
|
||||
|
||||
err = esp_intr_alloc(DT_IRQ_BY_IDX(DT_NODELABEL(touch), 0, irq),
|
||||
ESP_PRIO_TO_FLAGS(DT_IRQ_BY_IDX(DT_NODELABEL(touch), 0, priority)),
|
||||
intr_handler, (void *)handler_arg, NULL);
|
||||
ESP_PRIO_TO_FLAGS(DT_IRQ_BY_IDX(DT_NODELABEL(touch), 0, priority)) |
|
||||
ESP_INT_FLAGS_CHECK(DT_IRQ_BY_IDX(DT_NODELABEL(touch), 0, flags)),
|
||||
intr_handler, (void *)handler_arg, NULL);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,8 +35,10 @@ struct esp32_ipm_memory {
|
|||
struct esp32_ipm_config {
|
||||
int irq_source_pro_cpu;
|
||||
int irq_priority_pro_cpu;
|
||||
int irq_flags_pro_cpu;
|
||||
int irq_source_app_cpu;
|
||||
int irq_priority_app_cpu;
|
||||
int irq_flags_app_cpu;
|
||||
};
|
||||
|
||||
struct esp32_ipm_data {
|
||||
|
|
@ -222,6 +224,7 @@ static int esp32_ipm_init(const struct device *dev)
|
|||
if (data->this_core_id == 0) {
|
||||
ret = esp_intr_alloc(cfg->irq_source_pro_cpu,
|
||||
ESP_PRIO_TO_FLAGS(cfg->irq_priority_pro_cpu) |
|
||||
ESP_INT_FLAGS_CHECK(cfg->irq_flags_pro_cpu) |
|
||||
ESP_INTR_FLAG_IRAM,
|
||||
(intr_handler_t)esp32_ipm_isr,
|
||||
(void *)dev,
|
||||
|
|
@ -239,6 +242,7 @@ static int esp32_ipm_init(const struct device *dev)
|
|||
*/
|
||||
ret = esp_intr_alloc(cfg->irq_source_app_cpu,
|
||||
ESP_PRIO_TO_FLAGS(cfg->irq_priority_app_cpu) |
|
||||
ESP_INT_FLAGS_CHECK(cfg->irq_flags_app_cpu) |
|
||||
ESP_INTR_FLAG_IRAM,
|
||||
(intr_handler_t)esp32_ipm_isr,
|
||||
(void *)dev,
|
||||
|
|
@ -283,8 +287,10 @@ static const struct ipm_driver_api esp32_ipm_driver_api = {
|
|||
static struct esp32_ipm_config esp32_ipm_device_cfg_##idx = { \
|
||||
.irq_source_pro_cpu = DT_INST_IRQ_BY_IDX(idx, 0, irq), \
|
||||
.irq_priority_pro_cpu = DT_INST_IRQ_BY_IDX(idx, 0, priority), \
|
||||
.irq_flags_pro_cpu = DT_INST_IRQ_BY_IDX(idx, 0, flags), \
|
||||
.irq_source_app_cpu = DT_INST_IRQ_BY_IDX(idx, 1, irq), \
|
||||
.irq_priority_app_cpu = DT_INST_IRQ_BY_IDX(idx, 1, priority), \
|
||||
.irq_flags_app_cpu = DT_INST_IRQ_BY_IDX(idx, 1, flags), \
|
||||
}; \
|
||||
\
|
||||
static struct esp32_ipm_data esp32_ipm_device_data_##idx = { \
|
||||
|
|
|
|||
|
|
@ -540,7 +540,8 @@ static const struct pwm_driver_api mcpwm_esp32_api = {
|
|||
int ret; \
|
||||
ret = esp_intr_alloc(DT_INST_IRQ_BY_IDX(idx, 0, irq), \
|
||||
ESP_PRIO_TO_FLAGS(DT_INST_IRQ_BY_IDX(idx, 0, priority)) | \
|
||||
ESP_INTR_FLAG_IRAM, \
|
||||
ESP_INT_FLAGS_CHECK(DT_INST_IRQ_BY_IDX(idx, 0, flags)) | \
|
||||
ESP_INTR_FLAG_IRAM, \
|
||||
(intr_handler_t)mcpwm_esp32_isr, (void *)dev, NULL); \
|
||||
return ret; \
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ struct sdhc_esp32_config {
|
|||
|
||||
int irq_source;
|
||||
int irq_priority;
|
||||
int irq_flags;
|
||||
uint8_t bus_width_cfg;
|
||||
|
||||
struct sdhc_host_props props;
|
||||
|
|
@ -1341,7 +1342,8 @@ static int sdhc_esp32_init(const struct device *dev)
|
|||
|
||||
/* Attach interrupt handler */
|
||||
ret = esp_intr_alloc(cfg->irq_source,
|
||||
ESP_PRIO_TO_FLAGS(cfg->irq_priority) | ESP_INTR_FLAG_IRAM,
|
||||
ESP_PRIO_TO_FLAGS(cfg->irq_priority) |
|
||||
ESP_INT_FLAGS_CHECK(cfg->irq_flags) | ESP_INTR_FLAG_IRAM,
|
||||
&sdio_esp32_isr, (void *)dev,
|
||||
&data->s_host_ctx.intr_handle);
|
||||
|
||||
|
|
@ -1412,6 +1414,7 @@ static const struct sdhc_driver_api sdhc_api = {.reset = sdhc_esp32_reset,
|
|||
.clock_subsys = (clock_control_subsys_t)DT_CLOCKS_CELL(DT_INST_PARENT(n), offset), \
|
||||
.irq_source = DT_IRQ_BY_IDX(DT_INST_PARENT(n), 0, irq), \
|
||||
.irq_priority = DT_IRQ_BY_IDX(DT_INST_PARENT(n), 0, priority), \
|
||||
.irq_flags = DT_IRQ_BY_IDX(DT_INST_PARENT(n), 0, flags), \
|
||||
.slot = DT_REG_ADDR(DT_DRV_INST(n)), \
|
||||
.bus_width_cfg = DT_INST_PROP(n, bus_width), \
|
||||
.pcfg = PINCTRL_DT_DEV_CONFIG_GET(DT_DRV_INST(n)), \
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ struct pcnt_esp32_config {
|
|||
const clock_control_subsys_t clock_subsys;
|
||||
const int irq_source;
|
||||
const int irq_priority;
|
||||
const int irq_flags;
|
||||
struct pcnt_esp32_unit_config *unit_config;
|
||||
const int unit_len;
|
||||
};
|
||||
|
|
@ -342,7 +343,8 @@ static int pcnt_esp32_trigger_set(const struct device *dev, const struct sensor_
|
|||
data->trigger = trig;
|
||||
|
||||
ret = esp_intr_alloc(config->irq_source,
|
||||
ESP_PRIO_TO_FLAGS(config->irq_priority) | ESP_INTR_FLAG_IRAM,
|
||||
ESP_PRIO_TO_FLAGS(config->irq_priority) |
|
||||
ESP_INT_FLAGS_CHECK(config->irq_flags) | ESP_INTR_FLAG_IRAM,
|
||||
(intr_handler_t)pcnt_esp32_isr, (void *)dev, NULL);
|
||||
|
||||
if (ret != 0) {
|
||||
|
|
@ -405,6 +407,7 @@ static struct pcnt_esp32_config pcnt_esp32_config = {
|
|||
.clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(0, offset),
|
||||
.irq_source = DT_INST_IRQ_BY_IDX(0, 0, irq),
|
||||
.irq_priority = DT_INST_IRQ_BY_IDX(0, 0, priority),
|
||||
.irq_flags = DT_INST_IRQ_BY_IDX(0, 0, flags),
|
||||
.unit_config = unit_config,
|
||||
.unit_len = ARRAY_SIZE(unit_config),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ struct serial_esp32_usb_config {
|
|||
const clock_control_subsys_t clock_subsys;
|
||||
int irq_source;
|
||||
int irq_priority;
|
||||
int irq_flags;
|
||||
};
|
||||
|
||||
struct serial_esp32_usb_data {
|
||||
|
|
@ -113,7 +114,8 @@ static int serial_esp32_usb_init(const struct device *dev)
|
|||
|
||||
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
|
||||
ret = esp_intr_alloc(config->irq_source,
|
||||
ESP_PRIO_TO_FLAGS(config->irq_priority),
|
||||
ESP_PRIO_TO_FLAGS(config->irq_priority) |
|
||||
ESP_INT_FLAGS_CHECK(config->irq_flags),
|
||||
(ISR_HANDLER)serial_esp32_usb_isr,
|
||||
(void *)dev, NULL);
|
||||
#endif
|
||||
|
|
@ -276,7 +278,8 @@ static const DRAM_ATTR struct serial_esp32_usb_config serial_esp32_usb_cfg = {
|
|||
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(0)),
|
||||
.clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(0, offset),
|
||||
.irq_source = DT_INST_IRQ_BY_IDX(0, 0, irq),
|
||||
.irq_priority = DT_INST_IRQ_BY_IDX(0, 0, priority)
|
||||
.irq_priority = DT_INST_IRQ_BY_IDX(0, 0, priority),
|
||||
.irq_flags = DT_INST_IRQ_BY_IDX(0, 0, flags)
|
||||
};
|
||||
|
||||
static struct serial_esp32_usb_data serial_esp32_usb_data_0;
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ struct uart_esp32_config {
|
|||
const clock_control_subsys_t clock_subsys;
|
||||
int irq_source;
|
||||
int irq_priority;
|
||||
int irq_flags;
|
||||
bool tx_invert;
|
||||
bool rx_invert;
|
||||
#if CONFIG_UART_ASYNC_API
|
||||
|
|
@ -937,7 +938,8 @@ static int uart_esp32_init(const struct device *dev)
|
|||
|
||||
#if CONFIG_UART_INTERRUPT_DRIVEN || CONFIG_UART_ASYNC_API
|
||||
ret = esp_intr_alloc(config->irq_source,
|
||||
ESP_PRIO_TO_FLAGS(config->irq_priority),
|
||||
ESP_PRIO_TO_FLAGS(config->irq_priority) |
|
||||
ESP_INT_FLAGS_CHECK(config->irq_flags),
|
||||
(ISR_HANDLER)uart_esp32_isr,
|
||||
(void *)dev,
|
||||
NULL);
|
||||
|
|
@ -1024,6 +1026,7 @@ static const DRAM_ATTR struct uart_driver_api uart_esp32_api = {
|
|||
.clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(idx, offset), \
|
||||
.irq_source = DT_INST_IRQ_BY_IDX(idx, 0, irq), \
|
||||
.irq_priority = DT_INST_IRQ_BY_IDX(idx, 0, priority), \
|
||||
.irq_flags = DT_INST_IRQ_BY_IDX(idx, 0, flags), \
|
||||
.tx_invert = DT_INST_PROP_OR(idx, tx_invert, false), \
|
||||
.rx_invert = DT_INST_PROP_OR(idx, rx_invert, false), \
|
||||
ESP_UART_DMA_INIT(idx)}; \
|
||||
|
|
|
|||
|
|
@ -245,7 +245,8 @@ static int spi_esp32_init(const struct device *dev)
|
|||
spi_ll_clear_int_stat(cfg->spi);
|
||||
|
||||
err = esp_intr_alloc(cfg->irq_source,
|
||||
ESP_PRIO_TO_FLAGS(cfg->irq_priority) | ESP_INTR_FLAG_IRAM,
|
||||
ESP_PRIO_TO_FLAGS(cfg->irq_priority) |
|
||||
ESP_INT_FLAGS_CHECK(cfg->irq_flags) | ESP_INTR_FLAG_IRAM,
|
||||
(ISR_HANDLER)spi_esp32_isr,
|
||||
(void *)dev,
|
||||
NULL);
|
||||
|
|
@ -532,6 +533,7 @@ static const struct spi_driver_api spi_api = {
|
|||
.input_delay_ns = 0, \
|
||||
.irq_source = DT_INST_IRQ_BY_IDX(idx, 0, irq), \
|
||||
.irq_priority = DT_INST_IRQ_BY_IDX(idx, 0, priority), \
|
||||
.irq_flags = DT_INST_IRQ_BY_IDX(idx, 0, flags), \
|
||||
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(idx), \
|
||||
.clock_subsys = \
|
||||
(clock_control_subsys_t)DT_INST_CLOCKS_CELL(idx, offset), \
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ struct spi_esp32_config {
|
|||
int input_delay_ns;
|
||||
int irq_source;
|
||||
int irq_priority;
|
||||
int irq_flags;
|
||||
const struct pinctrl_dev_config *pcfg;
|
||||
clock_control_subsys_t clock_subsys;
|
||||
bool use_iomux;
|
||||
|
|
|
|||
|
|
@ -146,7 +146,8 @@ static int sys_clock_driver_init(void)
|
|||
int ret;
|
||||
|
||||
ret = esp_intr_alloc(DT_IRQ_BY_IDX(DT_NODELABEL(systimer0), 0, irq),
|
||||
ESP_PRIO_TO_FLAGS(DT_IRQ_BY_IDX(DT_NODELABEL(systimer0), 0, priority)),
|
||||
ESP_PRIO_TO_FLAGS(DT_IRQ_BY_IDX(DT_NODELABEL(systimer0), 0, priority)) |
|
||||
ESP_INT_FLAGS_CHECK(DT_IRQ_BY_IDX(DT_NODELABEL(systimer0), 0, flags)),
|
||||
sys_timer_isr,
|
||||
NULL,
|
||||
NULL);
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ struct wdt_esp32_config {
|
|||
void (*connect_irq)(void);
|
||||
int irq_source;
|
||||
int irq_priority;
|
||||
int irq_flags;
|
||||
};
|
||||
|
||||
static inline void wdt_esp32_seal(const struct device *dev)
|
||||
|
|
@ -168,7 +169,8 @@ static int wdt_esp32_init(const struct device *dev)
|
|||
wdt_hal_init(&data->hal, config->wdt_inst, MWDT_TICK_PRESCALER, true);
|
||||
|
||||
int ret = esp_intr_alloc(config->irq_source,
|
||||
ESP_PRIO_TO_FLAGS(config->irq_priority),
|
||||
ESP_PRIO_TO_FLAGS(config->irq_priority) |
|
||||
ESP_INT_FLAGS_CHECK(config->irq_flags),
|
||||
(ISR_HANDLER)wdt_esp32_isr,
|
||||
(void *)dev,
|
||||
NULL);
|
||||
|
|
@ -198,6 +200,7 @@ static const struct wdt_driver_api wdt_api = {
|
|||
.wdt_inst = WDT_MWDT##idx, \
|
||||
.irq_source = DT_IRQ_BY_IDX(DT_NODELABEL(wdt##idx), 0, irq), \
|
||||
.irq_priority = DT_IRQ_BY_IDX(DT_NODELABEL(wdt##idx), 0, priority), \
|
||||
.irq_flags = DT_IRQ_BY_IDX(DT_NODELABEL(wdt##idx), 0, flags), \
|
||||
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(idx)), \
|
||||
.clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(idx, offset), \
|
||||
}; \
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ struct esp32_xt_wdt_config {
|
|||
const clock_control_subsys_t clock_subsys;
|
||||
int irq_source;
|
||||
int irq_priority;
|
||||
int irq_flags;
|
||||
};
|
||||
|
||||
static int esp32_xt_wdt_setup(const struct device *dev, uint8_t options)
|
||||
|
|
@ -128,7 +129,8 @@ static int esp32_xt_wdt_init(const struct device *dev)
|
|||
ESP32_RTC_SLOW_CLK_SRC_RC_SLOW_FREQ/1000);
|
||||
|
||||
int err = esp_intr_alloc(cfg->irq_source,
|
||||
ESP_PRIO_TO_FLAGS(cfg->irq_priority),
|
||||
ESP_PRIO_TO_FLAGS(cfg->irq_priority) |
|
||||
ESP_INT_FLAGS_CHECK(cfg->irq_flags),
|
||||
(ISR_HANDLER)esp32_xt_wdt_isr, (void *)dev, NULL);
|
||||
|
||||
if (err) {
|
||||
|
|
@ -155,7 +157,8 @@ static struct esp32_xt_wdt_config esp32_xt_wdt_config0 = {
|
|||
.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(0)),
|
||||
.clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(0, offset),
|
||||
.irq_source = DT_INST_IRQ_BY_IDX(0, 0, irq),
|
||||
.irq_priority = DT_INST_IRQ_BY_IDX(0, 0, priority)
|
||||
.irq_priority = DT_INST_IRQ_BY_IDX(0, 0, priority),
|
||||
.irq_flags = DT_INST_IRQ_BY_IDX(0, 0, flags)
|
||||
};
|
||||
|
||||
DEVICE_DT_DEFINE(DT_NODELABEL(xt_wdt),
|
||||
|
|
|
|||
Loading…
Reference in a new issue