Changeset ec6766a in mainline
- Timestamp:
- 2013-07-27T08:30:53Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3cc55b47
- Parents:
- 8a23fef
- Location:
- uspace/lib/usbhost
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/include/usb/host/usb_endpoint_manager.h
r8a23fef rec6766a 92 92 int usb_endpoint_manager_add_ep(usb_endpoint_manager_t *instance, 93 93 usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction, 94 usb_transfer_type_t type, usb_speed_t speed, size_t max_packet_size,95 size_t data_size,ep_add_callback_t callback, void *arg);94 usb_transfer_type_t type, size_t max_packet_size, size_t data_size, 95 ep_add_callback_t callback, void *arg); 96 96 97 97 int usb_endpoint_manager_remove_ep(usb_endpoint_manager_t *instance, -
uspace/lib/usbhost/src/ddf_helpers.c
r8a23fef rec6766a 422 422 423 423 /* Add default pipe on default address */ 424 ret = hcd_add_ep(hcd, 424 ret = hcd_add_ep(hcd, 425 425 default_target, USB_DIRECTION_BOTH, USB_TRANSFER_CONTROL, 426 426 CTRL_PIPE_MIN_PACKET_SIZE, CTRL_PIPE_MIN_PACKET_SIZE); -
uspace/lib/usbhost/src/hcd.c
r8a23fef rec6766a 133 133 { 134 134 assert(hcd); 135 usb_speed_t speed = USB_SPEED_MAX;136 const int ret = usb_endpoint_manager_get_info_by_address(137 &hcd->ep_manager, target.address, &speed);138 if (ret != EOK) {139 return ret;140 }141 135 return usb_endpoint_manager_add_ep(&hcd->ep_manager, target.address, 142 target.endpoint, dir, type, speed, max_packet_size, size,143 register_helper,hcd);136 target.endpoint, dir, type, max_packet_size, size, register_helper, 137 hcd); 144 138 } 145 139 -
uspace/lib/usbhost/src/usb_endpoint_manager.c
r8a23fef rec6766a 286 286 int usb_endpoint_manager_add_ep(usb_endpoint_manager_t *instance, 287 287 usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction, 288 usb_transfer_type_t type, usb_speed_t speed, size_t max_packet_size,289 size_t data_size,ep_add_callback_t callback, void *arg)288 usb_transfer_type_t type, size_t max_packet_size, size_t data_size, 289 ep_add_callback_t callback, void *arg) 290 290 { 291 291 assert(instance); 292 292 if (instance->bw_count == NULL) 293 293 return ENOTSUP; 294 if (address < 0) 295 return EINVAL; 296 297 const size_t bw = 298 instance->bw_count(speed, type, data_size, max_packet_size); 299 300 fibril_mutex_lock(&instance->guard); 301 /* Check for available bandwidth */ 302 if (bw > instance->free_bw) { 303 fibril_mutex_unlock(&instance->guard); 304 return ENOSPC; 294 if (!usb_address_is_valid(address)) 295 return EINVAL; 296 297 298 fibril_mutex_lock(&instance->guard); 299 /* Check for speed and address */ 300 if (!instance->devices[address].occupied) { 301 fibril_mutex_unlock(&instance->guard); 302 return ENOENT; 305 303 } 306 304 … … 310 308 fibril_mutex_unlock(&instance->guard); 311 309 return EEXISTS; 310 } 311 312 const usb_speed_t speed = instance->devices[address].speed; 313 const size_t bw = 314 instance->bw_count(speed, type, data_size, max_packet_size); 315 316 /* Check for available bandwidth */ 317 if (bw > instance->free_bw) { 318 fibril_mutex_unlock(&instance->guard); 319 return ENOSPC; 312 320 } 313 321
Note:
See TracChangeset
for help on using the changeset viewer.