source: mainline/uspace/lib/usbhost/include/usb/host/usb2_bus.h@ 17873ac7

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

usbhost: change parameters of methods

Pass (device_t, usb_target_t) to read and write, which finally allows to drop hash tables and access device right away. Then, all callbacks to complete transfer now uses usb_transfer_batch. This requires libdrv to include libusbhost, but it is not linked against it - it is there only to share definition of usb_transfer_batch_t.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2 * Copyright (c) 2011 Jan Vesely
3 * Copyright (c) 2017 Ondrej Hlavaty <aearsis@eideo.cz>
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 libusbhost
30 * @{
31 */
32/** @file
33 *
34 * Bus implementation common for OHCI, UHCI and EHCI.
35 */
36#ifndef LIBUSBHOST_HOST_USB2_BUS_H
37#define LIBUSBHOST_HOST_USB2_BUS_H
38
39#include <usb/usb.h>
40#include <usb/host/bus.h>
41
42#include <adt/list.h>
43#include <stdbool.h>
44
45typedef struct usb2_bus usb2_bus_t;
46typedef struct endpoint endpoint_t;
47
48typedef size_t (*count_bw_func_t)(endpoint_t *, size_t);
49
50/** Endpoint management structure */
51typedef struct usb2_bus {
52 bus_t base; /**< Inheritance - keep this first */
53
54 /* Device bookkeeping */
55 struct {
56 usb_speed_t speed; /**< Device speed */
57 bool occupied; /**< The address is in use. */
58 // TODO: This can be stored in usb2_bus-specific device_t
59 list_t endpoint_list; /**< Store endpoint_t instances */
60 } devices[USB_ADDRESS_COUNT];
61
62 /** Size of the bandwidth pool */
63 size_t free_bw;
64 /** The last reserved address */
65 usb_address_t last_address;
66} usb2_bus_t;
67
68extern int usb2_bus_init(usb2_bus_t *, size_t, count_bw_func_t);
69
70#endif
71/**
72 * @}
73 */
Note: See TracBrowser for help on using the repository browser.