Changeset 357a302 in mainline for uspace/drv/vhc/connhost.c


Ignore:
Timestamp:
2011-02-20T14:17:40Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b68b279
Parents:
3ae93a8
Message:

USB interfaces reorganization

The most important change is that getting USB address of a device
is an operation of generic USB interface, not USB-HC interface.
That is needed for proper functionality of a MID driver.

Also added sample implementation of USB interface operations as is
needed by most drivers (sample does not mean unfunctional or partially
implemented here).
They are stored in libusb/ddfiface.h

Updated UHCI, UHCI-RH, hub, VHC drivers to use these sample
implementations.

Updated libusb device recognition routines to route get_address requests
through USB interface.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/vhc/connhost.c

    r3ae93a8 r357a302  
    3737#include <usb/usb.h>
    3838#include <usb/addrkeep.h>
     39#include <usb/ddfiface.h>
    3940
    4041#include "vhcd.h"
     
    313314static usb_address_keeping_t addresses;
    314315
     316static int tell_address(device_t *dev, devman_handle_t handle,
     317    usb_address_t *address)
     318{
     319        usb_address_t addr = usb_address_keeping_find(&addresses, handle);
     320        if (addr < 0) {
     321                return addr;
     322        }
     323
     324        *address = addr;
     325        return EOK;
     326}
    315327
    316328static int reserve_default_address(device_t *dev, usb_speed_t ignored)
     
    350362}
    351363
    352 static int tell_address(device_t *dev, devman_handle_t handle,
    353     usb_address_t *address)
    354 {
    355         usb_address_t addr = usb_address_keeping_find(&addresses, handle);
    356         if (addr < 0) {
    357                 return addr;
    358         }
    359 
    360         *address = addr;
    361         return EOK;
    362 }
    363 
    364364void address_init(void)
    365365{
     
    368368
    369369usbhc_iface_t vhc_iface = {
    370         .tell_address = tell_address,
    371 
    372370        .reserve_default_address = reserve_default_address,
    373371        .release_default_address = release_default_address,
     
    383381};
    384382
     383usb_iface_t vhc_usb_iface = {
     384        .get_hc_handle = usb_iface_get_hc_handle_hc_impl,
     385        .get_address = tell_address
     386};
     387
     388
    385389/**
    386390 * @}
Note: See TracChangeset for help on using the changeset viewer.