Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/src/host/device_keeper.c

    rffc63b0 r049eb87  
    264264        return instance->devices[address].speed;
    265265}
     266/*----------------------------------------------------------------------------*/
     267void usb_device_keeper_use_control(
     268    usb_device_keeper_t *instance, usb_target_t target)
     269{
     270        assert(instance);
     271        const uint16_t ep = 1 << target.endpoint;
     272        fibril_mutex_lock(&instance->guard);
     273        while (instance->devices[target.address].control_used & ep) {
     274                fibril_condvar_wait(&instance->change, &instance->guard);
     275        }
     276        instance->devices[target.address].control_used |= ep;
     277        fibril_mutex_unlock(&instance->guard);
     278}
     279/*----------------------------------------------------------------------------*/
     280void usb_device_keeper_release_control(
     281    usb_device_keeper_t *instance, usb_target_t target)
     282{
     283        assert(instance);
     284        const uint16_t ep = 1 << target.endpoint;
     285        fibril_mutex_lock(&instance->guard);
     286        assert((instance->devices[target.address].control_used & ep) != 0);
     287        instance->devices[target.address].control_used &= ~ep;
     288        fibril_mutex_unlock(&instance->guard);
     289        fibril_condvar_signal(&instance->change);
     290}
    266291/**
    267292 * @}
Note: See TracChangeset for help on using the changeset viewer.