Commit Graph

16556 Commits (5d8570be39bcb6ce8807f45c3a6d558201a0de84)

Author SHA1 Message Date
jeromecoutant 39a9801675 STM32 LPTICKER : clean include file 2018-05-25 12:29:54 -05:00
jeromecoutant c31a7c2277 STM32 LPTICKER : enable all STM32 targets supporting the feature
(All STM32 except F1 and F2 families)
2018-05-25 12:29:54 -05:00
jeromecoutant 1c4174d3eb STM32 RTC Init minor update 2018-05-25 12:26:05 -05:00
jeromecoutant 12b3df7773 #6536 rebase correction 2018-05-25 12:26:05 -05:00
jeromecoutant 2b8d6cbcc5 STM32 LPTICKER : read counter 2018-05-25 12:26:05 -05:00
jeromecoutant 8179d96d4d LPTICKER targets json update for STM32 supporting LPTIMER
STM32L0, STM32L4, STM32F7 and few STM32F4
2018-05-25 12:26:05 -05:00
jeromecoutant 5701fd5ab6 STM32 LPTICKER update for targets supporting LPTIMER 2018-05-25 12:22:35 -05:00
Bartek Szatkowski 1e13d8765a Rename LOWPOWERTIMER to LPTICKER after merge 2018-05-25 12:22:35 -05:00
jeromecoutant 26313d8938 tests-mbed_hal-common_tickers_freq : correct overflowCounter value 2018-05-25 12:22:06 -05:00
jeromecoutant d2fff9cab3 tests-mbed_hal-common_tickers_freq : use unsigned long 2018-05-25 12:22:06 -05:00
TomoYamanaka b528fbdfb3 Implementation of USTICKER feature for Renesas mbed boards
I implemented USTICKER feature.

The mainly changing is here.
- I added a macro to mbed_drv_cfg.h for commonalizing code for GR-PEACH and GR-LYCHEE with different clock frequencies, and referenced it's macro at us_ticker.c.
- ticker_init()
  Currently, ticker_init() keep counting, disables the ticker interrupt, and is safe to call repeatedly.
  Therefore, in order to satisfy specifications, I removed GIC_EnableIRQ at end of function and added GIC_DisableIRQ at begin of function.
  When an interrupt is required, it will be set with ticker_set_interrupt().
  If executing the following, the counter has been initialized. So it will not call after executing the first time.
    OSTM1TT   = 0x01;    /* Stop the counter and clears the OSTM1TE bit.     */
    OSTM1TS   = 0x1;    /* Start the counter and sets the OSTM0TE bit.     */

- ticker_free()
  this function stops the counting and powerdown the us_ticker.
  To satisfy the mbed specificationm, I implemented free() function.

- ticker_read()
  Currently, Mbed spec's frequeny is between 250KHz and 8MHz, but the frequency that is used at my ticker is 33MHz.
  Therefore, in order to satisfy specifications, I changed the process to return the timer counter value divided by 32(33MHz / 32).
  Since the calcurate function by using 64 bit is no longer necessay, I removed it.

- ticker_set_interrupt()
  Same as the above read(),
  In order to satisfy specifications, I changed the process to set the value multiplied by 32.

- ticker_fire_interrupt()
  In order to satisfy specifications, I implemented fire_interrupt() function.
  Also I added GIC_EnableIRQ for allowing the interrupt at end of function.

- ticker_get_info()
  To satisfy the mbed specificationm, I implemented ticker_get_info() function. The value of freq includes rounding off.
2018-05-25 12:22:06 -05:00
Przemyslaw Stekiel ea61f9887e tests-mbed_hal-lp_ticker: Add overflow protection. 2018-05-25 12:21:16 -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
jeromecoutant 69b51dffaf tests-mbed_hal-lp_ticker : increase time before deep sleep 2018-05-25 12:21:16 -05:00
Laurent MEUNIER beda4904d3 Make us_ticker common between 16 and 32 bits counters 2018-05-25 12:20:10 -05:00
Laurent MEUNIER c3d5daf80a Update STM32 16 bits us_tickers in line with new mbed HAL
The new HAL allows to share the timer bit width and frequency,
the actual handling of mapping 16 bits counter up to 32 bits or
64 bits is now managed by mbed common layer.

