mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #13976 from LDong-Arm/cypress_sleep_debug_rework
PSoC 6: rework sleep overrides by Cypress's debug macropull/14067/head
commit
89bd565582
|
@ -26,11 +26,16 @@
|
|||
|
||||
void hal_sleep(void)
|
||||
{
|
||||
// Noop, if the idle mode is active
|
||||
#if !defined(CY_CFG_PWR_SYS_IDLE_MODE) || (CY_CFG_PWR_SYS_IDLE_MODE != CY_CFG_PWR_MODE_ACTIVE)
|
||||
cyhal_syspm_sleep();
|
||||
#endif
|
||||
}
|
||||
|
||||
void hal_deepsleep(void)
|
||||
{
|
||||
#if !defined(CY_CFG_PWR_SYS_IDLE_MODE) || (CY_CFG_PWR_SYS_IDLE_MODE == CY_CFG_PWR_MODE_DEEPSLEEP)
|
||||
|
||||
#if DEVICE_LPTICKER
|
||||
// A running timer will block DeepSleep, which would normally be
|
||||
// good because we don't want the timer to accidentally
|
||||
|
@ -41,9 +46,14 @@ void hal_deepsleep(void)
|
|||
cy_us_ticker_stop();
|
||||
cyhal_syspm_deepsleep();
|
||||
cy_us_ticker_start();
|
||||
#else
|
||||
#else // DEVICE_LPTICKER
|
||||
cyhal_syspm_sleep();
|
||||
#endif /* DEVICE_LPTICKER */
|
||||
#endif // DEVICE_LPTICKER
|
||||
|
||||
#elif CY_CFG_PWR_SYS_IDLE_MODE == CY_CFG_PWR_MODE_SLEEP
|
||||
cyhal_syspm_sleep();
|
||||
#endif // CY_CFG_PWR_SYS_IDLE_MODE == CY_CFG_PWR_MODE_ACTIVE
|
||||
// Noop, if the idle mode is active
|
||||
}
|
||||
|
||||
#endif /* DEVICE_SLEEP */
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "cyhal_hwmgr.h"
|
||||
#include "cybsp.h"
|
||||
#include "cy_mbed_post_init.h"
|
||||
#include "mbed_power_mgmt.h"
|
||||
#include "mbed_error.h"
|
||||
#if MBED_CONF_RTOS_PRESENT
|
||||
#include "rtos_idle.h"
|
||||
|
@ -35,22 +34,6 @@
|
|||
#include "cy_serial_flash_qspi.h"
|
||||
#endif /* defined(MBED_CONF_TARGET_XIP_ENABLE) */
|
||||
|
||||
|
||||
#if (defined(CY_CFG_PWR_SYS_IDLE_MODE) && (CY_CFG_PWR_SYS_IDLE_MODE == CY_CFG_PWR_MODE_ACTIVE))
|
||||
/*******************************************************************************
|
||||
* Function Name: active_idle_hook
|
||||
****************************************************************************//**
|
||||
*
|
||||
* Empty idle hook function to prevent the system entering sleep mode
|
||||
* automatically any time the system is idle.
|
||||
*
|
||||
*******************************************************************************/
|
||||
static void active_idle_hook(void)
|
||||
{
|
||||
/* Do nothing, so the rtos_idle_loop() performs while(1) */
|
||||
}
|
||||
#endif
|
||||
|
||||
MBED_WEAK void cy_mbed_post_bsp_init_hook(void)
|
||||
{
|
||||
/* By default, do nothing */
|
||||
|
@ -102,18 +85,4 @@ void mbed_sdk_init(void)
|
|||
/* Enable global interrupts (disabled in CM4 startup assembly) */
|
||||
__enable_irq();
|
||||
#endif
|
||||
|
||||
#if defined (CY_CFG_PWR_SYS_IDLE_MODE)
|
||||
/* Configure the lowest power state the system is allowed to enter
|
||||
* based on the System Idle Power Mode parameter value in the Device
|
||||
* Configurator. The default value is system deep sleep.
|
||||
*/
|
||||
#if (CY_CFG_PWR_SYS_IDLE_MODE == CY_CFG_PWR_MODE_ACTIVE)
|
||||
rtos_attach_idle_hook(&active_idle_hook);
|
||||
#elif (CY_CFG_PWR_SYS_IDLE_MODE == CY_CFG_PWR_MODE_SLEEP)
|
||||
sleep_manager_lock_deep_sleep();
|
||||
#else
|
||||
/* Deep sleep is default state */
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue