Ignore:
Timestamp:
2011-09-07T11:38:57Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d394f1b8
Parents:
7099861
Message:

USB: make bandwidth count function changeable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/src/usb_endpoint_manager.c

    r7099861 r933b0d7  
    140140/*----------------------------------------------------------------------------*/
    141141int usb_endpoint_manager_init(usb_endpoint_manager_t *instance,
    142     size_t available_bandwidth)
     142    size_t available_bandwidth,
     143    size_t (*bw_count)(usb_speed_t, usb_transfer_type_t, size_t, size_t))
    143144{
    144145        assert(instance);
    145146        fibril_mutex_initialize(&instance->guard);
    146147        instance->free_bw = available_bandwidth;
     148        instance->bw_count = bw_count;
    147149        const bool ht =
    148150            hash_table_create(&instance->ep_table, BUCKET_COUNT, MAX_KEYS, &op);
     
    158160    endpoint_t *ep, size_t data_size)
    159161{
     162        assert(instance);
     163        assert(instance->bw_count);
    160164        assert(ep);
    161         const size_t bw = bandwidth_count_usb11(ep->speed, ep->transfer_type,
     165        const size_t bw = instance->bw_count(ep->speed, ep->transfer_type,
    162166            data_size, ep->max_packet_size);
    163         assert(instance);
    164167
    165168        fibril_mutex_lock(&instance->guard);
Note: See TracChangeset for help on using the changeset viewer.