Changeset 80fdffe in mainline for uspace/drv/uhci-hcd/iface.c


Ignore:
Timestamp:
2011-03-04T23:32:21Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
474d08e
Parents:
03f7952 (diff), 0e06a14 (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:

Support for bulk transfers, minor refactoring

File:
1 edited

Legend:

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

    r03f7952 r80fdffe  
    140140}
    141141/*----------------------------------------------------------------------------*/
     142static int bulk_out(ddf_fun_t *fun, usb_target_t target,
     143    size_t max_packet_size, void *data, size_t size,
     144    usbhc_iface_transfer_out_callback_t callback, void *arg)
     145{
     146        assert(fun);
     147        uhci_t *hc = fun_to_uhci(fun);
     148        assert(hc);
     149        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
     150
     151        usb_log_debug("Bulk OUT %d:%d %zu(%zu).\n",
     152            target.address, target.endpoint, size, max_packet_size);
     153
     154        batch_t *batch = batch_get(fun, target, USB_TRANSFER_BULK,
     155            max_packet_size, speed, data, size, NULL, 0, NULL, callback, arg);
     156        if (!batch)
     157                return ENOMEM;
     158        batch_bulk_out(batch);
     159        return EOK;
     160}
     161/*----------------------------------------------------------------------------*/
     162static int bulk_in(ddf_fun_t *fun, usb_target_t target,
     163    size_t max_packet_size, void *data, size_t size,
     164    usbhc_iface_transfer_in_callback_t callback, void *arg)
     165{
     166        assert(fun);
     167        uhci_t *hc = fun_to_uhci(fun);
     168        assert(hc);
     169        usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address);
     170        usb_log_debug("Bulk IN %d:%d %zu(%zu).\n",
     171            target.address, target.endpoint, size, max_packet_size);
     172
     173        batch_t *batch = batch_get(fun, target, USB_TRANSFER_BULK,
     174            max_packet_size, speed, data, size, NULL, 0, callback, NULL, arg);
     175        if (!batch)
     176                return ENOMEM;
     177        batch_bulk_in(batch);
     178        return EOK;
     179}
     180/*----------------------------------------------------------------------------*/
    142181static int control_write(ddf_fun_t *fun, usb_target_t target,
    143182    size_t max_packet_size,
     
    181220        return EOK;
    182221}
    183 
    184 
    185222/*----------------------------------------------------------------------------*/
    186223usbhc_iface_t uhci_iface = {
     
    194231        .interrupt_in = interrupt_in,
    195232
     233        .bulk_in = bulk_in,
     234        .bulk_out = bulk_out,
     235
    196236        .control_read = control_read,
    197237        .control_write = control_write,
Note: See TracChangeset for help on using the changeset viewer.