diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-06-30 00:53:54 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-06-30 00:53:54 +0000 |
commit | 41bec181a3c306b2006523305bead57dad8a7992 (patch) | |
tree | ec125eb4b4cd519fe4f49a4c90e41082462e010b /nuttx/configs/stm3210e-eval/src | |
parent | 95a79061c82da0e2e6ff50990129a8b1800d8977 (diff) | |
download | px4-nuttx-41bec181a3c306b2006523305bead57dad8a7992.tar.gz px4-nuttx-41bec181a3c306b2006523305bead57dad8a7992.tar.bz2 px4-nuttx-41bec181a3c306b2006523305bead57dad8a7992.zip |
PM Update; add configs//ekk-lm3s9b96
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4888 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs/stm3210e-eval/src')
-rw-r--r-- | nuttx/configs/stm3210e-eval/src/stm3210e-internal.h | 12 | ||||
-rw-r--r-- | nuttx/configs/stm3210e-eval/src/up_idle.c | 6 | ||||
-rw-r--r-- | nuttx/configs/stm3210e-eval/src/up_leds.c | 31 | ||||
-rw-r--r-- | nuttx/configs/stm3210e-eval/src/up_pmbuttons.c | 22 |
4 files changed, 52 insertions, 19 deletions
diff --git a/nuttx/configs/stm3210e-eval/src/stm3210e-internal.h b/nuttx/configs/stm3210e-eval/src/stm3210e-internal.h index 8b9deb8ee..12021eee0 100644 --- a/nuttx/configs/stm3210e-eval/src/stm3210e-internal.h +++ b/nuttx/configs/stm3210e-eval/src/stm3210e-internal.h @@ -180,6 +180,18 @@ 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: diff --git a/nuttx/configs/stm3210e-eval/src/up_idle.c b/nuttx/configs/stm3210e-eval/src/up_idle.c index 268a13803..9b6432da8 100644 --- a/nuttx/configs/stm3210e-eval/src/up_idle.c +++ b/nuttx/configs/stm3210e-eval/src/up_idle.c @@ -126,14 +126,14 @@ static void up_idlepm(void) break; case PM_IDLE: - break; + break; case PM_STANDBY: /* Configure all the buttons as wakeup EXTI */ up_pmbuttons(); - /* Call the MCU stop mode */ + /* Call the STM32 stop mode */ stm32_pmstop(true); break; @@ -187,7 +187,7 @@ void up_idle(void) /* Sleep until an interrupt occurs to save power */ BEGIN_IDLE(); - asm("WFI"); + __asm("wfi"); END_IDLE(); #endif } diff --git a/nuttx/configs/stm3210e-eval/src/up_leds.c b/nuttx/configs/stm3210e-eval/src/up_leds.c index 56ed766b2..5a02588ab 100644 --- a/nuttx/configs/stm3210e-eval/src/up_leds.c +++ b/nuttx/configs/stm3210e-eval/src/up_leds.c @@ -300,7 +300,7 @@ static void led_pm_notify(struct pm_callback_s *cb , enum pm_state_e pmstate) case(PM_STANDBY): { /* Entering STANDBY mode - Logic for PM_STANDBY goes here */ - + } break; @@ -369,18 +369,6 @@ void up_ledinit(void) void up_ledon(int led) { -#ifdef CONFIG_PM - if (led == LED_IRQSENABLED) - { - /* Register to receive power management callbacks */ - - int ret = pm_register(&g_ledscb); - if (ret != OK) - { - up_ledon(LED_ASSERTION); - } - } -#endif led_setonoff(ON_BITS(g_ledbits[led])); } @@ -393,4 +381,21 @@ void up_ledoff(int led) led_setonoff(OFF_BITS(g_ledbits[led])); } +/**************************************************************************** + * Name: up_ledpminitialize + ****************************************************************************/ + +#ifdef CONFIG_PM +void up_ledpminitialize(void) +{ + /* Register to receive power management callbacks */ + + int ret = pm_register(&g_ledscb); + if (ret != OK) + { + up_ledon(LED_ASSERTION); + } +} +#endif /* CONFIG_PM */ + #endif /* CONFIG_ARCH_LEDS */ diff --git a/nuttx/configs/stm3210e-eval/src/up_pmbuttons.c b/nuttx/configs/stm3210e-eval/src/up_pmbuttons.c index f7a001e9b..c90cf1c53 100644 --- a/nuttx/configs/stm3210e-eval/src/up_pmbuttons.c +++ b/nuttx/configs/stm3210e-eval/src/up_pmbuttons.c @@ -120,6 +120,10 @@ # error "CONFIG_PM_IRQBUTTONS_MAX > 7" #endif +#ifndef CONFIG_PM_BUTTON_ACTIVITY +# define CONFIG_PM_BUTTON_ACTIVITY 10 +#endif + #ifndef MIN # define MIN(a,b) (a < b ? a : b) #endif @@ -130,7 +134,7 @@ #define MIN_BUTTON MIN(CONFIG_PM_BUTTONS_MIN, CONFIG_PM_IRQBUTTONS_MIN) #define MAX_BUTTON MAX(CONFIG_PM_BUTTONS_MAX, CONFIG_PM_IRQBUTTONS_MAX) -#define NUM_PMBUTTONS (MAX_BUTTON - MIN_BUTTON + 1) +#define NUM_PMBUTTONS (MAX_BUTTON - MIN_BUTTON + 1) #define BUTTON_INDEX(b) ((b)-MIN_BUTTON) /**************************************************************************** @@ -259,8 +263,20 @@ static const struct button_info_s g_buttoninfo[NUM_PMBUTTONS] = #ifdef CONFIG_ARCH_IRQBUTTONS static void button_handler(int id, int irq) { - /* For the moment force to the normal state */ - (void)pm_changestate(PM_NORMAL); + int i; + + /* At this point the MCU should have already awakened. Just report some + * activity in order to drive the rest of the system to the PM_NORMAL state + */ + + pm_activity(CONFIG_PM_BUTTON_ACTIVITY); + + /* Un-register button handlers */ + + for (i = CONFIG_PM_IRQBUTTONS_MIN; i <= CONFIG_PM_IRQBUTTONS_MAX; i++) + { + (void)up_irqbutton(i, NULL); + } } #if MIN_BUTTON < 1 |