Changeset 1a93bb0 in mainline for uspace/drv/uhci-hcd/iface.c


Ignore:
Timestamp:
2011-02-25T23:27:26Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c3ae877
Parents:
5f183dc
Message:

Preperly support both low and full speed devices using device_keeper

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/iface.c

    r5f183dc r1a93bb0  
    4141#include "iface.h"
    4242#include "uhci.h"
    43 
    44 #define DEFAULT_SPEED FULL_SPEED
     43#include "utils/device_keeper.h"
    4544
    4645/*----------------------------------------------------------------------------*/
     
    5049        uhci_t *hc = fun_to_uhci(fun);
    5150        assert(hc);
    52         usb_address_keeping_reserve_default(&hc->address_manager);
     51        usb_log_debug("Default address request with speed %d.\n", speed);
     52        device_keeper_reserve_default(&hc->device_manager, speed);
    5353        return EOK;
    5454}
     
    5959        uhci_t *hc = fun_to_uhci(fun);
    6060        assert(hc);
    61         usb_address_keeping_release_default(&hc->address_manager);
     61        usb_log_debug("Default address release.\n");
     62        device_keeper_release_default(&hc->device_manager);
    6263        return EOK;
    6364}
     
    6970        uhci_t *hc = fun_to_uhci(fun);
    7071        assert(hc);
    71         *address = usb_address_keeping_request(&hc->address_manager);
     72        assert(address);
     73
     74        usb_log_debug("Address request with speed %d.\n", speed);
     75        *address = device_keeper_request(&hc->device_manager, speed);
     76        usb_log_debug("Address request with result: %d.\n", *address);
    7277        if (*address <= 0)
    7378          return *address;
     
    8186        uhci_t *hc = fun_to_uhci(fun);
    8287        assert(hc);
    83         usb_address_keeping_devman_bind(&hc->address_manager, address, handle);
     88        usb_log_debug("Address bind %d-%d.\n", address, handle);
     89        device_keeper_bind(&hc->device_manager, address, handle);
    8490        return EOK;
    8591}
     
    9096        uhci_t *hc = fun_to_uhci(fun);
    9197        assert(hc);
    92         usb_address_keeping_release_default(&hc->address_manager);
     98        usb_log_debug("Address release %d.\n", address);
     99        device_keeper_release(&hc->device_manager, address);
    93100        return EOK;
    94101}
    95102/*----------------------------------------------------------------------------*/
    96103static int interrupt_out(ddf_fun_t *fun, usb_target_t target,
    97     size_t max_packet_size,
    98     void *data, size_t size,
     104    size_t max_packet_size, void *data, size_t size,
    99105    usbhc_iface_transfer_out_callback_t callback, void *arg)
    100106{
    101         dev_speed_t speed = DEFAULT_SPEED;
     107        assert(fun);
     108        uhci_t *hc = fun_to_uhci(fun);
     109        assert(hc);
     110        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
    102111
    103112        batch_t *batch = batch_get(fun, target, USB_TRANSFER_INTERRUPT,
     
    114123    usbhc_iface_transfer_in_callback_t callback, void *arg)
    115124{
    116         dev_speed_t speed = DEFAULT_SPEED;
     125        assert(fun);
     126        uhci_t *hc = fun_to_uhci(fun);
     127        assert(hc);
     128        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
    117129
    118130        batch_t *batch = batch_get(fun, target, USB_TRANSFER_INTERRUPT,
     
    129141    usbhc_iface_transfer_out_callback_t callback, void *arg)
    130142{
    131         dev_speed_t speed = DEFAULT_SPEED;
     143        assert(fun);
     144        uhci_t *hc = fun_to_uhci(fun);
     145        assert(hc);
     146        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
    132147
    133148        batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL,
     
    145160    usbhc_iface_transfer_in_callback_t callback, void *arg)
    146161{
    147         dev_speed_t speed = DEFAULT_SPEED;
     162        assert(fun);
     163        uhci_t *hc = fun_to_uhci(fun);
     164        assert(hc);
     165        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
    148166
    149167        batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL,
Note: See TracChangeset for help on using the changeset viewer.