STM32: Review of last STM32 F2 PR. Progate changes to STM32 F4 and F7 OTGHS. Rename some configs/photon/src files. Naming can be either photon_ or stm32_ but must be consistent.

This commit is contained in:
Gregory Nutt 2017-03-11 16:31:11 -06:00
parent 11876dc090
commit e0f7b9582a
11 changed files with 47 additions and 33 deletions

View File

@ -5325,14 +5325,14 @@ static void stm32_hwinitialize(FAR struct stm32_usbdev_s *priv)
* some bug / errata in the chip. * some bug / errata in the chip.
*/ */
regval = stm32_getreg(STM32_RCC_AHB1LPENR); regval = stm32_getreg(STM32_RCC_AHB1LPENR);
regval &= ~RCC_AHB1ENR_OTGHSULPIEN; regval &= ~RCC_AHB1ENR_OTGHSULPIEN;
stm32_putreg(regval, STM32_RCC_AHB1LPENR); stm32_putreg(regval, STM32_RCC_AHB1LPENR);
/* Enable the interrupts in the INTMSK */ /* Enable the interrupts in the INTMSK */
regval = (OTGHS_GINT_RXFLVL | OTGHS_GINT_USBSUSP | OTGHS_GINT_ENUMDNE | regval = (OTGHS_GINT_RXFLVL | OTGHS_GINT_USBSUSP | OTGHS_GINT_ENUMDNE |
OTGHS_GINT_IEP | OTGHS_GINT_OEP | OTGHS_GINT_USBRST); OTGHS_GINT_IEP | OTGHS_GINT_OEP | OTGHS_GINT_USBRST);
#ifdef CONFIG_USBDEV_ISOCHRONOUS #ifdef CONFIG_USBDEV_ISOCHRONOUS
regval |= (OTGHS_GINT_IISOIXFR | OTGHS_GINT_IISOOXFR); regval |= (OTGHS_GINT_IISOIXFR | OTGHS_GINT_IISOOXFR);

View File

@ -196,13 +196,15 @@ static inline void rcc_enableahb1(void)
/* USB OTG HS */ /* USB OTG HS */
#ifndef BOARD_DISABLE_USBOTG_HSULPI #ifndef BOARD_DISABLE_USBOTG_HSULPI
/* Enable clocking for OTG and external PHY */ /* Enable clocking for USB OTG HS and external PHY */
regval |= (RCC_AHB1ENR_OTGHSEN | RCC_AHB1ENR_OTGHSULPIEN); regval |= (RCC_AHB1ENR_OTGHSEN | RCC_AHB1ENR_OTGHSULPIEN);
#else #else
/* Enable only clocking for USB OTG HS */
regval |= (RCC_AHB1ENR_OTGHSEN); regval |= (RCC_AHB1ENR_OTGHSEN);
#endif #endif
#endif #endif /* CONFIG_STM32_OTGHS */
putreg32(regval, STM32_RCC_AHB1ENR); /* Enable peripherals */ putreg32(regval, STM32_RCC_AHB1ENR); /* Enable peripherals */
} }

View File

@ -215,10 +215,15 @@ static inline void rcc_enableahb1(void)
#endif #endif
#ifdef CONFIG_STM32_OTGHS #ifdef CONFIG_STM32_OTGHS
/* USB OTG HS */ #if 0 /* ifndef BOARD_DISABLE_USBOTG_HSULPI */
/* Enable clocking for USB OTG HS and external PHY */
regval |= (RCC_AHB1ENR_OTGHSEN | RCC_AHB1ENR_OTGHSULPIEN);
#else
/* Enable only clocking for USB OTG HS */
regval |= RCC_AHB1ENR_OTGHSEN; regval |= RCC_AHB1ENR_OTGHSEN;
#endif
#endif /* CONFIG_STM32_OTGHS */ #endif /* CONFIG_STM32_OTGHS */
#ifdef CONFIG_STM32_DMA2D #ifdef CONFIG_STM32_DMA2D

View File

@ -225,10 +225,15 @@ static inline void rcc_enableahb1(void)
#endif #endif
#ifdef CONFIG_STM32F7_OTGHS #ifdef CONFIG_STM32F7_OTGHS
/* USB OTG HS */ #if 0 /* ifndef BOARD_DISABLE_USBOTG_HSULPI */
/* Enable clocking for USB OTG HS and external PHY */
regval |= (RCC_AHB1ENR_OTGHSEN | RCC_AHB1ENR_OTGHSULPIEN);
#else
/* Enable only clocking for USB OTG HS */
regval |= RCC_AHB1ENR_OTGHSEN; regval |= RCC_AHB1ENR_OTGHSEN;
#endif
#endif /* CONFIG_STM32F7_OTGHS */ #endif /* CONFIG_STM32F7_OTGHS */
putreg32(regval, STM32_RCC_AHB1ENR); /* Enable peripherals */ putreg32(regval, STM32_RCC_AHB1ENR); /* Enable peripherals */

