Changeset 7265558 in mainline for uspace/lib/usbhost/include/usb


Ignore:
Timestamp:
2011-10-28T20:53:41Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
48ae3ef
Parents:
83c3123
Message:

libusbhost: Drop hash_table and use multiple lists instead.

This has several advantages:
Knowing that all endpoints on one address are in one list makes toggle resets more efficient.
Endpoint search is done only once for inserts and deletes.
Lists are part of the structure and not allocated separately, removing one more failure point from init path.

Location:
uspace/lib/usbhost/include/usb/host
Files:
3 edited

Legend:

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

    r83c3123 r7265558  
    7777int endpoint_toggle_get(endpoint_t *instance);
    7878void endpoint_toggle_set(endpoint_t *instance, int toggle);
    79 void endpoint_toggle_reset_filtered(endpoint_t *instance, usb_target_t target);
     79
     80static inline endpoint_t * endpoint_get_instance(link_t *item)
     81{
     82        return list_get_instance(item, endpoint_t, link);
     83}
    8084#endif
    8185/**
  • uspace/lib/usbhost/include/usb/host/hcd.h

    r83c3123 r7265558  
    3737
    3838#include <assert.h>
     39#include <usbhc_iface.h>
    3940#include <usb/host/usb_device_manager.h>
    4041#include <usb/host/usb_endpoint_manager.h>
    4142#include <usb/host/usb_transfer_batch.h>
    42 #include <usbhc_iface.h>
    4343
    4444typedef struct hcd hcd_t;
     
    5353};
    5454/*----------------------------------------------------------------------------*/
    55 static inline int hcd_init(hcd_t *hcd, size_t bandwidth,
     55static inline void hcd_init(hcd_t *hcd, size_t bandwidth,
    5656    size_t (*bw_count)(usb_speed_t, usb_transfer_type_t, size_t, size_t))
    5757{
    5858        assert(hcd);
    5959        usb_device_manager_init(&hcd->dev_manager);
    60         return usb_endpoint_manager_init(&hcd->ep_manager, bandwidth, bw_count);
    61 }
    62 /*----------------------------------------------------------------------------*/
    63 static inline void hcd_destroy(hcd_t *hcd)
    64 {
    65         usb_endpoint_manager_destroy(&hcd->ep_manager);
     60        usb_endpoint_manager_init(&hcd->ep_manager, bandwidth, bw_count);
    6661}
    6762/*----------------------------------------------------------------------------*/
  • uspace/lib/usbhost/include/usb/host/usb_endpoint_manager.h

    r83c3123 r7265558  
    4040#define LIBUSBHOST_HOST_USB_ENDPOINT_MANAGER_H
    4141
    42 #include <stdlib.h>
    43 #include <adt/hash_table.h>
     42#include <adt/list.h>
    4443#include <fibril_synch.h>
    4544#include <usb/usb.h>
     45
    4646#include <usb/host/endpoint.h>
    4747
    4848#define BANDWIDTH_TOTAL_USB11 12000000
    4949#define BANDWIDTH_AVAILABLE_USB11 ((BANDWIDTH_TOTAL_USB11 / 10) * 9)
     50#define ENDPOINT_LIST_COUNT 8
    5051
    5152typedef struct usb_endpoint_manager {
    52         hash_table_t ep_table;
     53        list_t endpoint_lists[ENDPOINT_LIST_COUNT];
    5354        fibril_mutex_t guard;
    5455        size_t free_bw;
Note: See TracChangeset for help on using the changeset viewer.