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


Ignore:
Timestamp:
2018-02-28T16:37:50Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1b20da0
Parents:
f5e5f73 (diff), b2dca8de (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jakub Jermar <jakub@…> (2018-02-28 16:06:42)
git-committer:
Jakub Jermar <jakub@…> (2018-02-28 16:37:50)
Message:

Merge github.com:helenos-xhci-team/helenos

This commit merges support for USB 3 and generally refactors, fixes,
extends and cleans up the existing USB framework.

Notable additions and features:

  • new host controller driver has been implemented to control various xHC models (among others, NEC Renesas uPD720200)
  • isochronous data transfer mode
  • support for explicit USB device removal
  • USB tablet driver
File:
1 edited

Legend:

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

    rf5e5f73 rdf6ded8  
    11/*
    22 * Copyright (c) 2011 Jan Vesely
     3 * Copyright (c) 2018 Ondrej Hlavaty
    34 * All rights reserved.
    45 *
     
    4344#include <stddef.h>
    4445#include <usb/host/usb_transfer_batch.h>
     46#include <usb/host/endpoint.h>
    4547
    4648#include "hw_struct/queue_head.h"
     
    4951/** UHCI specific data required for USB transfer */
    5052typedef struct uhci_transfer_batch {
     53        usb_transfer_batch_t base;
     54
    5155        /** Queue head
    5256         * This QH is used to maintain UHCI schedule structure and the element
     
    5862        /** Number of TDs used by the transfer */
    5963        size_t td_count;
    60         /** Data buffer, must be accessible by the UHCI hw */
    61         void *device_buffer;
    62         /** Generic transfer data */
    63         usb_transfer_batch_t *usb_batch;
     64        /* Setup data */
     65        char *setup_buffer;
     66        /** Backing TDs + setup_buffer */
     67        dma_buffer_t uhci_dma_buffer;
    6468        /** List element */
    6569        link_t link;
    6670} uhci_transfer_batch_t;
    6771
    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);
     72uhci_transfer_batch_t *uhci_transfer_batch_create(endpoint_t *);
     73int uhci_transfer_batch_prepare(uhci_transfer_batch_t *);
     74bool uhci_transfer_batch_check_completed(uhci_transfer_batch_t *);
     75void uhci_transfer_batch_destroy(uhci_transfer_batch_t *);
    7176
    7277/** Get offset to setup buffer accessible to the HC hw.
     
    7479 * @return Pointer to the setup buffer.
    7580 */
    76 static inline void * uhci_transfer_batch_setup_buffer(
     81static inline void *uhci_transfer_batch_setup_buffer(
    7782    const uhci_transfer_batch_t *uhci_batch)
    7883{
    7984        assert(uhci_batch);
    80         assert(uhci_batch->device_buffer);
    81         return uhci_batch->device_buffer + sizeof(qh_t) +
     85        return uhci_batch->uhci_dma_buffer.virt + sizeof(qh_t) +
    8286            uhci_batch->td_count * sizeof(td_t);
    8387}
     
    8791 * @return Pointer to the data buffer.
    8892 */
    89 static inline void * uhci_transfer_batch_data_buffer(
     93static inline void *uhci_transfer_batch_data_buffer(
    9094    const uhci_transfer_batch_t *uhci_batch)
    9195{
    9296        assert(uhci_batch);
    93         assert(uhci_batch->usb_batch);
    94         return uhci_transfer_batch_setup_buffer(uhci_batch) +
    95             uhci_batch->usb_batch->setup_size;
    96 }
    97 
    98 /** Aborts the batch.
    99  * Sets error to EINTR and size off transferd data to 0, before finishing the
    100  * batch.
    101  * @param uhci_batch Batch to abort.
    102  */
    103 static inline void uhci_transfer_batch_abort(uhci_transfer_batch_t *uhci_batch)
    104 {
    105         assert(uhci_batch);
    106         assert(uhci_batch->usb_batch);
    107         uhci_batch->usb_batch->error = EINTR;
    108         uhci_batch->usb_batch->transfered_size = 0;
    109         uhci_transfer_batch_finish_dispose(uhci_batch);
     97        return uhci_batch->base.dma_buffer.virt;
    11098}
    11199
     
    120108}
    121109
     110static inline uhci_transfer_batch_t *uhci_transfer_batch_get(
     111    usb_transfer_batch_t *b)
     112{
     113        assert(b);
     114        return (uhci_transfer_batch_t *) b;
     115}
     116
    122117#endif
    123118
Note: See TracChangeset for help on using the changeset viewer.