summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-07-12 14:12:18 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-07-12 14:12:18 +0000
commit7769a6798482804a666bcd734b511795e53b33ff (patch)
tree62b38a0f5071c19c9b061722a2ebd9c7992caabd
parentdc7c79d7f673a8c641ad6c3e567b321a924af675 (diff)
downloadnuttx-7769a6798482804a666bcd734b511795e53b33ff.tar.gz
nuttx-7769a6798482804a666bcd734b511795e53b33ff.tar.bz2
nuttx-7769a6798482804a666bcd734b511795e53b33ff.zip
STM32: remove pm_unregister buttons. Initialize PM buttons only once
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4935 42af7a65-404d-4744-a932-0658087f49c3
-rwxr-xr-xnuttx/configs/stm3210e-eval/README.txt40
-rw-r--r--nuttx/configs/stm3210e-eval/pm/defconfig4
-rw-r--r--nuttx/configs/stm3210e-eval/src/stm3210e-internal.h12
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_idle.c30
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_pm.c6
-rw-r--r--nuttx/configs/stm3210e-eval/src/up_pmbuttons.c23
6 files changed, 49 insertions, 66 deletions
diff --git a/nuttx/configs/stm3210e-eval/README.txt b/nuttx/configs/stm3210e-eval/README.txt
index c46f73811..d7df1ef9b 100755
--- a/nuttx/configs/stm3210e-eval/README.txt
+++ b/nuttx/configs/stm3210e-eval/README.txt
@@ -810,10 +810,48 @@ Where <subdir> is one of the following:
This is a configuration that is used to test STM32 power management, i.e.,
to test that the board can go into lower and lower states of power usage
as a result of inactivity. This configuration is based on the nsh2
- configuration with modifications for testing power management.
+ configuration with modifications for testing power management. This
+ configuration should provide some guideline for power management in your
+ STM32 application.
CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows
+ CONFIG_PM_CUSTOMINIT and CONFIG_IDLE_CUSTOM are necessary parts of the
+ PM configuration:
+
+ CONFIG_PM_CUSTOMINIT=y
+
+ CONFIG_PM_CUSTOMINIT moves the PM initialization from arch/arm/src/stm32/stm32_pminitialiaze.c
+ to configs/stm3210-eval/src/up_pm.c. This allows us to support board-
+ specific PM initialization.
+
+ CONFIG_IDLE_CUSTOM=y
+
+ The bulk of the PM activities occur in the IDLE loop. The IDLE loop is
+ special because it is what runs when there is no other task running. Therefore
+ when the IDLE executes, we can be assure that nothing else is going on; this
+ is the ideal condition for doing reduced power management.
+
+ The configuration CONFIG_IDLE_CUSTOM allows us to "steal" the normal STM32
+ IDLE loop (of arch/arm/src/stm32/stm32_idle.c) and replace this with our own
+ custom IDLE loop (at configs/stm3210-eval/src/up_idle.c).
+
+ Here are some additional things to note in the configuration:
+
+ CONFIG_PM_BUTTONS=y
+
+ CONFIG_PM_BUTTONS enables button support for PM testing. Buttons can drive
+ EXTI interrupts and EXTI interrrupts can be used to wakeup for certain reduced
+ power modes (STOP mode). The use of the buttons here is for PM testing purposes
+ only; buttons would normally be part the application code and CONFIG_PM_BUTTONS
+ would not be defined.
+
+ CONFIG_RTC_ALARM=y
+
+ The RTC alarm is used to wake up from STOP mode and to transition to
+ STANDBY mode. This used of the RTC alarm could conflict with other uses of
+ the RTC alarm in your application.
+
RIDE
----
This configuration builds a trivial bring-up binary. It is
diff --git a/nuttx/configs/stm3210e-eval/pm/defconfig b/nuttx/configs/stm3210e-eval/pm/defconfig
index d5b0a75f9..5c1d57c84 100644
--- a/nuttx/configs/stm3210e-eval/pm/defconfig
+++ b/nuttx/configs/stm3210e-eval/pm/defconfig
@@ -473,6 +473,10 @@ CONFIG_IDLE_CUSTOM=y
# Board/Application-Specific Power Management Configuration.
# These settings are probably not meaningful outside of this configuration
#
+# Button support can be built into the configs/stm3210e-eval/pm configuration
+# to support PM testing. These would not be part of a normal, operational
+# configuration.
+#
CONFIG_PM_BUTTONS=y
CONFIG_PM_IRQBUTTONS_MIN=0
CONFIG_PM_IRQBUTTONS_MAX=7
diff --git a/nuttx/configs/stm3210e-eval/src/stm3210e-internal.h b/nuttx/configs/stm3210e-eval/src/stm3210e-internal.h
index d0ff66cf4..33a8750f9 100644
--- a/nuttx/configs/stm3210e-eval/src/stm3210e-internal.h
+++ b/nuttx/configs/stm3210e-eval/src/stm3210e-internal.h
@@ -317,18 +317,6 @@ void up_ledpminitialize(void);
void up_pmbuttons(void);
#endif
-/************************************************************************************
- * Name: up_unregisterbuttons
- *
- * Description:
- * Un-register button handlers
- *
- ************************************************************************************/
-
-#if defined(CONFIG_PM) && defined(CONFIG_IDLE_CUSTOM) && defined(CONFIG_PM_BUTTONS)
-void up_unregisterbuttons(void);
-#endif
-
#endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_STM3210E_EVAL_SRC_STM3210E_INTERNAL_H */
diff --git a/nuttx/configs/stm3210e-eval/src/up_idle.c b/nuttx/configs/stm3210e-eval/src/up_idle.c
index f68574bd8..bc5be2bdc 100644
--- a/nuttx/configs/stm3210e-eval/src/up_idle.c
+++ b/nuttx/configs/stm3210e-eval/src/up_idle.c
@@ -150,41 +150,11 @@ static void up_idlepm(void)
case PM_IDLE:
{
- /* The wake-up event is really dependent upon the application
- * an resources provided by the application. However,
- * CONFIG_PM_BUTTONS may defined to support PM testing.
- */
-
-#ifdef CONFIG_PM_BUTTONS
- /* Check if the buttons have already been registered */
-
- up_unregisterbuttons();
-
- /* Initialize the buttons to wake up the system from the idle
- * mode
- */
-
- up_pmbuttons();
-#endif
}
break;
case PM_STANDBY:
{
- /* The wake-up event is really dependent upon the application
- * an resources provided by the application. However,
- * CONFIG_PM_BUTTONS may defined to support PM testing.
- */
-
-#ifdef CONFIG_PM_BUTTONS
- /* Check if the buttons have already been registered */
-
- up_unregisterbuttons();
-
- /* Configure all the buttons as wakeup EXTI */
-
- up_pmbuttons();
-#endif
#ifdef CONFIG_RTC_ALARM
/* Configure the RTC alarm to Auto Wake the system */
diff --git a/nuttx/configs/stm3210e-eval/src/up_pm.c b/nuttx/configs/stm3210e-eval/src/up_pm.c
index 069a0cb5f..dd8a79b1c 100644
--- a/nuttx/configs/stm3210e-eval/src/up_pm.c
+++ b/nuttx/configs/stm3210e-eval/src/up_pm.c
@@ -93,6 +93,12 @@ void up_pminitialize(void)
pm_initialize();
+#ifdef CONFIG_PM_BUTTONS
+ /* Initialize the buttons to wake up the system from low power modes */
+
+ up_pmbuttons();
+#endif
+
/* Initialize the LED PM */
up_ledpminitialize();
diff --git a/nuttx/configs/stm3210e-eval/src/up_pmbuttons.c b/nuttx/configs/stm3210e-eval/src/up_pmbuttons.c
index 0a214d709..5892ce626 100644
--- a/nuttx/configs/stm3210e-eval/src/up_pmbuttons.c
+++ b/nuttx/configs/stm3210e-eval/src/up_pmbuttons.c
@@ -281,10 +281,6 @@ static void button_handler(int id, int irq)
*/
pm_activity(CONFIG_PM_BUTTON_ACTIVITY);
-
- /* Un-register button handlers */
-
- up_unregisterbuttons();
}
#if MIN_BUTTON < 1
@@ -387,23 +383,4 @@ void up_pmbuttons(void)
#endif
}
-/****************************************************************************
- * Name: up_unregisterbuttons
- *
- * Description:
- * Un-register button handlers
- *
- ****************************************************************************/
-
-void up_unregisterbuttons(void)
-{
-#ifdef CONFIG_ARCH_IRQBUTTONS
-int i;
- for (i = CONFIG_PM_IRQBUTTONS_MIN; i <= CONFIG_PM_IRQBUTTONS_MAX; i++)
- {
- (void)up_irqbutton(i, NULL);
- }
-#endif
-}
-
#endif /* defined(CONFIG_PM) && defined(CONFIG_IDLE_CUSTOM) && defined(CONFIG_PM_BUTTONS) */