1 /* 2 * Copyright (c) 2015, Freescale Semiconductor, Inc. 3 * Copyright 2016 - 2017 NXP 4 * 5 * Redistribution and use in source and binary forms, with or without modification, 6 * are permitted provided that the following conditions are met: 7 * 8 * o Redistributions of source code must retain the above copyright notice, this list 9 * of conditions and the following disclaimer. 10 * 11 * o Redistributions in binary form must reproduce the above copyright notice, this 12 * list of conditions and the following disclaimer in the documentation and/or 13 * other materials provided with the distribution. 14 * 15 * o Neither the name of the copyright holder nor the names of its 16 * contributors may be used to endorse or promote products derived from this 17 * software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 #ifndef _USB_DEVICE_CONFIG_H_ 32 #define _USB_DEVICE_CONFIG_H_ 33 34 /******************************************************************************* 35 * Definitions 36 ******************************************************************************/ 37 /*! 38 * @addtogroup usb_device_configuration 39 * @{ 40 */ 41 42 /*! 43 * @name Hardware instance define 44 * @{ 45 */ 46 47 /*! @brief KHCI instance count */ 48 #define USB_DEVICE_CONFIG_KHCI (0U) 49 50 /*! @brief EHCI instance count */ 51 #define USB_DEVICE_CONFIG_EHCI (2U) 52 53 /*! @brief LPC USB IP3511 FS instance count */ 54 #define USB_DEVICE_CONFIG_LPCIP3511FS (0U) 55 56 /*! @brief LPC USB IP3511 HS instance count */ 57 #define USB_DEVICE_CONFIG_LPCIP3511HS (0U) 58 59 /*! @brief Device instance count, the sum of KHCI and EHCI instance counts*/ 60 #define USB_DEVICE_CONFIG_NUM \ 61 (USB_DEVICE_CONFIG_KHCI + USB_DEVICE_CONFIG_EHCI + USB_DEVICE_CONFIG_LPCIP3511FS + USB_DEVICE_CONFIG_LPCIP3511HS) 62 63 /* @} */ 64 65 /*! 66 * @name class instance define 67 * @{ 68 */ 69 70 /*! @brief HID instance count */ 71 #define USB_DEVICE_CONFIG_HID (0U) 72 73 /*! @brief CDC ACM instance count */ 74 #define USB_DEVICE_CONFIG_CDC_ACM (1U) 75 76 /*! @brief MSC instance count */ 77 #define USB_DEVICE_CONFIG_MSC (0U) 78 79 /*! @brief Audio instance count */ 80 #define USB_DEVICE_CONFIG_AUDIO (0U) 81 82 /*! @brief PHDC instance count */ 83 #define USB_DEVICE_CONFIG_PHDC (0U) 84 85 /*! @brief Video instance count */ 86 #define USB_DEVICE_CONFIG_VIDEO (0U) 87 88 /*! @brief CCID instance count */ 89 #define USB_DEVICE_CONFIG_CCID (0U) 90 91 /*! @brief Printer instance count */ 92 #define USB_DEVICE_CONFIG_PRINTER (0U) 93 94 /*! @brief DFU instance count */ 95 #define USB_DEVICE_CONFIG_DFU (0U) 96 97 /* @} */ 98 99 /*! @brief Whether device is self power. 1U supported, 0U not supported */ 100 #define USB_DEVICE_CONFIG_SELF_POWER (1U) 101 102 /*! @brief How many endpoints are supported in the stack. */ 103 #define USB_DEVICE_CONFIG_ENDPOINTS (4U) 104 105 /*! @brief Whether the device task is enabled. */ 106 #define USB_DEVICE_CONFIG_USE_TASK (0U) 107 108 /*! @brief How many the notification message are supported when the device task is enabled. */ 109 #define USB_DEVICE_CONFIG_MAX_MESSAGES (8U) 110 111 /*! @brief Whether test mode enabled. */ 112 #define USB_DEVICE_CONFIG_USB20_TEST_MODE (0U) 113 114 /*! @brief Whether device CV test is enabled. */ 115 #define USB_DEVICE_CONFIG_CV_TEST (0U) 116 117 /*! @brief Whether device compliance test is enabled. If the macro is enabled, 118 the test mode and CV test macroes will be set.*/ 119 #define USB_DEVICE_CONFIG_COMPLIANCE_TEST (0U) 120 121 #if ((defined(USB_DEVICE_CONFIG_COMPLIANCE_TEST)) && (USB_DEVICE_CONFIG_COMPLIANCE_TEST > 0U)) 122 123 /*! @brief Undefine the marco USB_DEVICE_CONFIG_USB20_TEST_MODE. */ 124 #undef USB_DEVICE_CONFIG_USB20_TEST_MODE 125 /*! @brief Undefine the marco USB_DEVICE_CONFIG_CV_TEST. */ 126 #undef USB_DEVICE_CONFIG_CV_TEST 127 128 /*! @brief enable the test mode. */ 129 #define USB_DEVICE_CONFIG_USB20_TEST_MODE (1U) 130 131 /*! @brief enable the CV test */ 132 #define USB_DEVICE_CONFIG_CV_TEST (1U) 133 134 #endif 135 136 #if ((defined(USB_DEVICE_CONFIG_KHCI)) && (USB_DEVICE_CONFIG_KHCI > 0U)) 137 138 /*! @brief The MAX buffer length for the KHCI DMA workaround.*/ 139 #define USB_DEVICE_CONFIG_KHCI_DMA_ALIGN_BUFFER_LENGTH (64U) 140 #endif 141 142 #if ((defined(USB_DEVICE_CONFIG_EHCI)) && (USB_DEVICE_CONFIG_EHCI > 0U)) 143 /*! @brief How many the DTD are supported. */ 144 #define USB_DEVICE_CONFIG_EHCI_MAX_DTD (16U) 145 146 /*! @brief Whether the EHCI ID pin detect feature enabled. */ 147 #define USB_DEVICE_CONFIG_EHCI_ID_PIN_DETECT (0U) 148 #endif 149 150 /*! @brief Whether the keep alive feature enabled. */ 151 #define USB_DEVICE_CONFIG_KEEP_ALIVE_MODE (0U) 152 153 /*! @brief Whether the transfer buffer is cache-enabled or not. */ 154 #define USB_DEVICE_CONFIG_BUFFER_PROPERTY_CACHEABLE (1U) 155 156 /*! @brief Whether the low power mode is enabled or not. */ 157 #define USB_DEVICE_CONFIG_LOW_POWER_MODE (0U) 158 159 #if ((defined(USB_DEVICE_CONFIG_LOW_POWER_MODE)) && (USB_DEVICE_CONFIG_LOW_POWER_MODE > 0U)) 160 /*! @brief Whether device remote wakeup supported. 1U supported, 0U not supported */ 161 #define USB_DEVICE_CONFIG_REMOTE_WAKEUP (0U) 162 163 /*! @brief Whether LPM is supported. 1U supported, 0U not supported */ 164 #define USB_DEVICE_CONFIG_LPM_L1 (0U) 165 #else 166 /*! @brief The device remote wakeup is unsupported. */ 167 #define USB_DEVICE_CONFIG_REMOTE_WAKEUP (0U) 168 #endif 169 170 /*! @brief Whether the device detached feature is enabled or not. */ 171 #define USB_DEVICE_CONFIG_DETACH_ENABLE (0U) 172 173 /*! @brief Whether handle the USB bus error. */ 174 #define USB_DEVICE_CONFIG_ERROR_HANDLING (0U) 175 176 /* @} */ 177 /*! @brief rt-thread port alloc */ 178 #include <rtthread.h> 179 #define USB_OSA_SR_ALLOC(...) 180 /*! @brief rt-thread port enter critical */ 181 #define USB_OSA_ENTER_CRITICAL rt_enter_critical 182 /*! @brief rt-thread port exit critical */ 183 #define USB_OSA_EXIT_CRITICAL rt_exit_critical 184 185 #endif /* _USB_DEVICE_CONFIG_H_ */ 186