Disable sleep when uVisor is in use

pull/4097/head
Bartek Szatkowski 2017-04-05 15:33:31 +01:00
parent 4cd6068b73
commit c5f0ad506e
1 changed files with 7 additions and 1 deletions

View File

@ -28,7 +28,8 @@ extern "C" {
/** Send the microcontroller to sleep /** Send the microcontroller to sleep
* *
* @note This function can be a noop if not implemented by the platform. * @note This function can be a noop if not implemented by the platform.
* @note This function will be a noop in debug mode (debug build profile when MBED_DEBUG is defined) * @note This function will be a noop in debug mode (debug build profile when MBED_DEBUG is defined).
* @note This function will be a noop while uVisor is in use.
* *
* The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the
* system clock to the core is stopped until a reset or an interrupt occurs. This eliminates * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates
@ -44,17 +45,20 @@ extern "C" {
*/ */
__INLINE static void sleep(void) __INLINE static void sleep(void)
{ {
#if !(defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED))
#ifndef MBED_DEBUG #ifndef MBED_DEBUG
#if DEVICE_SLEEP #if DEVICE_SLEEP
hal_sleep(); hal_sleep();
#endif /* DEVICE_SLEEP */ #endif /* DEVICE_SLEEP */
#endif /* MBED_DEBUG */ #endif /* MBED_DEBUG */
#endif /* !(defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED)) */
} }
/** Send the microcontroller to deep sleep /** Send the microcontroller to deep sleep
* *
* @note This function can be a noop if not implemented by the platform. * @note This function can be a noop if not implemented by the platform.
* @note This function will be a noop in debug mode (debug build profile when MBED_DEBUG is defined) * @note This function will be a noop in debug mode (debug build profile when MBED_DEBUG is defined)
* @note This function will be a noop while uVisor is in use.
* *
* This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
* has the same sleep features as sleep plus it powers down peripherals and clocks. All state * has the same sleep features as sleep plus it powers down peripherals and clocks. All state
@ -69,11 +73,13 @@ __INLINE static void sleep(void)
*/ */
__INLINE static void deepsleep(void) __INLINE static void deepsleep(void)
{ {
#if !(defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED))
#ifndef MBED_DEBUG #ifndef MBED_DEBUG
#if DEVICE_SLEEP #if DEVICE_SLEEP
hal_deepsleep(); hal_deepsleep();
#endif /* DEVICE_SLEEP */ #endif /* DEVICE_SLEEP */
#endif /* MBED_DEBUG */ #endif /* MBED_DEBUG */
#endif /* !(defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED)) */
} }
#ifdef __cplusplus #ifdef __cplusplus