Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.
Upstream: https://github.com/ARMmbed/DAPLink
source/hic_hal/freescale/k26f/fsl_usb.h@0:01f31e923fe2, 2020-04-07 (annotated)
- Committer:
- Pawel Zarembski
- Date:
- Tue Apr 07 12:55:42 2020 +0200
- Revision:
- 0:01f31e923fe2
hani: DAPLink with reset workaround
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Pawel Zarembski |
0:01f31e923fe2 | 1 | /* |
Pawel Zarembski |
0:01f31e923fe2 | 2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. |
Pawel Zarembski |
0:01f31e923fe2 | 3 | * All rights reserved. |
Pawel Zarembski |
0:01f31e923fe2 | 4 | * |
Pawel Zarembski |
0:01f31e923fe2 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
Pawel Zarembski |
0:01f31e923fe2 | 6 | * are permitted provided that the following conditions are met: |
Pawel Zarembski |
0:01f31e923fe2 | 7 | * |
Pawel Zarembski |
0:01f31e923fe2 | 8 | * o Redistributions of source code must retain the above copyright notice, this list |
Pawel Zarembski |
0:01f31e923fe2 | 9 | * of conditions and the following disclaimer. |
Pawel Zarembski |
0:01f31e923fe2 | 10 | * |
Pawel Zarembski |
0:01f31e923fe2 | 11 | * o Redistributions in binary form must reproduce the above copyright notice, this |
Pawel Zarembski |
0:01f31e923fe2 | 12 | * list of conditions and the following disclaimer in the documentation and/or |
Pawel Zarembski |
0:01f31e923fe2 | 13 | * other materials provided with the distribution. |
Pawel Zarembski |
0:01f31e923fe2 | 14 | * |
Pawel Zarembski |
0:01f31e923fe2 | 15 | * o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
Pawel Zarembski |
0:01f31e923fe2 | 16 | * contributors may be used to endorse or promote products derived from this |
Pawel Zarembski |
0:01f31e923fe2 | 17 | * software without specific prior written permission. |
Pawel Zarembski |
0:01f31e923fe2 | 18 | * |
Pawel Zarembski |
0:01f31e923fe2 | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
Pawel Zarembski |
0:01f31e923fe2 | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
Pawel Zarembski |
0:01f31e923fe2 | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Pawel Zarembski |
0:01f31e923fe2 | 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
Pawel Zarembski |
0:01f31e923fe2 | 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
Pawel Zarembski |
0:01f31e923fe2 | 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
Pawel Zarembski |
0:01f31e923fe2 | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
Pawel Zarembski |
0:01f31e923fe2 | 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
Pawel Zarembski |
0:01f31e923fe2 | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
Pawel Zarembski |
0:01f31e923fe2 | 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Pawel Zarembski |
0:01f31e923fe2 | 29 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 30 | |
Pawel Zarembski |
0:01f31e923fe2 | 31 | #ifndef __FSL_USB_H__ |
Pawel Zarembski |
0:01f31e923fe2 | 32 | #define __FSL_USB_H__ |
Pawel Zarembski |
0:01f31e923fe2 | 33 | |
Pawel Zarembski |
0:01f31e923fe2 | 34 | #include <stdint.h> |
Pawel Zarembski |
0:01f31e923fe2 | 35 | #include <stdio.h> |
Pawel Zarembski |
0:01f31e923fe2 | 36 | // #include "usb_osa.h" |
Pawel Zarembski |
0:01f31e923fe2 | 37 | // #include "usb_misc.h" |
Pawel Zarembski |
0:01f31e923fe2 | 38 | // #include "usb_spec.h" |
Pawel Zarembski |
0:01f31e923fe2 | 39 | |
Pawel Zarembski |
0:01f31e923fe2 | 40 | /*! |
Pawel Zarembski |
0:01f31e923fe2 | 41 | * @addtogroup usb_drv |
Pawel Zarembski |
0:01f31e923fe2 | 42 | * @{ |
Pawel Zarembski |
0:01f31e923fe2 | 43 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 44 | |
Pawel Zarembski |
0:01f31e923fe2 | 45 | /******************************************************************************* |
Pawel Zarembski |
0:01f31e923fe2 | 46 | * Definitions |
Pawel Zarembski |
0:01f31e923fe2 | 47 | ******************************************************************************/ |
Pawel Zarembski |
0:01f31e923fe2 | 48 | /*! @brief Defines USB stack major version */ |
Pawel Zarembski |
0:01f31e923fe2 | 49 | #define USB_STACK_VERSION_MAJOR (0x01U) |
Pawel Zarembski |
0:01f31e923fe2 | 50 | /*! @brief Defines USB stack minor version */ |
Pawel Zarembski |
0:01f31e923fe2 | 51 | #define USB_STACK_VERSION_MINOR (0x00U) |
Pawel Zarembski |
0:01f31e923fe2 | 52 | /*! @brief Defines USB stack bugfix version */ |
Pawel Zarembski |
0:01f31e923fe2 | 53 | #define USB_STACK_VERSION_BUGFIX (0x00U) |
Pawel Zarembski |
0:01f31e923fe2 | 54 | |
Pawel Zarembski |
0:01f31e923fe2 | 55 | /*! @brief USB stack version definition */ |
Pawel Zarembski |
0:01f31e923fe2 | 56 | #define USB_MAKE_VERSION(major, minor, bugfix) (((major) << 16) | ((minor) << 8) | (bugfix)) |
Pawel Zarembski |
0:01f31e923fe2 | 57 | |
Pawel Zarembski |
0:01f31e923fe2 | 58 | /*! @brief USB error code */ |
Pawel Zarembski |
0:01f31e923fe2 | 59 | typedef enum _usb_status |
Pawel Zarembski |
0:01f31e923fe2 | 60 | { |
Pawel Zarembski |
0:01f31e923fe2 | 61 | kStatus_USB_Success = 0x00U, /*!< Success */ |
Pawel Zarembski |
0:01f31e923fe2 | 62 | kStatus_USB_Error, /*!< Failed */ |
Pawel Zarembski |
0:01f31e923fe2 | 63 | |
Pawel Zarembski |
0:01f31e923fe2 | 64 | kStatus_USB_Busy, /*!< Busy */ |
Pawel Zarembski |
0:01f31e923fe2 | 65 | kStatus_USB_InvalidHandle, /*!< Invalid handle */ |
Pawel Zarembski |
0:01f31e923fe2 | 66 | kStatus_USB_InvalidParameter, /*!< Invalid parameter */ |
Pawel Zarembski |
0:01f31e923fe2 | 67 | kStatus_USB_InvalidRequest, /*!< Invalid request */ |
Pawel Zarembski |
0:01f31e923fe2 | 68 | kStatus_USB_ControllerNotFound, /*!< Controller cannot be found */ |
Pawel Zarembski |
0:01f31e923fe2 | 69 | kStatus_USB_InvalidControllerInterface, /*!< Invalid controller interface */ |
Pawel Zarembski |
0:01f31e923fe2 | 70 | |
Pawel Zarembski |
0:01f31e923fe2 | 71 | kStatus_USB_NotSupported, /*!< Configuration is not supported */ |
Pawel Zarembski |
0:01f31e923fe2 | 72 | kStatus_USB_Retry, /*!< Enumeration get configuration retry */ |
Pawel Zarembski |
0:01f31e923fe2 | 73 | kStatus_USB_TransferStall, /*!< Transfer stalled */ |
Pawel Zarembski |
0:01f31e923fe2 | 74 | kStatus_USB_TransferFailed, /*!< Transfer failed */ |
Pawel Zarembski |
0:01f31e923fe2 | 75 | kStatus_USB_AllocFail, /*!< Allocation failed */ |
Pawel Zarembski |
0:01f31e923fe2 | 76 | kStatus_USB_LackSwapBuffer, /*!< Insufficient swap buffer for KHCI */ |
Pawel Zarembski |
0:01f31e923fe2 | 77 | kStatus_USB_TransferCancel, /*!< The transfer cancelled */ |
Pawel Zarembski |
0:01f31e923fe2 | 78 | kStatus_USB_BandwidthFail, /*!< Allocate bandwidth failed */ |
Pawel Zarembski |
0:01f31e923fe2 | 79 | kStatus_USB_MSDStatusFail, /*!< For MSD, the CSW status means fail */ |
Pawel Zarembski |
0:01f31e923fe2 | 80 | } usb_status_t; |
Pawel Zarembski |
0:01f31e923fe2 | 81 | |
Pawel Zarembski |
0:01f31e923fe2 | 82 | /*! @brief USB host handle type define */ |
Pawel Zarembski |
0:01f31e923fe2 | 83 | typedef void *usb_host_handle; |
Pawel Zarembski |
0:01f31e923fe2 | 84 | |
Pawel Zarembski |
0:01f31e923fe2 | 85 | /*! @brief USB device handle type define. For device stack it is the whole device handle; for host stack it is the |
Pawel Zarembski |
0:01f31e923fe2 | 86 | * attached device instance handle*/ |
Pawel Zarembski |
0:01f31e923fe2 | 87 | typedef void *usb_device_handle; |
Pawel Zarembski |
0:01f31e923fe2 | 88 | |
Pawel Zarembski |
0:01f31e923fe2 | 89 | /*! @brief USB OTG handle type define */ |
Pawel Zarembski |
0:01f31e923fe2 | 90 | typedef void *usb_otg_handle; |
Pawel Zarembski |
0:01f31e923fe2 | 91 | |
Pawel Zarembski |
0:01f31e923fe2 | 92 | /*! @brief USB controller ID */ |
Pawel Zarembski |
0:01f31e923fe2 | 93 | typedef enum _usb_controller_index |
Pawel Zarembski |
0:01f31e923fe2 | 94 | { |
Pawel Zarembski |
0:01f31e923fe2 | 95 | kUSB_ControllerKhci0 = 0U, /*!< KHCI 0U */ |
Pawel Zarembski |
0:01f31e923fe2 | 96 | kUSB_ControllerKhci1, /*!< KHCI 1U, Currently, there are no platforms which have two KHCI IPs, this is reserved |
Pawel Zarembski |
0:01f31e923fe2 | 97 | to be used in the future. */ |
Pawel Zarembski |
0:01f31e923fe2 | 98 | kUSB_ControllerEhci0, /*!< EHCI 0U */ |
Pawel Zarembski |
0:01f31e923fe2 | 99 | kUSB_ControllerEhci1, /*!< EHCI 1U, Currently, there are no platforms which have two KHCI IPs, this is reserved |
Pawel Zarembski |
0:01f31e923fe2 | 100 | to be used in the future. */ |
Pawel Zarembski |
0:01f31e923fe2 | 101 | } usb_controller_index_t; |
Pawel Zarembski |
0:01f31e923fe2 | 102 | |
Pawel Zarembski |
0:01f31e923fe2 | 103 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 104 | * @brief USB stack version fields |
Pawel Zarembski |
0:01f31e923fe2 | 105 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 106 | typedef struct _usb_version |
Pawel Zarembski |
0:01f31e923fe2 | 107 | { |
Pawel Zarembski |
0:01f31e923fe2 | 108 | uint8_t major; /*!< Major */ |
Pawel Zarembski |
0:01f31e923fe2 | 109 | uint8_t minor; /*!< Minor */ |
Pawel Zarembski |
0:01f31e923fe2 | 110 | uint8_t bugfix; /*!< Bug fix */ |
Pawel Zarembski |
0:01f31e923fe2 | 111 | } usb_version_t; |
Pawel Zarembski |
0:01f31e923fe2 | 112 | |
Pawel Zarembski |
0:01f31e923fe2 | 113 | /******************************************************************************* |
Pawel Zarembski |
0:01f31e923fe2 | 114 | * API |
Pawel Zarembski |
0:01f31e923fe2 | 115 | ******************************************************************************/ |
Pawel Zarembski |
0:01f31e923fe2 | 116 | |
Pawel Zarembski |
0:01f31e923fe2 | 117 | /*! @} */ |
Pawel Zarembski |
0:01f31e923fe2 | 118 | |
Pawel Zarembski |
0:01f31e923fe2 | 119 | #endif /* __FSL_USB_H__ */ |