Add untested OHCI driver for the SAMA5; structure naming and header files for USB host initialization prototypes
This commit is contained in:
parent
9cf1365cde
commit
dfe6452b8e
106
arch/arm/src/lpc17xx/lpc17_usbhost.h
Normal file
106
arch/arm/src/lpc17xx/lpc17_usbhost.h
Normal file
@ -0,0 +1,106 @@
|
||||
/************************************************************************************
|
||||
* 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
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* Name: 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 intialized. 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_driver_s;
|
||||
FAR struct usbhost_driver_s *usbhost_initialize(int controller);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_USBHOST_H */
|
@ -259,7 +259,7 @@ config SAMA5_SPI_DMATHRESHOLD
|
||||
---help---
|
||||
When SPI DMA is enabled, small DMA transfers will still be performed
|
||||
by polling logic. But we need a threshold value to determine what
|
||||
is small. That value is provided by CONFIG_SAMA5_SPI_DMATHRESHOLD.
|
||||
is small. That value is provided by SAMA5_SPI_DMATHRESHOLD.
|
||||
|
||||
config SAMA5_SPI_DMADEBUG
|
||||
bool "SPI DMA transfer debug"
|
||||
@ -335,6 +335,53 @@ config SAMA5_HSMCI_REGDEBUG
|
||||
endmenu # HSMCI device driver options
|
||||
endif # SAMA5_HSMCI0 || SAMA5_HSMCI1 || SAMA5_HSMCI2
|
||||
|
||||
if SAMA5_UHPHS
|
||||
menu "USB High Speed Host device driver options"
|
||||
|
||||
config SAMA5_OHCI
|
||||
bool "Full speed OHCI support"
|
||||
default n
|
||||
---help---
|
||||
Build support for the SAMA5 USB full speed Open Host Controller
|
||||
Interface (OHCI).
|
||||
|
||||
if SAMA5_OHCI
|
||||
config SAMA5_OHCI_NEDS
|
||||
int "Number of endpoint descriptors"
|
||||
default 2
|
||||
|
||||
config SAMA5_OHCI_NTDS
|
||||
int "Number of transfer descriptors"
|
||||
default 3
|
||||
|
||||
config SAMA5_OHCI_TDBUFFERS
|
||||
int "Number of transfer descriptor buffers"
|
||||
default 2
|
||||
|
||||
config SAMA5_OHCI_TDBUFSIZE
|
||||
int "Size of one transfer descriptor buffer"
|
||||
default 128
|
||||
---help---
|
||||
The size of one transfer descriptor (TD) buffer in bytes. The TD
|
||||
buffer size must be an even number of 32-bit words
|
||||
|
||||
config SAMA5_OHCI_REGDEBUG
|
||||
bool "Enable low-level OHCI register debug"
|
||||
default n
|
||||
depends on DEBUG
|
||||
|
||||
endif # OHCI
|
||||
|
||||
config SAMA5_EHCI
|
||||
bool "High speed EHCI support"
|
||||
default n
|
||||
---help---
|
||||
Build support for the SAMA5 USB high speed Enhanced Host Controller
|
||||
Interface (OHCI).
|
||||
|
||||
endmenu # USB High Speed Host driver option
|
||||
endif # SAMA5_UHPHS
|
||||
|
||||
menu "External Memory Configuration"
|
||||
|
||||
config SAMA5_DDRCS
|
||||
|
@ -115,6 +115,15 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SAMA5_UHPHS),y)
|
||||
ifeq ($(CONFIG_SAMA5_OHCI),y)
|
||||
CHIP_CSRCS += sam_ohci.c
|
||||
endif
|
||||
ifeq ($(CONFIG_SAMA5_EHCI),y)
|
||||
CHIP_CSRCS += sam_ehci.c
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SAMA5_HSMCI0),y)
|
||||
CHIP_CSRCS += sam_hsmci.c
|
||||
else
|
||||
|
107
arch/arm/src/sama5/chip/sam_ohci.h
Normal file
107
arch/arm/src/sama5/chip/sam_ohci.h
Normal file
@ -0,0 +1,107 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/sama5/chip/sam_ohci.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_SAMA5_CHIP_SAM_USB_H
|
||||
#define __ARCH_ARM_SRC_SAMA5_CHIP_SAM_USB_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/usb/ohci.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "chip/sam_memorymap.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Register offsets *********************************************************/
|
||||
/* See nuttx/usb/ohci.h */
|
||||
|
||||
/* Register addresses *******************************************************/
|
||||
|
||||
#define SAM_USBHOST_HCIREV (SAM_UHPOHCI_VSECTION+OHCI_HCIREV_OFFSET)
|
||||
#define SAM_USBHOST_CTRL (SAM_UHPOHCI_VSECTION+OHCI_CTRL_OFFSET)
|
||||
#define SAM_USBHOST_CMDST (SAM_UHPOHCI_VSECTION+OHCI_CMDST_OFFSET)
|
||||
#define SAM_USBHOST_INTST (SAM_UHPOHCI_VSECTION+OHCI_INTST_OFFSET)
|
||||
#define SAM_USBHOST_INTEN (SAM_UHPOHCI_VSECTION+OHCI_INTEN_OFFSET)
|
||||
#define SAM_USBHOST_INTDIS (SAM_UHPOHCI_VSECTION+OHCI_INTDIS_OFFSET)
|
||||
|
||||
/* Memory pointers (section 7.2) */
|
||||
|
||||
#define SAM_USBHOST_HCCA (SAM_UHPOHCI_VSECTION+OHCI_HCCA_OFFSET)
|
||||
#define SAM_USBHOST_PERED (SAM_UHPOHCI_VSECTION+OHCI_PERED_OFFSET)
|
||||
#define SAM_USBHOST_CTRLHEADED (SAM_UHPOHCI_VSECTION+OHCI_CTRLHEADED_OFFSET)
|
||||
#define SAM_USBHOST_CTRLED (SAM_UHPOHCI_VSECTION+OHCI_CTRLED_OFFSET)
|
||||
#define SAM_USBHOST_BULKHEADED (SAM_UHPOHCI_VSECTION+OHCI_BULKHEADED_OFFSET)
|
||||
#define SAM_USBHOST_BULKED (SAM_UHPOHCI_VSECTION+OHCI_BULKED_OFFSET)
|
||||
#define SAM_USBHOST_DONEHEAD (SAM_UHPOHCI_VSECTION+OHCI_DONEHEAD_OFFSET)
|
||||
|
||||
/* Frame counters (section 7.3) */
|
||||
|
||||
#define SAM_USBHOST_FMINT (SAM_UHPOHCI_VSECTION+OHCI_FMINT_OFFSET)
|
||||
#define SAM_USBHOST_FMREM (SAM_UHPOHCI_VSECTION+OHCI_FMREM_OFFSET)
|
||||
#define SAM_USBHOST_FMNO (SAM_UHPOHCI_VSECTION+OHCI_FMNO_OFFSET)
|
||||
#define SAM_USBHOST_PERSTART (SAM_UHPOHCI_VSECTION+OHCI_PERSTART_OFFSET)
|
||||
|
||||
/* Root hub ports (section 7.4) */
|
||||
|
||||
#define SAM_USBHOST_LSTHRES (SAM_UHPOHCI_VSECTION+OHCI_LSTHRES_OFFSET)
|
||||
#define SAM_USBHOST_RHDESCA (SAM_UHPOHCI_VSECTION+OHCI_RHDESCA_OFFSET)
|
||||
#define SAM_USBHOST_RHDESCB (SAM_UHPOHCI_VSECTION+OHCI_RHDESCB_OFFSET)
|
||||
#define SAM_USBHOST_RHSTATUS (SAM_UHPOHCI_VSECTION+OHCI_RHSTATUS_OFFSET)
|
||||
#define SAM_USBHOST_RHPORTST1 (SAM_UHPOHCI_VSECTION+OHCI_RHPORTST1_OFFSET)
|
||||
#define SAM_USBHOST_RHPORTST2 (SAM_UHPOHCI_VSECTION+OHCI_RHPORTST2_OFFSET)
|
||||
#define SAM_USBHOST_MODID (SAM_UHPOHCI_VSECTION+SAM_USBHOST_MODID_OFFSET)
|
||||
|
||||
/* Register bit definitions *************************************************/
|
||||
/* See include/nuttx/usb/ohci.h */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_SAMA5_CHIP_SAM_USB_H */
|
@ -321,16 +321,37 @@ static inline void sam_selectplla(void)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_upllsetup
|
||||
* Name: sam_usbclockconfig
|
||||
*
|
||||
* Description:
|
||||
* Select the PLLA output as the input clock for PCK and MCK.
|
||||
* Configure clocking for USB.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void sam_upllsetup(void)
|
||||
static inline void sam_usbclockconfig(void)
|
||||
{
|
||||
#ifdef CONFIG_USBDEV
|
||||
#ifdef CONFIG_SAMA5_OHCI
|
||||
/* For OHCI Full-speed operations only, the user has to perform the
|
||||
* following:
|
||||
*
|
||||
* 1) Enable UHP peripheral clock, bit (1 << AT91C_ID_UHPHS) in PMC_PCER
|
||||
* register.
|
||||
* 2) Select PLLACK as Input clock of OHCI part, USBS bit in PMC_USB
|
||||
* register.
|
||||
* 3) Program the OHCI clocks (UHP48M and UHP12M) with USBDIV field in
|
||||
* PMC_USB register. USBDIV value is calculated regarding the PLLACK
|
||||
* value and USB Full-speed accuracy.
|
||||
* 4) Enable the OHCI clocks, UHP bit in PMC_SCER register.
|
||||
*
|
||||
* Steps 2 and 3 are done here. 1 and 2 are performed with the USB device
|
||||
* driver is opened.
|
||||
*/
|
||||
|
||||
putreg32(BOARD_OHCI_INPUT | BOARD_OHCI_DIVIDER << PMC_USB_USBDIV_SHIFT,
|
||||
SAM_PMC_USB);
|
||||
#endif
|
||||
|
||||
#if 0 // #ifdef CONFIG_USBDEV
|
||||
uint32_t regval;
|
||||
|
||||
/* Setup UTMI for USB and wait for LOCKU */
|
||||
@ -512,9 +533,9 @@ void sam_clockconfig(void)
|
||||
|
||||
sam_selectplla();
|
||||
|
||||
/* Setup UTMI for USB */
|
||||
/* Setup USB clocking */
|
||||
|
||||
sam_upllsetup();
|
||||
sam_usbclockconfig();
|
||||
}
|
||||
#endif /* CONFIG_SAMA5_BOOT_ISRAM || CONFIG_SAMA5_BOOT_CS0FLASH */
|
||||
}
|
||||
|
2596
arch/arm/src/sama5/sam_ohci.c
Normal file
2596
arch/arm/src/sama5/sam_ohci.c
Normal file
File diff suppressed because it is too large
Load Diff
112
arch/arm/src/sama5/sam_ohci.h
Normal file
112
arch/arm/src/sama5/sam_ohci.h
Normal file
@ -0,0 +1,112 @@
|
||||
/************************************************************************************
|
||||
* 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
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* Name: sam_ohci_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize USB OHCI host controller hardware.
|
||||
*
|
||||
* Input Parameters:
|
||||
* controller -- If the device supports more than USB host controller, then
|
||||
* this identifies which controller is being intialized. 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_driver_s;
|
||||
FAR struct usbhost_driver_s *sam_ohci_initialize(int controller);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_USBHOST_H */
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* arch/arm/src/stm32/stm32_otgfs.h
|
||||
*
|
||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -47,6 +47,8 @@
|
||||
#include "stm32.h"
|
||||
#include "chip/stm32_otgfs.h"
|
||||
|
||||
#ifdef CONFIG_STM32_OTGFS
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
@ -65,11 +67,42 @@
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* Name: stm32_otgfshost_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 intialized. 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_driver_s;
|
||||
FAR struct usbhost_driver_s *stm32_otgfshost_initialize(int controller);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_usbsuspend
|
||||
*
|
||||
@ -89,5 +122,6 @@ void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* CONFIG_STM32_OTGFS */
|
||||
#endif /* __ARCH_ARM_SRC_STM32_STM32_OTGFS_H */
|
||||
|
||||
|
@ -4193,7 +4193,7 @@ static inline int stm32_hw_initialize(FAR struct stm32_usbhost_s *priv)
|
||||
*******************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* Name: usbhost_initialize
|
||||
* Name: stm32_otgfshost_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize USB host device controller hardware.
|
||||
@ -4217,7 +4217,7 @@ static inline int stm32_hw_initialize(FAR struct stm32_usbhost_s *priv)
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
FAR struct usbhost_driver_s *usbhost_initialize(int controller)
|
||||
FAR struct usbhost_driver_s *stm32_otgfshost_initialize(int controller)
|
||||
{
|
||||
/* At present, there is only support for a single OTG FS host. Hence it is
|
||||
* pre-allocated as g_usbhost. However, in most code, the private data
|
||||
|
@ -453,7 +453,6 @@ EXTERN int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
* Name: pic32mx_dmainitialize
|
||||
*
|
||||
* Description:
|
||||
@ -464,13 +463,11 @@ EXTERN int pic32mx_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
EXTERN void pic32mx_dmainitilaize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
* Name: pic32mx_dmachannel
|
||||
*
|
||||
* Description:
|
||||
@ -484,13 +481,11 @@ EXTERN void pic32mx_dmainitilaize(void);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
EXTERN DMA_HANDLE pic32mx_dmachannel(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
* Name: pic32mx_dmafree
|
||||
*
|
||||
* Description:
|
||||
@ -502,13 +497,11 @@ EXTERN DMA_HANDLE pic32mx_dmachannel(void);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
EXTERN void pic32mx_dmafree(DMA_HANDLE handle);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
* Name: pic32mx_dmasetup
|
||||
*
|
||||
* Description:
|
||||
@ -516,7 +509,6 @@ EXTERN void pic32mx_dmafree(DMA_HANDLE handle);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
EXTERN int pic32mx_dmarxsetup(DMA_HANDLE handle,
|
||||
uint32_t control, uint32_t config,
|
||||
@ -525,7 +517,6 @@ EXTERN int pic32mx_dmarxsetup(DMA_HANDLE handle,
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
* Name: pic32mx_dmastart
|
||||
*
|
||||
* Description:
|
||||
@ -533,13 +524,11 @@ EXTERN int pic32mx_dmarxsetup(DMA_HANDLE handle,
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
EXTERN int pic32mx_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
* Name: pic32mx_dmastop
|
||||
*
|
||||
* Description:
|
||||
@ -549,13 +538,11 @@ EXTERN int pic32mx_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *ar
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
EXTERN void pic32mx_dmastop(DMA_HANDLE handle);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
* Name: pic32mx_dmasample
|
||||
*
|
||||
* Description:
|
||||
@ -563,7 +550,6 @@ EXTERN void pic32mx_dmastop(DMA_HANDLE handle);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
#ifdef CONFIG_DEBUG_DMA
|
||||
EXTERN void pic32mx_dmasample(DMA_HANDLE handle, struct pic32mx_dmaregs_s *regs);
|
||||
@ -573,7 +559,6 @@ EXTERN void pic32mx_dmasample(DMA_HANDLE handle, struct pic32mx_dmaregs_s *regs)
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
* Name: pic32mx_dmadump
|
||||
*
|
||||
* Description:
|
||||
@ -581,7 +566,6 @@ EXTERN void pic32mx_dmasample(DMA_HANDLE handle, struct pic32mx_dmaregs_s *regs)
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
|
||||
#ifdef CONFIG_PIC32MX_DMA
|
||||
#ifdef CONFIG_DEBUG_DMA
|
||||
EXTERN void pic32mx_dmadump(DMA_HANDLE handle, const struct pic32mx_dmaregs_s *regs,
|
||||
@ -592,7 +576,6 @@ EXTERN void pic32mx_dmadump(DMA_HANDLE handle, const struct pic32mx_dmaregs_s *r
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
* Name: pic32mx_usbpullup
|
||||
*
|
||||
* Description:
|
||||
@ -604,14 +587,12 @@ EXTERN void pic32mx_dmadump(DMA_HANDLE handle, const struct pic32mx_dmaregs_s *r
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
|
||||
#ifdef CONFIG_PIC32MX_USBDEV
|
||||
struct usbdev_s;
|
||||
EXTERN int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
* Name: pic32mx_usbsuspend
|
||||
*
|
||||
* Description:
|
||||
@ -622,7 +603,6 @@ EXTERN int pic32mx_usbpullup(FAR struct usbdev_s *dev, bool enable);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
|
||||
#ifdef CONFIG_PIC32MX_USBDEV
|
||||
EXTERN void pic32mx_usbsuspend(FAR struct usbdev_s *dev, bool resume);
|
||||
#endif
|
||||
@ -637,7 +617,6 @@ EXTERN void pic32mx_usbsuspend(FAR struct usbdev_s *dev, bool resume);
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
|
||||
#ifdef CONFIG_PIC32MX_USBDEV
|
||||
EXTERN void pic32mx_usbattach(void);
|
||||
EXTERN void pic32mx_usbdetach(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user