mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 23:28:29 +08:00
Changes from review of last PR
This commit is contained in:
@@ -102,12 +102,6 @@ int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
/* Configure CPU load estimation */
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||
cpuload_initialize_once();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MMCSD
|
||||
/* First, get an instance of the SDIO interface */
|
||||
|
||||
|
||||
@@ -120,12 +120,6 @@ int board_app_initialize(uintptr_t arg)
|
||||
|
||||
(void)ret;
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||
/* Configure CPU load estimation */
|
||||
|
||||
cpuload_initialize_once();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PROC
|
||||
/* Mount the proc filesystem */
|
||||
|
||||
|
||||
@@ -15,5 +15,4 @@ config STM32F411DISCO_USBHOST_PRIO
|
||||
default 100
|
||||
depends on USBHOST
|
||||
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
############################################################################
|
||||
# configs/stm32f411e-disco/src/Makefile
|
||||
#
|
||||
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -84,11 +84,11 @@
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||
/* Configure CPU load estimation */
|
||||
|
||||
cpuload_initialize_once();
|
||||
#endif
|
||||
#ifndef CONFIG_BOARD_INITIALIZE
|
||||
/* Perform board-specific initialization */
|
||||
|
||||
return stm32_bringup();
|
||||
#else
|
||||
return OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -72,17 +72,18 @@ void stm32_boardinitialize(void)
|
||||
board_autoled_initialize();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3)
|
||||
/* Configure SPI chip selects if 1) SP2 is not disabled, and 2) the weak function
|
||||
* stm32_spidev_initialize() has been brought into the link.
|
||||
#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || \
|
||||
defined(CONFIG_STM32_SPI3)
|
||||
/* Configure SPI chip selects if 1) SP2 is not disabled, and 2) the
|
||||
* weak function stm32_spidev_initialize() has been brought into the link.
|
||||
*/
|
||||
|
||||
stm32_spidev_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32_OTGFS
|
||||
/* Initialize USB if the 1) OTG FS controller is in the configuration and 2)
|
||||
* disabled. Presumably either CONFIG_USBDEV or CONFIG_USBHOST is also selected.
|
||||
/* Initialize USB if the OTG FS controller is in the configuration.
|
||||
* Presumably either CONFIG_USBDEV or CONFIG_USBHOST is also selected.
|
||||
*/
|
||||
|
||||
stm32_usbinitialize();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* config/stm32f4discovery/src/stm32_bringup.c
|
||||
* config/stm32f411e-disco/src/stm32_bringup.c
|
||||
*
|
||||
* Copyright (C) 2012, 2014-2016 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -40,16 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef CONFIG_USBMONITOR
|
||||
# include <nuttx/usb/usbmonitor.h>
|
||||
#endif
|
||||
|
||||
#include <nuttx/binfmt/elf.h>
|
||||
|
||||
#include "stm32.h"
|
||||
|
||||
@@ -59,20 +50,6 @@
|
||||
|
||||
#include "stm32f411e-disco.h"
|
||||
|
||||
/* Conditional logic in stm32f4discover.h will determine if certain features
|
||||
* are supported. Tests for these features need to be made after including
|
||||
* stm32f4discovery.h.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_RTC_DRIVER
|
||||
# include <nuttx/timers/rtc.h>
|
||||
# include "stm32_rtc.h"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
@@ -95,7 +72,7 @@ int stm32_bringup(void)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
#ifdef HAVE_USBHOST
|
||||
#if defined(CONFIG_STM32_OTGFS) && defined(CONFIG_USBHOST)
|
||||
/* Initialize USB host operation. stm32_usbhost_initialize() starts a thread
|
||||
* will monitor for USB connection and disconnection events.
|
||||
*/
|
||||
@@ -114,7 +91,7 @@ int stm32_bringup(void)
|
||||
ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
serr("ERROR: Failed to mount procfs at %s: %d\n",
|
||||
ferr("ERROR: Failed to mount procfs at %s: %d\n",
|
||||
STM32_PROCFS_MOUNTPOINT, ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* configs/stm32f411e-disco/src/stm32_usb.c
|
||||
*
|
||||
* Copyright (C) 2012-2013, 2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Copyright (C) 2017 Brian Webb. All rights reserved.
|
||||
@@ -65,11 +65,8 @@
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
#if defined(CONFIG_USBDEV) || defined(CONFIG_USBHOST)
|
||||
# define HAVE_USB 1
|
||||
#else
|
||||
#if !defined(CONFIG_USBDEV) && !defined(CONFIG_USBHOST)
|
||||
# warning "CONFIG_STM32_OTGFS is enabled but neither CONFIG_USBDEV nor CONFIG_USBHOST"
|
||||
# undef HAVE_USB
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_STM32F411DISCO_USBHOST_PRIO
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* configs/stm32f411e-disco/src/stm32f411e-disco.h
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
@@ -32,28 +32,28 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CONFIGS_STM32F411E_DISCO_SRC_STM32F411E_DISCO_H
|
||||
#define __CONFIGS_STM32F411E_DISCO_SRC_STM32F411E_DISCO_H
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
/* Configuration ********************************************************************/
|
||||
****************************************************************************/
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* LED. User LD2: the green LED is a user LED connected to Arduino signal D13
|
||||
* corresponding to MCU I/O PA5 (pin 21) or PB13 (pin 34) depending on the STM32
|
||||
* target.
|
||||
/* LED. User LD2: the green LED is a user LED connected to Arduino signal
|
||||
* D13 corresponding to MCU I/O PA5 (pin 21) or PB13 (pin 34) depending on
|
||||
* the STM32 target.
|
||||
*
|
||||
* - When the I/O is HIGH value, the LED is on.
|
||||
* - When the I/O is LOW, the LED is off.
|
||||
@@ -85,16 +85,6 @@
|
||||
#define GPIO_SPI1_SCK_OFF (GPIO_INPUT | GPIO_PULLDOWN | \
|
||||
GPIO_PORTA | GPIO_PIN5)
|
||||
|
||||
/* Assume that we have everything */
|
||||
|
||||
#define HAVE_USBDEV 1
|
||||
#define HAVE_USBHOST 1
|
||||
#define HAVE_USBMONITOR 1
|
||||
#define HAVE_SDIO 1
|
||||
#define HAVE_RTC_DRIVER 1
|
||||
#define HAVE_ELF 1
|
||||
#define HAVE_NETMONITOR 1
|
||||
|
||||
/* USB OTG FS
|
||||
*
|
||||
* PA9 OTG_FS_VBUS VBUS sensing (also connected to the green LED)
|
||||
@@ -127,9 +117,9 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/* Global driver instances */
|
||||
|
||||
@@ -140,17 +130,17 @@ extern struct spi_dev_s *g_spi1;
|
||||
extern struct spi_dev_s *g_spi2;
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: stm32_spidev_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called to configure SPI chip select GPIO pins.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
void stm32_spidev_initialize(void);
|
||||
|
||||
@@ -158,7 +148,7 @@ void stm32_spidev_initialize(void);
|
||||
* Name: stm32_usbinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called from stm32_usbinitialize very early in initialization to setup
|
||||
* Called from stm32_boardinitialize very early in initialization to setup
|
||||
* USB-related GPIO pins for the STM32F4Discovery board.
|
||||
*
|
||||
****************************************************************************/
|
||||
@@ -172,7 +162,7 @@ void stm32_usbinitialize(void);
|
||||
*
|
||||
* Description:
|
||||
* Called at application startup time to initialize the USB host
|
||||
* functionality. This function will start a thread that will monitor for
|
||||
* functionality. This function will start a thread that will monitor for
|
||||
* device connection/disconnection events.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -113,12 +113,6 @@ int board_app_initialize(uintptr_t arg)
|
||||
|
||||
(void)ret;
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||
/* Configure CPU load estimation */
|
||||
|
||||
cpuload_initialize_once();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PROC
|
||||
/* mount the proc filesystem */
|
||||
|
||||
|
||||
@@ -140,12 +140,6 @@ FAR struct mtd_dev_s *mtd_temp;
|
||||
int ret;
|
||||
|
||||
(void)ret;
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||
/* Configure CPU load estimation */
|
||||
|
||||
cpuload_initialize_once();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PROC
|
||||
/* mount the proc filesystem */
|
||||
@@ -208,7 +202,7 @@ FAR struct mtd_dev_s *mtd_temp;
|
||||
return ret;
|
||||
}
|
||||
g_mtd_fs = mtd_temp;
|
||||
|
||||
|
||||
#ifdef CONFIG_MTD_PARTITION
|
||||
{
|
||||
FAR struct mtd_geometry_s geo;
|
||||
@@ -342,7 +336,7 @@ int board_ioctl(unsigned int cmd, uintptr_t arg)
|
||||
* 6 = CONFIG_N25QXXX_DUMMIES;
|
||||
* 0xeb = N25QXXX_FAST_READ_QUADIO;
|
||||
*/
|
||||
|
||||
|
||||
meminfo.flags = QSPIMEM_READ | QSPIMEM_QUADIO;
|
||||
meminfo.addrlen = 3;
|
||||
meminfo.dummies = 6; //CONFIG_N25QXXX_DUMMIES;
|
||||
@@ -350,17 +344,17 @@ int board_ioctl(unsigned int cmd, uintptr_t arg)
|
||||
meminfo.addr = 0;
|
||||
meminfo.buflen = 0;
|
||||
meminfo.buffer = NULL;
|
||||
|
||||
|
||||
stm32l4_qspi_enter_memorymapped(g_qspi, &meminfo, 80000000);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case BIOC_EXIT_MEMMAP:
|
||||
stm32l4_qspi_exit_memorymapped(g_qspi);
|
||||
break;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
default:
|
||||
return -EINVAL;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user