Changeset d773285 in mainline for uspace/lib/usb/src/host/device_keeper.c
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.