Skip to content

Commit 9bacdba

Browse files
lpereiraAnas Nashif
authored andcommitted
drivers: watchdog: esp32: Always use Timer Group 1 for WDT
The FreeRTOS port by Espressif uses the same timer group. Do the same here. Jira: ZEP-2556 Signed-off-by: Leandro Pereira <[email protected]>
1 parent 3b26373 commit 9bacdba

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

drivers/watchdog/wdt_esp32.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@ static struct wdt_esp32_data shared_data;
2525
*/
2626
static inline void wdt_esp32_seal(void)
2727
{
28-
volatile u32_t *reg = (u32_t *)TIMG_WDTWPROTECT_REG(0);
28+
volatile u32_t *reg = (u32_t *)TIMG_WDTWPROTECT_REG(1);
2929

3030
*reg = 0;
3131
}
3232

3333
static inline void wdt_esp32_unseal(void)
3434
{
35-
volatile u32_t *reg = (u32_t *)TIMG_WDTWPROTECT_REG(0);
35+
volatile u32_t *reg = (u32_t *)TIMG_WDTWPROTECT_REG(1);
3636

3737
*reg = TIMG_WDT_WKEY_VALUE;
3838
}
3939

4040
static void wdt_esp32_enable(struct device *dev)
4141
{
42-
volatile u32_t *reg = (u32_t *)TIMG_WDTCONFIG0_REG(0);
42+
volatile u32_t *reg = (u32_t *)TIMG_WDTCONFIG0_REG(1);
4343

4444
ARG_UNUSED(dev);
4545

@@ -50,7 +50,7 @@ static void wdt_esp32_enable(struct device *dev)
5050

5151
static void wdt_esp32_disable(struct device *dev)
5252
{
53-
volatile u32_t *reg = (u32_t *)TIMG_WDTCONFIG0_REG(0);
53+
volatile u32_t *reg = (u32_t *)TIMG_WDTCONFIG0_REG(1);
5454

5555
ARG_UNUSED(dev);
5656

@@ -88,7 +88,7 @@ static void adjust_timeout(u32_t timeout)
8888
/* MWDT ticks every 12.5ns. Set the prescaler to 40000, so the
8989
* counter for each watchdog stage is decremented every 0.5ms.
9090
*/
91-
reg = (u32_t *)TIMG_WDTCONFIG1_REG(0);
91+
reg = (u32_t *)TIMG_WDTCONFIG1_REG(1);
9292
*reg = 40000;
9393

9494
ticks = 1<<(cycles + 2);
@@ -100,18 +100,18 @@ static void adjust_timeout(u32_t timeout)
100100
*/
101101
ticks += (1<<cycles) / 10;
102102

103-
reg = (u32_t *)TIMG_WDTCONFIG2_REG(0);
103+
reg = (u32_t *)TIMG_WDTCONFIG2_REG(1);
104104
*reg = ticks;
105105

106-
reg = (u32_t *)TIMG_WDTCONFIG3_REG(0);
106+
reg = (u32_t *)TIMG_WDTCONFIG3_REG(1);
107107
*reg = ticks;
108108
}
109109

110110
static void wdt_esp32_isr(void *param);
111111

112112
static void wdt_esp32_reload(struct device *dev)
113113
{
114-
volatile u32_t *reg = (u32_t *)TIMG_WDTFEED_REG(0);
114+
volatile u32_t *reg = (u32_t *)TIMG_WDTFEED_REG(1);
115115

116116
ARG_UNUSED(dev);
117117

@@ -122,7 +122,7 @@ static void wdt_esp32_reload(struct device *dev)
122122

123123
static void set_interrupt_enabled(bool setting)
124124
{
125-
volatile u32_t *intr_enable_reg = (u32_t *)TIMG_INT_ENA_TIMERS_REG(0);
125+
volatile u32_t *intr_enable_reg = (u32_t *)TIMG_INT_ENA_TIMERS_REG(1);
126126

127127
wdt_esp32_unseal();
128128
if (setting) {
@@ -141,7 +141,7 @@ static void set_interrupt_enabled(bool setting)
141141
static int wdt_esp32_set_config(struct device *dev, struct wdt_config *config)
142142
{
143143
struct wdt_esp32_data *data = dev->driver_data;
144-
volatile u32_t *reg = (u32_t *)TIMG_WDTCONFIG0_REG(0);
144+
volatile u32_t *reg = (u32_t *)TIMG_WDTCONFIG0_REG(1);
145145
u32_t v;
146146

147147
if (!config) {

0 commit comments

Comments
 (0)