This makes this ticker layer very similar to 32bits one and much
easier than before.
2018-05-25 12:20:10 -05:00
Steven Cooreman 1448f81620 Re-implement us_ticker and lp_ticker for Silicon Labs targets
Re-implemented both us_ticker and lp_ticker to match the new API and specifications.
Details:
* On EFM32GG, EFM32WG, EFM32LG, EFM32HG, EFM32ZG: Use the RTC peripheral to back lp_ticker, and a TIMER to back us_ticker.
* On EFM32PG, EFR32MG, EFM32PG12, EFR32MG12: Use the RTCC peripheral to back lp_ticker (dual-purpose, also used to back RTC), and a TIMER to back us_ticker.
2018-05-25 12:20:10 -05:00
Steven Cooreman 5590f2b495 Re-implement RTC for Silicon Labs targets
mbed RTC specifications now dictate that the RTC needs to retain and keep on counting through reset. On Silicon Labs parts, this means the RTC API can not be backed by the Silicon Labs RTC peripheral, since that doesn't provide retention functionality.
Therefore:
* On EFM32GG, EFM32WG, EFM32LG: mbed RTC API is now backed by BURTC.
* On EFM32PG, EFR32MG, EFM32PG12, EFR32MG12: mbed RTC API is now backed by RTCC.
* On EFM32ZG, EFM32HG: mbed RTC API is sadly no longer supported, since these chips don't have retained memory.

