Add support for otgfs device class

This commit is contained in:
Michał Łyszczek 2016-08-18 18:06:05 +02:00
parent 3d609f858b
commit abcb00bf7d
9 changed files with 133 additions and 239 deletions

View File

@ -148,9 +148,6 @@ CONFIG_ARMV7M_HAVE_STACKCHECK=y
# CONFIG_ARMV7M_STACKCHECK is not set
# CONFIG_ARMV7M_ITMSYSLOG is not set
# CONFIG_SERIAL_TERMIOS is not set
# CONFIG_USBHOST_BULK_DISABLE is not set
# CONFIG_USBHOST_INT_DISABLE is not set
# CONFIG_USBHOST_ISOC_DISABLE is not set
#
# STM32 Configuration Options
@ -378,7 +375,7 @@ CONFIG_STM32_ADC1=y
# CONFIG_STM32_DMA2 is not set
# CONFIG_STM32_DAC1 is not set
# CONFIG_STM32_DAC2 is not set
CONFIG_STM32_ETHMAC=y
# CONFIG_STM32_ETHMAC is not set
# CONFIG_STM32_I2C1 is not set
CONFIG_STM32_OTGFS=y
CONFIG_STM32_PWR=y
@ -407,7 +404,6 @@ CONFIG_STM32_SPI=y
#
# Alternate Pin Mapping
#
CONFIG_STM32_ETH_REMAP=y
# CONFIG_STM32_SPI1_REMAP is not set
CONFIG_STM32_USART2_REMAP=y
# CONFIG_STM32_JTAG_DISABLE is not set
@ -462,27 +458,9 @@ CONFIG_STM32_USART2_SERIALDRIVER=y
CONFIG_STM32_HAVE_RTC_COUNTER=y
# CONFIG_STM32_HAVE_RTC_SUBSECONDS is not set
#
# Ethernet MAC configuration
#
CONFIG_STM32_PHYADDR=1
# CONFIG_STM32_PHYINIT is not set
CONFIG_STM32_MII=y
# CONFIG_STM32_MII_MCO is not set
CONFIG_STM32_MII_EXTCLK=y
# CONFIG_STM32_AUTONEG is not set
CONFIG_STM32_ETHFD=y
CONFIG_STM32_ETH100MBPS=y
# CONFIG_STM32_ETH_PTP is not set
#
# USB FS Host Configuration
#
CONFIG_STM32_OTGFS_RXFIFO_SIZE=128
CONFIG_STM32_OTGFS_NPTXFIFO_SIZE=96
CONFIG_STM32_OTGFS_PTXFIFO_SIZE=128
CONFIG_STM32_OTGFS_DESCSIZE=128
# CONFIG_STM32_OTGFS_SOFINTR is not set
#
# USB HS Host Configuration
@ -580,6 +558,7 @@ CONFIG_ARCH_BUTTONS=y
CONFIG_LIB_BOARDCTL=y
# CONFIG_BOARDCTL_RESET is not set
# CONFIG_BOARDCTL_UNIQUEID is not set
CONFIG_BOARDCTL_USBDEVCTRL=y
# CONFIG_BOARDCTL_TSCTEST is not set
CONFIG_BOARDCTL_ADCTEST=y
# CONFIG_BOARDCTL_PWMTEST is not set
@ -777,46 +756,6 @@ CONFIG_MMCSD_SPIMODE=0
# CONFIG_MODEM is not set
# CONFIG_MTD is not set
# CONFIG_EEPROM is not set
CONFIG_NETDEVICES=y
#
# General Ethernet MAC Driver Options
#
# CONFIG_NETDEV_LOOPBACK is not set
# CONFIG_NETDEV_TELNET is not set
# CONFIG_NETDEV_MULTINIC is not set
# CONFIG_ARCH_HAVE_NETDEV_STATISTICS is not set
# CONFIG_NETDEV_LATEINIT is not set
#
# External Ethernet MAC Device Support
#
# CONFIG_NET_DM90x0 is not set
# CONFIG_ENC28J60 is not set
# CONFIG_ENCX24J600 is not set
# CONFIG_NET_E1000 is not set
# CONFIG_NET_SLIP is not set
# CONFIG_NET_FTMAC100 is not set
# CONFIG_NET_VNET is not set
#
# External Ethernet PHY Device Support
#
# CONFIG_ARCH_PHY_INTERRUPT is not set
# CONFIG_ETH0_PHY_NONE is not set
# CONFIG_ETH0_PHY_AM79C874 is not set
# CONFIG_ETH0_PHY_KS8721 is not set
# CONFIG_ETH0_PHY_KSZ8041 is not set
# CONFIG_ETH0_PHY_KSZ8051 is not set
# CONFIG_ETH0_PHY_KSZ8061 is not set
# CONFIG_ETH0_PHY_KSZ8081 is not set
# CONFIG_ETH0_PHY_KSZ90x1 is not set
CONFIG_ETH0_PHY_DP83848C=y
# CONFIG_ETH0_PHY_LAN8720 is not set
# CONFIG_ETH0_PHY_LAN8740 is not set
# CONFIG_ETH0_PHY_LAN8740A is not set
# CONFIG_ETH0_PHY_LAN8742A is not set
# CONFIG_ETH0_PHY_DM9161 is not set
# CONFIG_PIPES is not set
# CONFIG_PM is not set
# CONFIG_POWER is not set
@ -824,7 +763,7 @@ CONFIG_ETH0_PHY_DP83848C=y
# CONFIG_SERCOMM_CONSOLE is not set
CONFIG_SERIAL=y
# CONFIG_DEV_LOWCONSOLE is not set
# CONFIG_SERIAL_REMOVABLE is not set
CONFIG_SERIAL_REMOVABLE=y
CONFIG_SERIAL_CONSOLE=y
# CONFIG_16550_UART is not set
# CONFIG_UART_SERIALDRIVER is not set
@ -873,26 +812,42 @@ CONFIG_USART2_2STOP=0
# CONFIG_USART2_OFLOWCONTROL is not set
# CONFIG_USART2_DMA is not set
# CONFIG_PSEUDOTERM is not set
# CONFIG_USBDEV is not set
CONFIG_USBHOST=y
CONFIG_USBHOST_NPREALLOC=4
CONFIG_USBHOST_HAVE_ASYNCH=y
# CONFIG_USBHOST_ASYNCH is not set
# CONFIG_USBHOST_HUB is not set
CONFIG_USBHOST_MSC=y
# CONFIG_USBHOST_CDCACM is not set
CONFIG_USBHOST_HIDKBD=y
CONFIG_HIDKBD_POLLUSEC=100000
CONFIG_HIDKBD_DEFPRIO=50
CONFIG_HIDKBD_STACKSIZE=1024
CONFIG_HIDKBD_BUFSIZE=64
CONFIG_HIDKBD_NPOLLWAITERS=2
# CONFIG_HIDKBD_RAWSCANCODES is not set
# CONFIG_HIDKBD_ALLSCANCODES is not set
# CONFIG_HIDKBD_NODEBOUNCE is not set
# CONFIG_USBHOST_HIDMOUSE is not set
# CONFIG_USBHOST_RTL8187 is not set
# CONFIG_USBHOST_TRACE is not set
CONFIG_USBDEV=y
#
# USB Device Controller Driver Options
#
# CONFIG_USBDEV_ISOCHRONOUS is not set
# CONFIG_USBDEV_DUALSPEED is not set
# CONFIG_USBDEV_SELFPOWERED is not set
CONFIG_USBDEV_BUSPOWERED=y
CONFIG_USBDEV_MAXPOWER=500
# CONFIG_USBDEV_DMA is not set
# CONFIG_ARCH_USBDEV_STALLQUEUE is not set
# CONFIG_USBDEV_TRACE is not set
#
# USB Device Class Driver Options
#
# CONFIG_USBDEV_COMPOSITE is not set
CONFIG_PL2303=y
# CONFIG_PL2303_CONSOLE is not set
CONFIG_PL2303_EPINTIN=1
CONFIG_PL2303_EPBULKOUT=2
CONFIG_PL2303_EPBULKIN=3
CONFIG_PL2303_EP0MAXPACKET=64
CONFIG_PL2303_NWRREQS=4
CONFIG_PL2303_NRDREQS=4
CONFIG_PL2303_BULKIN_REQLEN=96
CONFIG_PL2303_RXBUFSIZE=257
CONFIG_PL2303_TXBUFSIZE=193
CONFIG_PL2303_VENDORID=0x067b
CONFIG_PL2303_PRODUCTID=0x2303
CONFIG_PL2303_VENDORSTR="NuttX"
CONFIG_PL2303_PRODUCTSTR="PL2303 Emulation"
# CONFIG_CDCACM is not set
# CONFIG_USBMSC is not set
# CONFIG_USBHOST is not set
# CONFIG_HAVE_USBTRACE is not set
# CONFIG_DRIVERS_WIRELESS is not set
@ -913,113 +868,9 @@ CONFIG_SYSLOG_CONSOLE=y
#
# Networking Support
#
CONFIG_ARCH_HAVE_NET=y
CONFIG_ARCH_HAVE_PHY=y
CONFIG_NET=y
# CONFIG_NET_NOINTS is not set
# CONFIG_NET_PROMISCUOUS is not set
#
# Driver buffer configuration
#
CONFIG_NET_MULTIBUFFER=y
CONFIG_NET_ETH_MTU=590
CONFIG_NET_ETH_TCP_RECVWNDO=536
CONFIG_NET_GUARDSIZE=2
#
# Data link support
#
# CONFIG_NET_MULTILINK is not set
CONFIG_NET_ETHERNET=y
# CONFIG_NET_LOOPBACK is not set
# CONFIG_NET_TUN is not set
#
# Network Device Operations
#
# CONFIG_NETDEV_PHY_IOCTL is not set
#
# Internet Protocol Selection
#
CONFIG_NET_IPv4=y
# CONFIG_NET_IPv6 is not set
#
# Socket Support
#
CONFIG_NSOCKET_DESCRIPTORS=8
CONFIG_NET_NACTIVESOCKETS=16
# CONFIG_NET_SOCKOPTS is not set
#
# Raw Socket Support
#
# CONFIG_NET_PKT is not set
#
# Unix Domain Socket Support
#
# CONFIG_NET_LOCAL is not set
#
# TCP/IP Networking
#
CONFIG_NET_TCP=y
# CONFIG_NET_TCPURGDATA is not set
CONFIG_NET_TCP_CONNS=8
CONFIG_NET_MAX_LISTENPORTS=4
CONFIG_NET_TCP_READAHEAD=y
# CONFIG_NET_TCP_WRITE_BUFFERS is not set
CONFIG_NET_TCP_RECVDELAY=0
# CONFIG_NET_TCPBACKLOG is not set
# CONFIG_NET_TCP_SPLIT is not set
# CONFIG_NET_SENDFILE is not set
#
# UDP Networking
#
# CONFIG_NET_UDP is not set
#
# ICMP Networking Support
#
CONFIG_NET_ICMP=y
CONFIG_NET_ICMP_PING=y
#
# IGMPv2 Client Support
#
# CONFIG_NET_IGMP is not set
#
# ARP Configuration
#
CONFIG_NET_ARP=y
CONFIG_NET_ARPTAB_SIZE=16
CONFIG_NET_ARP_MAXAGE=120
CONFIG_NET_ARP_IPIN=y
CONFIG_NET_ARP_SEND=y
CONFIG_ARP_SEND_MAXTRIES=5
CONFIG_ARP_SEND_DELAYMSEC=20
#
# Network I/O Buffer Support
#
CONFIG_NET_IOB=y
CONFIG_IOB_NBUFFERS=24
CONFIG_IOB_BUFSIZE=196
CONFIG_IOB_NCHAINS=8
# CONFIG_NET_ARCH_INCR32 is not set
# CONFIG_NET_ARCH_CHKSUM is not set
# CONFIG_NET_STATISTICS is not set
#
# Routing Table Configuration
#
# CONFIG_NET_ROUTE is not set
CONFIG_NET_HOSTNAME="kurwistm"
# CONFIG_ARCH_HAVE_NET is not set
# CONFIG_ARCH_HAVE_PHY is not set
# CONFIG_NET is not set
#
# Crypto API
@ -1064,7 +915,6 @@ CONFIG_FS_PROCFS_REGISTER=y
# CONFIG_FS_PROCFS_EXCLUDE_UPTIME is not set
# CONFIG_FS_PROCFS_EXCLUDE_CPULOAD is not set
# CONFIG_FS_PROCFS_EXCLUDE_MOUNTS is not set
# CONFIG_FS_PROCFS_EXCLUDE_NET is not set
# CONFIG_FS_UNIONFS is not set
#
@ -1137,7 +987,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set
CONFIG_ARCH_HAVE_TLS=y
# CONFIG_TLS is not set
CONFIG_LIBC_NETDB=y
# CONFIG_LIBC_NETDB is not set
# CONFIG_NETDB_HOSTFILE is not set
#
@ -1189,10 +1039,7 @@ CONFIG_EXAMPLES_BUTTONS_MAX=4
# CONFIG_EXAMPLES_FTPC is not set
# CONFIG_EXAMPLES_FTPD is not set
# CONFIG_EXAMPLES_HELLO is not set
CONFIG_EXAMPLES_HIDKBD=y
CONFIG_EXAMPLES_HIDKBD_DEFPRIO=50
CONFIG_EXAMPLES_HIDKBD_STACKSIZE=1024
CONFIG_EXAMPLES_HIDKBD_DEVNAME="/dev/kbda"
# CONFIG_EXAMPLES_HIDKBD is not set
# CONFIG_EXAMPLES_IGMP is not set
# CONFIG_EXAMPLES_JSON is not set
# CONFIG_EXAMPLES_KEYPADTEST is not set
@ -1204,7 +1051,6 @@ CONFIG_EXAMPLES_MOUNT=y
CONFIG_EXAMPLES_MOUNT_NSECTORS=2048
CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512
CONFIG_EXAMPLES_MOUNT_RAMDEVNO=0
# CONFIG_EXAMPLES_NETTEST is not set
# CONFIG_EXAMPLES_NRF24L01TERM is not set
CONFIG_EXAMPLES_NSH=y
# CONFIG_EXAMPLES_NULL is not set
@ -1233,11 +1079,11 @@ CONFIG_EXAMPLES_NSH=y
# CONFIG_EXAMPLES_TELNETD is not set
# CONFIG_EXAMPLES_TIFF is not set
# CONFIG_EXAMPLES_TOUCHSCREEN is not set
# CONFIG_EXAMPLES_USBSERIAL is not set
# CONFIG_EXAMPLES_USBTERM is not set
CONFIG_EXAMPLES_USBSERIAL=y
CONFIG_EXAMPLES_USBSERIAL_BUFSIZE=512
CONFIG_EXAMPLES_USBTERM=y
# CONFIG_EXAMPLES_WATCHDOG is not set
# CONFIG_EXAMPLES_WEBSERVER is not set
# CONFIG_EXAMPLES_XMLRPC is not set
#
# File System Utilities
@ -1276,14 +1122,8 @@ CONFIG_EXAMPLES_NSH=y
# CONFIG_NETUTILS_CODECS is not set
# CONFIG_NETUTILS_ESP8266 is not set
# CONFIG_NETUTILS_FTPC is not set
# CONFIG_NETUTILS_FTPD is not set
# CONFIG_NETUTILS_JSON is not set
CONFIG_NETUTILS_NETLIB=y
# CONFIG_NETUTILS_SMTP is not set
# CONFIG_NETUTILS_TELNETD is not set
# CONFIG_NETUTILS_WEBCLIENT is not set
# CONFIG_NETUTILS_WEBSERVER is not set
# CONFIG_NETUTILS_XMLRPC is not set
#
# NSH Library
@ -1311,7 +1151,6 @@ CONFIG_NSH_BUILTIN_APPS=y
# Disable Individual commands
#
# CONFIG_NSH_DISABLE_ADDROUTE is not set
# CONFIG_NSH_DISABLE_ARP is not set
# CONFIG_NSH_DISABLE_BASENAME is not set
# CONFIG_NSH_DISABLE_CAT is not set
# CONFIG_NSH_DISABLE_CD is not set
@ -1344,7 +1183,6 @@ CONFIG_NSH_BUILTIN_APPS=y
# CONFIG_NSH_DISABLE_MV is not set
# CONFIG_NSH_DISABLE_MW is not set
# CONFIG_NSH_DISABLE_PS is not set
# CONFIG_NSH_DISABLE_PING is not set
# CONFIG_NSH_DISABLE_PUT is not set
# CONFIG_NSH_DISABLE_PWD is not set
# CONFIG_NSH_DISABLE_RM is not set
@ -1385,32 +1223,9 @@ CONFIG_NSH_STRERROR=y
# Console Configuration
#
CONFIG_NSH_CONSOLE=y
# CONFIG_NSH_USBCONSOLE is not set
# CONFIG_NSH_ALTCONDEV is not set
# CONFIG_NSH_USBKBD is not set
CONFIG_NSH_ARCHINIT=y
#
# Networking Configuration
#
CONFIG_NSH_NETINIT=y
CONFIG_NSH_NETINIT_THREAD=y
CONFIG_NSH_NETINIT_THREAD_STACKSIZE=1568
CONFIG_NSH_NETINIT_THREAD_PRIORITY=80
#
# IP Address Configuration
#
#
# IPv4 Addresses
#
CONFIG_NSH_IPADDR=0x0a01010a
CONFIG_NSH_DRIPADDR=0x0a010101
CONFIG_NSH_NETMASK=0xffffff00
CONFIG_NSH_NOMAC=y
CONFIG_NSH_SWMAC=y
CONFIG_NSH_MACADDR=0x00e0deadbeef
CONFIG_NSH_MAX_ROUNDTRIP=20
# CONFIG_NSH_LOGIN is not set
# CONFIG_NSH_CONSOLE_LOGIN is not set
@ -1428,7 +1243,6 @@ CONFIG_NSH_MAX_ROUNDTRIP=20
# CONFIG_SYSTEM_HEX2BIN is not set
# CONFIG_SYSTEM_HEXED is not set
# CONFIG_SYSTEM_INSTALL is not set
# CONFIG_SYSTEM_NETDB is not set
CONFIG_SYSTEM_RAMTEST=y
CONFIG_READLINE_HAVE_EXTMATCH=y
CONFIG_SYSTEM_READLINE=y

