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

Last change on this file was 09ab0a9a, checked in by Jiri Svoboda <jiri@…>, 7 years ago

Fix vertical spacing with new Ccheck revision.

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*
2 * Copyright (c) 2018 Ondrej Hlavaty
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28/** @addtogroup drvusbehci
29 * @{
30 */
31/** @file
32 * @brief USB host controller library: Utility functions.
33 *
34 * A mix of various functions that makes life of USB HC driver developers
35 * easier.
36 */
37#ifndef LIB_USBHOST_UTILITY
38#define LIB_USBHOST_UTILITY
39
40#include <usb/host/bus.h>
41#include <usb/host/usb_transfer_batch.h>
42#include <usb/descriptor.h>
43#include <usb/classes/hub.h>
44#include <usb/request.h>
45
46typedef void (*endpoint_reset_toggle_t)(endpoint_t *);
47
48uint16_t hc_get_ep0_initial_mps(usb_speed_t);
49int hc_get_ep0_max_packet_size(uint16_t *, device_t *);
50void hc_reset_toggles(const usb_transfer_batch_t *batch, endpoint_reset_toggle_t);
51int hc_setup_virtual_root_hub(hc_device_t *, usb_speed_t);
52int hc_get_device_desc(device_t *, usb_standard_device_descriptor_t *);
53int hc_get_hub_desc(device_t *, usb_hub_descriptor_header_t *);
54int hc_device_explore(device_t *);
55
56/** Joinable fibril */
57
58typedef int (*fibril_worker_t)(void *);
59typedef struct joinable_fibril joinable_fibril_t;
60
61joinable_fibril_t *joinable_fibril_create(fibril_worker_t, void *);
62void joinable_fibril_start(joinable_fibril_t *);
63void joinable_fibril_join(joinable_fibril_t *);
64void joinable_fibril_destroy(joinable_fibril_t *);
65errno_t joinable_fibril_recreate(joinable_fibril_t *);
66
67#endif
68/**
69 * @}
70 */
Note: See TracBrowser for help on using the repository browser.