Changeset ec6766a in mainline for uspace/lib/usbhost/src/usb_endpoint_manager.c
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.