| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Typedefs | Enumerations
Standard USB Requests
USB Core - software/LPCUSBLib/Drivers/USB/USB.h

## Detailed Description

USB control endpoint request definitions.

This module contains definitions for the various control request parameters, so that the request details (such as data direction, request recipient, etc.) can be extracted via masking.

## Macros
#define | CONTROL_REQTYPE_DIRECTION 0x80
#define | CONTROL_REQTYPE_TYPE 0x60
#define | CONTROL_REQTYPE_RECIPIENT 0x1F

## Typedefs
struct {
uint8_t bmRequestType
uint8_t bRequest
uint16_t wValue
uint16_t wIndex
uint16_t wLength
} | USB_Request_Header_t

## Enumerations
enum | USB_Control_Request_t { REQ_GetStatus = 0, REQ_ClearFeature = 1, REQ_SetFeature = 3, REQ_SetAddress = 5, REQ_GetDescriptor = 6, REQ_SetDescriptor = 7, REQ_GetConfiguration = 8, REQ_SetConfiguration = 9, REQ_GetInterface = 10, REQ_SetInterface = 11, REQ_SynchFrame = 12 }
enum | USB_Feature_Selectors_t { FEATURE_SEL_EndpointHalt = 0x00, FEATURE_SEL_DeviceRemoteWakeup = 0x01, FEATURE_SEL_TestMode = 0x02 }

## Macro Definition Documentation

#define CONTROL_REQTYPE_DIRECTION 0x80

Mask for the request type parameter, to indicate the direction of the request data (Host to Device or Device to Host). The result of this mask should then be compared to the request direction masks.

See Also
  REQDIR_* macros for masks indicating the request data direction.

Definition at line 68 of file StdRequestType.h.

#define CONTROL_REQTYPE_RECIPIENT 0x1F

Mask for the request type parameter, to indicate the recipient of the request (Device, Interface Endpoint or Other). The result of this mask should then be compared to the request recipient masks.

See Also
  REQREC_* macros for masks indicating the request recipient.

Definition at line 83 of file StdRequestType.h.

#define CONTROL_REQTYPE_TYPE 0x60

Mask for the request type parameter, to indicate the type of request (Device, Class or Vendor Specific). The result of this mask should then be compared to the request type masks.

See Also
  REQTYPE_* macros for masks indicating the request type.

Definition at line 75 of file StdRequestType.h.

#define REQDIR_DEVICETOHOST (1 << 7)

Request data direction mask, indicating that the request data will flow from device to host.

See Also
  CONTROL_REQTYPE_DIRECTION macro.

Definition at line 97 of file StdRequestType.h.

#define REQDIR_HOSTTODEVICE (0 << 7)

Request data direction mask, indicating that the request data will flow from host to device.

See Also
  CONTROL_REQTYPE_DIRECTION macro.

Definition at line 91 of file StdRequestType.h.

#define REQREC_DEVICE (0 << 0)

Request recipient mask, indicating that the request is to be issued to the device as a whole.

See Also
  CONTROL_REQTYPE_RECIPIENT macro.

Definition at line 127 of file StdRequestType.h.

#define REQREC_ENDPOINT (2 << 0)

Request recipient mask, indicating that the request is to be issued to an endpoint in the currently selected configuration.

See Also
  CONTROL_REQTYPE_RECIPIENT macro.

Definition at line 141 of file StdRequestType.h.

#define REQREC_INTERFACE (1 << 0)

Request recipient mask, indicating that the request is to be issued to an interface in the currently selected configuration.

See Also
  CONTROL_REQTYPE_RECIPIENT macro.

Definition at line 134 of file StdRequestType.h.

#define REQREC_OTHER (3 << 0)

Request recipient mask, indicating that the request is to be issued to an unspecified element in the currently selected configuration.

See Also
  CONTROL_REQTYPE_RECIPIENT macro.

Definition at line 148 of file StdRequestType.h.

#define REQTYPE_CLASS (1 << 5)

Request type mask, indicating that the request is a class-specific request.

See Also
  CONTROL_REQTYPE_TYPE macro.

Definition at line 112 of file StdRequestType.h.

#define REQTYPE_STANDARD (0 << 5)

Request type mask, indicating that the request is a standard request.

See Also
  CONTROL_REQTYPE_TYPE macro.

Definition at line 106 of file StdRequestType.h.

#define REQTYPE_VENDOR (2 << 5)

Request type mask, indicating that the request is a vendor specific request.

See Also
  CONTROL_REQTYPE_TYPE macro.

Definition at line 118 of file StdRequestType.h.

## Typedef Documentation

typedef { ... } USB_Request_Header_t

## Enumeration Type Documentation

enum USB_Control_Request_t

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 handled regardless of the request type value).

See Also
  Chapter 9 of the USB 2.0 Specification.

Enumerator:

  REQ_GetStatus | Implemented in the library for device and endpoint recipients. Passed to the user application for other recipients via the EVENT_USB_Device_ControlRequest() event when received in device mode.
  REQ_ClearFeature | Implemented in the library for device and endpoint recipients. Passed to the user application for other recipients via the EVENT_USB_Device_ControlRequest() event when received in device mode.
  REQ_SetFeature | Implemented in the library for device and endpoint recipients. Passed to the user application for other recipients via the EVENT_USB_Device_ControlRequest() event when received in device mode.
  REQ_SetAddress | Implemented in the library for the device recipient. Passed to the user application for other recipients via the EVENT_USB_Device_ControlRequest() event when received in device mode.
  REQ_GetDescriptor | Implemented in the library for device and interface recipients. Passed to the user application for other recipients via the EVENT_USB_Device_ControlRequest() event when received in device mode.
  REQ_SetDescriptor | Not implemented in the library, passed to the user application via the EVENT_USB_Device_ControlRequest() event when received in device mode.
  REQ_GetConfiguration | Implemented in the library for the device recipient. Passed to the user application for other recipients via the EVENT_USB_Device_ControlRequest() event when received in device mode.
  REQ_SetConfiguration | Implemented in the library for the device recipient. Passed to the user application for other recipients via the EVENT_USB_Device_ControlRequest() event when received in device mode.
  REQ_GetInterface | Not implemented in the library, passed to the user application via the EVENT_USB_Device_ControlRequest() event when received in device mode.
  REQ_SetInterface | Not implemented in the library, passed to the user application via the EVENT_USB_Device_ControlRequest() event when received in device mode.
  REQ_SynchFrame | Not implemented in the library, passed to the user application via the EVENT_USB_Device_ControlRequest() event when received in device mode.

Definition at line 174 of file StdRequestType.h.

enum USB_Feature_Selectors_t

Feature Selector values for Set Feature and Clear Feature standard control requests directed to the device, interface and endpoint recipients.

Enumerator:

  FEATURE_SEL_EndpointHalt | Feature selector for Clear Feature or Set Feature commands. When used in a Set Feature or Clear Feature request this indicates that an endpoint (whose address is given elsewhere in the request) should have its stall condition changed.
  FEATURE_SEL_DeviceRemoteWakeup | Feature selector for Device level Remote Wakeup enable set or clear. This feature can be controlled by the host on devices which indicate remote wakeup support in their descriptors to selectively disable or enable remote wakeup.
  FEATURE_SEL_TestMode | Feature selector for Test Mode features, used to test the USB controller to check for incorrect operation.

Definition at line 221 of file StdRequestType.h.