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