Ignore:
Timestamp:
2018-02-05T02:04:58Z (7 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fc3dfe6d
Parents:
af16ebe
Message:

libdrv usbhc iface: wrap transfer arguments into structure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/src/ddf_helpers.c

    raf16ebe r239eea41  
    271271 * @return Error code.
    272272 */
    273 static errno_t transfer(ddf_fun_t *fun, usb_target_t target,
    274     usb_direction_t dir, uint64_t setup_data, char *data, size_t size,
     273static errno_t transfer(ddf_fun_t *fun, const usbhc_iface_transfer_request_t *req,
    275274    usbhc_iface_transfer_callback_t callback, void *arg)
    276275{
     
    279278        assert(dev);
    280279
    281         target.address = dev->address;
     280        const usb_target_t target = {{
     281                .address = dev->address,
     282                .endpoint = req->endpoint,
     283                .stream = req->stream,
     284        }};
    282285
    283286        if (!usb_target_is_valid(&target))
    284287                return EINVAL;
    285288
    286         if (size > 0 && data == NULL)
     289        if (req->size > 0 && req->base == NULL)
    287290                return EBADMEM;
    288291
     
    290293                return EBADMEM;
    291294
    292         const char *name = (dir == USB_DIRECTION_IN) ? "READ" : "WRITE";
    293 
    294         return bus_device_send_batch(dev, target, dir,
    295             (char *) data, size, setup_data,
     295        const char *name = (req->dir == USB_DIRECTION_IN) ? "READ" : "WRITE";
     296
     297        char *buffer = req->base + req->offset;
     298
     299        return bus_device_send_batch(dev, target, req->dir,
     300            buffer, req->size, req->setup,
    296301            callback, arg, name);
    297302}
Note: See TracChangeset for help on using the changeset viewer.