2 * The Clear BSD License
3 * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc.
7 * Redistribution and use in source and binary forms, with or without modification,
8 * are permitted (subject to the limitations in the disclaimer below) provided
9 * that the following conditions are met:
11 * o Redistributions of source code must retain the above copyright notice, this list
12 * of conditions and the following disclaimer.
14 * o Redistributions in binary form must reproduce the above copyright notice, this
15 * list of conditions and the following disclaimer in the documentation and/or
16 * other materials provided with the distribution.
18 * o Neither the name of the copyright holder nor the names of its
19 * contributors may be used to endorse or promote products derived from this
20 * software without specific prior written permission.
22 * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
27 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
30 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 #ifndef __USB_MISC_H__
36 #define __USB_MISC_H__
40 #error ENDIANNESS should be defined, and then rebulid the project.
44 /*******************************************************************************
46 ******************************************************************************/
48 /*! @brief Define USB printf */
49 #if defined(__cplusplus)
51 #endif /* __cplusplus */
53 extern int DbgConsole_Printf(const char *fmt_s, ...);
55 #if defined(__cplusplus)
57 #endif /* __cplusplus */
59 #if defined(SDK_DEBUGCONSOLE) && (SDK_DEBUGCONSOLE < 1)
60 #define usb_echo printf
62 #define usb_echo DbgConsole_Printf
65 #if defined(__ICCARM__)
68 #define STRUCT_PACKED __packed
71 #ifndef STRUCT_UNPACKED
72 #define STRUCT_UNPACKED
75 #elif defined(__GNUC__)
81 #ifndef STRUCT_UNPACKED
82 #define STRUCT_UNPACKED __attribute__((__packed__))
85 #elif defined(__CC_ARM)
88 #define STRUCT_PACKED _Pragma("pack(1U)")
91 #ifndef STRUCT_UNPACKED
92 #define STRUCT_UNPACKED _Pragma("pack()")
97 #define USB_SHORT_GET_LOW(x) (((uint16_t)x) & 0xFFU)
98 #define USB_SHORT_GET_HIGH(x) ((uint8_t)(((uint16_t)x) >> 8U) & 0xFFU)
100 #define USB_LONG_GET_BYTE0(x) ((uint8_t)(((uint32_t)(x))) & 0xFFU)
101 #define USB_LONG_GET_BYTE1(x) ((uint8_t)(((uint32_t)(x)) >> 8U) & 0xFFU)
102 #define USB_LONG_GET_BYTE2(x) ((uint8_t)(((uint32_t)(x)) >> 16U) & 0xFFU)
103 #define USB_LONG_GET_BYTE3(x) ((uint8_t)(((uint32_t)(x)) >> 24U) & 0xFFU)
105 #define USB_MEM4_ALIGN_MASK (0x03U)
107 /* accessory macro */
108 #define USB_MEM4_ALIGN(n) ((n + 3U) & (0xFFFFFFFCu))
109 #define USB_MEM32_ALIGN(n) ((n + 31U) & (0xFFFFFFE0u))
110 #define USB_MEM64_ALIGN(n) ((n + 63U) & (0xFFFFFFC0u))
112 /* big/little endian */
113 #define SWAP2BYTE_CONST(n) ((((n)&0x00FFU) << 8U) | (((n)&0xFF00U) >> 8U))
114 #define SWAP4BYTE_CONST(n) \
115 ((((n)&0x000000FFU) << 24U) | (((n)&0x0000FF00U) << 8U) | (((n)&0x00FF0000U) >> 8U) | (((n)&0xFF000000U) >> 24U))
117 #define USB_ASSIGN_VALUE_ADDRESS_LONG_BY_BYTE(n, m) \
119 *((uint8_t *)&(n)) = *((uint8_t *)&(m)); \
120 *((uint8_t *)&(n) + 1) = *((uint8_t *)&(m) + 1); \
121 *((uint8_t *)&(n) + 2) = *((uint8_t *)&(m) + 2); \
122 *((uint8_t *)&(n) + 3) = *((uint8_t *)&(m) + 3); \
125 #define USB_ASSIGN_VALUE_ADDRESS_SHORT_BY_BYTE(n, m) \
127 *((uint8_t *)&(n)) = *((uint8_t *)&(m)); \
128 *((uint8_t *)&(n) + 1) = *((uint8_t *)&(m) + 1); \
131 #define USB_ASSIGN_MACRO_VALUE_ADDRESS_LONG_BY_BYTE(n, m) \
133 *((uint8_t *)&(n)) = (uint8_t)m; \
134 *((uint8_t *)&(n) + 1) = (uint8_t)(m >> 8); \
135 *((uint8_t *)&(n) + 2) = (uint8_t)(m >> 16); \
136 *((uint8_t *)&(n) + 3) = (uint8_t)(m >> 24); \
139 #define USB_ASSIGN_MACRO_VALUE_ADDRESS_SHORT_BY_BYTE(n, m) \
141 *((uint8_t *)&(n)) = (uint8_t)m; \
142 *((uint8_t *)&(n) + 1) = (uint8_t)(m >> 8); \
145 #if (ENDIANNESS == USB_BIG_ENDIAN)
147 #define USB_SHORT_TO_LITTLE_ENDIAN(n) SWAP2BYTE_CONST(n)
148 #define USB_LONG_TO_LITTLE_ENDIAN(n) SWAP4BYTE_CONST(n)
149 #define USB_SHORT_FROM_LITTLE_ENDIAN(n) SWAP2BYTE_CONST(n)
150 #define USB_LONG_FROM_LITTLE_ENDIAN(n) SWAP2BYTE_CONST(n)
152 #define USB_SHORT_TO_BIG_ENDIAN(n) (n)
153 #define USB_LONG_TO_BIG_ENDIAN(n) (n)
154 #define USB_SHORT_FROM_BIG_ENDIAN(n) (n)
155 #define USB_LONG_FROM_BIG_ENDIAN(n) (n)
157 #define USB_LONG_TO_LITTLE_ENDIAN_ADDRESS(n, m) \
159 m[3] = ((((uint32_t)(n)) >> 24U) & 0xFFU); \
160 m[2] = ((((uint32_t)(n)) >> 16U) & 0xFFU); \
161 m[1] = ((((uint32_t)(n)) >> 8U) & 0xFFU); \
162 m[0] = (((uint32_t)(n)) & 0xFFU); \
165 #define USB_LONG_FROM_LITTLE_ENDIAN_ADDRESS(n) \
166 ((uint32_t)((((uint8_t)n[3]) << 24U) | (((uint8_t)n[2]) << 16U) | (((uint8_t)n[1]) << 8U) | \
167 (((uint8_t)n[0]) << 0U)))
169 #define USB_LONG_TO_BIG_ENDIAN_ADDRESS(n, m) \
171 m[0] = ((((uint32_t)(n)) >> 24U) & 0xFFU); \
172 m[1] = ((((uint32_t)(n)) >> 16U) & 0xFFU); \
173 m[2] = ((((uint32_t)(n)) >> 8U) & 0xFFU); \
174 m[3] = (((uint32_t)(n)) & 0xFFU); \
177 #define USB_LONG_FROM_BIG_ENDIAN_ADDRESS(n) \
178 ((uint32_t)((((uint8_t)n[0]) << 24U) | (((uint8_t)n[1]) << 16U) | (((uint8_t)n[2]) << 8U) | \
179 (((uint8_t)n[3]) << 0U)))
181 #define USB_SHORT_TO_LITTLE_ENDIAN_ADDRESS(n, m) \
183 m[1] = ((((uint16_t)(n)) >> 8U) & 0xFFU); \
184 m[0] = (((uint16_t)(n)) & 0xFFU); \
187 #define USB_SHORT_FROM_LITTLE_ENDIAN_ADDRESS(n) ((uint32_t)((((uint8_t)n[1]) << 8U) | (((uint8_t)n[0]) << 0U)))
189 #define USB_SHORT_TO_BIG_ENDIAN_ADDRESS(n, m) \
191 m[0] = ((((uint16_t)(n)) >> 8U) & 0xFFU); \
192 m[1] = (((uint16_t)(n)) & 0xFFU); \
195 #define USB_SHORT_FROM_BIG_ENDIAN_ADDRESS(n) ((uint32_t)((((uint8_t)n[0]) << 8U) | (((uint8_t)n[1]) << 0U)))
197 #define USB_LONG_TO_LITTLE_ENDIAN_DATA(n, m) \
199 *((uint8_t *)&(m) + 3) = ((((uint32_t)(n)) >> 24U) & 0xFFU); \
200 *((uint8_t *)&(m) + 2) = ((((uint32_t)(n)) >> 16U) & 0xFFU); \
201 *((uint8_t *)&(m) + 1) = ((((uint32_t)(n)) >> 8U) & 0xFFU); \
202 *((uint8_t *)&(m) + 0) = (((uint32_t)(n)) & 0xFFU); \
205 #define USB_LONG_FROM_LITTLE_ENDIAN_DATA(n) \
206 ((uint32_t)(((*((uint8_t *)&(n) + 3)) << 24U) | ((*((uint8_t *)&(n) + 2)) << 16U) | \
207 ((*((uint8_t *)&(n) + 1)) << 8U) | ((*((uint8_t *)&(n))) << 0U)))
209 #define USB_SHORT_TO_LITTLE_ENDIAN_DATA(n, m) \
211 *((uint8_t *)&(m) + 1) = ((((uint16_t)(n)) >> 8U) & 0xFFU); \
212 *((uint8_t *)&(m)) = ((((uint16_t)(n))) & 0xFFU); \
215 #define USB_SHORT_FROM_LITTLE_ENDIAN_DATA(n) ((uint32_t)(((*((uint8_t *)&(n) + 1)) << 8U) | ((*((uint8_t *)&(n))))))
219 #define USB_SHORT_TO_LITTLE_ENDIAN(n) (n)
220 #define USB_LONG_TO_LITTLE_ENDIAN(n) (n)
221 #define USB_SHORT_FROM_LITTLE_ENDIAN(n) (n)
222 #define USB_LONG_FROM_LITTLE_ENDIAN(n) (n)
224 #define USB_SHORT_TO_BIG_ENDIAN(n) SWAP2BYTE_CONST(n)
225 #define USB_LONG_TO_BIG_ENDIAN(n) SWAP4BYTE_CONST(n)
226 #define USB_SHORT_FROM_BIG_ENDIAN(n) SWAP2BYTE_CONST(n)
227 #define USB_LONG_FROM_BIG_ENDIAN(n) SWAP4BYTE_CONST(n)
229 #define USB_LONG_TO_LITTLE_ENDIAN_ADDRESS(n, m) \
231 m[3] = ((((uint32_t)(n)) >> 24U) & 0xFFU); \
232 m[2] = ((((uint32_t)(n)) >> 16U) & 0xFFU); \
233 m[1] = ((((uint32_t)(n)) >> 8U) & 0xFFU); \
234 m[0] = (((uint32_t)(n)) & 0xFFU); \
237 #define USB_LONG_FROM_LITTLE_ENDIAN_ADDRESS(n) \
238 ((uint32_t)((((uint8_t)n[3]) << 24U) | (((uint8_t)n[2]) << 16U) | (((uint8_t)n[1]) << 8U) | \
239 (((uint8_t)n[0]) << 0U)))
241 #define USB_LONG_TO_BIG_ENDIAN_ADDRESS(n, m) \
243 m[0] = ((((uint32_t)(n)) >> 24U) & 0xFFU); \
244 m[1] = ((((uint32_t)(n)) >> 16U) & 0xFFU); \
245 m[2] = ((((uint32_t)(n)) >> 8U) & 0xFFU); \
246 m[3] = (((uint32_t)(n)) & 0xFFU); \
249 #define USB_LONG_FROM_BIG_ENDIAN_ADDRESS(n) \
250 ((uint32_t)((((uint8_t)n[0]) << 24U) | (((uint8_t)n[1]) << 16U) | (((uint8_t)n[2]) << 8U) | \
251 (((uint8_t)n[3]) << 0U)))
253 #define USB_SHORT_TO_LITTLE_ENDIAN_ADDRESS(n, m) \
255 m[1] = ((((uint16_t)(n)) >> 8U) & 0xFFU); \
256 m[0] = (((uint16_t)(n)) & 0xFFU); \
259 #define USB_SHORT_FROM_LITTLE_ENDIAN_ADDRESS(n) ((uint32_t)((((uint8_t)n[1]) << 8U) | (((uint8_t)n[0]) << 0U)))
261 #define USB_SHORT_TO_BIG_ENDIAN_ADDRESS(n, m) \
263 m[0] = ((((uint16_t)(n)) >> 8U) & 0xFFU); \
264 m[1] = (((uint16_t)(n)) & 0xFFU); \
267 #define USB_SHORT_FROM_BIG_ENDIAN_ADDRESS(n) ((uint32_t)((((uint8_t)n[0]) << 8U) | (((uint8_t)n[1]) << 0U)))
269 #define USB_LONG_TO_LITTLE_ENDIAN_DATA(n, m) \
271 *((uint8_t *)&(m) + 3) = ((((uint32_t)(n)) >> 24U) & 0xFFU); \
272 *((uint8_t *)&(m) + 2) = ((((uint32_t)(n)) >> 16U) & 0xFFU); \
273 *((uint8_t *)&(m) + 1) = ((((uint32_t)(n)) >> 8U) & 0xFFU); \
274 *((uint8_t *)&(m) + 0) = (((uint32_t)(n)) & 0xFFU); \
277 #define USB_LONG_FROM_LITTLE_ENDIAN_DATA(n) \
278 ((uint32_t)(((*((uint8_t *)&(n) + 3)) << 24U) | ((*((uint8_t *)&(n) + 2)) << 16U) | \
279 ((*((uint8_t *)&(n) + 1)) << 8U) | ((*((uint8_t *)&(n))) << 0U)))
281 #define USB_SHORT_TO_LITTLE_ENDIAN_DATA(n, m) \
283 *((uint8_t *)&(m) + 1) = ((((uint16_t)(n)) >> 8U) & 0xFFU); \
284 *((uint8_t *)&(m)) = ((((uint16_t)(n))) & 0xFFU); \
287 #define USB_SHORT_FROM_LITTLE_ENDIAN_DATA(n) ((uint32_t)(((*((uint8_t *)&(n) + 1)) << 8U) | ((*((uint8_t *)&(n))))))
292 * The following MACROs (USB_GLOBAL, USB_BDT, USB_RAM_ADDRESS_ALIGNMENT, etc) are only used for USB device stack.
293 * The USB device global variables are put into the section m_usb_global and m_usb_bdt or the section
294 * .bss.m_usb_global and .bss.m_usb_bdt by using the MACRO USB_GLOBAL and USB_BDT. In this way, the USB device
295 * global variables can be linked into USB dedicated RAM by USB_STACK_USE_DEDICATED_RAM.
296 * The MACRO USB_STACK_USE_DEDICATED_RAM is used to decide the USB stack uses dedicated RAM or not. The value of
297 * the marco can be set as 0, USB_STACK_DEDICATED_RAM_TYPE_BDT_GLOBAL, or USB_STACK_DEDICATED_RAM_TYPE_BDT.
298 * The MACRO USB_STACK_DEDICATED_RAM_TYPE_BDT_GLOBAL means USB device global variables, including USB_BDT and
299 * USB_GLOBAL, are put into the USB dedicated RAM. This feature can only be enabled when the USB dedicated RAM
300 * is not less than 2K Bytes.
301 * The MACRO USB_STACK_DEDICATED_RAM_TYPE_BDT means USB device global variables, only including USB_BDT, are put
302 * into the USB dedicated RAM, the USB_GLOBAL will be put into .bss section. This feature is used for some SOCs,
303 * the USB dedicated RAM size is not more than 512 Bytes.
305 #define USB_STACK_DEDICATED_RAM_TYPE_BDT_GLOBAL 1
306 #define USB_STACK_DEDICATED_RAM_TYPE_BDT 2
308 #if defined(__ICCARM__)
310 #define USB_WEAK_VAR __attribute__((weak))
311 #define USB_WEAK_FUN __attribute__((weak))
312 /* disable misra 19.13 */
313 _Pragma("diag_suppress=Pm120")
314 #define USB_ALIGN_PRAGMA(x) _Pragma(#x)
315 _Pragma("diag_default=Pm120")
317 #define USB_RAM_ADDRESS_ALIGNMENT(n) USB_ALIGN_PRAGMA(data_alignment = n)
318 _Pragma("diag_suppress=Pm120")
319 #define USB_LINK_SECTION_PART(str) _Pragma(#str)
320 #define USB_LINK_DMA_INIT_DATA(sec) USB_LINK_SECTION_PART(location = #sec)
321 #define USB_LINK_USB_GLOBAL _Pragma("location = \"m_usb_global\"")
322 #define USB_LINK_USB_BDT _Pragma("location = \"m_usb_bdt\"")
323 #define USB_LINK_USB_GLOBAL_BSS _Pragma("location = \".bss.m_usb_global\"")
324 #define USB_LINK_USB_BDT_BSS _Pragma("location = \".bss.m_usb_bdt\"")
325 _Pragma("diag_default=Pm120")
326 #define USB_LINK_DMA_NONINIT_DATA _Pragma("location = \"m_usb_dma_noninit_data\"")
327 #define USB_LINK_NONCACHE_NONINIT_DATA _Pragma("location = \"NonCacheable\"")
328 #elif defined(__CC_ARM)
330 #define USB_WEAK_VAR __attribute__((weak))
331 #define USB_WEAK_FUN __weak
332 #define USB_RAM_ADDRESS_ALIGNMENT(n) __attribute__((aligned(n)))
333 #define USB_LINK_DMA_INIT_DATA(sec) __attribute__((section(#sec)))
334 #define USB_LINK_USB_GLOBAL __attribute__((section("m_usb_global"))) __attribute__((zero_init))
335 #define USB_LINK_USB_BDT __attribute__((section("m_usb_bdt"))) __attribute__((zero_init))
336 #define USB_LINK_USB_GLOBAL_BSS __attribute__((section(".bss.m_usb_global"))) __attribute__((zero_init))
337 #define USB_LINK_USB_BDT_BSS __attribute__((section(".bss.m_usb_bdt"))) __attribute__((zero_init))
338 #define USB_LINK_DMA_NONINIT_DATA __attribute__((section("m_usb_dma_noninit_data"))) __attribute__((zero_init))
339 #define USB_LINK_NONCACHE_NONINIT_DATA __attribute__((section("NonCacheable"))) __attribute__((zero_init))
341 #elif defined(__GNUC__)
343 #define USB_WEAK_VAR __attribute__((weak))
344 #define USB_WEAK_FUN __attribute__((weak))
345 #define USB_RAM_ADDRESS_ALIGNMENT(n) __attribute__((aligned(n)))
346 #define USB_LINK_DMA_INIT_DATA(sec) __attribute__((section(#sec)))
347 #define USB_LINK_USB_GLOBAL __attribute__((section("m_usb_global, \"aw\", %nobits @")))
348 #define USB_LINK_USB_BDT __attribute__((section("m_usb_bdt, \"aw\", %nobits @")))
349 #define USB_LINK_USB_GLOBAL_BSS __attribute__((section(".bss.m_usb_global, \"aw\", %nobits @")))
350 #define USB_LINK_USB_BDT_BSS __attribute__((section(".bss.m_usb_bdt, \"aw\", %nobits @")))
351 #define USB_LINK_DMA_NONINIT_DATA __attribute__((section("m_usb_dma_noninit_data, \"aw\", %nobits @")))
352 #define USB_LINK_NONCACHE_NONINIT_DATA __attribute__((section("NonCacheable, \"aw\", %nobits @")))
355 #error The tool-chain is not supported.
358 #if (defined(USB_DEVICE_CONFIG_BUFFER_PROPERTY_CACHEABLE) && (USB_DEVICE_CONFIG_BUFFER_PROPERTY_CACHEABLE)) || \
359 (defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE))
361 #if ((defined(FSL_FEATURE_L2CACHE_LINESIZE_BYTE)) && (defined(FSL_FEATURE_L1DCACHE_LINESIZE_BYTE)))
362 #define USB_CACHE_LINESIZE MAX(FSL_FEATURE_L2CACHE_LINESIZE_BYTE, FSL_FEATURE_L1DCACHE_LINESIZE_BYTE)
363 #elif(defined(FSL_FEATURE_L2CACHE_LINESIZE_BYTE))
364 #define USB_CACHE_LINESIZE MAX(FSL_FEATURE_L2CACHE_LINESIZE_BYTE, 0)
365 #elif(defined(FSL_FEATURE_L1DCACHE_LINESIZE_BYTE))
366 #define USB_CACHE_LINESIZE MAX(0, FSL_FEATURE_L1DCACHE_LINESIZE_BYTE)
368 #define USB_CACHE_LINESIZE 4
372 #define USB_CACHE_LINESIZE 4
375 #if (((defined(USB_DEVICE_CONFIG_LPCIP3511FS)) && (USB_DEVICE_CONFIG_LPCIP3511FS > 0U)) || \
376 ((defined(USB_DEVICE_CONFIG_LPCIP3511HS)) && (USB_DEVICE_CONFIG_LPCIP3511HS > 0U)))
377 #define USB_DATA_ALIGN 64
379 #define USB_DATA_ALIGN 4
382 #define USB_DATA_ALIGN_SIZE MAX(USB_CACHE_LINESIZE, USB_DATA_ALIGN)
384 #define USB_DATA_ALIGN_SIZE_MULTIPLE(n) ((n + USB_DATA_ALIGN_SIZE - 1) & (~(USB_DATA_ALIGN_SIZE - 1)))
386 #if defined(USB_STACK_USE_DEDICATED_RAM) && (USB_STACK_USE_DEDICATED_RAM == USB_STACK_DEDICATED_RAM_TYPE_BDT_GLOBAL)
388 #define USB_GLOBAL USB_LINK_USB_GLOBAL
389 #define USB_BDT USB_LINK_USB_BDT
391 #if (defined(USB_DEVICE_CONFIG_BUFFER_PROPERTY_CACHEABLE) && (USB_DEVICE_CONFIG_BUFFER_PROPERTY_CACHEABLE)) || \
392 (defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE))
393 #define USB_DMA_DATA_NONINIT_SUB USB_LINK_DMA_NONINIT_DATA
394 #define USB_DMA_DATA_INIT_SUB USB_LINK_DMA_INIT_DATA(m_usb_dma_init_data)
395 #define USB_CONTROLLER_DATA USB_LINK_NONCACHE_NONINIT_DATA
397 #define USB_DMA_DATA_NONINIT_SUB
398 #define USB_DMA_DATA_INIT_SUB
399 #define USB_CONTROLLER_DATA USB_LINK_USB_GLOBAL
402 #elif defined(USB_STACK_USE_DEDICATED_RAM) && (USB_STACK_USE_DEDICATED_RAM == USB_STACK_DEDICATED_RAM_TYPE_BDT)
404 #define USB_BDT USB_LINK_USB_BDT
406 #if (defined(USB_DEVICE_CONFIG_BUFFER_PROPERTY_CACHEABLE) && (USB_DEVICE_CONFIG_BUFFER_PROPERTY_CACHEABLE)) || \
407 (defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE))
408 #define USB_GLOBAL USB_LINK_DMA_NONINIT_DATA
409 #define USB_DMA_DATA_NONINIT_SUB USB_LINK_DMA_NONINIT_DATA
410 #define USB_DMA_DATA_INIT_SUB USB_LINK_DMA_INIT_DATA(m_usb_dma_init_data)
411 #define USB_CONTROLLER_DATA USB_LINK_NONCACHE_NONINIT_DATA
413 #define USB_GLOBAL USB_LINK_USB_GLOBAL_BSS
414 #define USB_DMA_DATA_NONINIT_SUB
415 #define USB_DMA_DATA_INIT_SUB
416 #define USB_CONTROLLER_DATA
421 #if (defined(USB_DEVICE_CONFIG_BUFFER_PROPERTY_CACHEABLE) && (USB_DEVICE_CONFIG_BUFFER_PROPERTY_CACHEABLE)) || \
422 (defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE))
424 #define USB_GLOBAL USB_LINK_DMA_NONINIT_DATA
425 #define USB_BDT USB_LINK_NONCACHE_NONINIT_DATA
426 #define USB_DMA_DATA_NONINIT_SUB USB_LINK_DMA_NONINIT_DATA
427 #define USB_DMA_DATA_INIT_SUB USB_LINK_DMA_INIT_DATA(m_usb_dma_init_data)
428 #define USB_CONTROLLER_DATA USB_LINK_NONCACHE_NONINIT_DATA
431 #define USB_GLOBAL USB_LINK_USB_GLOBAL_BSS
432 #define USB_BDT USB_LINK_USB_BDT_BSS
433 #define USB_DMA_DATA_NONINIT_SUB
434 #define USB_DMA_DATA_INIT_SUB
435 #define USB_CONTROLLER_DATA
440 #define USB_DMA_NONINIT_DATA_ALIGN(n) USB_RAM_ADDRESS_ALIGNMENT(n) USB_DMA_DATA_NONINIT_SUB
441 #define USB_DMA_INIT_DATA_ALIGN(n) USB_RAM_ADDRESS_ALIGNMENT(n) USB_DMA_DATA_INIT_SUB
443 #if (defined(USB_DEVICE_CONFIG_BUFFER_PROPERTY_CACHEABLE) && (USB_DEVICE_CONFIG_BUFFER_PROPERTY_CACHEABLE)) || \
444 (defined(USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE) && (USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE))
445 #define USB_DMA_DATA_NONCACHEABLE USB_LINK_NONCACHE_NONINIT_DATA
448 #define USB_DMA_DATA_NONCACHEABLE
451 #define USB_GLOBAL_DEDICATED_RAM USB_LINK_USB_GLOBAL
453 /* #define USB_RAM_ADDRESS_NONCACHEREG_ALIGNMENT(n, var) AT_NONCACHEABLE_SECTION_ALIGN(var, n) */
454 /* #define USB_RAM_ADDRESS_NONCACHEREG(var) AT_NONCACHEABLE_SECTION(var) */
456 #endif /* __USB_MISC_H__ */