* arch/arm/src/sama5/sam_usbhost.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_SAMA5_SAM_USBHOST_H
#define __ARCH_ARM_SRC_SAMA5_SAM_USBHOST_H
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/usb/usbhost_trace.h>
#ifdef CONFIG_USBHOST
* Pre-processor Definitions
****************************************************************************/
* which need to know which USB host interface is being used.
*/
#define SAM_EHCI_IFACE 0
#define SAM_OHCI_IFACE 1
* which need to know which root hub port is being used.
*/
#define SAM_RHPORT1 0
#define SAM_RHPORT2 1
#define SAM_RHPORT3 2
* Public Types
****************************************************************************/
#ifdef HAVE_USBHOST_TRACE
enum usbhost_trace1codes_e
{
__TRACE1_BASEVALUE = 0,
#ifdef CONFIG_SAMA5_OHCI
OHCI_TRACE1_DEVDISCONN,
OHCI_TRACE1_INTRUNRECOVERABLE,
OHCI_TRACE1_INTRUNHANDLED,
OHCI_TRACE1_EPLISTALLOC_FAILED,
OHCI_TRACE1_EDALLOC_FAILED,
OHCI_TRACE1_TDALLOC_FAILED,
OHCI_TRACE1_IRQATTACH,
#ifdef CONFIG_USBHOST_ASYNCH
OHCI_TRACE1_BADTDSTATUS,
#endif
#ifdef HAVE_USBHOST_TRACE_VERBOSE
OHCI_VTRACE1_PHYSED,
OHCI_VTRACE1_VIRTED,
OHCI_VTRACE1_CSC,
OHCI_VTRACE1_DRWE,
OHCI_VTRACE1_ALREADYCONN,
OHCI_VTRACE1_SPEED,
OHCI_VTRACE1_ALREADYDISCONN,
OHCI_VTRACE1_RHSC,
OHCI_VTRACE1_WDHINTR,
OHCI_VTRACE1_CLASSENUM,
OHCI_VTRACE1_ENUMDISCONN,
OHCI_VTRACE1_INITIALIZING,
OHCI_VTRACE1_INITIALIZED,
OHCI_VTRACE1_INTRPENDING,
#endif
#endif
#ifdef CONFIG_SAMA5_EHCI
EHCI_TRACE1_SYSTEMERROR,
EHCI_TRACE1_QTDFOREACH_FAILED,
EHCI_TRACE1_QHALLOC_FAILED,
EHCI_TRACE1_BUFTOOBIG,
EHCI_TRACE1_REQQTDALLOC_FAILED,
EHCI_TRACE1_ADDBPL_FAILED,
EHCI_TRACE1_DATAQTDALLOC_FAILED,
EHCI_TRACE1_DEVDISCONNECTED,
EHCI_TRACE1_QHCREATE_FAILED,
EHCI_TRACE1_QTDSETUP_FAILED,
EHCI_TRACE1_QTDDATA_FAILED,
EHCI_TRACE1_QTDSTATUS_FAILED,
EHCI_TRACE1_TRANSFER_FAILED,
EHCI_TRACE1_QHFOREACH_FAILED,
EHCI_TRACE1_SYSERR_INTR,
EHCI_TRACE1_USBERR_INTR,
EHCI_TRACE1_EPALLOC_FAILED,
EHCI_TRACE1_BADXFRTYPE,
EHCI_TRACE1_HCHALTED_TIMEOUT,
EHCI_TRACE1_QHPOOLALLOC_FAILED,
EHCI_TRACE1_QTDPOOLALLOC_FAILED,
EHCI_TRACE1_PERFLALLOC_FAILED,
EHCI_TRACE1_RESET_FAILED,
EHCI_TRACE1_RUN_FAILED,
EHCI_TRACE1_IRQATTACH_FAILED,
#ifdef HAVE_USBHOST_TRACE_VERBOSE
EHCI_VTRACE1_PORTSC_CSC,
EHCI_VTRACE1_PORTSC_CONNALREADY,
EHCI_VTRACE1_PORTSC_DISCALREADY,
EHCI_VTRACE1_TOPHALF,
EHCI_VTRACE1_AAINTR,
EHCI_VTRACE1_USBINTR,
EHCI_VTRACE1_CLASSENUM,
EHCI_VTRACE1_ENUM_DISCONN,
EHCI_VTRACE1_INITIALIZING,
EHCI_VTRACE1_HCCPARAMS,
EHCI_VTRACE1_INIITIALIZED,
#endif
#endif
__TRACE1_NSTRINGS,
#ifdef CONFIG_SAMA5_OHCI
OHCI_TRACE2_BADTDSTATUS,
OHCI_TRACE2_WHDTDSTATUS,
OHCI_TRACE2_EP0ENQUEUE_FAILED,
OHCI_TRACE2_EDENQUEUE_FAILED,
OHCI_TRACE2_CLASSENUM_FAILED,
#ifdef HAVE_USBHOST_TRACE_VERBOSE
OHCI_VTRACE2_EP0CONFIG,
OHCI_VTRACE2_INTERVAL,
OHCI_VTRACE2_MININTERVAL,
OHCI_VTRACE2_RHPORTST,
OHCI_VTRACE2_CONNECTED,
OHCI_VTRACE2_DISCONNECTED,
OHCI_VTRACE2_WAKEUP,
OHCI_VTRACE2_EP0CTRLED,
OHCI_VTRACE2_EPALLOC,
OHCI_VTRACE2_CTRLIN,
OHCI_VTRACE2_CTRLOUT,
OHCI_VTRACE2_TRANSFER,
OHCI_VTRACE2_INITCONNECTED,
#ifdef CONFIG_USBHOST_HUB
OHCI_VTRACE2_HUBWAKEUP,
#endif
#endif
#endif
#ifdef CONFIG_SAMA5_EHCI
EHCI_TRACE2_EPSTALLED,
EHCI_TRACE2_EPIOERROR,
EHCI_TRACE2_CLASSENUM_FAILED,
#ifdef HAVE_USBHOST_TRACE_VERBOSE
EHCI_VTRACE2_EP0CONFIG,
EHCI_VTRACE2_ASYNCXFR,
EHCI_VTRACE2_INTRXFR,
EHCI_VTRACE2_IOCCHECK,
EHCI_VTRACE2_PORTSC,
EHCI_VTRACE2_PORTSC_CONNECTED,
EHCI_VTRACE2_PORTSC_DISCONND,
EHCI_VTRACE2_MONWAKEUP,
EHCI_VTRACE2_EPALLOC,
EHCI_VTRACE2_CTRLINOUT,
EHCI_VTRACE2_HCIVERSION,
EHCI_VTRACE2_HCSPARAMS,
#endif
#endif
__TRACE2_NSTRINGS
};
# define TRACE1_FIRST ((int)__TRACE1_BASEVALUE + 1)
# define TRACE1_INDEX(id) ((int)(id) - TRACE1_FIRST)
# define TRACE1_NSTRINGS TRACE1_INDEX(__TRACE1_NSTRINGS)
# define TRACE2_FIRST ((int)__TRACE1_NSTRINGS + 1)
# define TRACE2_INDEX(id) ((int)(id) - TRACE2_FIRST)
# define TRACE2_NSTRINGS TRACE2_INDEX(__TRACE2_NSTRINGS)
#endif
* Public Data
****************************************************************************/
* Public Data
****************************************************************************/
#ifndef __ASSEMBLY__
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
* Public Functions Prototypes
****************************************************************************/
* Name: sam_ohci_initialize
*
* Description:
* Initialize USB OHCI host controller hardware.
*
* Input Parameters:
* controller -- If the device supports more than one USB OHCI interface,
* 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_SAMA5_OHCI
struct usbhost_connection_s;
struct usbhost_connection_s *sam_ohci_initialize(int controller);
#endif
* Name: sam_ohci_tophalf
*
* Description:
* OHCI "Top Half" interrupt handler. If both EHCI and OHCI are enabled,
* then EHCI will manage the common UHPHS interrupt and will forward the
* interrupt event to this function.
*
****************************************************************************/
#ifdef CONFIG_SAMA5_OHCI
int sam_ohci_tophalf(int irq, void *context, void *arg);
#endif
* Name: sam_ehci_initialize
*
* Description:
* Initialize USB EHCI host controller hardware.
*
* Input Parameters:
* controller -- If the device supports more than one EHCI interface, 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_SAMA5_EHCI
struct usbhost_connection_s;
struct usbhost_connection_s *sam_ehci_initialize(int controller);
#endif
* Name: sam_usbhost_vbusdrive
*
* Description:
* Enable/disable driving of VBUS 5V output. This function must be
* provided by each platform that implements the OHCI or EHCI host
* interface
*
* Input Parameters:
* rhport - Selects root hub port to be powered host interface.
* See SAM_RHPORT_*definitions above.
* enable - true: enable VBUS power; false: disable VBUS power
*
* Returned Value:
* None
*
****************************************************************************/
void sam_usbhost_vbusdrive(int rhport, bool enable);
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif
#endif
#endif