Changeset 9162b27 in mainline


Ignore:
Timestamp:
2017-11-20T22:15:11Z (6 years ago)
Author:
Aearsis <Hlavaty.Ondrej@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
375211d2
Parents:
27b0ea0
git-author:
Aearsis <Hlavaty.Ondrej@…> (2017-11-20 22:12:13)
git-committer:
Aearsis <Hlavaty.Ondrej@…> (2017-11-20 22:15:11)
Message:

ohci: fixed bugs introduced by refactoring

Location:
uspace/drv/bus/usb/ohci
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/ohci_batch.c

    r27b0ea0 r9162b27  
    5858        if (ohci_batch->tds) {
    5959                const ohci_endpoint_t *ohci_ep =
    60                     ohci_endpoint_get(ohci_batch->usb_batch->ep);
     60                    ohci_endpoint_get(ohci_batch->base.ep);
    6161                assert(ohci_ep);
    6262                for (unsigned i = 0; i < ohci_batch->td_count; ++i) {
     
    7272/** Allocate memory and initialize internal data structure.
    7373 *
    74  * @param[in] usb_batch Pointer to generic USB batch structure.
     74 * @param[in] ep Endpoint for which the batch will be created
    7575 * @return Valid pointer if all structures were successfully created,
    7676 * NULL otherwise.
     
    176176
    177177        usb_log_debug("Batch %p checking %zu td(s) for completion.\n",
    178             ohci_batch->usb_batch, ohci_batch->td_count);
     178            &ohci_batch->base, ohci_batch->td_count);
    179179        usb_log_debug2("ED: %08x:%08x:%08x:%08x.\n",
    180180            ohci_batch->ed->status, ohci_batch->ed->td_head,
     
    218218                } else {
    219219                        usb_log_debug("Batch %p found error TD(%zu):%08x.\n",
    220                             ohci_batch->usb_batch, i,
     220                            &ohci_batch->base, i,
    221221                            ohci_batch->tds[i]->status);
    222222
     
    248248            ohci_batch->base.buffer_size);
    249249
     250        const size_t setup_size = (ohci_batch->base.ep->transfer_type == USB_TRANSFER_CONTROL)
     251                ? USB_SETUP_PACKET_SIZE
     252                : 0;
     253
    250254        if (ohci_batch->base.dir == USB_DIRECTION_IN)
    251                 memcpy(ohci_batch->base.buffer, ohci_batch->device_buffer, ohci_batch->base.transfered_size);
     255                memcpy(ohci_batch->base.buffer,
     256                    ohci_batch->device_buffer + setup_size,
     257                    ohci_batch->base.transfered_size);
    252258
    253259        /* Store the remaining TD */
     
    313319        /* Data stage */
    314320        size_t td_current = 1;
    315         size_t remain_size = ohci_batch->usb_batch->buffer_size;
     321        size_t remain_size = ohci_batch->base.buffer_size;
    316322        while (remain_size > 0) {
    317323                const size_t transfer_size =
     
    345351        usb_log_debug2(
    346352            "Batch %p %s %s " USB_TRANSFER_BATCH_FMT " initialized.\n", \
    347             ohci_batch->usb_batch,
    348             usb_str_transfer_type(ohci_batch->usb_batch->ep->transfer_type),
     353            &ohci_batch->base,
     354            usb_str_transfer_type(ohci_batch->base.ep->transfer_type),
    349355            usb_str_direction(dir),
    350             USB_TRANSFER_BATCH_ARGS(*ohci_batch->usb_batch));
     356            USB_TRANSFER_BATCH_ARGS(ohci_batch->base));
    351357}
    352358
     
    370376
    371377        size_t td_current = 0;
    372         size_t remain_size = ohci_batch->usb_batch->buffer_size;
     378        size_t remain_size = ohci_batch->base.buffer_size;
    373379        char *buffer = ohci_batch->device_buffer;
    374380        while (remain_size > 0) {
     
    393399        usb_log_debug2(
    394400            "Batch %p %s %s " USB_TRANSFER_BATCH_FMT " initialized.\n", \
    395             ohci_batch->usb_batch,
    396             usb_str_transfer_type(ohci_batch->usb_batch->ep->transfer_type),
     401            &ohci_batch->base,
     402            usb_str_transfer_type(ohci_batch->base.ep->transfer_type),
    397403            usb_str_direction(dir),
    398             USB_TRANSFER_BATCH_ARGS(*ohci_batch->usb_batch));
     404            USB_TRANSFER_BATCH_ARGS(ohci_batch->base));
    399405}
    400406
  • uspace/drv/bus/usb/ohci/ohci_batch.h

    r27b0ea0 r9162b27  
    5757        /** Data buffer, must be accessible by the OHCI hw. */
    5858        char *device_buffer;
    59         /** Generic USB transfer structure */
    60         usb_transfer_batch_t *usb_batch;
    6159} ohci_transfer_batch_t;
    6260
Note: See TracChangeset for help on using the changeset viewer.