View File

@ -221,10 +221,15 @@ static inline void rcc_enableahb1(void)
#endif #endif
#ifdef CONFIG_STM32F7_OTGHS #ifdef CONFIG_STM32F7_OTGHS
/* USB OTG HS */ #if 0 /* ifndef BOARD_DISABLE_USBOTG_HSULPI */
/* Enable clocking for USB OTG HS and external PHY */
regval |= (RCC_AHB1ENR_OTGHSEN | RCC_AHB1ENR_OTGHSULPIEN);
#else
/* Enable only clocking for USB OTG HS */
regval |= RCC_AHB1ENR_OTGHSEN; regval |= RCC_AHB1ENR_OTGHSEN;
#endif
#endif /* CONFIG_STM32F7_OTGHS */ #endif /* CONFIG_STM32F7_OTGHS */
putreg32(regval, STM32_RCC_AHB1ENR); /* Enable peripherals */ putreg32(regval, STM32_RCC_AHB1ENR); /* Enable peripherals */

View File

@ -148,6 +148,7 @@
/* USB OTG HS definitions ***********************************************************/ /* USB OTG HS definitions ***********************************************************/
/* Do not enable external PHY clock or OTG_HS module will not work */ /* Do not enable external PHY clock or OTG_HS module will not work */
#define BOARD_DISABLE_USBOTG_HSULPI 1 #define BOARD_DISABLE_USBOTG_HSULPI 1
/* LED definitions ******************************************************************/ /* LED definitions ******************************************************************/

View File

@ -42,15 +42,15 @@ CSRCS += dfu_signature.c
endif endif
ifeq ($(CONFIG_BUTTONS),y) ifeq ($(CONFIG_BUTTONS),y)
CSRCS += photon_buttons.c CSRCS += stm32_buttons.c
endif endif
ifeq ($(CONFIG_USERLED),y) ifeq ($(CONFIG_USERLED),y)
CSRCS += photon_leds.c CSRCS += stm32_leds.c
endif endif
ifeq ($(CONFIG_PHOTON_WDG),y) ifeq ($(CONFIG_PHOTON_WDG),y)
CSRCS += photon_wdt.c CSRCS += stm32_wdt.c
endif endif
ifeq ($(CONFIG_STM32_OTGHS),y) ifeq ($(CONFIG_STM32_OTGHS),y)

View File

@ -134,5 +134,6 @@ int board_app_initialize(uintptr_t arg)
return ret; return ret;
} }
#endif #endif
return ret; return ret;
} }

View File

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* configs/photon/src/photon_buttons.c * configs/photon/src/stm32_buttons.c
* *
* Copyright (C) 2017 Gregory Nutt. All rights reserved. * Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Simon Piriou <spiriou31@gmail.com> * Author: Simon Piriou <spiriou31@gmail.com>
@ -38,17 +38,15 @@
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#include <debug.h> #include <debug.h>
#include <errno.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "photon.h" #include "photon.h"
#include "stm32_gpio.h" #include "stm32_gpio.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
@ -80,22 +78,23 @@ uint8_t board_buttons(void)
return 0; return 0;
} }
#ifdef CONFIG_ARCH_IRQBUTTONS
/**************************************************************************** /****************************************************************************
* Name: board_button_irq * Name: board_button_irq
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_ARCH_IRQBUTTONS
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
{ {
if (id != BOARD_BUTTON1) { if (id != BOARD_BUTTON1)
/* Invalid button id */ {
return ERROR; /* Invalid button id */
}
return -EINVAL;
}
/* Configure interrupt on falling edge only */ /* Configure interrupt on falling edge only */
return stm32_gpiosetevent(GPIO_BUTTON1, false, true, false, irqhandler, arg); return stm32_gpiosetevent(GPIO_BUTTON1, false, true, false,
irqhandler, arg);
} }
#endif /* CONFIG_ARCH_IRQBUTTONS */ #endif /* CONFIG_ARCH_IRQBUTTONS */

View File

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* configs/photon/src/photon_leds.c * configs/photon/src/stm32_leds.c
* *
* Copyright (C) 2017 Gregory Nutt. All rights reserved. * Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Simon Piriou <spiriou31@gmail.com> * Author: Simon Piriou <spiriou31@gmail.com>
@ -45,10 +45,6 @@
#include "stm32_gpio.h" #include "stm32_gpio.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/

View File

@ -1,5 +1,5 @@
/************************************************************************************ /************************************************************************************
* configs/photon/src/photon_wdt.c * configs/photon/src/stm32_wdt.c
* *
* Copyright (C) 2017 Gregory Nutt. All rights reserved. * Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Simon Piriou <spiriou31@gmail.com> * Author: Simon Piriou <spiriou31@gmail.com>