arm/src/lpc54xx/: Bring in the USB FS OHCI driver from LPC17. This is a quick'n'dirty port that I will finish sometime later (I hope). Currently, it is missing hardware clocking setup and is not even hooked into the build system yet. Needless to say it does not yet even compile.
This commit is contained in:
parent
82cb456e02
commit
9b13eaf595
@ -150,7 +150,7 @@
|
||||
# error "Insufficent TDs"
|
||||
#endif
|
||||
|
||||
/* Derived size of user trasnfer descriptor (TD) memory. */
|
||||
/* Derived size of user transfer descriptor (TD) memory. */
|
||||
|
||||
#define LPC17_TDFREE_SIZE (CONFIG_LP17_USBHOST_NTDS * LPC17_TD_SIZE)
|
||||
|
||||
|
@ -401,6 +401,12 @@ config LPC54_EMC
|
||||
bool "External Memory Controller (EMC)"
|
||||
default n
|
||||
|
||||
config LPC54_OHCI
|
||||
bool "USB0 OHCI"
|
||||
select USBHOST
|
||||
select USBHOST_HAVE_ASYNCH
|
||||
default n
|
||||
|
||||
config LPC54_ETHERNET
|
||||
bool "Ethernet"
|
||||
default n
|
||||
@ -686,6 +692,65 @@ config LPC54_SPI_WIDEDATA
|
||||
|
||||
endmenu # SPI Master configuration
|
||||
|
||||
menu "USB0 OHCI Options"
|
||||
depends on LPC54_OHCI
|
||||
|
||||
config LPC54_OHCI_NEDS
|
||||
int "Number of Endpoint Descriptors"
|
||||
default 2
|
||||
---help---
|
||||
Number of endpoint descriptors. Default: 2
|
||||
|
||||
config LPC54_OHCI_NTDS
|
||||
int "Number of transfer descriptors"
|
||||
default 3
|
||||
---help---
|
||||
Number of transfer descriptors. Default: 3
|
||||
|
||||
config LPC54_OHCI_TDBUFFERS
|
||||
int "Number of descriptor buffers"
|
||||
default 2
|
||||
---help---
|
||||
Number of transfer descriptor buffers. Default: 2
|
||||
|
||||
config LPC54_OHCI_TDBUFSIZE
|
||||
int "Descriptor buffer size"
|
||||
default 128
|
||||
---help---
|
||||
Size of one transfer descriptor buffer. Default 128
|
||||
|
||||
config LPC54_OHCI_IOBUFSIZE
|
||||
int "I/O buffer size"
|
||||
default 512
|
||||
---help---
|
||||
Size of one end-user I/O buffer.
|
||||
|
||||
config LPC54_OHCI_NIOBUFFERS
|
||||
int "Number of I/O buffer"
|
||||
default 8 if USBHOST_HUB
|
||||
default 4 if !USBHOST_HUB
|
||||
---help---
|
||||
Size of one end-user I/O buffer.
|
||||
|
||||
config LPC54_OHCI_NPREALLOC
|
||||
int "Max concurrent transfers"
|
||||
default 8 if USBHOST_HUB
|
||||
default 4 if !USBHOST_HUB
|
||||
---help---
|
||||
This number represents a number of pre-allocated structures to support
|
||||
concurrent data transfers. This number limits that number of concurrent
|
||||
asynchronous IN endpoint transfer that can be supported.
|
||||
|
||||
config LPC54_OHCI_REGDEBUG
|
||||
bool "Register level debug"
|
||||
depends on DEBUG_USB_INFO
|
||||
default n
|
||||
---help---
|
||||
Output detailed register-level USB host debug information. Requires
|
||||
also CONFIG_DEBUG_USB_INFO.
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Ethernet configuration"
|
||||
depends on LPC54_ETHERNET
|
||||
|
||||
|
129
arch/arm/src/lpc54xx/chip/lpc54_usb0_ohci.h
Normal file
129
arch/arm/src/lpc54xx/chip/lpc54_usb0_ohci.h
Normal file
@ -0,0 +1,129 @@
|
||||
/************************************************************************************
|
||||
* arch/arm/src/lpc54xx/chip/lpc54_usb0_ohci.h
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_USB0_OHCI_H
|
||||
#define __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_USB0_OHCI_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/usb/ohci.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "chip/lpc54_memorymap.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Register offsets *****************************************************************/
|
||||
|
||||
/* USB Host Controller (OHCI). See include/nuttx/usb/ohci.h */
|
||||
|
||||
/* Additional, non-standard register offsets */
|
||||
|
||||
#define LPC54_OHCI_PORTMODE_OFFSET 0x005c /* Port mode register */
|
||||
|
||||
/* Register addresses ***************************************************************/
|
||||
|
||||
/* USB Host Controller (OHCI) */
|
||||
|
||||
/* Control and status registers (section 7.1) */
|
||||
|
||||
#define LPC54_OHCI_HCIREV (LPC54_FSUSBHOST_BASE + OHCI_HCIREV_OFFSET)
|
||||
#define LPC54_OHCI_CTRL (LPC54_FSUSBHOST_BASE + OHCI_CTRL_OFFSET)
|
||||
#define LPC54_OHCI_CMDST (LPC54_FSUSBHOST_BASE + OHCI_CMDST_OFFSET)
|
||||
#define LPC54_OHCI_INTST (LPC54_FSUSBHOST_BASE + OHCI_INTST_OFFSET)
|
||||
#define LPC54_OHCI_INTEN (LPC54_FSUSBHOST_BASE + OHCI_INTEN_OFFSET)
|
||||
#define LPC54_OHCI_INTDIS (LPC54_FSUSBHOST_BASE + OHCI_INTDIS_OFFSET)
|
||||
|
||||
/* Memory pointers (section 7.2) */
|
||||
|
||||
#define LPC54_OHCI_HCCA (LPC54_FSUSBHOST_BASE + OHCI_HCCA_OFFSET)
|
||||
#define LPC54_OHCI_PERED (LPC54_FSUSBHOST_BASE + OHCI_PERED_OFFSET)
|
||||
#define LPC54_OHCI_CTRLHEADED (LPC54_FSUSBHOST_BASE + OHCI_CTRLHEADED_OFFSET)
|
||||
#define LPC54_OHCI_CTRLED (LPC54_FSUSBHOST_BASE + OHCI_CTRLED_OFFSET)
|
||||
#define LPC54_OHCI_BULKHEADED (LPC54_FSUSBHOST_BASE + OHCI_BULKHEADED_OFFSET)
|
||||
#define LPC54_OHCI_BULKED (LPC54_FSUSBHOST_BASE + OHCI_BULKED_OFFSET)
|
||||
#define LPC54_OHCI_DONEHEAD (LPC54_FSUSBHOST_BASE + OHCI_DONEHEAD_OFFSET)
|
||||
|
||||
/* Frame counters (section 7.3) */
|
||||
|
||||
#define LPC54_OHCI_FMINT (LPC54_FSUSBHOST_BASE + OHCI_FMINT_OFFSET)
|
||||
#define LPC54_OHCI_FMREM (LPC54_FSUSBHOST_BASE + OHCI_FMREM_OFFSET)
|
||||
#define LPC54_OHCI_FMNO (LPC54_FSUSBHOST_BASE + OHCI_FMNO_OFFSET)
|
||||
#define LPC54_OHCI_PERSTART (LPC54_FSUSBHOST_BASE + OHCI_PERSTART_OFFSET)
|
||||
|
||||
/* Root hub ports (section 7.4) */
|
||||
|
||||
#define LPC54_OHCI_LSTHRES (LPC54_FSUSBHOST_BASE + OHCI_LSTHRES_OFFSET)
|
||||
#define LPC54_OHCI_RHDESCA (LPC54_FSUSBHOST_BASE + OHCI_RHDESCA_OFFSET)
|
||||
#define LPC54_OHCI_RHDESCB (LPC54_FSUSBHOST_BASE + OHCI_RHDESCB_OFFSET)
|
||||
#define LPC54_OHCI_RHSTATUS (LPC54_FSUSBHOST_BASE + OHCI_RHSTATUS_OFFSET)
|
||||
#define LPC54_OHCI_RHPORTST1 (LPC54_FSUSBHOST_BASE + OHCI_RHPORTST1_OFFSET)
|
||||
#define LPC54_OHCI_RHPORTST2 (LPC54_FSUSBHOST_BASE + OHCI_RHPORTST2_OFFSET)
|
||||
|
||||
/* Non-standard Registers */
|
||||
|
||||
#define LPC54_OHCI_PORTMODE (LPC54_FSUSBHOST_BASE + LPC54_OHCI_PORTMODE_OFFSET)
|
||||
|
||||
/* Register bit definitions *********************************************************/
|
||||
|
||||
/* USB Host Controller (OHCI). See include/nuttx/usb/ohci.h */
|
||||
|
||||
/* Port mode register */
|
||||
|
||||
#define OHCI_PORTMODE_ID (1 << 0) /* Bit 0: Port ID pin value */
|
||||
/* Bits 1-7: Reserved */
|
||||
#define OHCI_PORTMODE_IDEN (1 << 8) /* Bit 8: Port ID pull-up enable */
|
||||
/* Bits 9-15: Reserved */
|
||||
#define OHCI_PORTMODE_DEVENABLE (1 << 16) /* Bit 16: Device mode enable */
|
||||
/* Bits 17-31: Reserved */
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_LPC54XX_CHIP_LPC54_USB0_OHCI_H */
|
3995
arch/arm/src/lpc54xx/lpc54_usb0_ohci.c
Normal file
3995
arch/arm/src/lpc54xx/lpc54_usb0_ohci.c
Normal file
File diff suppressed because it is too large
Load Diff
108
arch/arm/src/lpc54xx/lpc54_usb0_ohci.h
Normal file
108
arch/arm/src/lpc54xx/lpc54_usb0_ohci.h
Normal file
@ -0,0 +1,108 @@
|
||||
/************************************************************************************
|
||||
* arch/arm/src/lpc17xx/lpc17_usbhost.h
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_USBHOST_H
|
||||
#define __ARCH_ARM_SRC_LPC17XX_LPC17_USBHOST_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lpc17_usbhost_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize USB host device controller hardware.
|
||||
*
|
||||
* Input Parameters:
|
||||
* controller -- If the device supports more than USB host controller, then
|
||||
* this identifies which controller is being initializeed. Normally, this
|
||||
* is just zero.
|
||||
*
|
||||
* Returned Value:
|
||||
* And instance of the USB host interface. The controlling task should
|
||||
* use this interface to (1) call the wait() method to wait for a device
|
||||
* to be connected, and (2) call the enumerate() method to bind the device
|
||||
* to a class driver.
|
||||
*
|
||||
* Assumptions:
|
||||
* - This function should called in the initialization sequence in order
|
||||
* to initialize the USB device functionality.
|
||||
* - Class drivers should be initialized prior to calling this function.
|
||||
* Otherwise, there is a race condition if the device is already connected.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBHOST
|
||||
struct usbhost_connection_s;
|
||||
FAR struct usbhost_connection_s *lpc17_usbhost_initialize(int controller);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_USBHOST_H */
|
@ -23,6 +23,8 @@ CONFIG_FS_PROCFS=y
|
||||
CONFIG_FT5X06_POLLMODE=y
|
||||
CONFIG_FT5X06_SINGLEPOINT=y
|
||||
CONFIG_FT5X06_SWAPXY=y
|
||||
CONFIG_FT5X06_THRESHX=8
|
||||
CONFIG_FT5X06_THRESHY=8
|
||||
CONFIG_GRAPHICS_TWM4NX=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
|
Loading…
Reference in New Issue
Block a user