Conflicts:
	arm/src/stm32l4/stm32l4_lse.c
This commit is contained in:
ziggurat29 2016-03-28 20:52:12 -05:00
commit 39b2d4077f
15 changed files with 87 additions and 92 deletions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/efm32/efm32_idle.c
*
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2014-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -68,6 +68,8 @@
# define END_IDLE()
#endif
#define PM_IDLE_DOMAIN 0 /* Revisit */
/****************************************************************************
* Private Data
****************************************************************************/
@ -98,7 +100,7 @@ static void up_idlepm(void)
/* Decide, which power saving level can be obtained */
newstate = pm_checkstate();
newstate = pm_checkstate(PM_IDLE_DOMAIN);
/* Check for state changes */
@ -112,12 +114,12 @@ static void up_idlepm(void)
/* Then force the global state change */
ret = pm_changestate(newstate);
ret = pm_changestate(PM_IDLE_DOMAIN, newstate);
if (ret < 0)
{
/* The new state change failed, revert to the preceding state */
(void)pm_changestate(oldstate);
(void)pm_changestate(PM_IDLE_DOMAIN, oldstate);
}
else
{

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/kl/kl_idle.c
*
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2013, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -65,6 +65,8 @@
# define END_IDLE()
#endif
#define PM_IDLE_DOMAIN 0 /* Revisit */
/****************************************************************************
* Private Data
****************************************************************************/
@ -91,7 +93,7 @@ static void up_idlepm(void)
/* Decide, which power saving level can be obtained */
newstate = pm_checkstate();
newstate = pm_checkstate(PM_IDLE_DOMAIN);
/* Check for state changes */
@ -105,12 +107,12 @@ static void up_idlepm(void)
/* Then force the global state change */
ret = pm_changestate(newstate);
ret = pm_changestate(PM_IDLE_DOMAIN, newstate);
if (ret < 0)
{
/* The new state change failed, revert to the preceding state */
(void)pm_changestate(oldstate);
(void)pm_changestate(PM_IDLE_DOMAIN, oldstate);
}
else
{

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/lpc43/lpc43_idle.c
*
* Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2012, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -64,9 +64,7 @@
# define END_IDLE()
#endif
/****************************************************************************
* Private Data
****************************************************************************/
#define PM_IDLE_DOMAIN 0 /* Revisit */
/****************************************************************************
* Private Functions
@ -90,7 +88,7 @@ static void up_idlepm(void)
/* Decide, which power saving level can be obtained */
newstate = pm_checkstate();
newstate = pm_checkstate(PM_IDLE_DOMAIN);
/* Check for state changes */
@ -104,12 +102,12 @@ static void up_idlepm(void)
/* Then force the global state change */
ret = pm_changestate(newstate);
ret = pm_changestate(PM_IDLE_DOMAIN, newstate);
if (ret < 0)
{
/* The new state change failed, revert to the preceding state */
(void)pm_changestate(oldstate);
(void)pm_changestate(PM_IDLE_DOMAIN, oldstate);
}
else
{

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/nuc1xx/nuc_idle.c
*
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2013, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -65,9 +65,7 @@
# define END_IDLE()
#endif
/****************************************************************************
* Private Data
****************************************************************************/
#define PM_IDLE_DOMAIN 0 /* Revisit */
/****************************************************************************
* Private Functions
@ -91,7 +89,7 @@ static void up_idlepm(void)
/* Decide, which power saving level can be obtained */
newstate = pm_checkstate();
newstate = pm_checkstate(PM_IDLE_DOMAIN);
/* Check for state changes */
@ -105,12 +103,12 @@ static void up_idlepm(void)
/* Then force the global state change */
ret = pm_changestate(newstate);
ret = pm_changestate(PM_IDLE_DOMAIN, newstate);
if (ret < 0)
{
/* The new state change failed, revert to the preceding state */
(void)pm_changestate(oldstate);
(void)pm_changestate(PM_IDLE_DOMAIN, oldstate);
}
else
{

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/samdl/sam_idle.c
*
* Copyright (C) 2014, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2014, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -65,9 +65,7 @@
# define END_IDLE()
#endif
/****************************************************************************
* Private Data
****************************************************************************/
#define PM_IDLE_DOMAIN 0 /* Revisit */
/****************************************************************************
* Private Functions
@ -91,7 +89,7 @@ static void up_idlepm(void)
/* Decide, which power saving level can be obtained */
newstate = pm_checkstate();
newstate = pm_checkstate(PM_IDLE_DOMAIN);
/* Check for state changes */
@ -105,12 +103,12 @@ static void up_idlepm(void)
/* Then force the global state change */
ret = pm_changestate(newstate);
ret = pm_changestate(PM_IDLE_DOMAIN, newstate);
if (ret < 0)
{
/* The new state change failed, revert to the preceding state */
(void)pm_changestate(oldstate);
(void)pm_changestate(PM_IDLE_DOMAIN, oldstate);
}
else
{

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32/stm32_idle.c
*
* Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2011-2012, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -67,9 +67,7 @@
# define END_IDLE()
#endif
/****************************************************************************
* Private Data
****************************************************************************/
#define PM_IDLE_DOMAIN 0 /* Revisit */
/****************************************************************************
* Private Functions
@ -93,7 +91,7 @@ static void up_idlepm(void)
/* Decide, which power saving level can be obtained */
newstate = pm_checkstate();
newstate = pm_checkstate(PM_IDLE_DOMAIN);
/* Check for state changes */
@ -107,12 +105,12 @@ static void up_idlepm(void)
/* Then force the global state change */
ret = pm_changestate(newstate);
ret = pm_changestate(PM_IDLE_DOMAIN, newstate);
if (ret < 0)
{
/* The new state change failed, revert to the preceding state */
(void)pm_changestate(oldstate);
(void)pm_changestate(PM_IDLE_DOMAIN, oldstate);
}
else
{

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32/stm32_serial.c
*
* Copyright (C) 2009-2014 Gregory Nutt. All rights reserved.
* Copyright (C) 2009-2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -252,6 +252,7 @@
#if defined(CONFIG_PM) && !defined(CONFIG_PM_SERIAL_ACTIVITY)
# define CONFIG_PM_SERIAL_ACTIVITY 10
# define PM_IDLE_DOMAIN 0 /* Revisit */
#endif
#ifdef USE_SERIALDRIVER
@ -363,8 +364,10 @@ static void up_dma_rxcallback(DMA_HANDLE handle, uint8_t status, void *arg);
#endif
#ifdef CONFIG_PM
static void up_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate);
static int up_pm_prepare(struct pm_callback_s *cb, enum pm_state_e pmstate);
static void up_pm_notify(struct pm_callback_s *cb, int dowmin,
enum pm_state_e pmstate);
static int up_pm_prepare(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate);
#endif
#ifdef CONFIG_STM32_USART1
@ -1779,7 +1782,7 @@ static int up_interrupt_common(struct up_dev_s *priv)
/* Report serial activity to the power management logic */
#if defined(CONFIG_PM) && CONFIG_PM_SERIAL_ACTIVITY > 0
pm_activity(CONFIG_PM_SERIAL_ACTIVITY);
pm_activity(PM_IDLE_DOMAIN, CONFIG_PM_SERIAL_ACTIVITY);
#endif
/* Loop until there are no characters to be transferred or,
@ -2613,7 +2616,8 @@ static void up_dma_rxcallback(DMA_HANDLE handle, uint8_t status, void *arg)
****************************************************************************/
#ifdef CONFIG_PM
static void up_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate)
static void up_pm_notify(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate)
{
switch (pmstate)
{
@ -2686,7 +2690,8 @@ static void up_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate)
****************************************************************************/
#ifdef CONFIG_PM
static int up_pm_prepare(struct pm_callback_s *cb, enum pm_state_e pmstate)
static int up_pm_prepare(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate)
{
/* Logic to prepare for a reduced power state goes here. */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32f7/stm32_serial.c
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -205,6 +205,7 @@
#if defined(CONFIG_PM) && !defined(CONFIG_PM_SERIAL_ACTIVITY)
# define CONFIG_PM_SERIAL_ACTIVITY 10
# define PM_IDLE_DOMAIN 0 /* Revisit */
#endif
#ifdef USE_SERIALDRIVER
@ -317,8 +318,10 @@ static void up_dma_rxcallback(DMA_HANDLE handle, uint8_t status, void *arg);
#endif
#ifdef CONFIG_PM
static void up_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate);
static int up_pm_prepare(struct pm_callback_s *cb, enum pm_state_e pmstate);
static void up_pm_notify(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate);
static int up_pm_prepare(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate);
#endif
#ifdef CONFIG_STM32F7_USART1
@ -1711,7 +1714,7 @@ static int up_interrupt_common(struct up_dev_s *priv)
/* Report serial activity to the power management logic */
#if defined(CONFIG_PM) && CONFIG_PM_SERIAL_ACTIVITY > 0
pm_activity(CONFIG_PM_SERIAL_ACTIVITY);
pm_activity(PM_IDLE_DOMAIN, CONFIG_PM_SERIAL_ACTIVITY);
#endif
/* Loop until there are no characters to be transferred or,
@ -2543,7 +2546,8 @@ static void up_dma_rxcallback(DMA_HANDLE handle, uint8_t status, void *arg)
****************************************************************************/
#ifdef CONFIG_PM
static void up_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate)
static void up_pm_notify(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate)
{
switch (pmstate)
{
@ -2616,7 +2620,8 @@ static void up_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate)
****************************************************************************/
#ifdef CONFIG_PM
static int up_pm_prepare(struct pm_callback_s *cb, enum pm_state_e pmstate)
static int up_pm_prepare(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate)
{
/* Logic to prepare for a reduced power state goes here. */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32l4/stm32l4_idle.c
*
* Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2011-2012, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -67,9 +67,7 @@
# define END_IDLE()
#endif
/****************************************************************************
* Private Data
****************************************************************************/
#define PM_IDLE_DOMAIN 0 /* Revisit */
/****************************************************************************
* Private Functions
@ -93,7 +91,7 @@ static void up_idlepm(void)
/* Decide, which power saving level can be obtained */
newstate = pm_checkstate();
newstate = pm_checkstate(PM_IDLE_DOMAIN);
/* Check for state changes */
@ -107,12 +105,12 @@ static void up_idlepm(void)
/* Then force the global state change */
ret = pm_changestate(newstate);
ret = pm_changestate(PM_IDLE_DOMAIN, newstate);
if (ret < 0)
{
/* The new state change failed, revert to the preceding state */
(void)pm_changestate(oldstate);
(void)pm_changestate(PM_IDLE_DOMAIN, oldstate);
}
else
{

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32l4/stm32l4_lse.c
*
* Copyright (C) 2009, 2011, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
* Author: dev@ziggurat29.com
*
* Redistribution and use in source and binary forms, with or without
@ -45,18 +45,6 @@
#include "stm32l4_rcc.h"
#include "stm32l4_waste.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
@ -88,7 +76,7 @@ void stm32l4_rcc_enablelse(void)
* the RCC BDCR register.
*/
regval = getreg32(STM32L4_RCC_BDCR);
regval = getreg32(STM32L4_RCC_BDCR);
regval |= RCC_BDCR_LSEON;
putreg32(regval,STM32L4_RCC_BDCR);

View File

@ -2,7 +2,7 @@
* arch/arm/src/stm32l4/stm32l4_pwr.c
*
* Copyright (C) 2011 Uros Platise. All rights reserved.
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2013, 2015-2016 Gregory Nutt. All rights reserved.
* Authors: Uros Platise <uros.platise@isotel.eu>
* Gregory Nutt <gnutt@nuttx.org>
* dev@ziggurat29.com
@ -51,11 +51,6 @@
#include "stm32l4_pwr.h"
#include "stm32l4_rcc.h"
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/************************************************************************************
* Private Functions
************************************************************************************/
@ -103,8 +98,7 @@ bool stm32l4_pwr_enableclk(bool enable)
regval = getreg32(STM32L4_RCC_APB1ENR1);
wasenabled = ((regval & RCC_APB1ENR1_PWREN) != 0);
/* Power interface clock enable.
*/
/* Power interface clock enable. */
if (wasenabled && !enable)
{

View File

@ -1,7 +1,7 @@
/************************************************************************************
* arch/arm/src/stm32l4/stm32l4_pwr.h
*
* Copyright (C) 2009, 2013, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
* Author: dev@ziggurat29.com
*
* Redistribution and use in source and binary forms, with or without
@ -84,7 +84,6 @@ extern "C"
bool stm32l4_pwr_enableclk(bool enable);
/************************************************************************************
* Name: stm32l4_pwr_enablebkp
*

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32l4/stm32l4_serial.c
*
* Copyright (C) 2009-2014 Gregory Nutt. All rights reserved.
* Copyright (C) 2009-2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -205,6 +205,7 @@
#if defined(CONFIG_PM) && !defined(CONFIG_PM_SERIAL_ACTIVITY)
# define CONFIG_PM_SERIAL_ACTIVITY 10
# define PM_IDLE_DOMAIN 0 /* Revisit */
#endif
#ifdef USE_SERIALDRIVER
@ -316,8 +317,10 @@ static void up_dma_rxcallback(DMA_HANDLE handle, uint8_t status, void *arg);
#endif
#ifdef CONFIG_PM
static void up_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate);
static int up_pm_prepare(struct pm_callback_s *cb, enum pm_state_e pmstate);
static void up_pm_notify(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate);
static int up_pm_prepare(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate);
#endif
#ifdef CONFIG_STM32L4_USART1
@ -1454,7 +1457,7 @@ static int up_interrupt_common(struct up_dev_s *priv)
/* Report serial activity to the power management logic */
#if defined(CONFIG_PM) && CONFIG_PM_SERIAL_ACTIVITY > 0
pm_activity(CONFIG_PM_SERIAL_ACTIVITY);
pm_activity(PM_IDLE_DOMAIN, CONFIG_PM_SERIAL_ACTIVITY);
#endif
/* Loop until there are no characters to be transferred or,
@ -2255,7 +2258,8 @@ static void up_dma_rxcallback(DMA_HANDLE handle, uint8_t status, void *arg)
****************************************************************************/
#ifdef CONFIG_PM
static void up_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate)
static void up_pm_notify(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate)
{
switch (pmstate)
{
@ -2328,7 +2332,8 @@ static void up_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate)
****************************************************************************/
#ifdef CONFIG_PM
static int up_pm_prepare(struct pm_callback_s *cb, enum pm_state_e pmstate)
static int up_pm_prepare(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate)
{
/* Logic to prepare for a reduced power state goes here. */

View File

@ -581,7 +581,7 @@ static void stm32l4_stdclockconfig(void)
# error STM32L4_BOARD_USEMSI not yet implemented in arch/arm/src/stm32l4/stm32l4x6xx_rcc.c
/* setting MSIRANGE */
/* setting MSIPLLEN */
regval = getreg32(STM32L4_RCC_CR);
regval |= RCC_CR_MSION; /* Enable MSI */
putreg32(regval, STM32L4_RCC_CR);
@ -621,9 +621,8 @@ static void stm32l4_stdclockconfig(void)
{
#warning todo: regulator voltage according to clock freq
#if 0
/* ensure Power control is enabled before modifying it
*/
/* Ensure Power control is enabled before modifying it. */
regval = getreg32(STM32L4_RCC_APB1ENR);
regval |= RCC_APB1ENR_PWREN;
putreg32(regval, STM32L4_RCC_APB1ENR);
@ -631,7 +630,7 @@ static void stm32l4_stdclockconfig(void)
/* Select regulator voltage output Scale 1 mode to support system
* frequencies up to 168 MHz.
*/
regval = getreg32(STM32L4_PWR_CR);
regval &= ~PWR_CR_VOS_MASK;
regval |= PWR_CR_VOS_SCALE_1;

View File

@ -54,6 +54,12 @@
#include "up_internal.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define PM_IDLE_DOMAIN 0 /* Revisit */
/****************************************************************************
* Private Data
****************************************************************************/
@ -149,10 +155,10 @@ void up_idle(void)
static enum pm_state_e state = PM_NORMAL;
enum pm_state_e newstate;
newstate = pm_checkstate();
newstate = pm_checkstate(PM_IDLE_DOMAIN);
if (newstate != state)
{
if (pm_changestate(newstate) == OK)
if (pm_changestate(PM_IDLE_DOMAIN, newstate) == OK)
{
state = newstate;
}