Arrow / Mbed OS DAPLink Reset
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers fsl_usb.h Source File

fsl_usb.h

00001 /*
00002  * Copyright (c) 2015, Freescale Semiconductor, Inc.
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without modification,
00006  * are permitted provided that the following conditions are met:
00007  *
00008  * o Redistributions of source code must retain the above copyright notice, this list
00009  *   of conditions and the following disclaimer.
00010  *
00011  * o Redistributions in binary form must reproduce the above copyright notice, this
00012  *   list of conditions and the following disclaimer in the documentation and/or
00013  *   other materials provided with the distribution.
00014  *
00015  * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
00016  *   contributors may be used to endorse or promote products derived from this
00017  *   software without specific prior written permission.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00020  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00021  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00022  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
00023  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00024  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00025  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
00026  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00027  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00028  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029  */
00030 
00031 #ifndef __FSL_USB_H__
00032 #define __FSL_USB_H__
00033 
00034 #include <stdint.h>
00035 #include <stdio.h>
00036 // #include "usb_osa.h"
00037 // #include "usb_misc.h"
00038 // #include "usb_spec.h"
00039 
00040 /*!
00041  * @addtogroup usb_drv
00042  * @{
00043  */
00044 
00045 /*******************************************************************************
00046  * Definitions
00047  ******************************************************************************/
00048 /*! @brief Defines USB stack major version */
00049 #define USB_STACK_VERSION_MAJOR (0x01U)
00050 /*! @brief Defines USB stack minor version */
00051 #define USB_STACK_VERSION_MINOR (0x00U)
00052 /*! @brief Defines USB stack bugfix version */
00053 #define USB_STACK_VERSION_BUGFIX (0x00U)
00054 
00055 /*! @brief USB stack version definition */
00056 #define USB_MAKE_VERSION(major, minor, bugfix) (((major) << 16) | ((minor) << 8) | (bugfix))
00057 
00058 /*! @brief USB error code */
00059 typedef enum _usb_status
00060 {
00061     kStatus_USB_Success  = 0x00U, /*!< Success */
00062     kStatus_USB_Error ,           /*!< Failed */
00063 
00064     kStatus_USB_Busy ,                       /*!< Busy */
00065     kStatus_USB_InvalidHandle ,              /*!< Invalid handle */
00066     kStatus_USB_InvalidParameter ,           /*!< Invalid parameter */
00067     kStatus_USB_InvalidRequest ,             /*!< Invalid request */
00068     kStatus_USB_ControllerNotFound ,         /*!< Controller cannot be found */
00069     kStatus_USB_InvalidControllerInterface , /*!< Invalid controller interface */
00070 
00071     kStatus_USB_NotSupported ,   /*!< Configuration is not supported */
00072     kStatus_USB_Retry ,          /*!< Enumeration get configuration retry */
00073     kStatus_USB_TransferStall ,  /*!< Transfer stalled */
00074     kStatus_USB_TransferFailed , /*!< Transfer failed */
00075     kStatus_USB_AllocFail ,      /*!< Allocation failed */
00076     kStatus_USB_LackSwapBuffer , /*!< Insufficient swap buffer for KHCI */
00077     kStatus_USB_TransferCancel , /*!< The transfer cancelled */
00078     kStatus_USB_BandwidthFail ,  /*!< Allocate bandwidth failed */
00079     kStatus_USB_MSDStatusFail ,  /*!< For MSD, the CSW status means fail */
00080 } usb_status_t;
00081 
00082 /*! @brief USB host handle type define */
00083 typedef void *usb_host_handle;
00084 
00085 /*! @brief USB device handle type define. For device stack it is the whole device handle; for host stack it is the
00086  * attached device instance handle*/
00087 typedef void *usb_device_handle;
00088 
00089 /*! @brief USB OTG handle type define */
00090 typedef void *usb_otg_handle;
00091 
00092 /*! @brief USB controller ID */
00093 typedef enum _usb_controller_index
00094 {
00095     kUSB_ControllerKhci0  = 0U, /*!< KHCI 0U */
00096     kUSB_ControllerKhci1 ,      /*!< KHCI 1U, Currently, there are no platforms which have two KHCI IPs, this is reserved
00097                                   to be used in the future. */
00098     kUSB_ControllerEhci0 ,      /*!< EHCI 0U */
00099     kUSB_ControllerEhci1 ,      /*!< EHCI 1U, Currently, there are no platforms which have two KHCI IPs, this is reserved
00100                                   to be used in the future. */
00101 } usb_controller_index_t;
00102 
00103 /**
00104 * @brief USB stack version fields
00105 */
00106 typedef struct _usb_version
00107 {
00108     uint8_t major ;  /*!< Major */
00109     uint8_t minor ;  /*!< Minor */
00110     uint8_t bugfix ; /*!< Bug fix */
00111 } usb_version_t;
00112 
00113 /*******************************************************************************
00114  * API
00115  ******************************************************************************/
00116 
00117 /*! @} */
00118 
00119 #endif /* __FSL_USB_H__ */