Changeset 8a23fef in mainline
- Timestamp:
- 2013-07-27T08:17:36Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ec6766a
- Parents:
- 3aac088
- Location:
- uspace/lib/usbhost
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/include/usb/host/usb_endpoint_manager.h
r3aac088 r8a23fef 86 86 int usb_endpoint_manager_unregister_ep( 87 87 usb_endpoint_manager_t *instance, endpoint_t *ep); 88 88 89 endpoint_t * usb_endpoint_manager_find_ep(usb_endpoint_manager_t *instance, 89 90 usb_address_t address, usb_endpoint_t ep, usb_direction_t direction); … … 101 102 usb_target_t target, bool all); 102 103 103 voidusb_endpoint_manager_remove_address(usb_endpoint_manager_t *instance,104 int usb_endpoint_manager_remove_address(usb_endpoint_manager_t *instance, 104 105 usb_address_t address, ep_remove_callback_t callback, void *arg); 105 106 106 107 int usb_endpoint_manager_request_address(usb_endpoint_manager_t *instance, 107 108 usb_address_t *address, bool strict, usb_speed_t speed); 108 109 int usb_endpoint_manager_release_address(usb_endpoint_manager_t *instance,110 usb_address_t address);111 109 112 110 int usb_endpoint_manager_get_info_by_address(usb_endpoint_manager_t *instance, -
uspace/lib/usbhost/src/hcd.c
r3aac088 r8a23fef 117 117 { 118 118 assert(hcd); 119 usb_endpoint_manager_remove_address(&hcd->ep_manager, address,119 return usb_endpoint_manager_remove_address(&hcd->ep_manager, address, 120 120 unregister_helper_warn, hcd); 121 usb_endpoint_manager_release_address(&hcd->ep_manager, address);122 return EOK;123 121 } 124 122 -
uspace/lib/usbhost/src/usb_endpoint_manager.c
r3aac088 r8a23fef 369 369 { 370 370 assert(instance); 371 if (!usb_target_is_valid(target)) { 372 return EINVAL; 373 } 374 375 int rc = ENOENT; 371 if (!usb_target_is_valid(target)) 372 return EINVAL; 373 374 int ret = ENOENT; 376 375 377 376 fibril_mutex_lock(&instance->guard); … … 381 380 && (all || ep->endpoint == target.endpoint)) { 382 381 endpoint_toggle_set(ep, 0); 383 r c= EOK;382 ret = EOK; 384 383 } 385 384 } 386 385 fibril_mutex_unlock(&instance->guard); 387 return r c;386 return ret; 388 387 } 389 388 … … 397 396 * @return Error code. 398 397 */ 399 voidusb_endpoint_manager_remove_address(usb_endpoint_manager_t *instance,398 int usb_endpoint_manager_remove_address(usb_endpoint_manager_t *instance, 400 399 usb_address_t address, ep_remove_callback_t callback, void *arg) 401 400 { 402 assert(address >= 0); 403 assert(instance); 404 fibril_mutex_lock(&instance->guard); 401 assert(instance); 402 if (!usb_address_is_valid(address)) 403 return EINVAL; 404 405 fibril_mutex_lock(&instance->guard); 406 407 const int ret = instance->devices[address].occupied ? EOK : ENOENT; 408 instance->devices[address].occupied = false; 409 405 410 list_foreach(*get_list(instance, address), iterator) { 406 411 endpoint_t *ep = endpoint_get_instance(iterator); … … 414 419 } 415 420 fibril_mutex_unlock(&instance->guard); 421 return ret; 416 422 } 417 423 … … 463 469 } 464 470 465 /** Release used USB address.466 *467 * @param[in] instance Device manager structure to use.468 * @param[in] address Device address469 * @return Error code.470 */471 int usb_endpoint_manager_release_address(472 usb_endpoint_manager_t *instance, usb_address_t address)473 {474 assert(instance);475 if (!usb_address_is_valid(address))476 return EINVAL;477 478 fibril_mutex_lock(&instance->guard);479 480 const int rc = instance->devices[address].occupied ? EOK : ENOENT;481 instance->devices[address].occupied = false;482 483 fibril_mutex_unlock(&instance->guard);484 return rc;485 }486 487 471 /** Get speed assigned to USB address. 488 472 * … … 502 486 fibril_mutex_lock(&instance->guard); 503 487 504 const int r c= instance->devices[address].occupied ? EOK : ENOENT;488 const int ret = instance->devices[address].occupied ? EOK : ENOENT; 505 489 if (speed && instance->devices[address].occupied) { 506 490 *speed = instance->devices[address].speed; … … 508 492 509 493 fibril_mutex_unlock(&instance->guard); 510 return r c;494 return ret; 511 495 } 512 496 /**
Note:
See TracChangeset
for help on using the changeset viewer.