Changeset 6326155b in mainline
- Timestamp:
- 2012-12-22T22:39:05Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 52f9c57
- Parents:
- 971fbfde
- Location:
- uspace/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/request.h
r971fbfde r6326155b 37 37 38 38 #include <sys/types.h> 39 #include <usb/usb.h>40 39 41 40 /** Standard device request. */ … … 54 53 USB_DEVREQ_LAST_STD 55 54 } usb_stddevreq_t; 55 56 /** USB device status - device is self powered (opposed to bus powered). */ 57 #define USB_DEVICE_STATUS_SELF_POWERED ((uint16_t)(1 << 0)) 58 59 /** USB device status - remote wake-up signaling is enabled. */ 60 #define USB_DEVICE_STATUS_REMOTE_WAKEUP ((uint16_t)(1 << 1)) 61 62 /** USB endpoint status - endpoint is halted (stalled). */ 63 #define USB_ENDPOINT_STATUS_HALTED ((uint16_t)(1 << 0)) 64 65 /** USB feature selector - endpoint halt (stall). */ 66 #define USB_FEATURE_SELECTOR_ENDPOINT_HALT (0) 67 68 /** USB feature selector - device remote wake-up. */ 69 #define USB_FEATURE_SELECTOR_REMOTE_WAKEUP (1) 56 70 57 71 /** Device request setup packet. … … 93 107 int assert[(sizeof(usb_device_request_setup_packet_t) == 8) ? 1: -1]; 94 108 109 int usb_request_needs_toggle_reset( 110 const usb_device_request_setup_packet_t *request); 95 111 96 112 #endif -
uspace/lib/usb/src/usb.c
r971fbfde r6326155b 34 34 */ 35 35 #include <usb/usb.h> 36 #include <usb/request.h> 37 36 38 #include <errno.h> 39 #include <assert.h> 37 40 38 41 #define ARR_SIZE(arr) (sizeof(arr)/sizeof(arr[0])) … … 116 119 } 117 120 121 /** Check setup packet data for signs of toggle reset. 122 * 123 * @param[in] requst Setup requst data. 124 * @retval -1 No endpoints need reset. 125 * @retval 0 All endpoints need reset. 126 * @retval >0 Specified endpoint needs reset. 127 */ 128 int usb_request_needs_toggle_reset( 129 const usb_device_request_setup_packet_t *request) 130 { 131 assert(request); 132 switch (request->request) 133 { 134 /* Clear Feature ENPOINT_STALL */ 135 case USB_DEVREQ_CLEAR_FEATURE: /*resets only cleared ep */ 136 /* 0x2 ( HOST to device | STANDART | TO ENPOINT) */ 137 if ((request->request_type == 0x2) && 138 (request->value == USB_FEATURE_SELECTOR_ENDPOINT_HALT)) 139 return uint16_usb2host(request->index); 140 break; 141 case USB_DEVREQ_SET_CONFIGURATION: 142 case USB_DEVREQ_SET_INTERFACE: 143 /* Recipient must be device, this resets all endpoints, 144 * In fact there should be no endpoints but EP 0 registered 145 * as different interfaces use different endpoints, 146 * unless you're changing configuration or alternative 147 * interface of an already setup device. */ 148 if (!(request->request_type & SETUP_REQUEST_TYPE_DEVICE_TO_HOST)) 149 return 0; 150 break; 151 default: 152 break; 153 } 154 return -1; 155 } 156 118 157 /** 119 158 * @} -
uspace/lib/usbdev/include/usb/dev/request.h
r971fbfde r6326155b 42 42 #include <usb/descriptor.h> 43 43 #include <usb/request.h> 44 45 /** USB device status - device is self powered (opposed to bus powered). */46 #define USB_DEVICE_STATUS_SELF_POWERED ((uint16_t)(1 << 0))47 48 /** USB device status - remote wake-up signaling is enabled. */49 #define USB_DEVICE_STATUS_REMOTE_WAKEUP ((uint16_t)(1 << 1))50 51 /** USB endpoint status - endpoint is halted (stalled). */52 #define USB_ENDPOINT_STATUS_HALTED ((uint16_t)(1 << 0))53 54 /** USB feature selector - endpoint halt (stall). */55 #define USB_FEATURE_SELECTOR_ENDPOINT_HALT (0)56 57 /** USB feature selector - device remote wake-up. */58 #define USB_FEATURE_SELECTOR_REMOTE_WAKEUP (1)59 60 44 61 45 int usb_control_request_set(usb_pipe_t *,
Note:
See TracChangeset
for help on using the changeset viewer.