Changeset f18d82f0 in mainline for uspace/lib/usbhost/src/batch.c


Ignore:
Timestamp:
2011-08-31T21:45:59Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9c10e51
Parents:
70fb822
Message:

libusbhost: change finish functions to do the data copying if necessary

uhci: use new finish functions instead of manual copy

File:
1 edited

Legend:

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

    r70fb822 rf18d82f0  
    8484 *
    8585 */
    86 void usb_transfer_batch_finish(usb_transfer_batch_t *instance)
     86void usb_transfer_batch_finish(
     87    usb_transfer_batch_t *instance, const void *data, size_t size)
    8788{
    8889        assert(instance);
    89         if (instance->next_step)
    90                 instance->next_step(instance);
     90        assert(instance->ep);
     91        /* we care about the data and there are some to copy */
     92        if (instance->ep->direction != USB_DIRECTION_OUT
     93            && data) {
     94                const size_t min_size =
     95                    size < instance->buffer_size ? size : instance->buffer_size;
     96                memcpy(instance->buffer, data, min_size);
     97        }
     98        if (instance->callback_out)
     99                usb_transfer_batch_call_out(instance);
     100        if (instance->callback_in)
     101                usb_transfer_batch_call_in(instance);
     102
    91103}
    92104/*----------------------------------------------------------------------------*/
Note: See TracChangeset for help on using the changeset viewer.