Changeset e50cd7f in mainline for uspace/lib/usb/src/host/usb_endpoint_manager.c
- Timestamp:
- 2011-04-17T19:17:55Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 63517c2, cfbbe1d3
- Parents:
- ef354b6 (diff), 8595577b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/host/usb_endpoint_manager.c
ref354b6 re50cd7f 31 31 #include <errno.h> 32 32 33 #include <usb/debug.h> 33 34 #include <usb/host/usb_endpoint_manager.h> 34 35 … … 80 81 endpoint_destroy(node->ep); 81 82 free(node); 83 } 84 /*----------------------------------------------------------------------------*/ 85 static void node_toggle_reset_filtered(link_t *item, void *arg) 86 { 87 assert(item); 88 node_t *node = hash_table_get_instance(item, node_t, link); 89 usb_target_t *target = arg; 90 endpoint_toggle_reset_filtered(node->ep, *target); 82 91 } 83 92 /*----------------------------------------------------------------------------*/ … … 202 211 203 212 node_t *node = hash_table_get_instance(item, node_t, link); 213 if (node->ep->active) 214 return EBUSY; 215 204 216 instance->free_bw += node->bw; 205 217 hash_table_remove(&instance->ep_table, key, MAX_KEYS); … … 230 242 return node->ep; 231 243 } 244 /*----------------------------------------------------------------------------*/ 245 /** Check setup packet data for signs of toggle reset. 246 * 247 * @param[in] instance Device keeper structure to use. 248 * @param[in] target Device to receive setup packet. 249 * @param[in] data Setup packet data. 250 * 251 * Really ugly one. 252 */ 253 void usb_endpoint_manager_reset_if_need( 254 usb_endpoint_manager_t *instance, usb_target_t target, const uint8_t *data) 255 { 256 assert(instance); 257 if (target.endpoint > 15 || target.endpoint < 0 258 || target.address >= USB11_ADDRESS_MAX || target.address < 0) { 259 usb_log_error("Invalid data when checking for toggle reset.\n"); 260 return; 261 } 262 263 switch (data[1]) 264 { 265 case 0x01: /*clear feature*/ 266 /* recipient is endpoint, value is zero (ENDPOINT_STALL) */ 267 if (((data[0] & 0xf) == 1) && ((data[2] | data[3]) == 0)) { 268 /* endpoint number is < 16, thus first byte is enough */ 269 usb_target_t reset_target = 270 { .address = target.address, data[4] }; 271 fibril_mutex_lock(&instance->guard); 272 hash_table_apply(&instance->ep_table, 273 node_toggle_reset_filtered, &reset_target); 274 fibril_mutex_unlock(&instance->guard); 275 } 276 break; 277 278 case 0x9: /* set configuration */ 279 case 0x11: /* set interface */ 280 /* target must be device */ 281 if ((data[0] & 0xf) == 0) { 282 usb_target_t reset_target = 283 { .address = target.address, 0 }; 284 fibril_mutex_lock(&instance->guard); 285 hash_table_apply(&instance->ep_table, 286 node_toggle_reset_filtered, &reset_target); 287 fibril_mutex_unlock(&instance->guard); 288 } 289 break; 290 } 291 }
Note:
See TracChangeset
for help on using the changeset viewer.