hub.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2010 Matus Dekanek
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * - Redistributions of source code must retain the above copyright
00010  *   notice, this list of conditions and the following disclaimer.
00011  * - Redistributions in binary form must reproduce the above copyright
00012  *   notice, this list of conditions and the following disclaimer in the
00013  *   documentation and/or other materials provided with the distribution.
00014  * - The name of the author may not be used to endorse or promote products
00015  *   derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00019  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00020  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00022  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00023  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00024  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00035 #ifndef LIBUSB_CLASS_HUB_H_
00036 #define LIBUSB_CLASS_HUB_H_
00037 
00038 #include <sys/types.h>
00039 
00044 typedef enum {
00045         USB_HUB_FEATURE_HUB_LOCAL_POWER = 0,
00046         USB_HUB_FEATURE_HUB_OVER_CURRENT = 1,
00047         USB_HUB_FEATURE_C_HUB_LOCAL_POWER = 0,
00048         USB_HUB_FEATURE_C_HUB_OVER_CURRENT = 1,
00049         USB_HUB_FEATURE_PORT_CONNECTION = 0,
00050         USB_HUB_FEATURE_PORT_ENABLE = 1,
00051         USB_HUB_FEATURE_PORT_SUSPEND = 2,
00052         USB_HUB_FEATURE_PORT_OVER_CURRENT = 3,
00053         USB_HUB_FEATURE_PORT_RESET = 4,
00054         USB_HUB_FEATURE_PORT_POWER = 8,
00055         USB_HUB_FEATURE_PORT_LOW_SPEED = 9,
00056         USB_HUB_FEATURE_C_PORT_CONNECTION = 16,
00057         USB_HUB_FEATURE_C_PORT_ENABLE = 17,
00058         USB_HUB_FEATURE_C_PORT_SUSPEND = 18,
00059         USB_HUB_FEATURE_C_PORT_OVER_CURRENT = 19,
00060         USB_HUB_FEATURE_C_PORT_RESET = 20,
00061         /* USB_HUB_FEATURE_ = , */
00062 } usb_hub_class_feature_t;
00063 
00064 
00066 typedef struct {
00068         uint8_t length;
00070         uint8_t descriptor_type;
00072         uint8_t port_count;
00074         uint16_t characteristics;
00076         uint8_t power_good_time;
00078         uint8_t max_current;
00079 } __attribute__ ((packed)) usb_hub_descriptor_header_t;
00080 
00086 typedef struct usb_hub_descriptor_type {
00088     //uint8_t bDescLength;
00089 
00091     //uint8_t bDescriptorType;
00092 
00094     uint8_t ports_count;
00095 
00120     uint16_t hub_characteristics;
00121 
00129     uint8_t pwr_on_2_good_time;
00130 
00135     uint8_t current_requirement;
00136 
00154     uint8_t devices_removable[32];
00155 
00164     //uint8_t * port_pwr_ctrl_mask;
00165 } usb_hub_descriptor_t;
00166 
00167 
00168 
00173 typedef enum {
00175     USB_HUB_REQ_TYPE_CLEAR_HUB_FEATURE = 0x20,
00177     USB_HUB_REQ_TYPE_CLEAR_PORT_FEATURE = 0x23,
00179     USB_HUB_REQ_TYPE_GET_STATE = 0xA3,
00181     USB_HUB_REQ_TYPE_GET_DESCRIPTOR = 0xA0,
00183     USB_HUB_REQ_TYPE_GET_HUB_STATUS = 0xA0,
00185     USB_HUB_REQ_TYPE_GET_PORT_STATUS = 0xA3,
00187     USB_HUB_REQ_TYPE_SET_DESCRIPTOR = 0x20,
00189     USB_HUB_REQ_TYPE_SET_HUB_FEATURE = 0x20,
00191     USB_HUB_REQ_TYPE_SET_PORT_FEATURE = 0x23
00192 } usb_hub_bm_request_type_t;
00193 
00195 
00196 typedef enum {
00198     USB_HUB_REQUEST_GET_STATUS = 0,
00200     USB_HUB_REQUEST_CLEAR_FEATURE = 1,
00202     USB_HUB_REQUEST_GET_STATE = 2,
00204     USB_HUB_REQUEST_SET_FEATURE = 3,
00206     USB_HUB_REQUEST_GET_DESCRIPTOR = 6,
00208     USB_HUB_REQUEST_SET_DESCRIPTOR = 7
00209 } usb_hub_request_t;
00210 
00214 extern size_t USB_HUB_MAX_DESCRIPTOR_SIZE;
00215 
00216 
00217 
00218 
00219 
00220 
00221 
00222 #endif
00223 

Generated on Thu Jun 2 07:45:45 2011 for HelenOS/USB by  doxygen 1.4.7