# Conflicts:
#	targets/TARGET_Silicon_Labs/TARGET_EFM32/lp_ticker.c
#	targets/TARGET_Silicon_Labs/TARGET_EFM32/rtc_api.c
#	targets/targets.json
2018-05-25 12:20:10 -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 a92ff94904 Fix rebase error 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
Bartek Szatkowski 88ba94221a Remove nrf51_dk from supported platform 2018-05-25 12:20:09 -05:00
Bartek Szatkowski d2a5e30a46 Disable platfroms that fail without LPTICKER 2018-05-25 12:20:09 -05:00
Bartek Szatkowski 9575dd26ec Don't use tickless if LPTICKER is not present
The current implementation of tickless requires LPTICKER to be present.
2018-05-25 12:20:09 -05:00
Bartek Szatkowski 2d19ac1d60 Make sure LPTICKER symbols are not used for builds without it for Nordic 2018-05-25 12:20:09 -05:00
Bartek Szatkowski 2d11b05756 Disable Maxim boards as LP_TICKER is used in RTC and they don't respect device_has 2018-05-25 12:20:09 -05:00
Bartek Szatkowski 6e9f04bf2f Rename DEVICE_LOWPOWERTIMER to DEVICE_LPTICKER
That's to match DEVICE_USTICKER.
2018-05-25 12:20:09 -05:00
Przemyslaw Stekiel f55f9d36fb lp_ticker test - provide lp ticker glitch test case
Test that lp ticker does not glitch backwards due to an incorrectly implemented ripple counter driver.
2018-05-25 12:18:55 -05:00
Przemyslaw Stekiel b7fdf60f29 Skip higher level ticker tests for targets with stale ticker target specific drivers.
Since target specific ticker drivers are not ready also features which uses ticker in upper layers may not work correctly and tests for these features.
We need to disable also failing higher level ticker related tests (by adding check if DEVICE_USTICKER symbol is available and raise #error [NOT_SUPPORTED] if not).

Note:
tests-mbed_drivers-rtc is new and uses us ticker to perform a delay.
2018-05-25 12:18:55 -05:00
Przemyslaw Stekiel 6d7aef6bf1 lp_us_tickers test - fix count_ticks() function to give the same results on all compilers
count_ticks() function counts ticker ticks elapsed during execution of N cycles of empty while loop.
In current version N value (cycles) is given as volatile paramater in order to disable possible compiler optimalisation.
There was a problem with measured time on different compilers and additionally results on ARM compiler were unexpected (the difference beetween measured elapsed ticks for the same number of cycles was to large). This might be caused by the memory access in order to store updated variable in memory. To fix this issue given numer of cycles has been stored into register and register is decremented (no memory access).

With this fix count_ticks(NUM_OF_CYCLES, 1) call returns 2500 +/-1 for us ticker ticks using each compiler (K64F).
2018-05-25 12:18:55 -05:00
Przemyslaw Stekiel c4cf1f1eae lp_us_tickers test - add tolerance to interrupt time.
On some platforms (e.g. K64F) different counters are used for time measurement and interrupt generation.
Because of that we should relax interrupt test case and give additional time before checking if interrupt handler has been executed.
2018-05-25 12:18:55 -05:00
Przemyslaw Stekiel e0fcce592c lp_us_tickers test - provide counter overflow protection
Since according to the ticker requirements min acceptable counter size is 12 bits (low power timer) for which max count is 4095, then all test cases must be executed in this time window.
HAL ticker layer handles overflow and it is not handled in the target ticker drivers.
2018-05-25 12:18:55 -05:00
Przemyslaw Stekiel 39852f772c Adapt K64F lp ticker driver to the new standards.
Low power ticker time counter is created based on RTC which is driven by 32KHz clock. Additional low power timer is used to generate interrupts.
We need to adapt driver to operate on ticks instead of us.

Perform the following updates:
- provide lp ticker configuration: 32KHz/32 bit counter.
- lp_ticker_init() routine disables lp ticker interrupts .
- adapt the driver functions to operate on ticks instead us.
- adapt comments.
- add us_ticker_free() routine.
2018-05-25 12:18:55 -05:00
Przemyslaw Stekiel c4bd9d125b Adapt K64F us ticker driver to the new standards.
- provide ticker configuration: 1MHz/32 bit counter.
- us_ticker_init() routine disables interrupts.
- adapt comments.
2018-05-25 12:18:55 -05:00
Przemyslaw Stekiel d96430e77d Enable ticker support for K64F board. 2018-05-25 12:18:55 -05:00
Steven Cartmell 18943a9693 Add lp/us ticker free() function implementation for NRF5 2018-05-25 12:17:49 -05:00
Steven Cartmell 2894152efe Add free function to lp/us ticker HAL API 2018-05-25 12:17:49 -05:00
Przemyslaw Stekiel 9d84143276 Provide fix to the implementation of ticker_overflow_test test case.
The intention was to use ticker_overflow_delta equal to 0 for low power ticker tests and ticker_overflow_delta equal to 50 for high frequency ticker tests. Current implementation is invalid since for devices which provide LOW_POWER_TIMER feature delta is equal to 0 and for devices without this feature delta is equal 50.
2018-05-25 12:17:49 -05:00
Przemyslaw Stekiel 1bd2e517a0 Modify ticker_init_test() to be consistent with the new requirement. 2018-05-25 12:17:49 -05:00
Przemyslaw Stekiel a8eee0fb1a Modify requirement for the ticker_init function.
Current version:
The function ticker_init resets the internal count and disables the ticker interrupt.

Proposed version:
The function ticker_init allows the ticker to keep counting and disables the ticker interrupt.

This is a result of the following discussion:
https://github.com/ARMmbed/mbed-os/pull/5233#pullrequestreview-86677815
2018-05-25 12:17:49 -05:00
Przemyslaw Stekiel 7227670416 Skip higher level ticker tests for targets with stale ticker target specific drivers.
Since target specific ticker drivers are not ready also features which uses ticker in upper layers may not work correctly and tests for these features.
We need to disable also failing higher level ticker related tests (by adding check if DEVICE_USTICKER symbol is available and raise #error [NOT_SUPPORTED] if not).
2018-05-25 12:17:49 -05:00
Przemyslaw Stekiel ebeab7f462 Add DEVICE_RTC symbol check in RTC source files for NCS36510 target. 2018-05-25 12:17:20 -05:00
Przemyslaw Stekiel d429458ac7 Disable boards which does not fulfil new ticker standards. 2018-05-25 12:17:19 -05:00
Przemyslaw Stekiel 0ae7b82c07 Add minor modifications of lp/us tickers tests desctiption in ticker header files.
Add one potential bug to the test description.
Fix test function names to be consistant with desctiption and test header.
Fix typos.
2018-05-25 12:04:32 -05:00
Przemyslaw Stekiel c32ccf69b1 Add tests for ticker HAL API. 2018-05-25 12:04:32 -05:00
Russ Butler 03d7141797 Add documentation for the HAL Ticker API
Add documentation and test header for the HAL Ticker API.
2018-05-25 12:04:32 -05:00
Bartek Szatkowski 9f3f49aea9 Remove sleep from rf52 due to failig tests 2018-05-25 12:04:32 -05:00