arch/stm32f7: Fix nxstyle errors

arch/arm/src/stm32f7/stm32_qencoder.c,
arch/arm/src/stm32f7/stm32_rng.c,
arch/arm/src/stm32f7/stm32_rtc.c,
arch/arm/src/stm32f7/stm32_rtc.h,
arch/arm/src/stm32f7/stm32_rtc_lowerhalf.c,
arch/arm/src/stm32f7/stm32_sai.h,
arch/arm/src/stm32f7/stm32_sdmmc.h,
arch/arm/src/stm32f7/stm32_spi.h,
arch/arm/src/stm32f7/stm32_tim_lowerhalf.c,
arch/arm/src/stm32f7/stm32_uid.c,
arch/arm/src/stm32f7/stm32_userspace.c,
arch/arm/src/stm32f7/stm32_userspace.h,
arch/arm/src/stm32f7/stm32f72xx73xx_rcc.c,
arch/arm/src/stm32f7/stm32f76xx77xx_rcc.c:

    * Fix nxstyle errors.
This commit is contained in:
Nathan Hartman
2021-02-12 11:40:34 -05:00
committed by Xiang Xiao
parent 830ec0c371
commit 01248cae8d
14 changed files with 212 additions and 176 deletions
+79 -67
View File
@@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/stm32f7/stm32_qencoder.c
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
@@ -32,11 +32,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -61,11 +61,11 @@
#ifdef CONFIG_SENSORS_QENCODER
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* Timers ***************************************************************************/
/* Timers *******************************************************************/
#undef HAVE_32BIT_TIMERS
#undef HAVE_16BIT_TIMERS
@@ -101,7 +101,7 @@
# define HAVE_MIXEDWIDTH_TIMERS 1
#endif
/* Input filter *********************************************************************/
/* Input filter *************************************************************/
#ifdef CONFIG_STM32F7_QENCODER_FILTER
# if defined(CONFIG_STM32F7_QENCODER_SAMPLE_FDTS)
@@ -163,9 +163,11 @@
#define STM32_GPIO_INPUT_FLOAT (GPIO_INPUT | GPIO_FLOAT)
/* Debug ****************************************************************************/
/* Debug ********************************************************************/
/* Non-standard debug that may be enabled just for testing the quadrature encoder */
/* Non-standard debug that may be enabled just for testing the quadrature
* encoder
*/
#ifndef CONFIG_DEBUG_FEATURES
# undef CONFIG_DEBUG_SENSORS
@@ -181,9 +183,9 @@
# define qe_dumpgpio(p,m)
#endif
/************************************************************************************
/****************************************************************************
* Private Types
************************************************************************************/
****************************************************************************/
/* Constant configuration structure that is retained in FLASH */
@@ -228,16 +230,18 @@ struct stm32_lowerhalf_s
#endif
};
/************************************************************************************
/****************************************************************************
* Private Function Prototypes
************************************************************************************/
****************************************************************************/
/* Helper functions */
static uint16_t stm32_getreg16(FAR struct stm32_lowerhalf_s *priv, int offset);
static uint16_t stm32_getreg16(FAR struct stm32_lowerhalf_s *priv,
int offset);
static void stm32_putreg16(FAR struct stm32_lowerhalf_s *priv, int offset,
uint16_t value);
static uint32_t stm32_getreg32(FAR struct stm32_lowerhalf_s *priv, int offset);
static uint32_t stm32_getreg32(FAR struct stm32_lowerhalf_s *priv,
int offset);
static void stm32_putreg32(FAR struct stm32_lowerhalf_s *priv, int offset,
uint32_t value);
@@ -260,14 +264,15 @@ static int stm32_interrupt(int irq, FAR void *context, FAR void *arg);
static int stm32_setup(FAR struct qe_lowerhalf_s *lower);
static int stm32_shutdown(FAR struct qe_lowerhalf_s *lower);
static int stm32_position(FAR struct qe_lowerhalf_s *lower, FAR int32_t *pos);
static int stm32_position(FAR struct qe_lowerhalf_s *lower,
FAR int32_t *pos);
static int stm32_reset(FAR struct qe_lowerhalf_s *lower);
static int stm32_ioctl(FAR struct qe_lowerhalf_s *lower, int cmd,
unsigned long arg);
/************************************************************************************
/****************************************************************************
* Private Data
************************************************************************************/
****************************************************************************/
/* The lower half callback structure */
@@ -432,11 +437,11 @@ static struct stm32_lowerhalf_s g_tim8lower =
#endif
/************************************************************************************
/****************************************************************************
* Private Functions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Name: stm32_getreg16
*
* Description:
@@ -449,14 +454,14 @@ static struct stm32_lowerhalf_s g_tim8lower =
* Returned Value:
* The current contents of the specified register
*
************************************************************************************/
****************************************************************************/
static uint16_t stm32_getreg16(struct stm32_lowerhalf_s *priv, int offset)
{
return getreg16(priv->config->base + offset);
}
/************************************************************************************
/****************************************************************************
* Name: stm32_putreg16
*
* Description:
@@ -469,7 +474,7 @@ static uint16_t stm32_getreg16(struct stm32_lowerhalf_s *priv, int offset)
* Returned Value:
* None
*
************************************************************************************/
****************************************************************************/
static void stm32_putreg16(FAR struct stm32_lowerhalf_s *priv, int offset,
uint16_t value)
@@ -477,13 +482,13 @@ static void stm32_putreg16(FAR struct stm32_lowerhalf_s *priv, int offset,
putreg16(value, priv->config->base + offset);
}
/************************************************************************************
/****************************************************************************
* Name: stm32_getreg32
*
* Description:
* Read the value of a 32-bit timer register. This applies for the STM32 F7
* 32-bit registers (CNT, ARR, CRR1-4) in the 32-bit timers TIM2-5 (but works OK
* with the 16-bit TIM1,8 as well).
* Read the value of a 32-bit timer register. This applies for the STM32
* F7 32-bit registers (CNT, ARR, CRR1-4) in the 32-bit timers TIM2-5 (but
* works OK with the 16-bit TIM1,8 as well).
*
* Input Parameters:
* priv - A reference to the lower half status
@@ -492,20 +497,21 @@ static void stm32_putreg16(FAR struct stm32_lowerhalf_s *priv, int offset,
* Returned Value:
* The current contents of the specified register
*
************************************************************************************/
****************************************************************************/
static uint32_t stm32_getreg32(FAR struct stm32_lowerhalf_s *priv, int offset)
static uint32_t stm32_getreg32(FAR struct stm32_lowerhalf_s *priv,
int offset)
{
return getreg32(priv->config->base + offset);
}
/************************************************************************************
/****************************************************************************
* Name: stm32_putreg32
*
* Description:
* Write a value to a 32-bit timer register. This applies for the STM32 F7
* 32-bit registers (CNT, ARR, CRR1-4) in the 32-bit timers TIM2-5 (but works OK
* with the 16-bit TIM1,8 as well).
* 32-bit registers (CNT, ARR, CRR1-4) in the 32-bit timers TIM2-5 (but
* works OK with the 16-bit TIM1,8 as well).
*
* Input Parameters:
* priv - A reference to the lower half status
@@ -514,7 +520,7 @@ static uint32_t stm32_getreg32(FAR struct stm32_lowerhalf_s *priv, int offset)
* Returned Value:
* None
*
************************************************************************************/
****************************************************************************/
static void stm32_putreg32(FAR struct stm32_lowerhalf_s *priv, int offset,
uint32_t value)
@@ -580,13 +586,13 @@ static void stm32_dumpregs(FAR struct stm32_lowerhalf_s *priv,
}
#endif
/************************************************************************************
/****************************************************************************
* Name: stm32_tim2lower
*
* Description:
* Map a timer number to a device structure
*
************************************************************************************/
****************************************************************************/
static FAR struct stm32_lowerhalf_s *stm32_tim2lower(int tim)
{
@@ -621,14 +627,14 @@ static FAR struct stm32_lowerhalf_s *stm32_tim2lower(int tim)
}
}
/************************************************************************************
/****************************************************************************
* Name: stm32_interrupt
*
* Description:
* Common timer interrupt handling. NOTE: Only 16-bit timers require timer
* interrupts.
*
************************************************************************************/
****************************************************************************/
#ifdef HAVE_16BIT_TIMERS
static int stm32_interrupt(int irq, FAR void *context, FAR void *arg)
@@ -656,7 +662,7 @@ static int stm32_interrupt(int irq, FAR void *context, FAR void *arg)
{
priv->position -= (int32_t)0x00010000;
}
else
else
{
priv->position += (int32_t)0x00010000;
}
@@ -665,7 +671,7 @@ static int stm32_interrupt(int irq, FAR void *context, FAR void *arg)
}
#endif
/************************************************************************************
/****************************************************************************
* Name: stm32_setup
*
* Description:
@@ -673,7 +679,7 @@ static int stm32_interrupt(int irq, FAR void *context, FAR void *arg)
* should configure and initialize the device so that it is ready for use.
* The initial position value should be zero. *
*
************************************************************************************/
****************************************************************************/
static int stm32_setup(FAR struct qe_lowerhalf_s *lower)
{
@@ -696,8 +702,8 @@ static int stm32_setup(FAR struct qe_lowerhalf_s *lower)
cr1 = stm32_getreg16(priv, STM32_GTIM_CR1_OFFSET);
/* Clear the direction bit (0=count up) and select the Counter Mode (0=Edge aligned)
* (Timers 2-5 and 1-8 only)
/* Clear the direction bit (0=count up) and select the Counter Mode
* (0=Edge aligned) (Timers 2-5 and 1-8 only)
*/
cr1 &= ~(GTIM_CR1_DIR | GTIM_CR1_CMS_MASK);
@@ -760,6 +766,7 @@ static int stm32_setup(FAR struct qe_lowerhalf_s *lower)
stm32_putreg32(priv, STM32_GTIM_SMCR_OFFSET, smcr);
/* TI1 Channel Configuration */
/* Disable the Channel 1: Reset the CC1E Bit */
ccer = stm32_getreg16(priv, STM32_GTIM_CCER_OFFSET);
@@ -795,6 +802,7 @@ static int stm32_setup(FAR struct qe_lowerhalf_s *lower)
stm32_putreg32(priv, STM32_GTIM_CCMR1_OFFSET, ccmr1);
/* TI2 Channel Configuration */
/* Disable the Channel 2: Reset the CC2E Bit */
ccer = stm32_getreg16(priv, STM32_GTIM_CCER_OFFSET);
@@ -899,15 +907,15 @@ static int stm32_setup(FAR struct qe_lowerhalf_s *lower)
return OK;
}
/************************************************************************************
/****************************************************************************
* Name: stm32_shutdown
*
* Description:
* This method is called when the driver is closed. The lower half driver
* should stop data collection, free any resources, disable timer hardware, and
* put the system into the lowest possible power usage state *
* should stop data collection, free any resources, disable timer hardware,
* and put the system into the lowest possible power usage state *
*
************************************************************************************/
****************************************************************************/
static int stm32_shutdown(FAR struct qe_lowerhalf_s *lower)
{
@@ -1015,13 +1023,13 @@ static int stm32_shutdown(FAR struct qe_lowerhalf_s *lower)
return OK;
}
/************************************************************************************
/****************************************************************************
* Name: stm32_position
*
* Description:
* Return the current position measurement.
*
************************************************************************************/
****************************************************************************/
static int stm32_position(FAR struct qe_lowerhalf_s *lower, FAR int32_t *pos)
{
@@ -1037,8 +1045,8 @@ static int stm32_position(FAR struct qe_lowerhalf_s *lower, FAR int32_t *pos)
do
{
/* Don't let another task preempt us until we get the measurement. The timer
* interrupt may still be processed
/* Don't let another task preempt us until we get the measurement.
* The timer interrupt may still be processed.
*/
sched_lock();
@@ -1060,13 +1068,13 @@ static int stm32_position(FAR struct qe_lowerhalf_s *lower, FAR int32_t *pos)
return OK;
}
/************************************************************************************
/****************************************************************************
* Name: stm32_reset
*
* Description:
* Reset the position measurement to zero.
*
************************************************************************************/
****************************************************************************/
static int stm32_reset(FAR struct qe_lowerhalf_s *lower)
{
@@ -1077,8 +1085,8 @@ static int stm32_reset(FAR struct qe_lowerhalf_s *lower)
sninfo("Resetting position to zero\n");
DEBUGASSERT(lower && priv->inuse);
/* Reset the timer and the counter. Interrupts are disabled to make this atomic
* (if possible)
/* Reset the timer and the counter. Interrupts are disabled to make this
* atomic (if possible)
*/
flags = enter_critical_section();
@@ -1096,15 +1104,16 @@ static int stm32_reset(FAR struct qe_lowerhalf_s *lower)
return OK;
}
/************************************************************************************
/****************************************************************************
* Name: stm32_ioctl
*
* Description:
* Lower-half logic may support platform-specific ioctl commands
*
************************************************************************************/
****************************************************************************/
static int stm32_ioctl(FAR struct qe_lowerhalf_s *lower, int cmd, unsigned long arg)
static int stm32_ioctl(FAR struct qe_lowerhalf_s *lower, int cmd,
unsigned long arg)
{
/* No ioctl commands supported */
@@ -1113,32 +1122,35 @@ static int stm32_ioctl(FAR struct qe_lowerhalf_s *lower, int cmd, unsigned long
return -ENOTTY;
}
/************************************************************************************
/****************************************************************************
* Public Functions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Name: stm32_qeinitialize
*
* Description:
* Initialize a quadrature encoder interface. This function must be called from
* board-specific logic.
* Initialize a quadrature encoder interface. This function must be
* called from board-specific logic.
*
* Input Parameters:
* devpath - The full path to the driver to register. E.g., "/dev/qe0"
* tim - The timer number to used. 'tim' must be an element of {1,2,3,4,5,8}
* tim - The timer number to used. 'tim' must be an element of
* {1,2,3,4,5,8}
*
* Returned Value:
* Zero on success; A negated errno value is returned on failure.
*
************************************************************************************/
****************************************************************************/
int stm32_qeinitialize(FAR const char *devpath, int tim)
{
FAR struct stm32_lowerhalf_s *priv;
int ret;
/* Find the pre-allocated timer state structure corresponding to this timer */
/* Find the pre-allocated timer state structure corresponding to this
* timer
*/
priv = stm32_tim2lower(tim);
if (!priv)
+4 -3
View File
@@ -211,9 +211,10 @@ static int stm32_rnginterrupt(int irq, void *context, FAR void *arg)
/* As required by the FIPS PUB (Federal Information Processing Standard
* Publication) 140-2, the first random number generated after setting the
* RNGEN bit should not be used, but saved for comparison with the next
* generated random number. Each subsequent generated random number has to be
* compared with the previously generated number. The test fails if any two
* compared numbers are equal (continuous random number generator test).
* generated random number. Each subsequent generated random number has to
* be compared with the previously generated number. The test fails if any
* two compared numbers are equal (continuous random number generator
* test).
*/
if (g_rngdev.rd_first)
+10 -5
View File
@@ -860,16 +860,20 @@ static int stm32_rtc_getalarmdatetime(rtc_alarmreg_t reg, FAR struct tm *tp)
* ranges of values correspond between struct tm and the time register.
*/
tmp = (data & (RTC_ALRMR_SU_MASK | RTC_ALRMR_ST_MASK)) >> RTC_ALRMR_SU_SHIFT;
tmp = (data & (RTC_ALRMR_SU_MASK | RTC_ALRMR_ST_MASK)) >>
RTC_ALRMR_SU_SHIFT;
tp->tm_sec = rtc_bcd2bin(tmp);
tmp = (data & (RTC_ALRMR_MNU_MASK | RTC_ALRMR_MNT_MASK)) >> RTC_ALRMR_MNU_SHIFT;
tmp = (data & (RTC_ALRMR_MNU_MASK | RTC_ALRMR_MNT_MASK)) >>
RTC_ALRMR_MNU_SHIFT;
tp->tm_min = rtc_bcd2bin(tmp);
tmp = (data & (RTC_ALRMR_HU_MASK | RTC_ALRMR_HT_MASK)) >> RTC_ALRMR_HU_SHIFT;
tmp = (data & (RTC_ALRMR_HU_MASK | RTC_ALRMR_HT_MASK)) >>
RTC_ALRMR_HU_SHIFT;
tp->tm_hour = rtc_bcd2bin(tmp);
tmp = (data & (RTC_ALRMR_DU_MASK | RTC_ALRMR_DT_MASK)) >> RTC_ALRMR_DU_SHIFT;
tmp = (data & (RTC_ALRMR_DU_MASK | RTC_ALRMR_DT_MASK)) >>
RTC_ALRMR_DU_SHIFT;
tp->tm_mday = rtc_bcd2bin(tmp);
return OK;
@@ -1790,7 +1794,8 @@ int stm32_rtc_setperiodic(FAR const struct timespec *period,
#elif defined(CONFIG_STM32F7_RTC_LSICLOCK)
# error "Periodic wakeup not available for LSI (and it is too inaccurate!)"
#elif defined(CONFIG_STM32F7_RTC_LSECLOCK)
const uint32_t rtc_div16_max_msecs = 16 * 1000 * 0xffffu / STM32_LSE_FREQUENCY;
const uint32_t rtc_div16_max_msecs = 16 * 1000 * 0xffffu /
STM32_LSE_FREQUENCY;
#else
# error "No clock for RTC!"
#endif
+6 -5
View File
@@ -4,7 +4,8 @@
* Copyright (C) 2011 Uros Platise. All rights reserved.
* Copyright (C) 2011-2013, 2015-2018 Gregory Nutt. All rights reserved.
* Authors: Uros Platise <uros.platise@isotel.eu> (Original for the F1)
* Gregory Nutt <gnutt@nuttx.org> (On-going support and development)
* Gregory Nutt <gnutt@nuttx.org> (On-going support and
* development)
* David Sidrane <david_s5@nscdg.com>
*
* Redistribution and use in source and binary forms, with or without
@@ -47,9 +48,9 @@
#include "chip.h"
/* The STMF7 family use a more traditional Realtime Clock/Calendar (RTCC) with
* broken-out data/time in BCD format. The backup registers are integrated into
* the RTCC in these families.
/* The STMF7 family use a more traditional Realtime Clock/Calendar (RTCC)
* with broken-out data/time in BCD format. The backup registers are
* integrated into the RTCC in these families.
*/
#include "hardware/stm32_rtcc.h"
@@ -98,7 +99,7 @@ extern "C"
#endif
/****************************************************************************
* Public Functions
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
+8 -5
View File
@@ -121,7 +121,8 @@ static bool stm32_havesettime(FAR struct rtc_lowerhalf_s *lower);
static int stm32_setalarm(FAR struct rtc_lowerhalf_s *lower,
FAR const struct lower_setalarm_s *alarminfo);
static int stm32_setrelative(FAR struct rtc_lowerhalf_s *lower,
FAR const struct lower_setrelative_s *alarminfo);
FAR const struct lower_setrelative_s
*alarminfo);
static int stm32_cancelalarm(FAR struct rtc_lowerhalf_s *lower,
int alarmid);
static int stm32_rdalarm(FAR struct rtc_lowerhalf_s *lower,
@@ -130,13 +131,15 @@ static int stm32_rdalarm(FAR struct rtc_lowerhalf_s *lower,
#ifdef CONFIG_RTC_PERIODIC
static int stm32_setperiodic(FAR struct rtc_lowerhalf_s *lower,
FAR const struct lower_setperiodic_s *alarminfo);
FAR const struct lower_setperiodic_s
*alarminfo);
static int stm32_cancelperiodic(FAR struct rtc_lowerhalf_s *lower, int id);
#endif
/****************************************************************************
* Private Data
****************************************************************************/
/* STM32 RTC driver operations */
static const struct rtc_ops_s g_rtc_ops =
@@ -248,9 +251,9 @@ static int stm32_rdtime(FAR struct rtc_lowerhalf_s *lower,
ret = nxsem_wait(&priv->devsem);
if (ret < 0)
{
return ret;
}
{
return ret;
}
#if defined(CONFIG_RTC_DATETIME)
/* This operation depends on the fact that struct rtc_time is cast
+8 -8
View File
@@ -1,4 +1,4 @@
/******************************************************************************
/****************************************************************************
* arch/arm/src/stm32f7/stm32_sai.h
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
@@ -31,14 +31,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_STM32F7_STM32_SAI_H
#define __ARCH_ARM_SRC_STM32F7_STM32_SAI_H
/******************************************************************************
/****************************************************************************
* Included Files
******************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -47,18 +47,18 @@
#include <nuttx/audio/i2s.h>
/******************************************************************************
/****************************************************************************
* Pre-processor definitions
******************************************************************************/
****************************************************************************/
#define SAI1_BLOCK_A 0
#define SAI1_BLOCK_B 1
#define SAI2_BLOCK_A 2
#define SAI2_BLOCK_B 3
/******************************************************************************
/****************************************************************************
* Public Function Prototypes
******************************************************************************/
****************************************************************************/
#ifndef __ASSEMBLY__
#ifdef __cplusplus
+9 -9
View File
@@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/stm32f7/stm32_sdmmc.h
*
* Copyright (C) 2009, 2011, 2016 Gregory Nutt. All rights reserved.
@@ -31,14 +31,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_STM32F7_STM32_SDMMC_H
#define __ARCH_ARM_SRC_STM32F7_STM32_SDMMC_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
@@ -47,10 +47,9 @@
#include "chip.h"
#include "hardware/stm32_sdmmc.h"
/************************************************************************************
* Public Functions
************************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifndef __ASSEMBLY__
@@ -73,7 +72,8 @@ extern "C"
* slotno - Not used.
*
* Returned Value:
* A reference to an SDIO interface structure. NULL is returned on failures.
* A reference to an SDIO interface structure. NULL is returned on
* failures.
*
****************************************************************************/
+50 -42
View File
@@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/stm32f7/stm32_spi.h
*
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
@@ -32,14 +32,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_STM32F7_STM32_SPI_H
#define __ARCH_ARM_SRC_STM32F7_STM32_SPI_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -48,9 +48,9 @@
#include "chip.h"
#include "hardware/stm32_spi.h"
/************************************************************************************
* Public Functions
************************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifndef __ASSEMBLY__
@@ -65,7 +65,7 @@ extern "C"
struct spi_dev_s; /* Forward reference */
/************************************************************************************
/****************************************************************************
* Name: stm32_spibus_initialize
*
* Description:
@@ -77,84 +77,92 @@ struct spi_dev_s; /* Forward reference */
* Returned Value:
* Valid SPI device structure reference on success; a NULL on failure
*
************************************************************************************/
****************************************************************************/
FAR struct spi_dev_s *stm32_spibus_initialize(int bus);
/************************************************************************************
/****************************************************************************
* Name: stm32_spi1/2/...select and stm32_spi1/2/...status
*
* Description:
* The external functions, stm32_spi1/2/...select, stm32_spi1/2/...status, and
* stm32_spi1/2/...cmddata must be provided by board-specific logic. These are
* implementations of the select, status, and cmddata methods of the SPI interface
* defined by struct spi_ops_s (see include/nuttx/spi/spi.h). All other methods
* (including stm32_spibus_initialize()) are provided by common STM32 logic. To use this
* common SPI logic on your board:
* The external functions, stm32_spi1/2/...select, stm32_spi1/2/...status,
* and stm32_spi1/2/...cmddata must be provided by board-specific logic.
* These are implementations of the select, status, and cmddata methods of
* the SPI interface defined by struct spi_ops_s (see
* include/nuttx/spi/spi.h). All other methods (including
* stm32_spibus_initialize()) are provided by common STM32 logic. To use
* this common SPI logic on your board:
*
* 1. Provide logic in stm32_boardinitialize() to configure SPI chip select
* pins.
* 2. Provide stm32_spi1/2/...select() and stm32_spi1/2/...status() functions in your
* board-specific logic. These functions will perform chip selection and
* status operations using GPIOs in the way your board is configured.
* 3. If CONFIG_SPI_CMDDATA is defined in your NuttX configuration file, then
* provide stm32_spi1/2/...cmddata() functions in your board-specific logic.
* These functions will perform cmd/data selection operations using GPIOs in the
* way your board is configured.
* 4. Add a calls to stm32_spibus_initialize() in your low level application
* initialization logic
* 5. The handle returned by stm32_spibus_initialize() may then be used to bind the
* SPI driver to higher level logic (e.g., calling
* 1. Provide logic in stm32_boardinitialize() to configure SPI chip
* select pins.
* 2. Provide stm32_spi1/2/...select() and stm32_spi1/2/...status()
* functions in your board-specific logic. These functions will
* perform chip selection and status operations using GPIOs in the way
* your board is configured.
* 3. If CONFIG_SPI_CMDDATA is defined in your NuttX configuration file,
* then provide stm32_spi1/2/...cmddata() functions in your board-
* specific logic. These functions will perform cmd/data selection
* operations using GPIOs in the way your board is configured.
* 4. Add a calls to stm32_spibus_initialize() in your low level
* application initialization logic
* 5. The handle returned by stm32_spibus_initialize() may then be used to
* bind the SPI driver to higher level logic (e.g., calling
* mmcsd_spislotinitialize(), for example, will bind the SPI driver to
* the SPI MMC/SD driver).
*
************************************************************************************/
****************************************************************************/
#ifdef CONFIG_STM32F7_SPI1
void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
void stm32_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, uint32_t devid);
int stm32_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_STM32F7_SPI2
void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
void stm32_spi2select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, uint32_t devid);
int stm32_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_STM32F7_SPI3
void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
void stm32_spi3select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, uint32_t devid);
int stm32_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_STM32F7_SPI4
void stm32_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
void stm32_spi4select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
uint8_t stm32_spi4status(FAR struct spi_dev_s *dev, uint32_t devid);
int stm32_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_STM32F7_SPI5
void stm32_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
void stm32_spi5select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
uint8_t stm32_spi5status(FAR struct spi_dev_s *dev, uint32_t devid);
int stm32_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_STM32F7_SPI6
void stm32_spi6select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
void stm32_spi6select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
uint8_t stm32_spi6status(FAR struct spi_dev_s *dev, uint32_t devid);
int stm32_spi6cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
/************************************************************************************
/****************************************************************************
* Name: stm32_spi1/2/...register
*
* Description:
* If the board supports a card detect callback to inform the SPI-based MMC/SD
* driver when an SD card is inserted or removed, then CONFIG_SPI_CALLBACK should
* be defined and the following function(s) must be implemented. These functions
* implements the registercallback method of the SPI interface (see
* include/nuttx/spi/spi.h for details)
* If the board supports a card detect callback to inform the SPI-based
* MMC/SD driver when an SD card is inserted or removed, then
* CONFIG_SPI_CALLBACK should be defined and the following function(s)
* must be implemented. These functions implements the registercallback
* method of the SPI interface (see include/nuttx/spi/spi.h for details)
*
* Input Parameters:
* dev - Device-specific state data
+9 -9
View File
@@ -300,8 +300,8 @@ static int stm32_timer_handler(int irq, void * context, void * arg)
* Start the timer, resetting the time to the current timeout,
*
* Input Parameters:
* lower - A pointer the publicly visible representation of the "lower-half"
* driver state structure.
* lower - A pointer the publicly visible representation of the
* "lower-half" driver state structure.
*
* Returned Value:
* Zero on success; a negated errno value on failure.
@@ -338,8 +338,8 @@ static int stm32_start(FAR struct timer_lowerhalf_s *lower)
* Stop the timer
*
* Input Parameters:
* lower - A pointer the publicly visible representation of the "lower-half"
* driver state structure.
* lower - A pointer the publicly visible representation of the
* "lower-half" driver state structure.
*
* Returned Value:
* Zero on success; a negated errno value on failure.
@@ -414,12 +414,12 @@ static int stm32_settimeout(FAR struct timer_lowerhalf_s *lower,
* Call this user provided timeout callback.
*
* Input Parameters:
* lower - A pointer the publicly visible representation of the "lower-
* half" driver state structure.
* lower - A pointer the publicly visible representation of the
* "lower-half" driver state structure.
* callback - The new timer expiration function pointer. If this
* function pointer is NULL, then the reset-on-expiration
* behavior is restored,
* arg - Argument that will be provided in the callback
* function pointer is NULL, then the reset-on-expiration
* behavior is restored,
* arg - Argument that will be provided in the callback.
*
* Returned Value:
* The previous timer expiration function pointer or NULL is there was
+7 -7
View File
@@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/stm32/stm32_uid.c
*
* Copyright (C) 2015 Marawan Ragab. All rights reserved.
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -45,9 +45,9 @@
#ifdef STM32_SYSMEM_UID
/************************************************************************************
/****************************************************************************
* Public Functions
************************************************************************************/
****************************************************************************/
void stm32_get_uniqueid(uint8_t uniqueid[12])
{
@@ -55,7 +55,7 @@ void stm32_get_uniqueid(uint8_t uniqueid[12])
for (i = 0; i < 12; i++)
{
uniqueid[i] = *((uint8_t*)(STM32_SYSMEM_UID)+i);
uniqueid[i] = *((uint8_t *)(STM32_SYSMEM_UID) + i);
}
}
+4
View File
@@ -49,6 +49,10 @@
#ifdef CONFIG_BUILD_PROTECTED
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: stm32_userspace
*
+14 -14
View File
@@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/stm32f7/stm32_userspace.h
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
@@ -31,14 +31,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_STM32F7_STM32_USERSPACE_H
#define __ARCH_ARM_SRC_STM32F7_STM32_USERSPACE_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
@@ -50,23 +50,23 @@
#include "arm_internal.h"
#include "chip.h"
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Public Types
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Inline Functions
************************************************************************************/
****************************************************************************/
#ifndef __ASSEMBLY__
/************************************************************************************
/****************************************************************************
* Public Data
************************************************************************************/
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
@@ -77,9 +77,9 @@ extern "C"
#define EXTERN extern
#endif
/************************************************************************************
/****************************************************************************
* Public Function Prototypes
************************************************************************************/
****************************************************************************/
/****************************************************************************
* Name: stm32_userspace
+2 -1
View File
@@ -860,7 +860,8 @@ static void stm32_stdclockconfig(void)
/* Wait until the PLL source is used as the system clock source */
while ((getreg32(STM32_RCC_CFGR) & RCC_CFGR_SWS_MASK) != RCC_CFGR_SWS_PLL)
while ((getreg32(STM32_RCC_CFGR) & RCC_CFGR_SWS_MASK) !=
RCC_CFGR_SWS_PLL)
{
}
+2 -1
View File
@@ -874,7 +874,8 @@ static void stm32_stdclockconfig(void)
/* Wait until the PLL source is used as the system clock source */
while ((getreg32(STM32_RCC_CFGR) & RCC_CFGR_SWS_MASK) != RCC_CFGR_SWS_PLL)
while ((getreg32(STM32_RCC_CFGR) & RCC_CFGR_SWS_MASK) !=
RCC_CFGR_SWS_PLL)
{
}