mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #9785 from c1728p9/default_to_us_ticker
Use us ticker for tickless on devs with wrapperpull/9899/head
commit
e393c2dc0b
|
@ -288,7 +288,7 @@ void test_sleep(void)
|
||||||
TEST_ASSERT_UINT64_WITHIN(DELAY_DELTA_US, DELAY_US, timer.read_high_resolution_us());
|
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
|
/** Test wake up from deepsleep
|
||||||
*
|
*
|
||||||
* Given a SysTimer with a tick scheduled in the future
|
* Given a SysTimer with a tick scheduled in the future
|
||||||
|
@ -342,7 +342,7 @@ Case cases[] = {
|
||||||
Case("Handler called once", test_handler_called_once),
|
Case("Handler called once", test_handler_called_once),
|
||||||
#if DEVICE_SLEEP
|
#if DEVICE_SLEEP
|
||||||
Case("Wake up from sleep", test_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),
|
Case("Wake up from deep sleep", test_deepsleep),
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "platform/mbed_power_mgmt.h"
|
#include "platform/mbed_power_mgmt.h"
|
||||||
#include "TimerEvent.h"
|
#include "TimerEvent.h"
|
||||||
#include "lp_ticker_api.h"
|
#include "lp_ticker_api.h"
|
||||||
|
#include "us_ticker_api.h"
|
||||||
#include "mbed_critical.h"
|
#include "mbed_critical.h"
|
||||||
#include "mbed_assert.h"
|
#include "mbed_assert.h"
|
||||||
#include <new>
|
#include <new>
|
||||||
|
@ -35,7 +36,12 @@ extern "C" {
|
||||||
|
|
||||||
using namespace mbed;
|
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"
|
#include "rtos/TARGET_CORTEX/SysTimer.h"
|
||||||
|
|
||||||
|
@ -47,7 +53,11 @@ extern "C" {
|
||||||
{
|
{
|
||||||
// Do not use SingletonPtr since this relies on the RTOS
|
// Do not use SingletonPtr since this relies on the RTOS
|
||||||
if (NULL == os_timer) {
|
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();
|
os_timer->setup_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +104,8 @@ extern "C" {
|
||||||
static void default_idle_hook(void)
|
static void default_idle_hook(void)
|
||||||
{
|
{
|
||||||
uint32_t ticks_to_sleep = osKernelSuspend();
|
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) {
|
if (block_deep_sleep) {
|
||||||
sleep_manager_lock_deep_sleep();
|
sleep_manager_lock_deep_sleep();
|
||||||
|
|
|
@ -38,6 +38,10 @@
|
||||||
"default-form-factor": {
|
"default-form-factor": {
|
||||||
"help": "Default form factor of this board taken from supported_form_factors. This must be a lowercase string such as 'arduino'",
|
"help": "Default form factor of this board taken from supported_form_factors. This must be a lowercase string such as 'arduino'",
|
||||||
"value": null
|
"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": {
|
"overrides": {
|
||||||
"deep-sleep-latency": 3
|
"deep-sleep-latency": 3,
|
||||||
|
"tickless-from-us-ticker": true
|
||||||
},
|
},
|
||||||
"device_has": [
|
"device_has": [
|
||||||
"USTICKER",
|
"USTICKER",
|
||||||
|
@ -3122,7 +3127,7 @@
|
||||||
},
|
},
|
||||||
"lpticker_lptim": {
|
"lpticker_lptim": {
|
||||||
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
|
"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": [
|
"macros_add": [
|
||||||
|
@ -7029,7 +7034,8 @@
|
||||||
"device_name": "NUC472HI8AE",
|
"device_name": "NUC472HI8AE",
|
||||||
"bootloader_supported": true,
|
"bootloader_supported": true,
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"network-default-interface-type": "ETHERNET"
|
"network-default-interface-type": "ETHERNET",
|
||||||
|
"tickless-from-us-ticker": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"NCS36510": {
|
"NCS36510": {
|
||||||
|
@ -7152,7 +7158,10 @@
|
||||||
],
|
],
|
||||||
"release_versions": ["2", "5"],
|
"release_versions": ["2", "5"],
|
||||||
"device_name": "M453VG6AE",
|
"device_name": "M453VG6AE",
|
||||||
"bootloader_supported": true
|
"bootloader_supported": true,
|
||||||
|
"overrides": {
|
||||||
|
"tickless-from-us-ticker": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"NUMAKER_PFM_NANO130": {
|
"NUMAKER_PFM_NANO130": {
|
||||||
"core": "Cortex-M0",
|
"core": "Cortex-M0",
|
||||||
|
@ -7214,7 +7223,10 @@
|
||||||
"SPI_ASYNCH"
|
"SPI_ASYNCH"
|
||||||
],
|
],
|
||||||
"release_versions": ["5"],
|
"release_versions": ["5"],
|
||||||
"device_name": "NANO130KE3BN"
|
"device_name": "NANO130KE3BN",
|
||||||
|
"overrides": {
|
||||||
|
"tickless-from-us-ticker": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"HI2110": {
|
"HI2110": {
|
||||||
"inherits": ["Target"],
|
"inherits": ["Target"],
|
||||||
|
@ -7538,7 +7550,8 @@
|
||||||
"release_versions": ["5"],
|
"release_versions": ["5"],
|
||||||
"bootloader_supported": true,
|
"bootloader_supported": true,
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"network-default-interface-type": "ETHERNET"
|
"network-default-interface-type": "ETHERNET",
|
||||||
|
"tickless-from-us-ticker": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"NUMAKER_PFM_M487": {
|
"NUMAKER_PFM_M487": {
|
||||||
|
@ -7777,7 +7790,8 @@
|
||||||
"detect_code": ["1305"],
|
"detect_code": ["1305"],
|
||||||
"release_versions": ["5"],
|
"release_versions": ["5"],
|
||||||
"device_name": "M2351KIAAEES",
|
"device_name": "M2351KIAAEES",
|
||||||
"bootloader_supported": true
|
"bootloader_supported": true,
|
||||||
|
"tickless-from-us-ticker": true
|
||||||
},
|
},
|
||||||
"TMPM3H6": {
|
"TMPM3H6": {
|
||||||
"inherits": ["Target"],
|
"inherits": ["Target"],
|
||||||
|
|
Loading…
Reference in New Issue