[riot-notifications] [RIOT-OS/RIOT] tests/bench_timers: improve test to work on some SAM based boards (#11346)

Federico Pellegrin notifications at github.com
Fri Apr 5 11:35:02 CEST 2019


### Contribution description
This PR does some small improvements to the bench_timers test to make it work on some SAM based boards and probably also improve test portability to other boards.
Specifically:
-) specific SAM boards definition with only one timer are added to Makefile so correct timer is used
-) before calling `timer_init` on a timer this is first stopped with `timer_stop` otherwise for most of SAM based CPUs the init will not have any effect since if the timer has already been inited (and it is at boot) then initialization would be skipped and test would block undefinitely waiting for the callback to be called. 
Ie see code:
```
/**
 * @brief Setup the given timer
 */
int timer_init(tim_t dev, unsigned long freq, timer_cb_t cb, void *arg)
{
   ...
        if (TIMER_0_DEV.CTRLA.bit.ENABLE) {
            return 0;
        }
```
-) Default minimum time for relative timer test (`TEST_MIN_REL`) is set to `TEST_MIN` (which is the minimum for absolute alarms) as the previous 0 results in timer shooting off before the callback is even set and test blocking. It sounds reasonable that the minimum for the relative test should be the same as the one for absolute by the user. It can anyhow, as before, be overridden explicitly if needed.

### Testing procedure
In tests/bench_timers:
`BOARD=XYZ make all flash`
And then see the test output (after a while) on the serial

### Issues/PRs references
Addresses problems of test execution explained in #10523 (even if doesn't address the timer driver problem).
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * tests/bench_timers: improve test to work on some SAM based boards

-- File Changes --

    M tests/bench_timers/Makefile (5)
    M tests/bench_timers/bench_timers_config.h (4)
    M tests/bench_timers/main.c (2)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/11346.patch
https://github.com/RIOT-OS/RIOT/pull/11346.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/11346
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190405/7b25e61b/attachment.html>


More information about the notifications mailing list