Changeset 5e07cbc0 in mainline


Ignore:
Timestamp:
2011-10-31T13:39:22Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0cd8089
Parents:
27ed734c
Message:

libusbhost: usb_device_manager: Add speed limit.

Location:
uspace
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/hc.c

    r27ed734c r5e07cbc0  
    193193        list_initialize(&instance->pending_batches);
    194194
    195         hcd_init(&instance->generic, BANDWIDTH_AVAILABLE_USB11,
    196             bandwidth_count_usb11);
     195        hcd_init(&instance->generic, USB_SPEED_FULL,
     196            BANDWIDTH_AVAILABLE_USB11, bandwidth_count_usb11);
    197197        instance->generic.private_data = instance;
    198198        instance->generic.schedule = hc_schedule;
  • uspace/drv/bus/usb/uhci/hc.c

    r27ed734c r5e07cbc0  
    199199#undef CHECK_RET_RETURN
    200200
    201         hcd_init(&instance->generic, BANDWIDTH_AVAILABLE_USB11,
    202             bandwidth_count_usb11);
     201        hcd_init(&instance->generic, USB_SPEED_FULL,
     202            BANDWIDTH_AVAILABLE_USB11, bandwidth_count_usb11);
    203203
    204204        instance->generic.private_data = instance;
  • uspace/drv/bus/usb/vhc/main.c

    r27ed734c r5e07cbc0  
    8080                return rc;
    8181        }
    82         usb_device_manager_init(&data->dev_manager);
     82        usb_device_manager_init(&data->dev_manager, USB_SPEED_MAX);
    8383
    8484        ddf_fun_t *hc = ddf_fun_create(dev, fun_exposed, "hc");
  • uspace/lib/usbhost/include/usb/host/hcd.h

    r27ed734c r5e07cbc0  
    6868 * @param bw_count Bandwidth compute function, passed to endpoint manager.
    6969 */
    70 static inline void hcd_init(hcd_t *hcd, size_t bandwidth,
     70static inline void hcd_init(hcd_t *hcd, usb_speed_t max_speed, size_t bandwidth,
    7171    size_t (*bw_count)(usb_speed_t, usb_transfer_type_t, size_t, size_t))
    7272{
    7373        assert(hcd);
    74         usb_device_manager_init(&hcd->dev_manager);
     74        usb_device_manager_init(&hcd->dev_manager, max_speed);
    7575        usb_endpoint_manager_init(&hcd->ep_manager, bandwidth, bw_count);
    7676        hcd->private_data = NULL;
  • uspace/lib/usbhost/include/usb/host/usb_device_manager.h

    r27ed734c r5e07cbc0  
    5959                devman_handle_t handle; /**< Devman handle of the device. */
    6060        } devices[USB_ADDRESS_COUNT];
     61        usb_speed_t max_speed;
    6162        fibril_mutex_t guard;
    6263        /** The last reserved address */
     
    6465} usb_device_manager_t;
    6566
    66 void usb_device_manager_init(usb_device_manager_t *instance);
     67void usb_device_manager_init(
     68    usb_device_manager_t *instance, usb_speed_t max_speed);
    6769
    6870usb_address_t usb_device_manager_get_free_address(
  • uspace/lib/usbhost/src/usb_device_manager.c

    r27ed734c r5e07cbc0  
    4141 *
    4242 * @param[in] instance Memory place to initialize.
     43 * @param[in] max_speed Maximum allowed USB speed of devices (inclusive).
    4344 *
    4445 * Set all values to false/0.
    4546 */
    46 void usb_device_manager_init(usb_device_manager_t *instance)
     47void usb_device_manager_init(
     48    usb_device_manager_t *instance, usb_speed_t max_speed)
    4749{
    4850        assert(instance);
     
    5658        instance->devices[0].occupied = true;
    5759        instance->last_address = 0;
     60        instance->max_speed = max_speed;
    5861        fibril_mutex_initialize(&instance->guard);
    5962}
     
    6972{
    7073        assert(instance);
     74        if (speed > instance->max_speed)
     75                return ENOTSUP;
    7176        fibril_mutex_lock(&instance->guard);
    7277
Note: See TracChangeset for help on using the changeset viewer.