Changeset d773285 in mainline
- Timestamp:
- 2011-04-02T15:37:22Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0053fa38
- Parents:
- 1273b86c
- Location:
- uspace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/hc.c
r1273b86c rd773285 351 351 if (batch->transfer_type == USB_TRANSFER_CONTROL) { 352 352 usb_device_keeper_use_control( 353 &instance->manager, batch->target .address);353 &instance->manager, batch->target); 354 354 } 355 355 transfer_list_add_batch(list, batch); … … 394 394 case USB_TRANSFER_CONTROL: 395 395 usb_device_keeper_release_control( 396 &instance->manager, batch->target .address);396 &instance->manager, batch->target); 397 397 break; 398 398 case USB_TRANSFER_INTERRUPT: -
uspace/lib/usb/include/usb/host/device_keeper.h
r1273b86c rd773285 51 51 usb_speed_t speed; 52 52 bool occupied; 53 boolcontrol_used;53 uint16_t control_used; 54 54 uint16_t toggle_status[2]; 55 55 devman_handle_t handle; … … 99 99 100 100 void usb_device_keeper_use_control(usb_device_keeper_t *instance, 101 usb_ address_t address);101 usb_target_t target); 102 102 103 103 void usb_device_keeper_release_control(usb_device_keeper_t *instance, 104 usb_ address_t address);104 usb_target_t target); 105 105 106 106 #endif -
uspace/lib/usb/src/host/device_keeper.c
r1273b86c rd773285 54 54 for (; i < USB_ADDRESS_COUNT; ++i) { 55 55 instance->devices[i].occupied = false; 56 instance->devices[i].control_used = false;56 instance->devices[i].control_used = 0; 57 57 instance->devices[i].handle = 0; 58 58 instance->devices[i].toggle_status[0] = 0; … … 311 311 /*----------------------------------------------------------------------------*/ 312 312 void usb_device_keeper_use_control(usb_device_keeper_t *instance, 313 usb_address_t address) 314 { 315 assert(instance); 316 fibril_mutex_lock(&instance->guard); 317 while (instance->devices[address].control_used) { 313 usb_target_t target) 314 { 315 assert(instance); 316 const uint16_t ep = 1 << target.endpoint; 317 fibril_mutex_lock(&instance->guard); 318 while (instance->devices[target.address].control_used & ep) { 318 319 fibril_condvar_wait(&instance->change, &instance->guard); 319 320 } 320 instance->devices[ address].control_used = true;321 instance->devices[target.address].control_used |= ep; 321 322 fibril_mutex_unlock(&instance->guard); 322 323 } 323 324 /*----------------------------------------------------------------------------*/ 324 325 void usb_device_keeper_release_control(usb_device_keeper_t *instance, 325 usb_address_t address) 326 { 327 assert(instance); 328 fibril_mutex_lock(&instance->guard); 329 instance->devices[address].control_used = false; 326 usb_target_t target) 327 { 328 assert(instance); 329 const uint16_t ep = 1 << target.endpoint; 330 fibril_mutex_lock(&instance->guard); 331 assert((instance->devices[target.address].control_used & ep) != 0); 332 instance->devices[target.address].control_used &= ~ep; 330 333 fibril_mutex_unlock(&instance->guard); 331 334 fibril_condvar_signal(&instance->change);
Note:
See TracChangeset
for help on using the changeset viewer.