arch/arm/src/stm32: Use of inline function for I/O compensation causes too many issues. No just a plain callable function.

This commit is contained in:
Gregory Nutt
2018-07-16 09:05:53 -06:00
parent c1a2c55764
commit 871bface28
3 changed files with 73 additions and 60 deletions
+46 -14
View File
@@ -49,25 +49,15 @@
#include <nuttx/irq.h>
#include "up_arch.h"
#include "chip.h"
#include "stm32_syscfg.h"
#include "stm32_gpio.h"
#if defined(CONFIG_STM32_STM32L15XX) || defined(CONFIG_STM32_STM32F20XX) || \
defined(CONFIG_STM32_STM32F30XX) || defined(CONFIG_STM32_STM32F33XX) || \
defined(CONFIG_STM32_STM32F37XX) || defined(CONFIG_STM32_STM32F4XXX)
# include "chip/stm32_syscfg.h"
#endif
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
/* Base addresses for each GPIO block */
const uint32_t g_gpiobase[STM32_NGPIO_PORTS] =
@@ -788,3 +778,45 @@ bool stm32_gpioread(uint32_t pinset)
return 0;
}
/****************************************************************************
* Name: stm32_iocompensation
*
* Description:
* Enable I/O compensation.
*
* By default the I/O compensation cell is not used. However when the I/O
* output buffer speed is configured in 50 MHz or 100 MHz mode, it is
* recommended to use the compensation cell for slew rate control on I/O
* tf(IO)out)/tr(IO)out commutation to reduce the I/O noise on power supply.
*
* The I/O compensation cell can be used only when the supply voltage ranges
* from 2.4 to 3.6 V.
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
#ifdef CONFIG_STM32_HAVE_IOCOMPENSATION
void stm32_iocompensation(void)
{
#ifdef STM32_SYSCFG_CMPCR
/* Enable I/O Compensation. Writing '1' to the CMPCR power-down bit
* enables the I/O compensation cell.
*/
putreg32(SYSCFG_CMPCR_CMPPD, STM32_SYSCFG_CMPCR);
/* Wait for compensation cell to become ready */
while ((getreg32(STM32_SYSCFG_CMPCR) & SYSCFG_CMPCR_READY) == 0)
{
}
#endif
}
#endif
+26 -45
View File
@@ -51,9 +51,7 @@
#include <nuttx/irq.h>
#include "up_arch.h"
#include "chip.h"
#include "stm32_syscfg.h"
#if defined(CONFIG_STM32_STM32L15XX)
# include "chip/stm32l15xxx_gpio.h"
@@ -421,49 +419,6 @@ extern "C"
EXTERN const uint32_t g_gpiobase[STM32_NGPIO_PORTS];
/************************************************************************************
* Inline Functions
************************************************************************************/
/****************************************************************************
* Name: syscfg_iocompensation
*
* Description:
* Enable I/O compensation.
*
* By default the I/O compensation cell is not used. However when the I/O
* output buffer speed is configured in 50 MHz or 100 MHz mode, it is
* recommended to use the compensation cell for slew rate control on I/O
* tf(IO)out)/tr(IO)out commutation to reduce the I/O noise on power supply.
*
* The I/O compensation cell can be used only when the supply voltage ranges
* from 2.4 to 3.6 V.
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
static inline void syscfg_iocompensation(void)
{
#ifdef STM32_SYSCFG_CMPCR
/* Enable I/O Compensation. Writing '1' to the CMPCR power-down bit
* enables the I/O compensation cell.
*/
putreg32(SYSCFG_CMPCR_CMPPD, STM32_SYSCFG_CMPCR);
/* Wait for compensation cell to become ready */
while ((getreg32(STM32_SYSCFG_CMPCR) & SYSCFG_CMPCR_READY) == 0)
{
}
#endif
}
/************************************************************************************
* Public Function Prototypes
************************************************************************************/
@@ -526,6 +481,32 @@ void stm32_gpiowrite(uint32_t pinset, bool value);
bool stm32_gpioread(uint32_t pinset);
/************************************************************************************
* Name: stm32_iocompensation
*
* Description:
* Enable I/O compensation.
*
* By default the I/O compensation cell is not used. However when the I/O
* output buffer speed is configured in 50 MHz or 100 MHz mode, it is
* recommended to use the compensation cell for slew rate control on I/O
* tf(IO)out)/tr(IO)out commutation to reduce the I/O noise on power supply.
*
* The I/O compensation cell can be used only when the supply voltage ranges
* from 2.4 to 3.6 V.
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
************************************************************************************/
#ifdef CONFIG_STM32_HAVE_IOCOMPENSATION
void stm32_iocompensation(void);
#endif
/************************************************************************************
* Name: stm32_gpiosetevent
*
+1 -1
View File
@@ -202,7 +202,7 @@ void stm32_clockconfig(void)
#ifdef CONFIG_STM32_SYSCFG_IOCOMPENSATION
/* Enable I/O Compensation */
syscfg_iocompensation();
stm32_iocompensation();
#endif
/* Enable peripheral clocking */