Skip to content

Commit c5f0ad5

Browse files
committed
Disable sleep when uVisor is in use
1 parent 4cd6068 commit c5f0ad5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

platform/mbed_sleep.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ extern "C" {
2828
/** Send the microcontroller to sleep
2929
*
3030
* @note This function can be a noop if not implemented by the platform.
31-
* @note This function will be a noop in debug mode (debug build profile when MBED_DEBUG is defined)
31+
* @note This function will be a noop in debug mode (debug build profile when MBED_DEBUG is defined).
32+
* @note This function will be a noop while uVisor is in use.
3233
*
3334
* The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the
3435
* system clock to the core is stopped until a reset or an interrupt occurs. This eliminates
@@ -44,17 +45,20 @@ extern "C" {
4445
*/
4546
__INLINE static void sleep(void)
4647
{
48+
#if !(defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED))
4749
#ifndef MBED_DEBUG
4850
#if DEVICE_SLEEP
4951
hal_sleep();
5052
#endif /* DEVICE_SLEEP */
5153
#endif /* MBED_DEBUG */
54+
#endif /* !(defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED)) */
5255
}
5356

5457
/** Send the microcontroller to deep sleep
5558
*
5659
* @note This function can be a noop if not implemented by the platform.
5760
* @note This function will be a noop in debug mode (debug build profile when MBED_DEBUG is defined)
61+
* @note This function will be a noop while uVisor is in use.
5862
*
5963
* This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
6064
* 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)
6973
*/
7074
__INLINE static void deepsleep(void)
7175
{
76+
#if !(defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED))
7277
#ifndef MBED_DEBUG
7378
#if DEVICE_SLEEP
7479
hal_deepsleep();
7580
#endif /* DEVICE_SLEEP */
7681
#endif /* MBED_DEBUG */
82+
#endif /* !(defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED)) */
7783
}
7884

7985
#ifdef __cplusplus

0 commit comments

Comments
 (0)