Commit Graph

11 Commits (7caec465120a027aa7243afce26951f4aad648d9)

Author SHA1 Message Date
Przemyslaw Stekiel 12be24c98c tests-mbed_hal-common_tickers: Fix increment test case implementation
In case when base tick count is different than next tick count check first if the difference is equal to 1 tick (this is what we are looking for) if not then decrease the tick count.

Repeat counting process few times before incrementing the number of cycles in case when base tick count is equal to next tick count.
2018-05-28 12:39:09 +02:00
Bartek Szatkowski b9814fae9b Fix missmatch between feature branches and new CMSIS 2018-05-25 13:04:23 -05:00
Przemyslaw Stekiel 50a5e2c1f4 tests-mbed_hal-common_tickers: fix bug in ticker increment test case
It is possible that the difference between base and next tick count on some platforms is greater than 1, in this case we need to repeat counting with the reduced number of cycles (for slower boards).
If number of cycles has been reduced than base tick count needs to be redefined. This operation is missing and is added by this patch.
2018-05-25 12:33:42 -05:00
Przemyslaw Stekiel c18763bb41 tests-mbed_hal-common_tickers: disable os tick while running test cases
It has been noticed on NRF51_DK board that occurrence of system tick have impact on test execution.
NRF51_DK is a slow board with fast us ticker and handling of system tick interrupt takes about 250 us ticker ticks which have huge influence on interrupt tests where interrupt is set to <current count> + 100, 200, 500 ticks.
2018-05-25 12:30:52 -05:00
Przemyslaw Stekiel ff39a9874a tests-mbed_hal-common_tickers: increase overflow protection limit
For NR51_DK US_TICKER_OV_LIMIT needs to be increased since if test is run few times in row sometimes fails. This is because NR51_DK is a slow board (16 MHz) with fast and short us ticker counter 1 MHz/16 bits.
2018-05-25 12:29:55 -05:00
Russ Butler 9c2d758cda Restore ticker state after each test
Update the ticker common test to clean up after each case by restoring
the ticker IRQ handler. This allows tickers to function normally after
each case has completed.
2018-05-25 12:21:16 -05:00
Przemyslaw Stekiel 85ce887cea lp_us_tickers test: provide minor fixes after review
- count_ticks: fix counter overflow handling,
- count_ticks: use reg_cycles variable in while loop,
- increment test: reduce number of cycles for slow cores if measure process needs to be repeated (difference is greater than 1).
2018-05-25 12:20:10 -05:00
Przemyslaw Stekiel f6163a341c lp_us_tickers test: call overflow_protect function in test functions instead test setup handler.
This is done to bypass green-tea setup handler which takes additional time.
2018-05-25 12:20:10 -05:00
Przemyslaw Stekiel 8f52816bba lp_us_tickers test: fix overflow protection
On slow targets with fast high frequency tickers like NRF51_DK (16 Mhz CPU/1MHz ticker) time window for test case execution without overflow needs to be increased. Add parameter to `overflow_protect` function to be able to set different time window without overflow for us ticker and lp ticker.
2018-05-25 12:20:10 -05:00
Przemyslaw Stekiel 0ecf58f51c lp_us_tickers test: fix `increment test` for slow boards
Increment test proves that ticker counter is incremented by one.
This is done indirectly for high frequency counters where it is impossible to read 'value' and 'value + 1' in two successive ticker reads.
This check is done indirectly by counting ticker ticks elapsed during execution of N cycles of empty while loop. Unfortunately on slow boards with fast tickers like NRF51_DK(16 MHz CPU/1MHz hf ticker) it is possible that for the same N cycles measured number of elapsed ticks in two successive calls is greater than 1. This patch provides fix for such case - measure operation is repeated with the same number of cycles.
2018-05-25 12:20:10 -05:00
Bartek Szatkowski ba963b4453 Rename lp_us tests to common and hf to microsecond 2018-05-25 12:20:09 -05:00