|
1 | 1 | <h2 id="watchdog-port">Watchdog</h2>
|
2 | 2 |
|
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. |
4 | 6 |
|
5 | 7 | ### Assumptions
|
6 | 8 |
|
7 | 9 | #### Defined behavior
|
8 | 10 |
|
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. |
10 | 15 |
|
11 | 16 | #### Undefined behavior
|
12 | 17 |
|
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. |
14 | 24 |
|
15 |
| -#### Potential bugs |
| 25 | +### Dependency |
16 | 26 |
|
17 |
| -[Include any potential bugs in bullet format here.] |
| 27 | +Hardware Independent Watchdog support. |
18 | 28 |
|
19 | 29 | ### Implementing Watchdog
|
20 | 30 |
|
21 |
| -[Include implementation information here.] |
| 31 | +You can find the API and specification for the Watchdog API in the following header file: |
| 32 | + |
| 33 | +[](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. |
22 | 36 |
|
23 | 37 | ### Testing
|
24 | 38 |
|
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 | +[](http://os.mbed.com/docs/v5.8/feature-hal-spec-watchdog-doxy/watchdog__api__tests_8h_source.html) |
| 48 | + |
| 49 | +[](http://os.mbed.com/docs/v5.8/feature-hal-spec-watchdog-doxy/watchdog__reset__tests_8h_source.html) |
0 commit comments