source: mainline/uspace/lib/usbvirt/include/usbvirt/virthub_base.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.9 KB
Line 
1/*
2 * Copyright (c) 2013 Jan Vesely
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
29/** @addtogroup libusbvirt
30 * @{
31 */
32/** @file
33 * Virtual USB device.
34 */
35
36#ifndef LIBUSBVIRT_VIRTHUB_BASE_H_
37#define LIBUSBVIRT_VIRTHUB_BASE_H_
38
39#include <usbvirt/device.h>
40#include <usb/classes/hub.h>
41
42enum {
43 VIRTHUB_EXTR_DESC = 3,
44};
45
46typedef struct {
47 usb_standard_configuration_descriptor_t config_descriptor;
48 usb_standard_endpoint_descriptor_t endpoint_descriptor;
49 usbvirt_device_configuration_extras_t extra[VIRTHUB_EXTR_DESC];
50 usbvirt_device_configuration_t configuration;
51 usbvirt_descriptors_t descriptors;
52 usbvirt_device_t device;
53 void *data;
54} virthub_base_t;
55
56void *virthub_get_data(usbvirt_device_t *dev);
57
58errno_t virthub_base_init(virthub_base_t *instance,
59 const char *name, usbvirt_device_ops_t *ops, void *data,
60 const usb_standard_device_descriptor_t *device_desc,
61 const usb_hub_descriptor_header_t *hub_desc, usb_endpoint_t ep);
62
63usb_address_t virthub_base_get_address(virthub_base_t *instance);
64
65errno_t virthub_base_request(virthub_base_t *instance, usb_target_t target,
66 usb_direction_t dir, const usb_device_request_setup_packet_t *setup,
67 void *buffer, size_t buffer_size, size_t *real_size);
68
69errno_t virthub_base_get_hub_descriptor(usbvirt_device_t *dev,
70 const usb_device_request_setup_packet_t *request, uint8_t *data,
71 size_t *act_size);
72errno_t virthub_base_get_null_status(usbvirt_device_t *dev,
73 const usb_device_request_setup_packet_t *request, uint8_t *data,
74 size_t *act_size);
75
76#endif
77
78/**
79 * @}
80 */
Note: See TracBrowser for help on using the repository browser.