Changeset 5fd9c30 in mainline for uspace/drv/bus/usb/uhci/uhci_batch.h


Ignore:
Timestamp:
2017-10-21T20:52:56Z (8 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
766043c
Parents:
74b852b
Message:

usbhost refactoring: let transfer_batch be initialized by bus

Currently makes older HCs fail, work in progress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/uhci/uhci_batch.h

    r74b852b r5fd9c30  
    4343#include <stddef.h>
    4444#include <usb/host/usb_transfer_batch.h>
     45#include <usb/host/endpoint.h>
    4546
    4647#include "hw_struct/queue_head.h"
     
    4950/** UHCI specific data required for USB transfer */
    5051typedef struct uhci_transfer_batch {
     52        usb_transfer_batch_t base;
     53
    5154        /** Queue head
    5255         * This QH is used to maintain UHCI schedule structure and the element
     
    6669} uhci_transfer_batch_t;
    6770
    68 uhci_transfer_batch_t * uhci_transfer_batch_get(usb_transfer_batch_t *batch);
    69 void uhci_transfer_batch_finish_dispose(uhci_transfer_batch_t *uhci_batch);
    70 bool uhci_transfer_batch_is_complete(const uhci_transfer_batch_t *uhci_batch);
     71uhci_transfer_batch_t * uhci_transfer_batch_create(endpoint_t *ep);
     72int uhci_transfer_batch_prepare(uhci_transfer_batch_t *uhci_batch);
     73bool uhci_transfer_batch_check_completed(uhci_transfer_batch_t *uhci_batch);
     74void uhci_transfer_batch_destroy(uhci_transfer_batch_t *uhci_batch);
    7175
    7276/** Get offset to setup buffer accessible to the HC hw.
     
    9397        assert(uhci_batch->usb_batch);
    9498        return uhci_transfer_batch_setup_buffer(uhci_batch) +
    95             uhci_batch->usb_batch->setup_size;
     99            (uhci_batch->base.ep->transfer_type == USB_TRANSFER_CONTROL ? USB_SETUP_PACKET_SIZE : 0);
    96100}
    97101
     
    107111        uhci_batch->usb_batch->error = EINTR;
    108112        uhci_batch->usb_batch->transfered_size = 0;
    109         uhci_transfer_batch_finish_dispose(uhci_batch);
     113        usb_transfer_batch_finish(&uhci_batch->base);
    110114}
    111115
     
    120124}
    121125
     126static inline uhci_transfer_batch_t *uhci_transfer_batch_get(usb_transfer_batch_t *b)
     127{
     128        assert(b);
     129        return (uhci_transfer_batch_t *) b;
     130}
     131
    122132#endif
    123133
Note: See TracChangeset for help on using the changeset viewer.