LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
USBMode.h
Go to the documentation of this file.
1 /*
2  * @brief USB mode and feature support definitions
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2012
6  * Copyright(C) Dean Camera, 2011, 2012
7  * All rights reserved.
8  *
9  * @par
10  * Software that is described herein is for illustrative purposes only
11  * which provides customers with programming information regarding the
12  * LPC products. This software is supplied "AS IS" without any warranties of
13  * any kind, and NXP Semiconductors and its licensor disclaim any and
14  * all warranties, express or implied, including all implied warranties of
15  * merchantability, fitness for a particular purpose and non-infringement of
16  * intellectual property rights. NXP Semiconductors assumes no responsibility
17  * or liability for the use of the software, conveys no license or rights under any
18  * patent, copyright, mask work right, or any other intellectual property rights in
19  * or to any products. NXP Semiconductors reserves the right to make changes
20  * in the software without notification. NXP Semiconductors also makes no
21  * representation or warranty that such application will be suitable for the
22  * specified use without further testing or modification.
23  *
24  * @par
25  * Permission to use, copy, modify, and distribute this software and its
26  * documentation is hereby granted, under NXP Semiconductors' and its
27  * licensor's relevant copyrights in the software, without fee, provided that it
28  * is used in conjunction with NXP Semiconductors microcontrollers. This
29  * copyright, permission, and disclaimer notice must appear in all copies of
30  * this code.
31  */
32 
49 #ifndef __USBMODE_H__
50 #define __USBMODE_H__
51 
52  /* Enable C linkage for C++ Compilers: */
53  #if defined(__cplusplus)
54  extern "C" {
55  #endif
56 
57  /* Preprocessor Checks: */
58  #if !defined(__INCLUDE_FROM_USB_DRIVER)
59  #error Do not include this file directly. Include lpcroot/libraries/LPCUSBlib/Drivers/USB/USB.h instead.
60  #endif
61 
62  #include "../../../LPCUSBlibConfig.h"
63 
64  /* Public Interface - May be used in end-application: */
65  #if defined(__DOXYGEN__)
66 
70  #define USB_CAN_BE_DEVICE
71 
75  #define USB_CAN_BE_HOST
76 
80  #define USB_CAN_BE_BOTH
81  #else
82  /* Macros: */
83  #if (defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__) || \
84  defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__))
85  #define USB_SERIES_2_AVR
86  #define USB_CAN_BE_DEVICE
87  #elif (defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__))
88  #define USB_SERIES_4_AVR
89  #define USB_CAN_BE_DEVICE
90  #elif (defined(__AVR_ATmega32U6__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
91  #define USB_SERIES_6_AVR
92  #define USB_CAN_BE_DEVICE
93  #elif (defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1287__))
94  #define USB_SERIES_7_AVR
95  #define USB_CAN_BE_DEVICE
96  #define USB_CAN_BE_HOST
97  #elif (defined(__AVR32_UC3A0512__) || defined(__AVR32_UC3A0256__) || \
98  defined(__AVR32_UC3A0128__) || defined(__AVR32_UC3A064__))
99  #define USB_SERIES_UC3A0_AVR32
100  #define USB_CAN_BE_DEVICE
101  #define USB_CAN_BE_HOST
102  #elif (defined(__AVR32_UC3A1512__) || defined(__AVR32_UC3A1256__) || \
103  defined(__AVR32_UC3A1128__) || defined(__AVR32_UC3A164__))
104  #define USB_SERIES_UC3A1_AVR32
105  #define USB_CAN_BE_DEVICE
106  #define USB_CAN_BE_HOST
107  #elif (defined(__AVR32_UC3A3256__) || defined(__AVR32_UC3A3256S__) || \
108  defined(__AVR32_UC3A3128__) || defined(__AVR32_UC3A3128S__) || \
109  defined(__AVR32_UC3A364__) || defined(__AVR32_UC3A364S__))
110  #define USB_SERIES_UC3A3_AVR32
111  #define USB_CAN_BE_DEVICE
112  #define USB_CAN_BE_HOST
113  #elif (defined(__AVR32_UC3A4256__) || defined(__AVR32_UC3A4256S__) || \
114  defined(__AVR32_UC3A4128__) || defined(__AVR32_UC3A4128S__) || \
115  defined(__AVR32_UC3A464__) || defined(__AVR32_UC3A464S__))
116  #define USB_SERIES_UC3A4_AVR32
117  #define USB_CAN_BE_DEVICE
118  #define USB_CAN_BE_HOST
119  #elif (defined(__AVR32_UC3B0512__) || defined(__AVR32_UC3B0256__) || \
120  defined(__AVR32_UC3B0128__) || defined(__AVR32_UC3B064__))
121  #define USB_SERIES_UC3B0_AVR32
122  #define USB_CAN_BE_DEVICE
123  #define USB_CAN_BE_HOST
124  #elif (defined(__AVR32_UC3B1512__) || defined(__AVR32_UC3B1256__) || \
125  defined(__AVR32_UC3B1128__) || defined(__AVR32_UC3B164__))
126  #define USB_SERIES_UC3B1_AVR32
127  #define USB_CAN_BE_DEVICE
128  #define USB_CAN_BE_HOST
129  #elif (defined(__AVR_ATxmega128A1U__))
130  #define USB_SERIES_A1U_XMEGA
131  #define USB_CAN_BE_DEVICE
132  #elif (defined(__AVR_ATxmega16A4U__) || defined(__AVR_ATxmega32A4U__))
133  #define USB_SERIES_A4U_XMEGA
134  #define USB_CAN_BE_DEVICE
135  #elif (defined(__AVR_ATxmega64A3U__) || defined(__AVR_ATxmega128A3U__) || \
136  defined(__AVR_ATxmega192A3U__) || defined(__AVR_ATxmega256A3U__))
137  #define USB_SERIES_A3U_XMEGA
138  #define USB_CAN_BE_DEVICE
139  #elif (defined(__AVR_ATxmega256A3BU__))
140  #define USB_SERIES_A3BU_XMEGA
141  #define USB_CAN_BE_DEVICE
142  #elif (defined(__LPC17XX__))||(defined(__LPC177X_8X__))
143  #define USB_CAN_BE_HOST
144  #define __LPC_OHCI__
145  #define USB_CAN_BE_DEVICE
146 
147  #define MAX_USB_CORE 1
148  #define USB_PORT_SELECTED (0)
149  #elif (defined (__LPC18XX__)||defined(__LPC43XX__))
150  #define USB_CAN_BE_HOST
151  #define __LPC_EHCI__
152  #define USB_CAN_BE_DEVICE
153 
154  #if (USE_USB_ROM_STACK)
155  #define USB_DEVICE_ROM_DRIVER
156  #endif
157 
158  #define MAX_USB_CORE 2
159  #if defined(USB_HOST_ONLY)
160  #define RUN_MULTI_PORT (((USB_PORT)== 0xFF)?1:0)
161  #if (RUN_MULTI_PORT)
162  #define USB_MULTI_PORTS
163  #endif
164  #endif
165  #define USB_PORT_SELECTED (((USB_PORT)>=(MAX_USB_CORE))?1:USB_PORT)
166  #elif (defined(__LPC11UXX__) || defined(__LPC13UXX__))
167  #define USB_CAN_BE_DEVICE
168 
169  #if (USE_USB_ROM_STACK)
170  #define USB_DEVICE_ROM_DRIVER
171  #endif
172 
173  #define MAX_USB_CORE 1
174  #define USB_PORT_SELECTED (0)
175  #endif
176 
177  #if (defined(USB_CAN_BE_DEVICE) && defined(USB_CAN_BE_HOST))
178  #define USB_CAN_BE_BOTH
179  #endif
180 
181  #if defined(USB_HOST_ONLY)
182  #if !defined(USB_CAN_BE_HOST)
183  #error USB_HOST_ONLY is not available for the currently selected microcontroller model.
184  #else
185  #undef USB_CAN_BE_DEVICE
186  #undef USB_CAN_BE_BOTH
187  #endif
188  #endif
189 
190  #if defined(USB_DEVICE_ONLY)
191  #if !defined(USB_CAN_BE_DEVICE)
192  #error USB_DEVICE_ONLY is not available for the currently selected microcontroller model.
193  #else
194  #undef USB_CAN_BE_HOST
195  #undef USB_CAN_BE_BOTH
196  #endif
197  #endif
198 
199  #if (defined(USB_HOST_ONLY) && defined(USB_DEVICE_ONLY))
200  #error USB_HOST_ONLY and USB_DEVICE_ONLY are mutually exclusive.
201  #endif
202 
203  #if (!defined(USB_CAN_BE_DEVICE) && !defined(USB_CAN_BE_HOST))
204  #error The currently selected device or architecture is not supported under the USB component of the library.
205  #endif
206  #endif
207 
208  /* Disable C linkage for C++ Compilers: */
209  #if defined(__cplusplus)
210  }
211  #endif
212 
213 #endif
214