diff --git a/arch/arm/src/stm32f7/stm32_config.h b/arch/arm/src/stm32f7/stm32_config.h index d26fee87139..62d71958d3c 100644 --- a/arch/arm/src/stm32f7/stm32_config.h +++ b/arch/arm/src/stm32f7/stm32_config.h @@ -48,6 +48,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* GPIO IRQs ****************************************************************/ #ifndef CONFIG_STM32F7_GPIO_IRQ @@ -75,6 +76,7 @@ #endif /* UARTs ********************************************************************/ + /* Don't enable UARTs not supported by the chip. */ #if STM32F7_NUART < 1 @@ -109,6 +111,7 @@ #endif /* USARTs *******************************************************************/ + /* If the USART is not being used as a UART, then it really isn't enabled * for our purposes. */ @@ -145,6 +148,7 @@ #endif /* UART Flow Control ********************************************************/ + /* UARTs do not support flow control */ #undef CONFIG_UART0_IFLOWCONTROL @@ -164,8 +168,11 @@ #endif /* Serial Console ***********************************************************/ -/* Is there a serial console? There should be no more than one defined. It - * could be on any UARTn, n=1,..,STM32F7_NUART, or USARTn, n=1,.., STM32F7_NUSART + +/* Is there a serial console? There should be no more than one defined. + * It could be on any: + * UARTn, n=1..STM32F7_NUART, or + * USARTn, n=1..STM32F7_NUSART */ #undef HAVE_SERIAL_CONSOLE @@ -252,7 +259,8 @@ # undef CONFIG_USART2_SERIAL_CONSOLE #endif -/* SPI ******************************************************************************/ +/* SPI **********************************************************************/ + /* Don't enable SPI peripherals not supported by the chip. */ #if CHIP_NSPI < 1 @@ -286,7 +294,7 @@ ****************************************************************************/ /**************************************************************************** - * Public Functions + * Public Function Prototypes ****************************************************************************/ #endif /* __ARCH_ARM_SRC_STM32F7_STM32_CONFIG_H */ diff --git a/arch/arm/src/stm32f7/stm32_dma.h b/arch/arm/src/stm32f7/stm32_dma.h index 20e52db04ef..67b52ba9771 100644 --- a/arch/arm/src/stm32f7/stm32_dma.h +++ b/arch/arm/src/stm32f7/stm32_dma.h @@ -1,4 +1,4 @@ -/************************************************************************************ +/**************************************************************************** * arch/arm/src/stm32f7/stm32_dma.h * * Copyright (C) 2015 Gregory Nutt. All rights reserved. @@ -31,22 +31,22 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ #ifndef __ARCH_ARM_SRC_STM32F7_STM32_DMA_H #define __ARCH_ARM_SRC_STM32F7_STM32_DMA_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include #include "hardware/stm32_dma.h" -/* These definitions provide the bit encoding of the 'status' parameter passed to the - * DMA callback function (see dma_callback_t). +/* These definitions provide the bit encoding of the 'status' parameter + * passed to the DMA callback function (see dma_callback_t). */ #define DMA_STATUS_FEIF 0 /* Stream FIFO error (ignored) */ @@ -55,14 +55,14 @@ #define DMA_STATUS_HTIF DMA_STREAM_HTIF_BIT /* Stream Half Transfer */ #define DMA_STATUS_TCIF DMA_STREAM_TCIF_BIT /* Stream Transfer Complete */ -#define DMA_STATUS_ERROR (DMA_STATUS_FEIF|DMA_STATUS_DMEIF|DMA_STATUS_TEIF) -#define DMA_STATUS_SUCCESS (DMA_STATUS_TCIF|DMA_STATUS_HTIF) +#define DMA_STATUS_ERROR (DMA_STATUS_FEIF | DMA_STATUS_DMEIF | DMA_STATUS_TEIF) +#define DMA_STATUS_SUCCESS (DMA_STATUS_TCIF | DMA_STATUS_HTIF) -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ -/* DMA_HANDLE Provides an opaque are reference that can be used to represent a DMA +/* DMA_HANDLE Provides an opaque are reference that can be used to represent * a DMA stream. */ @@ -70,16 +70,16 @@ typedef FAR void *DMA_HANDLE; /* Description: * This is the type of the callback that is used to inform the user of the - * completion of the DMA. NOTE: The DMA module does *NOT* perform any cache - * operations. It is the responsibility of the DMA client to invalidate DMA - * buffers after completion of the DMA RX operations. + * completion of the DMA. NOTE: The DMA module does *NOT* perform any + * cache operations. It is the responsibility of the DMA client to + * invalidate DMA buffers after completion of the DMA RX operations. * * Input Parameters: * handle - Refers tot he DMA channel or stream - * status - A bit encoded value that provides the completion status. See the - * DMASTATUS_* definitions above. - * arg - A user-provided value that was provided when stm32_dmastart() was - * called. + * status - A bit encoded value that provides the completion status. See + * the DMASTATUS_* definitions above. + * arg - A user-provided value that was provided when stm32_dmastart() + * was called. */ typedef void (*dma_callback_t)(DMA_HANDLE handle, uint8_t status, void *arg); @@ -96,9 +96,9 @@ struct stm32_dmaregs_s uint32_t sfcr; }; -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ @@ -111,9 +111,9 @@ extern "C" #define EXTERN extern #endif -/************************************************************************************ - * Public Functions - ************************************************************************************/ +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ /**************************************************************************** * Name: stm32_dmachannel @@ -158,11 +158,13 @@ DMA_HANDLE stm32_dmachannel(unsigned int chan); * Name: stm32_dmafree * * Description: - * Release a DMA channel. If another thread is waiting for this DMA channel - * in a call to stm32_dmachannel, then this function will re-assign the - * DMA channel to that thread and wake it up. NOTE: The 'handle' used - * in this argument must NEVER be used again until stm32_dmachannel() is - * called again to re-gain access to the channel. + * Release a DMA channel. If another thread is waiting for this DMA + * channel in a call to stm32_dmachannel, then this function will re- + * assign the DMA channel to that thread and wake it up. + * + * NOTE: The 'handle' used in this argument must NEVER be used again + * until stm32_dmachannel() is called again to re-gain access to + * the channel. * * Returned Value: * None @@ -237,15 +239,15 @@ size_t stm32_dmaresidual(DMA_HANDLE handle); * Description: * Check if the DMA controller can transfer data to/from given memory * address with the given configuration. This depends on the internal - * connections in the ARM bus matrix of the processor. Note that this - * only applies to memory addresses, it will return false for any peripheral + * connections in the ARM bus matrix of the processor. Note that this only + * applies to memory addresses, it will return false for any peripheral * address. * * Input Parameters: * * maddr - starting memory address - * count - number of unit8 or uint16 or uint32 items as defined by MSIZE of - * ccr. + * count - number of unit8 or uint16 or uint32 items as defined by MSIZE + * of ccr. * ccr - DMA stream configuration register * * Returned Value: diff --git a/arch/arm/src/stm32f7/stm32_dma2d.h b/arch/arm/src/stm32f7/stm32_dma2d.h index 0400b093913..2733ae732f2 100644 --- a/arch/arm/src/stm32f7/stm32_dma2d.h +++ b/arch/arm/src/stm32f7/stm32_dma2d.h @@ -85,9 +85,8 @@ struct dma2d_layer_s /* Name: fillcolor * * Description: - * Fill a specific memory region with a color. - * The caller must ensure that the memory region (area) is within the entire - * overlay. + * Fill a specific memory region with a color. The caller must ensure + * that the memory region (area) is within the entire overlay. * * Parameter: * oinfo - Reference to overlay information @@ -106,9 +105,9 @@ struct dma2d_layer_s * * Description: * Copies memory from a source overlay (defined by sarea) to destination - * overlay position (defined by destxpos and destypos) without pixelformat - * conversion. The caller must ensure that the memory region (area) is - * within the entire overlay. + * overlay position (defined by destxpos and destypos) without + * pixelformat conversion. The caller must ensure that the memory region + * (area) is within the entire overlay. * * Parameter: * doverlay - Reference destination overlay @@ -159,7 +158,7 @@ struct dma2d_layer_s }; /**************************************************************************** - * Public Functions + * Public Function Prototypes ****************************************************************************/ /**************************************************************************** diff --git a/arch/arm/src/stm32f7/stm32_dtcm.h b/arch/arm/src/stm32f7/stm32_dtcm.h index e7532add151..e38ef1cdcd1 100644 --- a/arch/arm/src/stm32f7/stm32_dtcm.h +++ b/arch/arm/src/stm32f7/stm32_dtcm.h @@ -49,7 +49,9 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ + /* Assume that we can support the DTCM heap */ #define HAVE_DTCM_HEAP 1 diff --git a/arch/arm/src/stm32f7/stm32_dumpgpio.c b/arch/arm/src/stm32f7/stm32_dumpgpio.c index bb9c66fc6c0..b0f1a764dd2 100644 --- a/arch/arm/src/stm32f7/stm32_dumpgpio.c +++ b/arch/arm/src/stm32f7/stm32_dumpgpio.c @@ -65,6 +65,7 @@ /**************************************************************************** * Private Data ****************************************************************************/ + /* Port letters for prettier debug output */ static const char g_portchar[STM32F7_NGPIO] = diff --git a/arch/arm/src/stm32f7/stm32_ethernet.h b/arch/arm/src/stm32f7/stm32_ethernet.h index 2e0a1f4358a..0b6d876bc3a 100644 --- a/arch/arm/src/stm32f7/stm32_ethernet.h +++ b/arch/arm/src/stm32f7/stm32_ethernet.h @@ -1,4 +1,4 @@ -/************************************************************************************ +/**************************************************************************** * arch/arm/src/stm32f7/stm32_ethernet.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_ETHERNET_H #define __ARCH_ARM_SRC_STM32F7_STM32_ETHERNET_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -47,9 +47,9 @@ #if STM32F7_NETHERNET > 0 #ifndef __ASSEMBLY__ -/************************************************************************************ - * Public Functions - ************************************************************************************/ +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -60,38 +60,40 @@ extern "C" #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Function: stm32_ethinitialize * * Description: - * Initialize the Ethernet driver for one interface. If the STM32 chip supports - * multiple Ethernet controllers, then board specific logic must implement - * arm_netinitialize() and call this function to initialize the desired interfaces. + * Initialize the Ethernet driver for one interface. If the STM32 chip + * supports multiple Ethernet controllers, then board specific logic must + * implement arm_netinitialize() and call this function to initialize the + * desired interfaces. * * Input Parameters: - * intf - In the case where there are multiple EMACs, this value identifies which - * EMAC is to be initialized. + * intf - In the case where there are multiple EMACs, this value + * identifies which EMAC is to be initialized. * * Returned Value: * OK on success; Negated errno on failure. * * Assumptions: * - ************************************************************************************/ + ****************************************************************************/ #if STM32F7_NETHERNET > 1 || defined(CONFIG_NETDEV_LATEINIT) int stm32_ethinitialize(int intf); #endif -/************************************************************************************ +/**************************************************************************** * Function: stm32_phy_boardinitialize * * Description: - * Some boards require specialized initialization of the PHY before it can be used. - * This may include such things as configuring GPIOs, resetting the PHY, etc. If - * CONFIG_STM32F7_PHYINIT is defined in the configuration then the board specific - * logic must provide stm32_phyinitialize(); The STM32 Ethernet driver will call - * this function one time before it first uses the PHY. + * Some boards require specialized initialization of the PHY before it can + * be used. This may include such things as configuring GPIOs, resetting + * the PHY, etc. If CONFIG_STM32F7_PHYINIT is defined in the + * configuration then the board specific logic must provide + * stm32_phyinitialize(); The STM32 Ethernet driver will call this + * function one time before it first uses the PHY. * * Input Parameters: * intf - Always zero for now. @@ -101,7 +103,7 @@ int stm32_ethinitialize(int intf); * * Assumptions: * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_STM32F7_PHYINIT int stm32_phy_boardinitialize(int intf); diff --git a/arch/arm/src/stm32f7/stm32_gpio.c b/arch/arm/src/stm32f7/stm32_gpio.c index 9d61e0a1ce4..9c25100a387 100644 --- a/arch/arm/src/stm32f7/stm32_gpio.c +++ b/arch/arm/src/stm32f7/stm32_gpio.c @@ -64,6 +64,7 @@ /**************************************************************************** * Public Data ****************************************************************************/ + /* Base addresses for each GPIO block */ const uint32_t g_gpiobase[STM32F7_NGPIO] = @@ -164,7 +165,10 @@ int stm32_configgpio(uint32_t cfgset) break; case GPIO_OUTPUT: /* General purpose output mode */ - stm32_gpiowrite(cfgset, (cfgset & GPIO_OUTPUT_SET) != 0); /* Set the initial output value */ + + /* Set the initial output value */ + + stm32_gpiowrite(cfgset, (cfgset & GPIO_OUTPUT_SET) != 0); pinmode = GPIO_MODER_OUTPUT; break; @@ -294,18 +298,22 @@ int stm32_configgpio(uint32_t cfgset) putreg32(regval, base + STM32_GPIO_OTYPER_OFFSET); - /* Otherwise, it is an input pin. Should it configured as an EXTI interrupt? */ + /* Otherwise, it is an input pin. Should it configured as an EXTI + * interrupt? + */ if (pinmode != GPIO_MODER_OUTPUT && (cfgset & GPIO_EXTI) != 0) { - /* "In STM32 F1 the selection of the EXTI line source is performed through - * the EXTIx bits in the AFIO_EXTICRx registers, while in F2 series this - * selection is done through the EXTIx bits in the SYSCFG_EXTICRx registers. + /* "In STM32 F1 the selection of the EXTI line source is performed + * through the EXTIx bits in the AFIO_EXTICRx registers, while in F2 + * series this selection is done through the EXTIx bits in the + * SYSCFG_EXTICRx registers. * - * "Only the mapping of the EXTICRx registers has been changed, without any - * changes to the meaning of the EXTIx bits. However, the range of EXTI - * bits values has been extended to 0b1000 to support the two ports added - * in F2, port H and I (in F1 series the maximum value is 0b0110)." + * "Only the mapping of the EXTICRx registers has been changed, + * without any changes to the meaning of the EXTIx bits. However, the + * range of EXTI bits values has been extended to 0b1000 to support + * the two ports added in F2, port H and I (in F1 series the maximum + * value is 0b0110)." */ uint32_t regaddr; @@ -330,14 +338,15 @@ int stm32_configgpio(uint32_t cfgset) * Name: stm32_unconfiggpio * * Description: - * Unconfigure a GPIO pin based on bit-encoded description of the pin, set it - * into default HiZ state (and possibly mark it's unused) and unlock it whether - * it was previously selected as alternative function (GPIO_ALT|GPIO_CNF_AFPP|...). + * Unconfigure a GPIO pin based on bit-encoded description of the pin, set + * it into default HiZ state (and possibly mark it's unused) and unlock it + * whether it was previously selected as alternative function + * (GPIO_ALT|GPIO_CNF_AFPP|...). * - * This is a safety function and prevents hardware from schocks, as unexpected - * write to the Timer Channel Output GPIO to fixed '1' or '0' while it should - * operate in PWM mode could produce excessive on-board currents and trigger - * over-current/alarm function. + * This is a safety function and prevents hardware from schocks, as + * unexpected write to the Timer Channel Output GPIO to fixed '1' or '0' + * while it should operate in PWM mode could produce excessive on-board + * currents and trigger over-current/alarm function. * * Returned Value: * OK on success @@ -425,6 +434,7 @@ bool stm32_gpioread(uint32_t pinset) pin = (pinset & GPIO_PIN_MASK) >> GPIO_PIN_SHIFT; return ((getreg32(base + STM32_GPIO_IDR_OFFSET) & (1 << pin)) != 0); } + return 0; } @@ -437,10 +447,11 @@ bool stm32_gpioread(uint32_t pinset) * 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. + * 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. + * The I/O compensation cell can be used only when the supply voltage + * ranges from 2.4 to 3.6 V. * * Input Parameters: * None diff --git a/arch/arm/src/stm32f7/stm32_gpio.h b/arch/arm/src/stm32f7/stm32_gpio.h index 73fb662d6d6..9792c62e0f9 100644 --- a/arch/arm/src/stm32f7/stm32_gpio.h +++ b/arch/arm/src/stm32f7/stm32_gpio.h @@ -1,4 +1,4 @@ -/************************************************************************************ +/**************************************************************************** * arch/arm/src/stm32f7/stm32_gpio.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_GPIO_H #define __ARCH_ARM_SRC_STM32F7_STM32_GPIO_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -52,14 +52,14 @@ #include "chip.h" #include "hardware/stm32_gpio.h" -/************************************************************************************ +/**************************************************************************** * Pre-Processor Declarations - ************************************************************************************/ + ****************************************************************************/ /* Bit-encoded input to stm32_configgpio() */ -/* Each port bit of the general-purpose I/O (GPIO) ports can be individually configured - * by software in several modes: +/* Each port bit of the general-purpose I/O (GPIO) ports can be individually + * configured by software in several modes: * * - Input floating * - Input pull-up @@ -162,7 +162,9 @@ #define GPIO_OPENDRAIN (1 << 9) /* Bit9: 1=Open-drain output */ #define GPIO_PUSHPULL (0) /* Bit9: 0=Push-pull output */ -/* If the pin is a GPIO digital output, then this identifies the initial output value. +/* If the pin is a GPIO digital output, then this identifies the initial + * output value. + * * If the pin is an input, this bit is overloaded to provide the qualifier to * distinguish input pull-up and -down: * @@ -234,9 +236,9 @@ # define GPIO_PIN14 (14 << GPIO_PIN_SHIFT) # define GPIO_PIN15 (15 << GPIO_PIN_SHIFT) -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ @@ -253,11 +255,11 @@ extern "C" EXTERN const uint32_t g_gpiobase[STM32F7_NGPIO]; -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: stm32_configgpio * * Description: @@ -270,48 +272,49 @@ EXTERN const uint32_t g_gpiobase[STM32F7_NGPIO]; * OK on success * ERROR on invalid port, or when pin is locked as ALT function. * - ************************************************************************************/ + ****************************************************************************/ int stm32_configgpio(uint32_t cfgset); -/************************************************************************************ +/**************************************************************************** * Name: stm32_unconfiggpio * * Description: - * Unconfigure a GPIO pin based on bit-encoded description of the pin, set it - * into default HiZ state (and possibly mark it's unused) and unlock it whether - * it was previously selected as alternative function (GPIO_ALT|GPIO_CNF_AFPP|...). + * Unconfigure a GPIO pin based on bit-encoded description of the pin, set + * it into default HiZ state (and possibly mark it's unused) and unlock it + * whether it was previously selected as alternative function + * (GPIO_ALT|GPIO_CNF_AFPP|...). * - * This is a safety function and prevents hardware from schocks, as unexpected - * write to the Timer Channel Output GPIO to fixed '1' or '0' while it should - * operate in PWM mode could produce excessive on-board currents and trigger - * over-current/alarm function. + * This is a safety function and prevents hardware from schocks, as + * unexpected write to the Timer Channel Output GPIO to fixed '1' or '0' + * while it should operate in PWM mode could produce excessive on-board + * currents and trigger over-current/alarm function. * * Returned Value: * OK on success * ERROR on invalid port * - ************************************************************************************/ + ****************************************************************************/ int stm32_unconfiggpio(uint32_t cfgset); -/************************************************************************************ +/**************************************************************************** * Name: stm32_gpiowrite * * Description: * Write one or zero to the selected GPIO pin * - ************************************************************************************/ + ****************************************************************************/ void stm32_gpiowrite(uint32_t pinset, bool value); -/************************************************************************************ +/**************************************************************************** * Name: stm32_gpioread * * Description: * Read one or zero from the selected GPIO pin * - ************************************************************************************/ + ****************************************************************************/ bool stm32_gpioread(uint32_t pinset); @@ -324,10 +327,11 @@ bool stm32_gpioread(uint32_t pinset); * 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. + * 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. + * The I/O compensation cell can be used only when the supply voltage + * ranges from 2.4 to 3.6 V. * * Input Parameters: * None @@ -357,18 +361,18 @@ void stm32_iocompensation(void); * Zero (OK) on success; a negated errno value on failure indicating the * nature of the failure. * - ************************************************************************************/ + ****************************************************************************/ int stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge, bool event, xcpt_t func, void *arg); -/************************************************************************************ +/**************************************************************************** * Function: stm32_dumpgpio * * Description: * Dump all GPIO registers associated with the provided base address * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_DEBUG_GPIO_INFO int stm32_dumpgpio(uint32_t pinset, const char *msg);