source: mainline/uspace/lib/usbvirt/include/usbvirt/virthub_base.h@ 49f2f29

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 49f2f29 was 49f2f29, checked in by Jan Vesely <jano.vesely@…>, 12 years ago

libusbvirt: Drop port_count param.

Use library provided macro to compute additional space.

  • Property mode set to 100644
File size: 2.9 KB
RevLine 
[32c2c8f]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;
[2a5a7711]48 usb_standard_endpoint_descriptor_t endpoint_descriptor;
[32c2c8f]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
58int 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,
[49f2f29]61 const usb_hub_descriptor_header_t *hub_desc, usb_endpoint_t ep);
[32c2c8f]62
63usb_address_t virthub_base_get_address(virthub_base_t *instance);
64
65int 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
69int 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);
72int 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
77#endif
78
79/**
80 * @}
81 */
Note: See TracBrowser for help on using the repository browser.