[riot-notifications] [RIOT-OS/RIOT] drivers/include: add header definition for wdt (#11527)

Francisco notifications at github.com
Wed May 15 14:11:19 CEST 2019


<!--
The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.
-->

### Contribution description

<!--
Put here the description of your contribution:
- describe which part(s) of RIOT is (are) involved
- if it's a bug fix, describe the bug that it solves and how it is solved
- you can also give more information to reviewers about how to test your changes
-->

This PR adds header files defining  a proposition for a common wdt api. It's based on implementations discussed in #11520, #7374 and #11252,. This PR aims at unifying the 3 implementations and achieving an implementation that covers  stm32, sam0 and cc2538.

4 functions are defined:

```
void wdt_start(void);
void wdt_stop(void);
void wdt_kick(void);
int wdt_setup(uint32_t min_time, uint32_t max_time, wdt_cb_t wdt_cb, void* arg);
```

In many cases (e.g. stm32) the wdt can't be stopped so this function would have no effect. In cases where a callback is not possible these can be defined as  NULL. 'min_time' and 'max_time' must must be defined with valid values for windowed timer, while 'min_time=0' would equal normal wdg operation.

Range limits for the WDT should be known at compile time although they could be different for normal operation and windowed operation. 'WDT_TIME_LOWER_BOUND' et al should be defined per CPU.

```
/**
 * @name    WDT upper and lower bound times in us
 * @{
 */
#define WDT_TIME_LOWER_BOUND            Y
#define WDT_TIME_UPPER_BOUND            X
#define WWDT_TIME_LOWER_BOUND           YY
#define WWDT_TIME_UPPER_BOUND           XX
/** @} */
```

Specially interested in thoughts @geith and @benpicco have on the subject since they implemented similar similar header definitions. Since this header definition took from all of their definitions it should be able to work for all referenced implementations.

### Testing procedure

<!--
Details steps to test your contribution:
- which test/example to compile for which board and is there a 'test' command
- how to know that it was not working/available in master
- the expected success test output
-->

Testing should be addressed in the related PR's.

### Issues/PRs references

<!--
Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.
-->

Implementations following this api in #11520 and #11252.

Based on discussion in #11520, #7374 and #11252 
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/11527

-- Commit Summary --

  * drivers/include: add header definition for wdt

-- File Changes --

    A drivers/include/periph/wdt.h (77)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/11527.patch
https://github.com/RIOT-OS/RIOT/pull/11527.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11527
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190515/4f844bcd/attachment.html>


More information about the notifications mailing list