2 * @brief USB device standard request management
\r
5 * Copyright(C) NXP Semiconductors, 2012
\r
6 * Copyright(C) Dean Camera, 2011, 2012
\r
7 * All rights reserved.
\r
10 * Software that is described herein is for illustrative purposes only
\r
11 * which provides customers with programming information regarding the
\r
12 * LPC products. This software is supplied "AS IS" without any warranties of
\r
13 * any kind, and NXP Semiconductors and its licensor disclaim any and
\r
14 * all warranties, express or implied, including all implied warranties of
\r
15 * merchantability, fitness for a particular purpose and non-infringement of
\r
16 * intellectual property rights. NXP Semiconductors assumes no responsibility
\r
17 * or liability for the use of the software, conveys no license or rights under any
\r
18 * patent, copyright, mask work right, or any other intellectual property rights in
\r
19 * or to any products. NXP Semiconductors reserves the right to make changes
\r
20 * in the software without notification. NXP Semiconductors also makes no
\r
21 * representation or warranty that such application will be suitable for the
\r
22 * specified use without further testing or modification.
\r
25 * Permission to use, copy, modify, and distribute this software and its
\r
26 * documentation is hereby granted, under NXP Semiconductors' and its
\r
27 * licensor's relevant copyrights in the software, without fee, provided that it
\r
28 * is used in conjunction with NXP Semiconductors microcontrollers. This
\r
29 * copyright, permission, and disclaimer notice must appear in all copies of
\r
35 #ifndef __DEVICESTDREQ_H__
\r
36 #define __DEVICESTDREQ_H__
\r
39 #include "../../../Common/Common.h"
\r
40 #include "USBMode.h"
\r
41 #include "StdDescriptors.h"
\r
43 #include "StdRequestType.h"
\r
44 #include "USBTask.h"
\r
45 #include "USBController.h"
\r
47 /* Enable C linkage for C++ Compilers: */
\r
48 #if defined(__cplusplus)
\r
52 /* Preprocessor Checks: */
\r
53 #if !defined(__INCLUDE_FROM_USB_DRIVER)
\r
54 #error Do not include this file directly. Include lpcroot/libraries/LPCUSBlib/Drivers/USB/USB.h instead.
\r
57 /* Public Interface - May be used in end-application: */
\r
59 #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) || defined(__DOXYGEN__)
\r
60 /** Enum for the possible descriptor memory spaces, for the \c MemoryAddressSpace parameter of the
\r
61 * @ref CALLBACK_USB_GetDescriptor() function. This can be used when none of the \c USE_*_DESCRIPTORS
\r
62 * compile time options are used, to indicate in which memory space the descriptor is stored.
\r
64 * @ingroup Group_Device
\r
66 enum USB_DescriptorMemorySpaces_t
\r
68 #if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) || defined(__DOXYGEN__)
\r
69 MEMSPACE_FLASH = 0, /**< Indicates the requested descriptor is located in FLASH memory. */
\r
71 #if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) || defined(__DOXYGEN__)
\r
72 MEMSPACE_EEPROM = 1, /**< Indicates the requested descriptor is located in EEPROM memory. */
\r
74 MEMSPACE_RAM = 2, /**< Indicates the requested descriptor is located in RAM memory. */
\r
78 /* Global Variables: */
\r
79 /** Indicates the currently set configuration number of the device. USB devices may have several
\r
80 * different configurations which the host can select between; this indicates the currently selected
\r
81 * value, or 0 if no configuration has been selected.
\r
83 * @note This variable should be treated as read-only in the user application, and never manually
\r
86 * @ingroup Group_Device
\r
88 extern uint8_t USB_Device_ConfigurationNumber;
\r
90 #if !defined(NO_DEVICE_REMOTE_WAKEUP)
\r
91 /** Indicates if the host is currently allowing the device to issue remote wakeup events. If this
\r
92 * flag is cleared, the device should not issue remote wakeup events to the host.
\r
94 * @note This variable should be treated as read-only in the user application, and never manually
\r
98 * @note To reduce FLASH usage of the compiled applications where Remote Wakeup is not supported,
\r
99 * this global and the underlying management code can be disabled by defining the
\r
100 * \c NO_DEVICE_REMOTE_WAKEUP token in the project makefile and passing it to the compiler via
\r
103 * @ingroup Group_Device
\r
105 extern bool USB_Device_RemoteWakeupEnabled;
\r
108 #if !defined(NO_DEVICE_SELF_POWER)
\r
109 /** Indicates if the device is currently being powered by its own power supply, rather than being
\r
110 * powered by the host's USB supply. This flag should remain cleared if the device does not
\r
111 * support self powered mode, as indicated in the device descriptors.
\r
113 * @ingroup Group_Device
\r
115 extern bool USB_Device_CurrentlySelfPowered;
\r
118 /* Private Interface - For use in library only: */
\r
119 #if !defined(__DOXYGEN__)
\r
120 #if defined(USE_RAM_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS)
\r
121 #error USE_RAM_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive.
\r
122 #elif defined(USE_RAM_DESCRIPTORS) && defined(USE_FLASH_DESCRIPTORS)
\r
123 #error USE_RAM_DESCRIPTORS and USE_FLASH_DESCRIPTORS are mutually exclusive.
\r
124 #elif defined(USE_FLASH_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS)
\r
125 #error USE_FLASH_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive.
\r
126 #elif defined(USE_FLASH_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS) && defined(USE_RAM_DESCRIPTORS)
\r
127 #error Only one of the USE_*_DESCRIPTORS modes should be selected.
\r
130 /* Function Prototypes: */
\r
131 void USB_Device_ProcessControlRequest(uint8_t corenum);
\r
133 #if defined(__INCLUDE_FROM_DEVICESTDREQ_C)
\r
134 static void USB_Device_SetAddress(uint8_t corenum);
\r
135 static void USB_Device_SetConfiguration(uint8_t corenum);
\r
136 static void USB_Device_GetConfiguration(uint8_t corenum);
\r
137 static void USB_Device_GetDescriptor(uint8_t corenum);
\r
138 static void USB_Device_GetStatus(uint8_t corenum);
\r
139 static void USB_Device_ClearSetFeature(uint8_t corenum);
\r
141 #if !defined(NO_INTERNAL_SERIAL) && (USE_INTERNAL_SERIAL != NO_DESCRIPTOR)
\r
142 static void USB_Device_GetInternalSerialDescriptor(uint8_t corenum);
\r
147 /* Disable C linkage for C++ Compilers: */
\r
148 #if defined(__cplusplus)
\r