[944f8fdd] | 1 | /*
|
---|
[e0a5d4c] | 2 | * Copyright (c) 2018 Ondrej Hlavaty
|
---|
[944f8fdd] | 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>
|
---|
[2833bb4] | 43 | #include <usb/classes/hub.h>
|
---|
[944f8fdd] | 44 | #include <usb/request.h>
|
---|
| 45 |
|
---|
[c6f82e5] | 46 | typedef void (*endpoint_reset_toggle_t)(endpoint_t *);
|
---|
| 47 |
|
---|
[6271a34] | 48 | uint16_t hc_get_ep0_initial_mps(usb_speed_t);
|
---|
[fa4b12d5] | 49 | int hc_get_ep0_max_packet_size(uint16_t *, device_t *);
|
---|
[c6f82e5] | 50 | void hc_reset_toggles(const usb_transfer_batch_t *batch, endpoint_reset_toggle_t);
|
---|
[129b821f] | 51 | int hc_setup_virtual_root_hub(hc_device_t *, usb_speed_t);
|
---|
[944f8fdd] | 52 | int hc_get_device_desc(device_t *, usb_standard_device_descriptor_t *);
|
---|
[2833bb4] | 53 | int hc_get_hub_desc(device_t *, usb_hub_descriptor_header_t *);
|
---|
[944f8fdd] | 54 | int hc_device_explore(device_t *);
|
---|
| 55 |
|
---|
[73a5857] | 56 | /** Joinable fibril */
|
---|
| 57 |
|
---|
| 58 | typedef int (*fibril_worker_t)(void *);
|
---|
| 59 | typedef struct joinable_fibril joinable_fibril_t;
|
---|
| 60 |
|
---|
| 61 | joinable_fibril_t *joinable_fibril_create(fibril_worker_t, void *);
|
---|
| 62 | void joinable_fibril_start(joinable_fibril_t *);
|
---|
| 63 | void joinable_fibril_join(joinable_fibril_t *);
|
---|
| 64 | void joinable_fibril_destroy(joinable_fibril_t *);
|
---|
[19f0048] | 65 | errno_t joinable_fibril_recreate(joinable_fibril_t *);
|
---|
[73a5857] | 66 |
|
---|
[944f8fdd] | 67 | #endif
|
---|
| 68 | /**
|
---|
| 69 | * @}
|
---|
| 70 | */
|
---|