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
This commit is contained in:
parent
ea603f7489
commit
63cc3c9e86
@ -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.,
|
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
|
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
|
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_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
|
RIDE
|
||||||
----
|
----
|
||||||
This configuration builds a trivial bring-up binary. It is
|
This configuration builds a trivial bring-up binary. It is
|
||||||
|
@ -473,6 +473,10 @@ CONFIG_IDLE_CUSTOM=y
|
|||||||
# Board/Application-Specific Power Management Configuration.
|
# Board/Application-Specific Power Management Configuration.
|
||||||
# These settings are probably not meaningful outside of this 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_BUTTONS=y
|
||||||
CONFIG_PM_IRQBUTTONS_MIN=0
|
CONFIG_PM_IRQBUTTONS_MIN=0
|
||||||
CONFIG_PM_IRQBUTTONS_MAX=7
|
CONFIG_PM_IRQBUTTONS_MAX=7
|
||||||
|
@ -317,18 +317,6 @@ void up_ledpminitialize(void);
|
|||||||
void up_pmbuttons(void);
|
void up_pmbuttons(void);
|
||||||
#endif
|
#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 /* __ASSEMBLY__ */
|
||||||
#endif /* __CONFIGS_STM3210E_EVAL_SRC_STM3210E_INTERNAL_H */
|
#endif /* __CONFIGS_STM3210E_EVAL_SRC_STM3210E_INTERNAL_H */
|
||||||
|
|
||||||
|
@ -150,41 +150,11 @@ static void up_idlepm(void)
|
|||||||
|
|
||||||
case PM_IDLE:
|
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;
|
break;
|
||||||
|
|
||||||
case PM_STANDBY:
|
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
|
#ifdef CONFIG_RTC_ALARM
|
||||||
/* Configure the RTC alarm to Auto Wake the system */
|
/* Configure the RTC alarm to Auto Wake the system */
|
||||||
|
|
||||||
|
@ -93,6 +93,12 @@ void up_pminitialize(void)
|
|||||||
|
|
||||||
pm_initialize();
|
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 */
|
/* Initialize the LED PM */
|
||||||
|
|
||||||
up_ledpminitialize();
|
up_ledpminitialize();
|
||||||
|
@ -281,10 +281,6 @@ static void button_handler(int id, int irq)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
pm_activity(CONFIG_PM_BUTTON_ACTIVITY);
|
pm_activity(CONFIG_PM_BUTTON_ACTIVITY);
|
||||||
|
|
||||||
/* Un-register button handlers */
|
|
||||||
|
|
||||||
up_unregisterbuttons();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MIN_BUTTON < 1
|
#if MIN_BUTTON < 1
|
||||||
@ -387,23 +383,4 @@ void up_pmbuttons(void)
|
|||||||
#endif
|
#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) */
|
#endif /* defined(CONFIG_PM) && defined(CONFIG_IDLE_CUSTOM) && defined(CONFIG_PM_BUTTONS) */
|
||||||
|
Loading…
Reference in New Issue
Block a user