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 <adt/list.h>
|
---|
40 | #include <stdbool.h>
|
---|
41 | #include <usb/usb.h>
|
---|
42 |
|
---|
43 | #include <usb/host/bus.h>
|
---|
44 | #include <usb/host/bandwidth.h>
|
---|
45 |
|
---|
46 | typedef struct usb2_bus usb2_bus_t;
|
---|
47 | typedef struct endpoint endpoint_t;
|
---|
48 |
|
---|
49 | /** Endpoint management structure */
|
---|
50 | typedef struct usb2_bus {
|
---|
51 | bus_t base; /**< Inheritance - keep this first */
|
---|
52 |
|
---|
53 | /** Map of occupied addresses */
|
---|
54 | bool address_occupied [USB_ADDRESS_COUNT];
|
---|
55 | /** The last reserved address */
|
---|
56 | usb_address_t last_address;
|
---|
57 |
|
---|
58 | /** Size of the bandwidth pool */
|
---|
59 | size_t free_bw;
|
---|
60 |
|
---|
61 | /* Configured bandwidth accounting */
|
---|
62 | const bandwidth_accounting_t *bw_accounting;
|
---|
63 | } usb2_bus_t;
|
---|
64 |
|
---|
65 | extern const bus_ops_t usb2_bus_ops;
|
---|
66 |
|
---|
67 | extern void usb2_bus_init(usb2_bus_t *, const bandwidth_accounting_t *);
|
---|
68 |
|
---|
69 | #endif
|
---|
70 | /**
|
---|
71 | * @}
|
---|
72 | */
|
---|