Merge pull request #9785 from c1728p9/default_to_us_ticker

Use us ticker for tickless on devs with wrapper
pull/9899/head
Cruz Monrreal 2019-02-28 18:25:01 -06:00 committed by GitHub
commit e393c2dc0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 12 deletions

View File

@ -288,7 +288,7 @@ void test_sleep(void)
TEST_ASSERT_UINT64_WITHIN(DELAY_DELTA_US, DELAY_US, timer.read_high_resolution_us());
}
#if DEVICE_LPTICKER
#if DEVICE_LPTICKER && !MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER
/** Test wake up from deepsleep
*
* Given a SysTimer with a tick scheduled in the future
@ -342,7 +342,7 @@ Case cases[] = {
Case("Handler called once", test_handler_called_once),
#if DEVICE_SLEEP
Case("Wake up from sleep", test_sleep),
#if DEVICE_LPTICKER
#if DEVICE_LPTICKER && !MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER
Case("Wake up from deep sleep", test_deepsleep),
#endif
#endif

View File

@ -24,6 +24,7 @@
#include "platform/mbed_power_mgmt.h"
#include "TimerEvent.h"
#include "lp_ticker_api.h"
#include "us_ticker_api.h"
#include "mbed_critical.h"
#include "mbed_assert.h"
#include <new>
@ -35,7 +36,12 @@ extern "C" {
using namespace mbed;
#if (defined(MBED_TICKLESS) && DEVICE_LPTICKER)
#ifdef MBED_TICKLESS
MBED_STATIC_ASSERT(!MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER || DEVICE_USTICKER,
"Microsecond ticker required when MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER is true");
MBED_STATIC_ASSERT(MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER || DEVICE_LPTICKER,
"Low power ticker required when MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER is false");
#include "rtos/TARGET_CORTEX/SysTimer.h"
@ -47,7 +53,11 @@ extern "C" {
{
// Do not use SingletonPtr since this relies on the RTOS
if (NULL == os_timer) {
os_timer = new (os_timer_data) rtos::internal::SysTimer();
#if MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER
os_timer = new (os_timer_data) rtos::internal::SysTimer(get_us_ticker_data());
#else
os_timer = new (os_timer_data) rtos::internal::SysTimer(get_lp_ticker_data());
#endif
os_timer->setup_irq();
}
@ -94,7 +104,8 @@ extern "C" {
static void default_idle_hook(void)
{
uint32_t ticks_to_sleep = osKernelSuspend();
const bool block_deep_sleep = ticks_to_sleep <= MBED_CONF_TARGET_DEEP_SLEEP_LATENCY;
const bool block_deep_sleep = MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER ||
(ticks_to_sleep <= MBED_CONF_TARGET_DEEP_SLEEP_LATENCY);
if (block_deep_sleep) {
sleep_manager_lock_deep_sleep();

View File

@ -38,6 +38,10 @@
"default-form-factor": {
"help": "Default form factor of this board taken from supported_form_factors. This must be a lowercase string such as 'arduino'",
"value": null
},
"tickless-from-us-ticker": {
"help": "Run tickless from the microsecond ticker rather than the low power ticker. Running tickless off of the microsecond ticker improves interrupt latency on targets which use lpticker_delay_ticks",
"value": false
}
}
},
@ -1861,7 +1865,8 @@
}
},
"overrides": {
"deep-sleep-latency": 3
"deep-sleep-latency": 3,
"tickless-from-us-ticker": true
},
"device_has": [
"USTICKER",
@ -3122,7 +3127,7 @@
},
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
"value": 0
}
},
"macros_add": [
@ -7029,7 +7034,8 @@
"device_name": "NUC472HI8AE",
"bootloader_supported": true,
"overrides": {
"network-default-interface-type": "ETHERNET"
"network-default-interface-type": "ETHERNET",
"tickless-from-us-ticker": true
}
},
"NCS36510": {
@ -7152,7 +7158,10 @@
],
"release_versions": ["2", "5"],
"device_name": "M453VG6AE",
"bootloader_supported": true
"bootloader_supported": true,
"overrides": {
"tickless-from-us-ticker": true
}
},
"NUMAKER_PFM_NANO130": {
"core": "Cortex-M0",
@ -7214,7 +7223,10 @@
"SPI_ASYNCH"
],
"release_versions": ["5"],
"device_name": "NANO130KE3BN"
"device_name": "NANO130KE3BN",
"overrides": {
"tickless-from-us-ticker": true
}
},
"HI2110": {
"inherits": ["Target"],
@ -7538,7 +7550,8 @@
"release_versions": ["5"],
"bootloader_supported": true,
"overrides": {
"network-default-interface-type": "ETHERNET"
"network-default-interface-type": "ETHERNET",
"tickless-from-us-ticker": true
}
},
"NUMAKER_PFM_M487": {
@ -7777,7 +7790,8 @@
"detect_code": ["1305"],
"release_versions": ["5"],
"device_name": "M2351KIAAEES",
"bootloader_supported": true
"bootloader_supported": true,
"tickless-from-us-ticker": true
},
"TMPM3H6": {
"inherits": ["Target"],