Move Set Feature and Clear Feature control request feature selector values into their own enum.

pull/1469/head
Dean Camera 14 years ago
parent b120c4e4cd
commit 2d49c09b38

@ -346,7 +346,7 @@ static void USB_Device_ClearSetFeature(void)
{ {
#if !defined(NO_DEVICE_REMOTE_WAKEUP) #if !defined(NO_DEVICE_REMOTE_WAKEUP)
case REQREC_DEVICE: case REQREC_DEVICE:
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_REMOTE_WAKEUP) if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_DeviceRemoteWakeup)
USB_RemoteWakeupEnabled = (USB_ControlRequest.bRequest == REQ_SetFeature); USB_RemoteWakeupEnabled = (USB_ControlRequest.bRequest == REQ_SetFeature);
else else
return; return;
@ -355,7 +355,7 @@ static void USB_Device_ClearSetFeature(void)
#endif #endif
#if !defined(CONTROL_ONLY_DEVICE) #if !defined(CONTROL_ONLY_DEVICE)
case REQREC_ENDPOINT: case REQREC_ENDPOINT:
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_ENDPOINT_HALT) if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_EndpointHalt)
{ {
uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK); uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);

@ -147,23 +147,6 @@
#define REQREC_OTHER (3 << 0) #define REQREC_OTHER (3 << 0)
//@} //@}
/** \name Feature Request Types */
//@{
/** Feature indicator for Clear Feature or Set Feature commands. When used in a Clear Feature
* request this indicates that an endpoint (whose address is given elsewhere in the request
* should have its stall condition cleared. If used in a similar manner inside a Set Feature
* request, this stalls an endpoint.
*/
#define FEATURE_ENDPOINT_HALT 0x00
/** Feature indicator for Clear Feature or Set Feature commands. When used in a Clear Feature
* request this indicates that the remote wakeup enabled device should not issue remote
* wakeup requests until further notice. If used in a similar manner inside a Set Feature
* request, this re-enabled the remote wakeup feature on the device.
*/
#define FEATURE_REMOTE_WAKEUP 0x01
//@}
/* Type Defines: */ /* Type Defines: */
/** \brief Standard USB Control Request /** \brief Standard USB Control Request
* *
@ -231,6 +214,26 @@
* device mode. */ * device mode. */
}; };
/** Feature Selector values for Set Feature and Clear Feature standard control requests directed to the device, interface
* and endpoint recipients.
*/
enum USB_Feature_Selectors_t
{
FEATURE_SEL_EndpointHalt = 0x00, /**< 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 = 0x01, /**< 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 = 0x02, /**< Feature selector for Test Mode features, used to test the USB controller
* to check for incorrect operation.
*/
};
/* Private Interface - For use in library only: */ /* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__) #if !defined(__DOXYGEN__)
/* Macros: */ /* Macros: */

Loading…
Cancel
Save