Ignore:
Timestamp:
2011-10-28T21:52:15Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
57e06ef
Parents:
7265558
Message:

libusbhost: Make interfaces more symmetric.

Make usb_endpoint_manager interface easier to use and understand.
Move ep removal hook pointer from endpoint_t to hcd_t.

File:
1 edited

Legend:

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

    r7265558 r48ae3ef  
    6464    size_t (*bw_count)(usb_speed_t, usb_transfer_type_t, size_t, size_t));
    6565
    66 void usb_endpoint_manager_destroy(usb_endpoint_manager_t *instance);
     66void usb_endpoint_manager_reset_eps_if_need(
     67    usb_endpoint_manager_t *instance, usb_target_t target, const uint8_t *data);
    6768
    68 int usb_endpoint_manager_register_ep(usb_endpoint_manager_t *instance,
    69     endpoint_t *ep, size_t data_size);
    70 
    71 int usb_endpoint_manager_unregister_ep(usb_endpoint_manager_t *instance,
     69int usb_endpoint_manager_register_ep(
     70    usb_endpoint_manager_t *instance, endpoint_t *ep, size_t data_size);
     71int usb_endpoint_manager_unregister_ep(
     72    usb_endpoint_manager_t *instance, endpoint_t *ep);
     73endpoint_t * usb_endpoint_manager_find_ep(usb_endpoint_manager_t *instance,
    7274    usb_address_t address, usb_endpoint_t ep, usb_direction_t direction);
    7375
    74 endpoint_t * usb_endpoint_manager_get_ep(usb_endpoint_manager_t *instance,
    75     usb_address_t address, usb_endpoint_t ep, usb_direction_t direction);
    76 
    77 void usb_endpoint_manager_reset_if_need(
    78     usb_endpoint_manager_t *instance, usb_target_t target, const uint8_t *data);
    79 
    80 /** Wrapper combining allocation and insertion */
    81 static inline int usb_endpoint_manager_add_ep(usb_endpoint_manager_t *instance,
     76int usb_endpoint_manager_add_ep(usb_endpoint_manager_t *instance,
    8277    usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction,
    8378    usb_transfer_type_t type, usb_speed_t speed, size_t max_packet_size,
    84     size_t data_size)
    85 {
    86         assert(instance);
    87         const size_t bw =
    88             instance->bw_count(speed, type, data_size, max_packet_size);
     79    size_t data_size, int (*callback)(endpoint_t *, void *), void *arg);
    8980
    90         endpoint_t *ep = endpoint_create(
    91             address, endpoint, direction, type, speed, max_packet_size, bw);
    92         if (!ep)
    93                 return ENOMEM;
    94 
    95         const int ret =
    96             usb_endpoint_manager_register_ep(instance, ep, data_size);
    97         if (ret != EOK) {
    98                 endpoint_destroy(ep);
    99         }
    100         return ret;
    101 }
     81int usb_endpoint_manager_remove_ep(usb_endpoint_manager_t *instance,
     82    usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction,
     83    void (*callback)(endpoint_t *, void *), void *arg);
    10284#endif
    10385/**
    10486 * @}
    10587 */
    106 
Note: See TracChangeset for help on using the changeset viewer.