aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/HighLevel
diff options
context:
space:
mode:
Diffstat (limited to 'LUFA/Drivers/USB/HighLevel')
-rw-r--r--LUFA/Drivers/USB/HighLevel/Events.h4
-rw-r--r--LUFA/Drivers/USB/HighLevel/StdRequestType.h14
-rw-r--r--LUFA/Drivers/USB/HighLevel/USBTask.c11
-rw-r--r--LUFA/Drivers/USB/HighLevel/USBTask.h9
4 files changed, 31 insertions, 7 deletions
diff --git a/LUFA/Drivers/USB/HighLevel/Events.h b/LUFA/Drivers/USB/HighLevel/Events.h
index 9638afee3..73a804c35 100644
--- a/LUFA/Drivers/USB/HighLevel/Events.h
+++ b/LUFA/Drivers/USB/HighLevel/Events.h
@@ -305,7 +305,7 @@
* parameters (wValue, wIndex, wLength, and Data) remain in the control endpoint bank until
* read out by the user application for processing.
*/
- void USB_UnhandledControlPacket(const uint8_t bRequest, const uint8_t bmRequestType);
+ void USB_UnhandledControlPacket(void);
/** Event for USB configuration number changed. This event fires when a the USB host changes the
* selected configuration number while in device mode. This event should be hooked in device
@@ -392,7 +392,7 @@
#endif
#if defined(USB_CAN_BE_DEVICE)
- #define USB_UnhandledControlPacket_P (const uint8_t bRequest, const uint8_t bmRequestType)
+ #define USB_UnhandledControlPacket_P (void)
#define USB_ConfigurationChanged_P (void)
#define USB_Suspend_P (void)
#define USB_WakeUp_P (void)
diff --git a/LUFA/Drivers/USB/HighLevel/StdRequestType.h b/LUFA/Drivers/USB/HighLevel/StdRequestType.h
index 27c179497..6f214893b 100644
--- a/LUFA/Drivers/USB/HighLevel/StdRequestType.h
+++ b/LUFA/Drivers/USB/HighLevel/StdRequestType.h
@@ -135,6 +135,20 @@
*/
#define FEATURE_REMOTE_WAKEUP 0x01
+ /* Type Defines: */
+ /** Type define for a standard USB control request.
+ *
+ * \see The USB 2.0 specification for more information on standard control requests.
+ */
+ typedef struct
+ {
+ uint8_t bmRequestType; /**< Type of the request. */
+ uint8_t bRequest; /**< Request command code. */
+ uint16_t wValue; /**< wValue parameter of the request. */
+ uint16_t wIndex; /**< wIndex parameter of the request. */
+ uint16_t wLength; /**< Length of the data to transfer in bytes. */
+ } USB_Request_Header_t;
+
/* Enums: */
/** Enumeration for the various standard request commands. These commands are applicable when the
* request type is REQTYPE_STANDARD (with the exception of REQ_GetDescriptor, which is always
diff --git a/LUFA/Drivers/USB/HighLevel/USBTask.c b/LUFA/Drivers/USB/HighLevel/USBTask.c
index e1c065905..aa04c56ba 100644
--- a/LUFA/Drivers/USB/HighLevel/USBTask.c
+++ b/LUFA/Drivers/USB/HighLevel/USBTask.c
@@ -33,9 +33,10 @@
#define INCLUDE_FROM_USBTASK_C
#include "USBTask.h"
-volatile bool USB_IsSuspended;
-volatile bool USB_IsConnected;
-volatile bool USB_IsInitialized;
+volatile bool USB_IsSuspended;
+volatile bool USB_IsConnected;
+volatile bool USB_IsInitialized;
+USB_Request_Header_t USB_ControlRequest;
#if defined(USB_CAN_BE_HOST)
volatile uint8_t USB_HostState;
@@ -169,7 +170,7 @@ static void USB_HostTask(void)
USB_HostState = HOST_STATE_Default;
break;
case HOST_STATE_Default:
- USB_HostRequest = (USB_Host_Request_Header_t)
+ USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE),
.bRequest = REQ_GetDescriptor,
@@ -214,7 +215,7 @@ static void USB_HostTask(void)
Pipe_SetInfiniteINRequests();
- USB_HostRequest = (USB_Host_Request_Header_t)
+ USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE),
.bRequest = REQ_SetAddress,
diff --git a/LUFA/Drivers/USB/HighLevel/USBTask.h b/LUFA/Drivers/USB/HighLevel/USBTask.h
index 833fd9ec7..7e88ce88b 100644
--- a/LUFA/Drivers/USB/HighLevel/USBTask.h
+++ b/LUFA/Drivers/USB/HighLevel/USBTask.h
@@ -40,6 +40,7 @@
#include "../../../Scheduler/Scheduler.h"
#include "../LowLevel/LowLevel.h"
+ #include "StdRequestType.h"
#include "USBMode.h"
#include "Events.h"
#include "StdDescriptors.h"
@@ -82,6 +83,14 @@
*/
extern volatile bool USB_IsInitialized;
+ /** Structure containing the last received Control request when in Device mode (for use in user-applications
+ * inside of the USB_UnhandledControlPacket() event, or for filling up with a control request to issue when
+ * in Host mode before calling USB_Host_SendControlRequest().
+ *
+ * \ingroup Group_USBManagement
+ */
+ extern USB_Request_Header_t USB_ControlRequest;
+
#if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__)
/** Indicates if the USB interface is currently suspended by the host when in device mode. When suspended,
* the device should consume minimal power, and cannot communicate to the host. If Remote Wakeup is