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

Last change on this file was ae3a941, checked in by Ondřej Hlavatý <aearsis@…>, 7 years ago

usb: cstyle

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*
2 * Copyright (c) 2011 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 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
46typedef struct usb2_bus usb2_bus_t;
47typedef struct endpoint endpoint_t;
48
49/** Endpoint and bandwidth management structure */
50typedef struct usb2_bus_helper {
51 /** Map of occupied addresses */
52 bool address_occupied [USB_ADDRESS_COUNT];
53 /** The last reserved address */
54 usb_address_t last_address;
55
56 /** Size of the bandwidth pool */
57 size_t free_bw;
58
59 /* Configured bandwidth accounting */
60 const bandwidth_accounting_t *bw_accounting;
61} usb2_bus_helper_t;
62
63extern void usb2_bus_helper_init(usb2_bus_helper_t *,
64 const bandwidth_accounting_t *);
65
66extern int usb2_bus_device_enumerate(usb2_bus_helper_t *, device_t *);
67extern void usb2_bus_device_gone(usb2_bus_helper_t *, device_t *);
68
69extern int usb2_bus_endpoint_register(usb2_bus_helper_t *, endpoint_t *);
70extern void usb2_bus_endpoint_unregister(usb2_bus_helper_t *, endpoint_t *);
71
72#endif
73/**
74 * @}
75 */
Note: See TracBrowser for help on using the repository browser.