File tree Expand file tree Collapse file tree 3 files changed +47
-1
lines changed Expand file tree Collapse file tree 3 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ LDFLAGS = -T linker.ld -mcpu=cortex-m0plus -mlittle-endian -g -nostdlib -mthumb
18
18
LIBS += -lgcc
19
19
20
20
OBJECTS = startup.o main.o miniprintf.o uart.o systick.o adc.o vref.o misc.o
21
- OBJECTS += iomux.o sysctl.o gpio.o cp.o i2c.o nvic.o nvm.o config.o
21
+ OBJECTS += iomux.o sysctl.o gpio.o cp.o i2c.o nvic.o nvm.o config.o wdt.o
22
22
23
23
DEPS := $(shell find -name '* .d')
24
24
Original file line number Diff line number Diff line change
1
+ // SPDX-License-Identifier: BSD-2-Clause
2
+ /*
3
+ * Copyright (c) 2025 Kontron Europe GmbH
4
+ */
5
+
6
+ #include "misc.h"
7
+ #include "wdt.h"
8
+
9
+ #define WWDT_BASE 0x40080000
10
+
11
+ #define WWDT_PWREN (WWDT_BASE + 0x0800)
12
+ #define PWREN_KEY 0x26000000
13
+ #define PWREN_ENABLE BIT(0)
14
+
15
+ #define WWDT_WWDTCTL0 (WWDT_BASE + 0x1100)
16
+ #define WWDTCTL0_KEY 0xc9000000
17
+ #define WWDTCTL0_CLKDIV (n ) ((n) << 0)
18
+ #define WWDTCTL0_PER (n ) ((n) << 4)
19
+
20
+ #define WWDT_WWDTCNTRST (WWDT_BASE + 0x1108)
21
+ #define WWDTCNTRST_RESTART 0xa7
22
+
23
+ void wdt_init (void )
24
+ {
25
+ iow (WWDT_PWREN , PWREN_KEY | PWREN_ENABLE );
26
+
27
+ /* set watchdog timeout to 1s */
28
+ iow (WWDT_WWDTCTL0 , WWDTCTL0_KEY | WWDTCTL0_CLKDIV (0 ) | WWDTCTL0_PER (3 ));
29
+ }
30
+
31
+ void wdt_kick (void )
32
+ {
33
+ iow (WWDT_WWDTCNTRST , WWDTCNTRST_RESTART );
34
+ }
Original file line number Diff line number Diff line change
1
+ // SPDX-License-Identifier: BSD-2-Clause
2
+ /*
3
+ * Copyright (c) 2025 Kontron Europe GmbH
4
+ */
5
+
6
+ #ifndef __WDT_H
7
+ #define __WDT_H
8
+
9
+ void wdt_init (void );
10
+ void wdt_kick (void );
11
+
12
+ #endif /* __WDT_H */
You can’t perform that action at this time.
0 commit comments