Changeset a6a9910 in mainline


Ignore:
Timestamp:
2012-12-22T23:13:05Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1affef2f
Parents:
52f9c57
Message:

libusbhost: Add external toggle rest function to ep manager

Location:
uspace/lib/usbhost
Files:
2 edited

Legend:

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

    r52f9c57 ra6a9910  
    9595    ep_remove_callback_t callback, void *arg);
    9696
     97int usb_endpoint_manager_reset_toggle(usb_endpoint_manager_t *instance,
     98    usb_target_t target, bool all);
     99
    97100void usb_endpoint_manager_remove_address(usb_endpoint_manager_t *instance,
    98101    usb_address_t address, ep_remove_callback_t callback, void *arg);
  • uspace/lib/usbhost/src/usb_endpoint_manager.c

    r52f9c57 ra6a9910  
    395395}
    396396
     397int usb_endpoint_manager_reset_toggle(usb_endpoint_manager_t *instance,
     398    usb_target_t target, bool all)
     399{
     400        assert(instance);
     401        if (!usb_target_is_valid(target)) {
     402                return EINVAL;
     403        }
     404
     405        int rc = ENOENT;
     406
     407        fibril_mutex_lock(&instance->guard);
     408        list_foreach(*get_list(instance, target.address), it) {
     409                endpoint_t *ep = endpoint_get_instance(it);
     410                if ((ep->address == target.address)
     411                    && (all || ep->endpoint == target.endpoint)) {
     412                        endpoint_toggle_set(ep, 0);
     413                        rc = EOK;
     414                }
     415        }
     416        fibril_mutex_unlock(&instance->guard);
     417        return rc;
     418}
     419
    397420/** Unregister and destroy all endpoints using given address.
    398421 * @param instance usb_endpoint_manager structure, non-null.
Note: See TracChangeset for help on using the changeset viewer.