View File

@ -53,6 +53,10 @@ ifeq ($(CONFIG_USBHOST),y)
CSRCS += stm32_usbhost.c
endif
ifeq ($(CONFIG_USBDEV),y)
CSRCS += stm32_usbdev.c
endif
ifeq ($(CONFIG_MMCSD),y)
CSRCS += stm32_mmcsd.c
endif

View File

@ -92,3 +92,4 @@ int board_app_initialize(uintptr_t arg)
return rv;
}

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* configs/stm32butterfly2/src/stm32_led.c
* configs/stm32butterfly2/src/stm32_leds.c
*
* Copyright (C) 2016 Michał Łyszczek. All rights reserved.
* Author: Michał Łyszczek <michal.lyszczek@gmail.com>
@ -30,7 +30,6 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/*****************************************************************************

View File

@ -30,7 +30,6 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/*****************************************************************************

View File

@ -102,3 +102,4 @@ uint8_t stm32_spi1status(struct spi_dev_s *dev, enum spi_dev_e devid)
return 0;
}

View File

@ -30,7 +30,6 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/*****************************************************************************

View File

@ -0,0 +1,78 @@
/*****************************************************************************
* configs/stm32butterfly2/src/stm32_usbdev.c
*
* Copyright (C) 2016 Michał Łyszczek. All rights reserved.
* Author: Michał Łyszczek <michal.lyszczek@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
****************************************************************************/
/*****************************************************************************
* Included Files
****************************************************************************/
#include <debug.h>
#include <stdbool.h>
#include <sys/boardctl.h>
#include "stm32_otgfs.h"
/*****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifndef CONFIG_STM32_OTGFS
# error "CONFIG_USBDEV requires CONFIG_STM32_OTGFS to be enabled"
#endif
#ifdef CONFIG_USBHOST
# error "CONFIG_USBDEV cannot be set alongside CONFIG_USBHOST"
#endif
/*****************************************************************************
* Public Functions
****************************************************************************/
/*****************************************************************************
* Name: stm32_usbsuspend
*
* Description:
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver
* is used. This function is called whenever the USB enters or leaves
* suspend mode. This is an oportunity for the board logic to shutdown
* clocks, power, etc. while the USB is suspended.
*
* TODO:
* - Well... implement those features like clock shutdown.
****************************************************************************/
void stm32_usbsuspend(struct usbdev_s *dev, bool resume)
{
uinfo("INFO: usb %s", resume ? "resumed" : "suspended");
}

View File

@ -30,7 +30,6 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/*****************************************************************************