source: mainline/uspace/drv/bus/usb/ehci/ehci_batch.h@ 3be9d10

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 3be9d10 was ae3a941, checked in by Ondřej Hlavatý <aearsis@…>, 7 years ago

usb: cstyle

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*
2 * Copyright (c) 2014 Jan Vesely
3 * Copyright (c) 2018 Ondrej Hlavaty
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * - Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * - The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29/** @addtogroup drvusbehci
30 * @{
31 */
32/** @file
33 * @brief EHCI driver USB transaction structure
34 */
35#ifndef DRV_EHCI_BATCH_H
36#define DRV_EHCI_BATCH_H
37
38#include <adt/list.h>
39#include <assert.h>
40#include <stdbool.h>
41#include <usb/host/usb_transfer_batch.h>
42#include <usb/dma_buffer.h>
43
44#include "hw_struct/queue_head.h"
45#include "hw_struct/transfer_descriptor.h"
46
47/** EHCI specific data required for USB transfer */
48typedef struct ehci_transfer_batch {
49 usb_transfer_batch_t base;
50 /** Number of TDs used by the transfer */
51 size_t td_count;
52 /** Endpoint descriptor of the target endpoint. */
53 qh_t *qh;
54 /** Backend for TDs and setup data. */
55 dma_buffer_t ehci_dma_buffer;
56 /** List of TDs needed for the transfer - backed by dma_buffer */
57 td_t *tds;
58 /** Data buffers - backed by dma_buffer */
59 void *setup_buffer;
60 void *data_buffer;
61 /** Generic USB transfer structure */
62 usb_transfer_batch_t *usb_batch;
63} ehci_transfer_batch_t;
64
65ehci_transfer_batch_t *ehci_transfer_batch_create(endpoint_t *ep);
66int ehci_transfer_batch_prepare(ehci_transfer_batch_t *batch);
67void ehci_transfer_batch_commit(const ehci_transfer_batch_t *batch);
68bool ehci_transfer_batch_check_completed(ehci_transfer_batch_t *batch);
69void ehci_transfer_batch_destroy(ehci_transfer_batch_t *batch);
70
71static inline ehci_transfer_batch_t *ehci_transfer_batch_get(
72 usb_transfer_batch_t *usb_batch)
73{
74 assert(usb_batch);
75
76 return (ehci_transfer_batch_t *) usb_batch;
77}
78
79#endif
80/**
81 * @}
82 */
83
Note: See TracBrowser for help on using the repository browser.