source: mainline/uspace/lib/usbvirt/src/virthub_descriptors.c

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: 3.5 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 main routines.
34 */
35
36#include <usb/classes/classes.h>
37#include <usb/classes/hub.h>
38#include <usb/descriptor.h>
39#include <usb/usb.h>
40#include <usbvirt/device.h>
41
42#include "virthub_base.h"
43
44#define HUB_CONFIGURATION_ID 1
45
46/** Standard device descriptor. */
47const usb_standard_device_descriptor_t virthub_device_descriptor = {
48 .length = sizeof(usb_standard_device_descriptor_t),
49 .descriptor_type = USB_DESCTYPE_DEVICE,
50 .usb_spec_version = 0x110,
51 .device_class = USB_CLASS_HUB,
52 .device_subclass = 0,
53 .device_protocol = 0,
54 .max_packet_size = 64,
55 .configuration_count = 1
56};
57
58/** Standard interface descriptor. */
59const usb_standard_interface_descriptor_t virthub_interface_descriptor = {
60 .length = sizeof(usb_standard_interface_descriptor_t),
61 .descriptor_type = USB_DESCTYPE_INTERFACE,
62 .interface_number = 0,
63 .alternate_setting = 0,
64 .endpoint_count = 1,
65 .interface_class = USB_CLASS_HUB,
66 .interface_subclass = 0,
67 .interface_protocol = 0,
68 .str_interface = 0
69};
70
71/** Endpoint descriptor. */
72const usb_standard_endpoint_descriptor_t virthub_endpoint_descriptor = {
73 .length = sizeof(usb_standard_endpoint_descriptor_t),
74 .descriptor_type = USB_DESCTYPE_ENDPOINT,
75 .endpoint_address = 1 | 128,
76 .attributes = USB_TRANSFER_INTERRUPT,
77 .max_packet_size = 8,
78 .poll_interval = 0xFF,
79};
80
81/** Standard configuration descriptor. */
82const usb_standard_configuration_descriptor_t virthub_configuration_descriptor_without_hub_size = {
83 .length = sizeof(virthub_configuration_descriptor_without_hub_size),
84 .descriptor_type = USB_DESCTYPE_CONFIGURATION,
85 .total_length =
86 sizeof(virthub_configuration_descriptor_without_hub_size) +
87 sizeof(virthub_interface_descriptor) +
88 sizeof(virthub_endpoint_descriptor),
89 .interface_count = 1,
90 .configuration_number = HUB_CONFIGURATION_ID,
91 .str_configuration = 0,
92 .attributes = 0, /* We are self-powered device */
93 .max_power = 0,
94};
95
96const usbvirt_device_configuration_extras_t virthub_interface_descriptor_ex = {
97 .data = (uint8_t *) &virthub_interface_descriptor,
98 .length = sizeof(virthub_interface_descriptor),
99};
100
101/**
102 * @}
103 */
Note: See TracBrowser for help on using the repository browser.