STM32 PM update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4908 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
1dd5db0742
commit
06d5e7224a
@ -122,7 +122,7 @@ CONFIG_LPC43_USART3=n
|
||||
CONFIG_LPC43_CAN1=n
|
||||
CONFIG_LPC43_CAN2=n
|
||||
CONFIG_LPC43_SPI=n
|
||||
CONFIG_LPC43_SSP0=y
|
||||
CONFIG_LPC43_SSP0=n
|
||||
CONFIG_LPC43_SSP1=n
|
||||
CONFIG_LPC43_I2C0=n
|
||||
CONFIG_LPC43_I2C1=n
|
||||
|
@ -179,18 +179,6 @@ void weak_function stm32_spiinitialize(void);
|
||||
|
||||
void weak_function stm32_usbinitialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: up_ledpminitialize
|
||||
*
|
||||
* Description:
|
||||
* Register the LEDs to receive power management event callbacks
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
void up_ledpminitialize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_extcontextsave
|
||||
*
|
||||
@ -304,6 +292,18 @@ void stm32_deselectlcd(void);
|
||||
|
||||
#endif /* CONFIG_STM32_FSMC */
|
||||
|
||||
/************************************************************************************
|
||||
* Name: up_ledpminitialize
|
||||
*
|
||||
* Description:
|
||||
* Register the LEDs to receive power management event callbacks
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#if defined(CONFIG_PM) && defined(CONFIG_ARCH_LEDS)
|
||||
void up_ledpminitialize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: up_pmbuttons
|
||||
*
|
||||
@ -314,7 +314,7 @@ void stm32_deselectlcd(void);
|
||||
************************************************************************************/
|
||||
|
||||
#if defined(CONFIG_PM) && defined(CONFIG_IDLE_CUSTOM)
|
||||
EXTERN void up_pmbuttons(void);
|
||||
void up_pmbuttons(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
|
@ -53,11 +53,12 @@
|
||||
#include "stm32_pm.h"
|
||||
#include "stm32_rcc.h"
|
||||
#include "up_internal.h"
|
||||
#include "stm3210e-internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
/* Does the board support an IDLE LED to indicate that the board is in the
|
||||
* IDLE state?
|
||||
*/
|
||||
@ -70,6 +71,22 @@
|
||||
# define END_IDLE()
|
||||
#endif
|
||||
|
||||
/* Values for the RTC Alarm to wake up from the PM_STANDBY mode */
|
||||
|
||||
#ifndef CONFIG_PM_ALARM_SEC
|
||||
# define CONFIG_PM_ALARM_SEC 1
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_PM_ALARM_NSEC
|
||||
# define CONFIG_PM_ALARM_NSEC 0
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static void up_alarmcb(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
@ -85,11 +102,12 @@
|
||||
#ifdef CONFIG_PM
|
||||
static void up_idlepm(void)
|
||||
{
|
||||
struct timespec alarmtime;
|
||||
static enum pm_state_e oldstate = PM_NORMAL;
|
||||
enum pm_state_e newstate;
|
||||
irqstate_t flags;
|
||||
int ret;
|
||||
|
||||
|
||||
/* Decide, which power saving level can be obtained */
|
||||
|
||||
newstate = pm_checkstate();
|
||||
@ -150,6 +168,18 @@ static void up_idlepm(void)
|
||||
|
||||
up_pmbuttons();
|
||||
|
||||
/* Configure the RTC alarm to Auto Wake the system */
|
||||
|
||||
alarmtime.tv_sec = CONFIG_PM_ALARM_SEC;
|
||||
alarmtime.tv_nsec = CONFIG_PM_ALARM_NSEC;
|
||||
|
||||
ret = up_rtc_setalarm(&alarmtime, &up_alarmcb);
|
||||
if (ret < 0)
|
||||
{
|
||||
lldbg("The alarm is already set to %d seconds \n",
|
||||
alarmtime.tv_sec);
|
||||
}
|
||||
|
||||
/* Call the STM32 stop mode */
|
||||
|
||||
stm32_pmstop(true);
|
||||
@ -173,6 +203,19 @@ static void up_idlepm(void)
|
||||
# define up_idlepm()
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************************
|
||||
* Name: up_alarmcb
|
||||
*
|
||||
* Description:
|
||||
* RTC alarm service routine
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
static void up_alarmcb(void)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -45,6 +45,7 @@
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "stm32_pm.h"
|
||||
#include "stm3210e-internal.h"
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
@ -91,6 +92,10 @@ void up_pminitialize(void)
|
||||
/* Then initialize the NuttX power management subsystem proper */
|
||||
|
||||
pm_initialize();
|
||||
|
||||
/* Initialize the LED PM */
|
||||
|
||||
up_ledpminitialize();
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PM */
|
||||
|
@ -51,13 +51,13 @@
|
||||
#include "nvic.h"
|
||||
#include "stm32_pwr.h"
|
||||
#include "stm32_pm.h"
|
||||
#include "stm3210e-internal.h"
|
||||
|
||||
#if defined(CONFIG_PM) && defined(CONFIG_IDLE_CUSTOM)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#ifndef CONFIG_ARCH_BUTTONS
|
||||
@ -124,6 +124,8 @@
|
||||
# define CONFIG_PM_BUTTON_ACTIVITY 10
|
||||
#endif
|
||||
|
||||
/* Miscellaneous Definitions ************************************************/
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(a,b) (a < b ? a : b)
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user