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


Ignore:
Timestamp:
2011-08-31T16:41:11Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ff6dd73
Parents:
96e2d01
Message:

uhci: use uhci sepcific structure instead of generic library

revert the way uhci_transfer_batch_t and usb_transfer_batch_t are included,
don't use usb_transfer_batch_t:

-private data and data dtor
-next_step pointer
-buffer_data pointer

File:
1 edited

Legend:

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

    r96e2d01 rb991d37  
    3636
    3737#include <usb/host/batch.h>
     38#include <adt/list.h>
    3839
    3940#include "hw_struct/queue_head.h"
     41#include "hw_struct/transfer_descriptor.h"
    4042
    41 int batch_init_uhci(usb_transfer_batch_t *batch);
    42 bool batch_is_complete(usb_transfer_batch_t *batch);
    43 qh_t * batch_qh(usb_transfer_batch_t *batch);
     43/** UHCI specific data required for USB transfer */
     44typedef struct uhci_transfer_batch {
     45        /** Queue head
     46         * This QH is used to maintain UHCI schedule structure and the element
     47         * pointer points to the first TD of this batch.
     48         */
     49        qh_t *qh;
     50        /** List of TDs needed for the transfer */
     51        td_t *tds;
     52        /** Number of TDs used by the transfer */
     53        size_t td_count;
     54        /** Data buffer, must be accessible by the UHCI hw */
     55        void *device_buffer;
     56        /** Generic transfer data */
     57        usb_transfer_batch_t *usb_batch;
     58        /** List element */
     59        link_t link;
     60} uhci_transfer_batch_t;
     61
     62uhci_transfer_batch_t * uhci_transfer_batch_get(usb_transfer_batch_t *batch);
     63void uhci_transfer_batch_call_dispose(uhci_transfer_batch_t *uhci_batch);
     64bool uhci_transfer_batch_is_complete(uhci_transfer_batch_t *uhci_batch);
     65
     66static inline void * uhci_transfer_batch_data_buffer(
     67    uhci_transfer_batch_t *uhci_batch)
     68{
     69        assert(uhci_batch);
     70        assert(uhci_batch->usb_batch);
     71        assert(uhci_batch->device_buffer);
     72        return uhci_batch->device_buffer + sizeof(qh_t) +
     73            uhci_batch->td_count * sizeof(td_t) +
     74            uhci_batch->usb_batch->setup_size;
     75}
     76/*----------------------------------------------------------------------------*/
     77static inline void * uhci_transfer_batch_setup_buffer(
     78    uhci_transfer_batch_t *uhci_batch)
     79{
     80        assert(uhci_batch);
     81        assert(uhci_batch->usb_batch);
     82        assert(uhci_batch->device_buffer);
     83        return uhci_batch->device_buffer + sizeof(qh_t) +
     84            uhci_batch->td_count * sizeof(td_t);
     85}
     86/*----------------------------------------------------------------------------*/
     87static inline uhci_transfer_batch_t *uhci_transfer_batch_from_link(link_t *l)
     88{
     89        assert(l);
     90        return list_get_instance(l, uhci_transfer_batch_t, link);
     91}
     92
    4493#endif
    4594/**
Note: See TracChangeset for help on using the changeset viewer.