Skip to content

Commit 8dc8806

Browse files
lpereiraAnas Nashif
authored andcommitted
drivers: watchdog: esp32: Acknowledge watchdog interrupt
If the interrupt isn't acknowledged, the callback will continue to be called. Jira: ZEP-2556 Signed-off-by: Leandro Pereira <[email protected]>
1 parent 1861022 commit 8dc8806

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/watchdog/wdt_esp32.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ static void wdt_esp32_reload(struct device *dev)
123123
static void set_interrupt_enabled(bool setting)
124124
{
125125
volatile u32_t *intr_enable_reg = (u32_t *)TIMG_INT_ENA_TIMERS_REG(1);
126+
volatile u32_t *intr_clear_timers = (u32_t *)TIMG_INT_CLR_TIMERS_REG(1);
127+
128+
*intr_clear_timers |= TIMG_WDT_INT_CLR;
126129

127130
if (setting) {
128131
*intr_enable_reg |= TIMG_WDT_INT_ENA;
@@ -132,6 +135,7 @@ static void set_interrupt_enabled(bool setting)
132135
irq_enable(CONFIG_WDT_ESP32_IRQ);
133136
} else {
134137
*intr_enable_reg &= ~TIMG_WDT_INT_ENA;
138+
135139
irq_disable(CONFIG_WDT_ESP32_IRQ);
136140
}
137141
}
@@ -229,8 +233,11 @@ DEVICE_AND_API_INIT(wdt_esp32, CONFIG_WDT_ESP32_DEVICE_NAME, wdt_esp32_init,
229233
static void wdt_esp32_isr(void *param)
230234
{
231235
struct wdt_esp32_data *data = param;
236+
volatile u32_t *reg = (u32_t *)TIMG_INT_CLR_TIMERS_REG(1);
232237

233238
if (data->config.interrupt_fn) {
234239
data->config.interrupt_fn(DEVICE_GET(wdt_esp32));
235240
}
241+
242+
*reg |= TIMG_WDT_INT_CLR;
236243
}

0 commit comments

Comments
 (0)