Changeset dcaf819 in mainline for uspace/lib/usb/include


Ignore:
Timestamp:
2011-04-06T22:33:08Z (15 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9a7e5b4
Parents:
6bf9bc4 (diff), 87305bb (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:

OHCI structures, bandwidth reworked

Initial support for endpoint registration and a new way of bandwidth reservation
New usb_endpoint_manager to manage endpoints, bandwidth, and toggle states.
Further work:

switch communication collision avoidance to the new endpoint manager (requires registration of all endpoints)

use endpoint registration in default address reservation

Location:
uspace/lib/usb/include/usb/host
Files:
1 added
2 edited
1 moved

Legend:

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

    r6bf9bc4 rdcaf819  
    3939#include <usbhc_iface.h>
    4040#include <usb/usb.h>
     41#include <usb/host/endpoint.h>
    4142
    4243typedef struct usb_transfer_batch usb_transfer_batch_t;
     
    6061        ddf_fun_t *fun;
    6162        void *arg;
     63        endpoint_t *ep;
    6264        void *private_data;
    6365};
     
    7880    void *arg,
    7981    ddf_fun_t *fun,
     82                endpoint_t *ep,
    8083    void *private_data
    8184);
  • uspace/lib/usb/include/usb/host/device_keeper.h

    r6bf9bc4 rdcaf819  
    4040#ifndef LIBUSB_HOST_DEVICE_KEEPER_H
    4141#define LIBUSB_HOST_DEVICE_KEEPER_H
     42
     43#include <adt/list.h>
    4244#include <devman.h>
    4345#include <fibril_synch.h>
    4446#include <usb/usb.h>
     47#include <usb/host/endpoint.h>
    4548
    4649/** Number of USB address for array dimensions. */
     
    5154        usb_speed_t speed;
    5255        bool occupied;
     56        link_t endpoints;
    5357        uint16_t control_used;
    54         uint16_t toggle_status[2];
    5558        devman_handle_t handle;
    5659};
     
    6871void usb_device_keeper_init(usb_device_keeper_t *instance);
    6972
    70 void usb_device_keeper_reserve_default_address(usb_device_keeper_t *instance,
    71     usb_speed_t speed);
     73void usb_device_keeper_add_ep(
     74    usb_device_keeper_t *instance, usb_address_t address, endpoint_t *ep);
     75
     76void usb_device_keeper_reserve_default_address(
     77    usb_device_keeper_t *instance, usb_speed_t speed);
    7278
    7379void usb_device_keeper_release_default_address(usb_device_keeper_t *instance);
    7480
    7581void usb_device_keeper_reset_if_need(usb_device_keeper_t *instance,
    76     usb_target_t target,
    77     const uint8_t *setup_data);
    78 
    79 int usb_device_keeper_get_toggle(usb_device_keeper_t *instance,
    80     usb_target_t target, usb_direction_t direction);
    81 
    82 int usb_device_keeper_set_toggle(usb_device_keeper_t *instance,
    83     usb_target_t target, usb_direction_t direction, bool toggle);
     82    usb_target_t target, const uint8_t *setup_data);
    8483
    8584usb_address_t device_keeper_get_free_address(usb_device_keeper_t *instance,
  • uspace/lib/usb/include/usb/host/usb_endpoint_manager.h

    r6bf9bc4 rdcaf819  
    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    usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction,
     67    endpoint_t *ep, size_t data_size);
    6868
    69 int bandwidth_release(bandwidth_t *instance, usb_address_t address,
    70     usb_endpoint_t endpoint, usb_direction_t direction);
     69int usb_endpoint_manager_register_ep_wait(usb_endpoint_manager_t *instance,
     70    usb_address_t address, usb_endpoint_t ep, usb_direction_t direction,
     71    void *data, void (*data_remove_callback)(void* data, void* arg), void *arg,
     72    size_t bw);
    7173
    72 int bandwidth_use(bandwidth_t *instance, usb_address_t address,
    73     usb_endpoint_t endpoint, usb_direction_t direction, size_t bw);
     74int usb_endpoint_manager_unregister_ep(usb_endpoint_manager_t *instance,
     75    usb_address_t address, usb_endpoint_t ep, usb_direction_t direction);
    7476
    75 int bandwidth_free(bandwidth_t *instance, usb_address_t address,
    76     usb_endpoint_t endpoint, usb_direction_t direction);
     77endpoint_t * usb_endpoint_manager_get_ep(usb_endpoint_manager_t *instance,
     78    usb_address_t address, usb_endpoint_t ep, usb_direction_t direction,
     79    size_t *bw);
    7780
    7881#endif
     
    8083 * @}
    8184 */
     85
Note: See TracChangeset for help on using the changeset viewer.