LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Host_LPC.h
Go to the documentation of this file.
1 /*
2  * @brief USB Host definitions for the LPC microcontrollers
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2012
6  * All rights reserved.
7  *
8  * @par
9  * Software that is described herein is for illustrative purposes only
10  * which provides customers with programming information regarding the
11  * LPC products. This software is supplied "AS IS" without any warranties of
12  * any kind, and NXP Semiconductors and its licensor disclaim any and
13  * all warranties, express or implied, including all implied warranties of
14  * merchantability, fitness for a particular purpose and non-infringement of
15  * intellectual property rights. NXP Semiconductors assumes no responsibility
16  * or liability for the use of the software, conveys no license or rights under any
17  * patent, copyright, mask work right, or any other intellectual property rights in
18  * or to any products. NXP Semiconductors reserves the right to make changes
19  * in the software without notification. NXP Semiconductors also makes no
20  * representation or warranty that such application will be suitable for the
21  * specified use without further testing or modification.
22  *
23  * @par
24  * Permission to use, copy, modify, and distribute this software and its
25  * documentation is hereby granted, under NXP Semiconductors' and its
26  * licensor's relevant copyrights in the software, without fee, provided that it
27  * is used in conjunction with NXP Semiconductors microcontrollers. This
28  * copyright, permission, and disclaimer notice must appear in all copies of
29  * this code.
30  */
31 
41 #ifndef __USBHOST_LPC_H__
42 #define __USBHOST_LPC_H__
43 
44 /* Includes: */
45  #include "../../../../Common/Common.h"
46  #include "../StdDescriptors.h"
47  #include "../Pipe.h"
48  #include "../USBInterrupt.h"
49 
50 /* Enable C linkage for C++ Compilers: */
51  #if defined(__cplusplus)
52 extern "C" {
53  #endif
54 
55 /* Preprocessor Checks: */
56  #if !defined(__INCLUDE_FROM_USB_DRIVER)
57  #error Do not include this file directly. Include lpcroot/libraries/LPCUSBlib/Drivers/USB/USB.h instead.
58  #endif
59 
60 /* Public Interface - May be used in end-application: */
61 /* Macros: */
67  #define USB_HOST_DEVICEADDRESS 1
68 
69  #if !defined(USB_HOST_TIMEOUT_MS) || defined(__DOXYGEN__)
70 
77  #define USB_HOST_TIMEOUT_MS 1000
78  #endif
79 
80  #if !defined(HOST_DEVICE_SETTLE_DELAY_MS) || defined(__DOXYGEN__)
81 
90  #define HOST_DEVICE_SETTLE_DELAY_MS 1000
91  #endif
92 
104 };
105 
128 };
129 
130 uint8_t USB_Host_GetActiveHost(void);
131 
132 extern uint8_t USB_Host_ControlPipeSize[MAX_USB_CORE];
133 
134 /* Inline Functions: */
135  #if !defined(NO_SOF_EVENTS)
136 
145 static inline void USB_Host_EnableSOFEvents(void) ATTR_ALWAYS_INLINE;
146 
147 static inline void USB_Host_EnableSOFEvents(void)
148 {}
149 
157 static inline void USB_Host_DisableSOFEvents(void) ATTR_ALWAYS_INLINE;
158 
159 static inline void USB_Host_DisableSOFEvents(void)
160 {}
161 
162  #endif
163 
172 static inline void USB_Host_ResetBus(void) ATTR_ALWAYS_INLINE;
173 
174 static inline void USB_Host_ResetBus(void)
175 {}
176 
183 
184 static inline bool USB_Host_IsBusResetComplete(void)
185 {
186  return true;
187 }
188 
195 static inline void USB_Host_ResumeBus(void) ATTR_ALWAYS_INLINE;
196 
197 static inline void USB_Host_ResumeBus(void)
198 {}
199 
206 static inline void USB_Host_SuspendBus(void) ATTR_ALWAYS_INLINE;
207 
208 static inline void USB_Host_SuspendBus(void)
209 {}
210 
219 
220 static inline bool USB_Host_IsBusSuspended(void)
221 {
222  return false;
223 }
224 
232 
233 static inline bool USB_Host_IsDeviceFullSpeed(void)
234 {
235  return true; // implement later when needed
236 }
237 
245 
246 static inline bool USB_Host_IsRemoteWakeupSent(void)
247 {
248  return false;
249 }
250 
252 static inline void USB_Host_ClearRemoteWakeupSent(void) ATTR_ALWAYS_INLINE;
253 
254 static inline void USB_Host_ClearRemoteWakeupSent(void)
255 {}
256 
262 
263 static inline void USB_Host_ResumeFromWakeupRequest(void)
264 {}
265 
273 
275 {
276  return false;
277 }
278 
279 /* Private Interface - For use in library only: */
280  #if !defined(__DOXYGEN__)
281 /* Macros: */
282 static inline void USB_Host_HostMode_On(void) ATTR_ALWAYS_INLINE;
283 
284 static inline void USB_Host_HostMode_On(void)
285 {}
286 
287 static inline void USB_Host_HostMode_Off(void) ATTR_ALWAYS_INLINE;
288 
289 static inline void USB_Host_HostMode_Off(void)
290 {}
291 
292 static inline void USB_Host_VBUS_Auto_Enable(void) ATTR_ALWAYS_INLINE;
293 
294 static inline void USB_Host_VBUS_Auto_Enable(void)
295 {}
296 
297 static inline void USB_Host_VBUS_Manual_Enable(void) ATTR_ALWAYS_INLINE;
298 
299 static inline void USB_Host_VBUS_Manual_Enable(void)
300 {}
301 
302 static inline void USB_Host_VBUS_Auto_On(void) ATTR_ALWAYS_INLINE;
303 
304 static inline void USB_Host_VBUS_Auto_On(void)
305 {}
306 
307 static inline void USB_Host_VBUS_Manual_On(void) ATTR_ALWAYS_INLINE;
308 
309 static inline void USB_Host_VBUS_Manual_On(void)
310 {}
311 
312 static inline void USB_Host_VBUS_Auto_Off(void) ATTR_ALWAYS_INLINE;
313 
314 static inline void USB_Host_VBUS_Auto_Off(void)
315 {}
316 
317 static inline void USB_Host_VBUS_Manual_Off(void) ATTR_ALWAYS_INLINE;
318 
319 static inline void USB_Host_VBUS_Manual_Off(void)
320 {}
321 
322 static inline void USB_Host_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;
323 
324 static inline void USB_Host_SetDeviceAddress(const uint8_t Address)
325 {}
326 
327 /* Enums: */
328 enum USB_Host_WaitMSErrorCodes_t {
329  HOST_WAITERROR_Successful = 0,
330  HOST_WAITERROR_DeviceDisconnect = 1,
331  HOST_WAITERROR_PipeError = 2,
332  HOST_WAITERROR_SetupStalled = 3,
333 };
334 
335 /* Function Prototypes: */
336 void USB_Host_ProcessNextHostState(uint8_t corenum);
337 
338 uint8_t USB_Host_WaitMS(uint8_t MS);
339 
343 uint16_t USB_Host_GetFrameNumber(void);
344 
345  #if defined(__INCLUDE_FROM_HOST_C)
346 // static void USB_Host_ResetDevice(void);
347  #endif
348  #endif
349 
350 /* Disable C linkage for C++ Compilers: */
351  #if defined(__cplusplus)
352 }
353  #endif
354 
355 #endif
356