Logo Search packages:      
Sourcecode: virtualbox-ose version File versions

usb.h

Go to the documentation of this file.
/** @file
 * USB - Universal Serial Bus.
 */

/*
 * Copyright (C) 2006-2007 innotek GmbH
 *
 * This file is part of VirtualBox Open Source Edition (OSE), as
 * available from http://www.virtualbox.org. This file is free software;
 * you can redistribute it and/or modify it under the terms of the GNU
 * General Public License as published by the Free Software Foundation,
 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
 * distribution. VirtualBox OSE is distributed in the hope that it will
 * be useful, but WITHOUT ANY WARRANTY of any kind.
 */

#ifndef ___VBox_usb_h
#define ___VBox_usb_h

#include <VBox/types.h>

__BEGIN_DECLS

/**
 * USB device interface endpoint.
 */
00027 typedef struct USBENDPOINT
{
    /** The address of the endpoint on the USB device described by this descriptor. */
00030     uint8_t     bEndpointAddress;
    /** This field describes the endpoint's attributes when it is configured using the bConfigurationValue. */
00032     uint8_t     bmAttributes;
    /** Maximum packet size this endpoint is capable of sending or receiving when this configuration is selected. */
00034     uint16_t    wMaxPacketSize;
    /** Interval for polling endpoint for data transfers. Expressed in milliseconds.
     * This is interpreted the bInterval value. */
00037     uint16_t    u16Interval;
} USBENDPOINT;
/** Pointer to a USB device interface endpoint. */
00040 typedef USBENDPOINT *PUSBENDPOINT;
/** Pointer to a const USB device interface endpoint. */
00042 typedef const USBENDPOINT *PCUSBENDPOINT;

/** USBENDPOINT::bmAttributes values.
 * @{ */
00046 #define USB_EP_ATTR_CONTROL         0
#define USB_EP_ATTR_ISOCHRONOUS     1
#define USB_EP_ATTR_BULK            2
#define USB_EP_ATTR_INTERRUPT       3
/** @} */


/**
 * USB device interface.
 */
00056 typedef struct USBINTERFACE
{
    /** Number of interface. */
00059     uint8_t     bInterfaceNumber;
    /** Value used to select alternate setting for the interface identified in the prior field. */
00061     uint8_t     bAlternateSetting;
    /** Number of endpoints used by this interface (excluding endpoint zero). */
00063     uint8_t     bNumEndpoints;
    /** Pointer to an array of endpoints. */
00065     PUSBENDPOINT paEndpoints;
    /** Interface class. */
00067     uint8_t     bInterfaceClass;
    /** Interface subclass. */
00069     uint8_t     bInterfaceSubClass;
    /** Protocol code. */
00071     uint8_t     bInterfaceProtocol;
    /** Number of alternate settings. */
00073     uint8_t     cAlts;
    /** Pointer to an array of alternate interface settings. */
00075     struct USBINTERFACE *paAlts;
    /** String describing this interface. */
00077     const char *pszInterface;
    /** String containing the driver name.
     * This is a NULL pointer if the interface is not in use. */
00080     const char *pszDriver;
} USBINTERFACE;
/** Pointer to a USB device interface description. */
00083 typedef USBINTERFACE *PUSBINTERFACE;
/** Pointer to a const USB device interface description. */
00085 typedef const USBINTERFACE *PCUSBINTERFACE;

/**
 * Device configuration.
 */
00090 typedef struct USBCONFIG
{
    /** Set if this is the active configuration. */
00093     bool        fActive;
    /** Number of interfaces. */
00095     uint8_t     bNumInterfaces;
    /** Pointer to an array of interfaces. */
00097     PUSBINTERFACE paInterfaces;
    /** Configuration number. (For SetConfiguration().) */
00099     uint8_t     bConfigurationValue;
    /** Configuration description string. */
00101     const char *pszConfiguration;
    /** Configuration characteristics. */
00103     uint8_t     bmAttributes;
    /** Maximum power consumption of the USB device in this config.
     * (This field does NOT need shifting like in the USB config descriptor.)  */
00106     uint16_t    u16MaxPower;
} USBCONFIG;
/** Pointer to a USB configuration. */
00109 typedef USBCONFIG *PUSBCONFIG;
/** Pointer to a const USB configuration. */
00111 typedef const USBCONFIG *PCUSBCONFIG;


/**
 * The USB host device state.
 */
00117 typedef enum USBDEVICESTATE
{
    /** The device is unsupported. */
00120     USBDEVICESTATE_UNSUPPORTED = 1,
    /** The device is in use by the host. */
00122     USBDEVICESTATE_USED_BY_HOST,
    /** The device is in use by the host but could perhaps be captured even so. */
00124     USBDEVICESTATE_USED_BY_HOST_CAPTURABLE,
    /** The device is not used by the host or any guest. */
00126     USBDEVICESTATE_UNUSED,
    /** The device is held by the proxy for later guest usage. */
00128     USBDEVICESTATE_HELD_BY_PROXY,
    /** The device in use by a guest. */
00130     USBDEVICESTATE_USED_BY_GUEST,
    /** The usual 32-bit hack. */
00132     USBDEVICESTATE_32BIT_HACK = 0x7fffffff
} USBDEVICESTATE;


/**
 * USB host device description.
 * Used for enumeration of USB devices.
 */
00140 typedef struct USBDEVICE
{
    /** USB version number. */
00143     uint16_t        bcdUSB;
    /** Device class. */
00145     uint8_t         bDeviceClass;
    /** Device subclass. */
00147     uint8_t         bDeviceSubClass;
    /** Device protocol */
00149     uint8_t         bDeviceProtocol;
    /** Vendor ID. */
00151     uint16_t        idVendor;
    /** Product ID. */
00153     uint16_t        idProduct;
    /** Revision, integer part. */
00155     uint16_t        bcdDevice;
    /** Manufacturer string. */
00157     const char     *pszManufacturer;
    /** Product string. */
00159     const char     *pszProduct;
    /** Serial number string. */
00161     const char     *pszSerialNumber;
    /** Serial hash. */
00163     uint64_t        u64SerialHash;
    /** Number of configurations. */
00165     uint8_t         bNumConfigurations;
    /** Pointer to an array of configurations. */
00167     PUSBCONFIG      paConfigurations;
    /** The device state. */
00169     USBDEVICESTATE  enmState;
    /** The address of the device. */
00171     const char     *pszAddress;

    /** The USB Bus number. */
00174     uint8_t         bBus;
    /** The level in topologly for this bus. */
00176     uint8_t         bLevel;
    /** Device number. */
00178     uint8_t         bDevNum;
    /** Parent device number. */
00180     uint8_t         bDevNumParent;
    /** The port number. */
00182     uint8_t         bPort;
    /** Number of devices on this level. */
00184     uint8_t         bNumDevices;
    /** Maximum number of children. */
00186     uint8_t         bMaxChildren;

    /** If linked, this is the pointer to the next device in the list. */
00189     struct USBDEVICE *pNext;
    /** If linked doubly, this is the pointer to the prev device in the list. */
00191     struct USBDEVICE *pPrev;
} USBDEVICE;
/** Pointer to a USB device. */
00194 typedef USBDEVICE *PUSBDEVICE;
/** Pointer to a const USB device. */
00196 typedef USBDEVICE *PCUSBDEVICE;

__END_DECLS

#endif

Generated by  Doxygen 1.6.0   Back to index