source: mainline/uspace/drv/vhc/hub/virthub.h@ 6967c14

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 6967c14 was 70e5ad5, checked in by Vojtech Horky <vojtechhorky@…>, 15 years ago

More doxygen comments

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*
2 * Copyright (c) 2010 Vojtech Horky
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 usb
30 * @{
31 */
32/** @file
33 * @brief USB hub as a virtual USB device.
34 */
35#ifndef VHC_HUB_VIRTHUB_H_
36#define VHC_HUB_VIRTHUB_H_
37
38#include <usbvirt/device.h>
39#include "../devices.h"
40#include "hub.h"
41
42/** Endpoint number for status change pipe. */
43#define HUB_STATUS_CHANGE_PIPE 1
44/** Configuration value for hub configuration. */
45#define HUB_CONFIGURATION_ID 1
46
47
48/** Hub descriptor.
49 */
50typedef struct {
51 /** Size of this descriptor in bytes. */
52 uint8_t length;
53 /** Descriptor type (USB_DESCTYPE_HUB). */
54 uint8_t type;
55 /** Number of downstream ports. */
56 uint8_t port_count;
57 /** Hub characteristics. */
58 uint16_t characteristics;
59 /** Time from power-on to stabilized current.
60 * Expressed in 2ms unit.
61 */
62 uint8_t power_on_warm_up;
63 /** Maximum current (in mA). */
64 uint8_t max_current;
65 /** Whether device at given port is removable. */
66 uint8_t removable_device[BITS2BYTES(HUB_PORT_COUNT+1)];
67 /** Port power control.
68 * This is USB1.0 compatibility field, all bits must be 1.
69 */
70 uint8_t port_power[BITS2BYTES(HUB_PORT_COUNT+1)];
71} __attribute__ ((packed)) hub_descriptor_t;
72
73extern usbvirt_device_ops_t hub_ops;
74extern hub_descriptor_t hub_descriptor;
75
76int virthub_init(usbvirt_device_t *);
77int virthub_connect_device(usbvirt_device_t *, virtdev_connection_t *);
78int virthub_disconnect_device(usbvirt_device_t *, virtdev_connection_t *);
79bool virthub_is_device_enabled(usbvirt_device_t *, virtdev_connection_t *);
80void virthub_get_status(usbvirt_device_t *, char *, size_t);
81
82#endif
83/**
84 * @}
85 */
Note: See TracBrowser for help on using the repository browser.