Ignore:
Timestamp:
2011-09-19T16:31:00Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a347a11
Parents:
3842a955 (diff), 086290d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

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

    r3842a955 r26e7d6d  
    3838 */
    3939#ifndef LIBUSBHOST_HOST_USB_ENDPOINT_MANAGER_H
    40 #define LIBUSBHOST_HOST_YSB_ENDPOINT_MANAGER_H
     40#define LIBUSBHOST_HOST_USB_ENDPOINT_MANAGER_H
    4141
    4242#include <stdlib.h>
     
    5252        hash_table_t ep_table;
    5353        fibril_mutex_t guard;
    54         fibril_condvar_t change;
    5554        size_t free_bw;
     55        size_t (*bw_count)(usb_speed_t, usb_transfer_type_t, size_t, size_t);
    5656} usb_endpoint_manager_t;
    5757
     
    6060
    6161int usb_endpoint_manager_init(usb_endpoint_manager_t *instance,
    62     size_t available_bandwidth);
     62    size_t available_bandwidth,
     63    size_t (*bw_count)(usb_speed_t, usb_transfer_type_t, size_t, size_t));
    6364
    6465void usb_endpoint_manager_destroy(usb_endpoint_manager_t *instance);
     
    7778    usb_endpoint_manager_t *instance, usb_target_t target, const uint8_t *data);
    7879
     80/** Wrapper combining allocation and insertion */
    7981static inline int usb_endpoint_manager_add_ep(usb_endpoint_manager_t *instance,
    8082    usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction,
     
    8284    size_t data_size)
    8385{
    84         endpoint_t *ep = malloc(sizeof(endpoint_t));
    85         if (ep == NULL)
     86        endpoint_t *ep = endpoint_get(
     87            address, endpoint, direction, type, speed, max_packet_size);
     88        if (!ep)
    8689                return ENOMEM;
    8790
    88         int ret = endpoint_init(ep, address, endpoint, direction, type, speed,
    89             max_packet_size);
    90         if (ret != EOK) {
    91                 free(ep);
    92                 return ret;
    93         }
    94 
    95         ret = usb_endpoint_manager_register_ep(instance, ep, data_size);
     91        const int ret =
     92            usb_endpoint_manager_register_ep(instance, ep, data_size);
    9693        if (ret != EOK) {
    9794                endpoint_destroy(ep);
    98                 return ret;
    9995        }
    100         return EOK;
     96        return ret;
    10197}
    10298#endif
Note: See TracChangeset for help on using the changeset viewer.