Changeset 820d9bc in mainline for uspace/lib/usbhost
- Timestamp:
 - 2017-11-22T13:54:05Z (8 years ago)
 - Branches:
 - lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
 - Children:
 - d42ba37
 - Parents:
 - 64fea02
 - Location:
 - uspace/lib/usbhost
 - Files:
 - 
      
- 2 edited
 
- 
          
  include/usb/host/hcd.h (modified) (1 diff)
 - 
          
  src/hcd.c (modified) (2 diffs)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
uspace/lib/usbhost/include/usb/host/hcd.h
r64fea02 r820d9bc 112 112 const char *); 113 113 114 /** How many toggles need to be reset */ 115 typedef enum { 116 RESET_NONE, 117 RESET_EP, 118 RESET_ALL 119 } toggle_reset_mode_t; 120 114 121 #endif 115 122  - 
      
uspace/lib/usbhost/src/hcd.c
r64fea02 r820d9bc 147 147 } 148 148 149 /** Check setup packet data for signs of toggle reset. 150 * 151 * @param[in] requst Setup requst data. 152 * 153 * @retval -1 No endpoints need reset. 154 * @retval 0 All endpoints need reset. 155 * @retval >0 Specified endpoint needs reset. 156 * 157 */ 158 static toggle_reset_mode_t hcd_get_request_toggle_reset_mode( 159 const usb_device_request_setup_packet_t *request) 160 { 161 assert(request); 162 switch (request->request) 163 { 164 /* Clear Feature ENPOINT_STALL */ 165 case USB_DEVREQ_CLEAR_FEATURE: /*resets only cleared ep */ 166 /* 0x2 ( HOST to device | STANDART | TO ENPOINT) */ 167 if ((request->request_type == 0x2) && 168 (request->value == USB_FEATURE_ENDPOINT_HALT)) 169 return RESET_EP; 170 break; 171 case USB_DEVREQ_SET_CONFIGURATION: 172 case USB_DEVREQ_SET_INTERFACE: 173 /* Recipient must be device, this resets all endpoints, 174 * In fact there should be no endpoints but EP 0 registered 175 * as different interfaces use different endpoints, 176 * unless you're changing configuration or alternative 177 * interface of an already setup device. */ 178 if (!(request->request_type & SETUP_REQUEST_TYPE_DEVICE_TO_HOST)) 179 return RESET_ALL; 180 break; 181 default: 182 break; 183 } 184 185 return RESET_NONE; 186 } 187 149 188 /** Prepare generic usb_transfer_batch and schedule it. 150 189 * @param hcd Host controller driver. … … 207 246 if (ep->transfer_type == USB_TRANSFER_CONTROL) 208 247 batch->toggle_reset_mode 209 = usb_request_get_toggle_reset_mode(&batch->setup.packet);248 = hcd_get_request_toggle_reset_mode(&batch->setup.packet); 210 249 211 250 const int ret = hcd->ops.schedule(hcd, batch);  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  