Skip to content

Commit 3729fe9

Browse files
author
Amanda Butler
authored
Update Watchdog.md
Create Watchdog contributing API in 5.8.
1 parent cbf55e0 commit 3729fe9

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed
Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,49 @@
11
<h2 id="watchdog-port">Watchdog</h2>
22

3-
[Include a brief description here.]
3+
The Watchdog HAL API provides a low-level interface to the Independent Watchdog Timer of a target. Implementing the Watchdog API is not mandatory, but by implementing it, you can use the hardware watchdog timer to detect and recover from computer malfunctions.
4+
5+
Implement the ResetReason API when implementing the Watchdog API. The ResetReason API allows you to detect at boot time whether a watchdog caused the last reset.
46

57
### Assumptions
68

79
#### Defined behavior
810

9-
[Include any defined behavior in bullet format here.]
11+
- Sleep and debug modes don't stop the watchdog timer from counting down.
12+
- The function `hal_watchdog_init` is safe to call repeatedly. The function's implementation must not do anything if `hal_watchdog_init` has already initialized the hardware watchdog timer.
13+
- Maximum supported timeout is `UINT32_MAX` milliseconds; minimum timeout is 1ms.
14+
- The timeout must be accurate to the nearest millisecond.
1015

1116
#### Undefined behavior
1217

13-
[Include any undefined behavior in bullet format here.]
18+
- Calling any function other than `hal_watchdog_init` or `hal_watchdog_get_platform_features` before you have initialized the watchdog.
19+
20+
#### Notes
21+
22+
- A software reset may not stop the watchdog timer; the behavior is platform specific.
23+
- Timing on most platforms is based on the timeout registers and a prescaler value. They should be accurate to the nearest millisecond but may be off my a several µs.
1424

15-
#### Potential bugs
25+
### Dependency
1626

17-
[Include any potential bugs in bullet format here.]
27+
Hardware Independent Watchdog support.
1828

1929
### Implementing Watchdog
2030

21-
[Include implementation information here.]
31+
You can find the API and specification for the Watchdog API in the following header file:
32+
33+
[![View code](https://www.mbed.com/embed/?type=library)](http://os.mbed.com/docs/v5.8/feature-hal-spec-watchdog-doxy/classmbed_1_1_watchdog.html)
34+
35+
To enable Watchdog support in Mbed OS, add the `WATCHDOG` label in the `device_has` option of the target's section in the `targets.json` file.
2236

2337
### Testing
2438

25-
[Include testing information here.]
39+
The Mbed OS HAL provides a set of conformance tests for Watchdog. You can use these tests to validate the correctness of your implementation. To run the Watchdog HAL tests use the following command:
40+
41+
```
42+
mbed test -t <toolchain> -m <target> -n "tests-mbed_hal-watchdog*"
43+
```
44+
45+
You can read more about the test cases here:
46+
47+
[![View code](https://www.mbed.com/embed/?type=library)](http://os.mbed.com/docs/v5.8/feature-hal-spec-watchdog-doxy/watchdog__api__tests_8h_source.html)
48+
49+
[![View code](https://www.mbed.com/embed/?type=library)](http://os.mbed.com/docs/v5.8/feature-hal-spec-watchdog-doxy/watchdog__reset__tests_8h_source.html)

0 commit comments

Comments
 (0)