Ignore:
Timestamp:
2011-04-07T15:04:16Z (13 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
36cd378
Parents:
9d06563 (diff), a82889e (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:

partial merge form usb/development

File:
1 moved

Legend:

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

    r9d06563 ra4e18e1  
    3737 * This structure shall simplify the management.
    3838 */
    39 #ifndef LIBUSB_HOST_BANDWIDTH_H
    40 #define LIBUSB_HOST_BANDWIDTH_H
     39#ifndef LIBUSB_HOST_USB_ENDPOINT_MANAGER_H
     40#define LIBUSB_HOST_YSB_ENDPOINT_MANAGER_H
    4141
    4242#include <adt/hash_table.h>
    4343#include <fibril_synch.h>
    4444#include <usb/usb.h>
     45#include <usb/host/endpoint.h>
    4546
    4647#define BANDWIDTH_TOTAL_USB11 12000000
    4748#define BANDWIDTH_AVAILABLE_USB11 ((BANDWIDTH_TOTAL_USB11 / 10) * 9)
    4849
    49 typedef struct bandwidth {
    50         hash_table_t reserved;
     50typedef struct usb_endpoint_manager {
     51        hash_table_t ep_table;
    5152        fibril_mutex_t guard;
    52         size_t free;
    53         size_t (*usage_fnc)(usb_speed_t, usb_transfer_type_t, size_t, size_t);
    54 } bandwidth_t;
     53        fibril_condvar_t change;
     54        size_t free_bw;
     55} usb_endpoint_manager_t;
    5556
    5657size_t bandwidth_count_usb11(usb_speed_t speed, usb_transfer_type_t type,
    5758    size_t size, size_t max_packet_size);
    5859
    59 int bandwidth_init(bandwidth_t *instance, size_t bandwidth,
    60     size_t (*usage_fnc)(usb_speed_t, usb_transfer_type_t, size_t, size_t));
     60int usb_endpoint_manager_init(usb_endpoint_manager_t *instance,
     61    size_t available_bandwidth);
    6162
    62 void bandwidth_destroy(bandwidth_t *instance);
     63void usb_endpoint_manager_destroy(usb_endpoint_manager_t *instance);
    6364
    64 int bandwidth_reserve(bandwidth_t *instance, usb_address_t address,
    65     usb_endpoint_t endpoint, usb_direction_t direction, usb_speed_t speed,
    66     usb_transfer_type_t transfer_type, size_t max_packet_size, size_t size,
    67     unsigned interval);
     65int usb_endpoint_manager_register_ep(usb_endpoint_manager_t *instance,
     66    endpoint_t *ep, size_t data_size);
    6867
    69 int bandwidth_release(bandwidth_t *instance, usb_address_t address,
    70     usb_endpoint_t endpoint, usb_direction_t direction);
     68int usb_endpoint_manager_register_ep_wait(usb_endpoint_manager_t *instance,
     69    usb_address_t address, usb_endpoint_t ep, usb_direction_t direction,
     70    void *data, void (*data_remove_callback)(void* data, void* arg), void *arg,
     71    size_t bw);
    7172
    72 int bandwidth_use(bandwidth_t *instance, usb_address_t address,
    73     usb_endpoint_t endpoint, usb_direction_t direction);
     73int usb_endpoint_manager_unregister_ep(usb_endpoint_manager_t *instance,
     74    usb_address_t address, usb_endpoint_t ep, usb_direction_t direction);
    7475
    75 int bandwidth_free(bandwidth_t *instance, usb_address_t address,
    76     usb_endpoint_t endpoint, usb_direction_t direction);
     76endpoint_t * usb_endpoint_manager_get_ep(usb_endpoint_manager_t *instance,
     77    usb_address_t address, usb_endpoint_t ep, usb_direction_t direction,
     78    size_t *bw);
    7779
    7880#endif
     
    8082 * @}
    8183 */
     84
Note: See TracChangeset for help on using the changeset viewer.