diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-07-04 23:19:59 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-07-04 23:19:59 +0000 |
commit | d2a5c3d4f5b9899dc5de05c49ede4e616fae9a64 (patch) | |
tree | 0069f942928564b5216301ec2623b1f102d46fb5 /nuttx/configs | |
parent | 08088bc230efd32182b46b42b42e2b5e7d83a265 (diff) | |
download | px4-nuttx-d2a5c3d4f5b9899dc5de05c49ede4e616fae9a64.tar.gz px4-nuttx-d2a5c3d4f5b9899dc5de05c49ede4e616fae9a64.tar.bz2 px4-nuttx-d2a5c3d4f5b9899dc5de05c49ede4e616fae9a64.zip |
STM32 PM update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4908 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs')
-rw-r--r-- | nuttx/configs/lpc4330-xplorer/ostest/defconfig | 2 | ||||
-rw-r--r-- | nuttx/configs/stm3210e-eval/src/stm3210e-internal.h | 26 | ||||
-rw-r--r-- | nuttx/configs/stm3210e-eval/src/up_idle.c | 47 | ||||
-rw-r--r-- | nuttx/configs/stm3210e-eval/src/up_pm.c | 5 | ||||
-rw-r--r-- | nuttx/configs/stm3210e-eval/src/up_pmbuttons.c | 4 |
5 files changed, 67 insertions, 17 deletions
diff --git a/nuttx/configs/lpc4330-xplorer/ostest/defconfig b/nuttx/configs/lpc4330-xplorer/ostest/defconfig index 6d6bd7b67..bd894902d 100644 --- a/nuttx/configs/lpc4330-xplorer/ostest/defconfig +++ b/nuttx/configs/lpc4330-xplorer/ostest/defconfig @@ -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 diff --git a/nuttx/configs/stm3210e-eval/src/stm3210e-internal.h b/nuttx/configs/stm3210e-eval/src/stm3210e-internal.h index ddfbee428..0f31b6201 100644 --- a/nuttx/configs/stm3210e-eval/src/stm3210e-internal.h +++ b/nuttx/configs/stm3210e-eval/src/stm3210e-internal.h @@ -180,18 +180,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 * * Description: @@ -305,6 +293,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 * * Description: @@ -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 /************************************************************************************ diff --git a/nuttx/configs/stm3210e-eval/src/up_idle.c b/nuttx/configs/stm3210e-eval/src/up_idle.c index 27784056b..456a92db8 100644 --- a/nuttx/configs/stm3210e-eval/src/up_idle.c +++ b/nuttx/configs/stm3210e-eval/src/up_idle.c @@ -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 ****************************************************************************/ diff --git a/nuttx/configs/stm3210e-eval/src/up_pm.c b/nuttx/configs/stm3210e-eval/src/up_pm.c index 8fa8b283d..069a0cb5f 100644 --- a/nuttx/configs/stm3210e-eval/src/up_pm.c +++ b/nuttx/configs/stm3210e-eval/src/up_pm.c @@ -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 */ diff --git a/nuttx/configs/stm3210e-eval/src/up_pmbuttons.c b/nuttx/configs/stm3210e-eval/src/up_pmbuttons.c index 527f46163..62dc45f1e 100644 --- a/nuttx/configs/stm3210e-eval/src/up_pmbuttons.c +++ b/nuttx/configs/stm3210e-eval/src/up_pmbuttons.c @@ -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 |