Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 46f2808 in mainline


Ignore:
Timestamp:
2011-11-04T16:05:17Z (9 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
master
Children:
6b6fc232
Parents:
07a7a97d
Message:

libusbhost: usb_endpoint_manager add function to remove all endpoints of one address.

Location:
uspace/lib/usbhost
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/include/usb/host/usb_endpoint_manager.h

    r07a7a97d r46f2808  
    9090    usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction,
    9191    void (*callback)(endpoint_t *, void *), void *arg);
     92
     93void usb_endpoint_manager_remove_address(usb_endpoint_manager_t *instance,
     94    usb_address_t address, void (*callback)(endpoint_t *, void *), void *arg);
    9295#endif
    9396/**
  • uspace/lib/usbhost/src/usb_endpoint_manager.c

    r07a7a97d r46f2808  
    384384        return EOK;
    385385}
     386/*----------------------------------------------------------------------------*/
     387void usb_endpoint_manager_remove_address(usb_endpoint_manager_t *instance,
     388    usb_address_t address, void (*callback)(endpoint_t *, void *), void *arg)
     389{
     390        assert(address >= 0);
     391        assert(instance);
     392        fibril_mutex_lock(&instance->guard);
     393        list_foreach(*get_list(instance, address), iterator) {
     394                endpoint_t *ep = endpoint_get_instance(iterator);
     395                if (ep->address == address) {
     396                        iterator = iterator->next;
     397                        list_remove(&ep->link);
     398                        if (callback)
     399                                callback(ep, arg);
     400                        endpoint_destroy(ep);
     401                }
     402        }
     403        fibril_mutex_unlock(&instance->guard);
     404}
Note: See TracChangeset for help on using the changeset viewer.