Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/include/usb/classes/hub.h

    r9d58539 r82a639cd  
    4343 */
    4444typedef enum {
     45        USB_HUB_FEATURE_C_HUB_LOCAL_POWER = 0,
     46        USB_HUB_FEATURE_C_HUB_OVER_CURRENT = 1,
    4547        USB_HUB_FEATURE_HUB_LOCAL_POWER = 0,
    4648        USB_HUB_FEATURE_HUB_OVER_CURRENT = 1,
    47         USB_HUB_FEATURE_C_HUB_LOCAL_POWER = 0,
    48         USB_HUB_FEATURE_C_HUB_OVER_CURRENT = 1,
    4949        USB_HUB_FEATURE_PORT_CONNECTION = 0,
    5050        USB_HUB_FEATURE_PORT_ENABLE = 1,
     
    5454        USB_HUB_FEATURE_PORT_POWER = 8,
    5555        USB_HUB_FEATURE_PORT_LOW_SPEED = 9,
     56        USB_HUB_FEATURE_PORT_HIGH_SPEED = 10,
    5657        USB_HUB_FEATURE_C_PORT_CONNECTION = 16,
    5758        USB_HUB_FEATURE_C_PORT_ENABLE = 17,
     
    5960        USB_HUB_FEATURE_C_PORT_OVER_CURRENT = 19,
    6061        USB_HUB_FEATURE_C_PORT_RESET = 20,
     62        USB_HUB_FEATURE_PORT_TEST = 21,
     63        USB_HUB_FEATURE_PORT_INDICATOR = 22
    6164        /* USB_HUB_FEATURE_ = , */
    6265} usb_hub_class_feature_t;
     
    6770        /** Descriptor length. */
    6871        uint8_t length;
     72
    6973        /** Descriptor type (0x29). */
    7074        uint8_t descriptor_type;
     75
    7176        /** Number of downstream ports. */
    7277        uint8_t port_count;
    73         /** Characteristics bitmask. */
     78
     79        /** Characteristics bitmask.
     80         *
     81         *  D1..D0: Logical Power Switching Mode
     82         *  00: Ganged power switching (all ports power at
     83         *  once)
     84         *  01: Individual port power switching
     85         *  1X: Reserved. Used only on 1.0 compliant hubs
     86         *  that implement no power switching.
     87         *  D2: Identifies a Compound Device
     88         *  0: Hub is not part of a compound device
     89         *  1: Hub is part of a compound device
     90         *  D4..D3: Over-current Protection Mode
     91         *  00: Global Over-current Protection. The hub
     92         *  reports over-current as a summation of all
     93         *  ports current draw, without a breakdown of
     94         *  individual port over-current status.
     95         *  01: Individual Port Over-current Protection. The
     96         *  hub reports over-current on a per-port basis.
     97         *  Each port has an over-current indicator.
     98         *  1X: No Over-current Protection. This option is
     99         *  allowed only for bus-powered hubs that do not
     100         *  implement over-current protection.
     101         *  D6..D5: TT think time
     102         *  00: At most 8 FS bit times
     103         *  01: At most 16 FS bit times
     104         *  10: At most 24 FS bit times
     105         *  11: At most 32 FS bit times
     106         *  D7: Port indicators
     107         *  0: Not supported
     108         *  1: Supported
     109         *  D15...D8: Reserved
     110         */
    74111        uint8_t characteristics;
    75 #define HUB_CHAR_POWER_PER_PORT_FLAG  (1 << 0)
    76 #define HUB_CHAR_NO_POWER_SWITCH_FLAG (1 << 1)
    77         /* Unused part of characteristics field */
     112#define HUB_CHAR_POWER_PER_PORT_FLAG    (1 << 0)
     113#define HUB_CHAR_NO_POWER_SWITCH_FLAG   (1 << 1)
     114#define HUB_CHAR_COMPOUND_DEVICE        (1 << 2)
     115#define HUB_CHAR_OC_PER_PORT_FLAG       (1 << 3)
     116#define HUB_CHAR_NO_OC_FLAG             (1 << 4)
     117#define HUB_CHAR_TT_THINK_16            (1 << 5)
     118#define HUB_CHAR_TT_THINK_8             (1 << 6)
     119#define HUB_CHAR_INDICATORS_FLAG        (1 << 7)
     120
     121        /** Unused part of characteristics field */
    78122        uint8_t characteristics_reserved;
    79         /** Time from power-on to stabilization of current on the port. */
     123
     124        /** Time from power-on to stabilization of current on the port.
     125         *
     126         *  Time (in 2ms intervals) from the time the power-on
     127         *  sequence begins on a port until power is good on that
     128         *  port. The USB System Software uses this value to
     129         *  determine how long to wait before accessing a
     130         *  powered-on port.
     131         */
    80132        uint8_t power_good_time;
    81         /** Maximum current requirements in mA. */
     133        /** Maximum current requirements in mA.
     134         *
     135         *  Maximum current requirements of the Hub Controller
     136         *  electronics in mA.
     137         */
    82138        uint8_t max_current;
    83139} __attribute__ ((packed)) usb_hub_descriptor_header_t;
    84140
    85 /**
    86  * @brief usb hub descriptor
    87  *
    88  * For more information see Universal Serial Bus Specification Revision 1.1
    89  * chapter 11.16.2
    90  */
    91 typedef struct usb_hub_descriptor_type {
    92     /** Number of bytes in this descriptor, including this byte */
    93     //uint8_t bDescLength;
    94 
    95     /** Descriptor Type, value: 29H for hub descriptor */
    96     //uint8_t bDescriptorType;
    97 
    98     /** Number of downstream ports that this hub supports */
    99     uint8_t port_count;
    100 
    101     /**
    102             D1...D0: Logical Power Switching Mode
    103             00: Ganged power switching (all ports power at
    104             once)
    105             01: Individual port power switching
    106             1X: Reserved. Used only on 1.0 compliant hubs
    107             that implement no power switching.
    108             D2: Identifies a Compound Device
    109             0: Hub is not part of a compound device
    110             1: Hub is part of a compound device
    111             D4...D3: Over-current Protection Mode
    112             00: Global Over-current Protection. The hub
    113             reports over-current as a summation of all
    114             ports current draw, without a breakdown of
    115             individual port over-current status.
    116             01: Individual Port Over-current Protection. The
    117             hub reports over-current on a per-port basis.
    118             Each port has an over-current indicator.
    119             1X: No Over-current Protection. This option is
    120             allowed only for bus-powered hubs that do not
    121             implement over-current protection.
    122             D15...D5:
    123             Reserved
    124      */
    125     uint16_t hub_characteristics;
    126 
    127     /**
    128             Time (in 2ms intervals) from the time the power-on
    129             sequence begins on a port until power is good on that
    130             port. The USB System Software uses this value to
    131             determine how long to wait before accessing a
    132             powered-on port.
    133      */
    134     uint8_t pwr_on_2_good_time;
    135 
    136     /**
    137             Maximum current requirements of the Hub Controller
    138             electronics in mA.
    139      */
    140     uint8_t current_requirement;
    141 
    142     /**
    143             Indicates if a port has a removable device attached.
    144             This field is reported on byte-granularity. Within a
    145             byte, if no port exists for a given location, the field
    146             representing the port characteristics returns 0.
    147             Bit value definition:
    148             0B - Device is removable
    149             1B - Device is non-removable
    150             This is a bitmap corresponding to the individual ports
    151             on the hub:
    152             Bit 0: Reserved for future use
    153             Bit 1: Port 1
    154             Bit 2: Port 2
    155             ....
    156             Bit n: Port n (implementation-dependent, up to a
    157             maximum of 255 ports).
    158      */
    159     uint8_t devices_removable[32];
    160 
    161     /**
    162             This field exists for reasons of compatibility with
    163             software written for 1.0 compliant devices. All bits in
    164             this field should be set to 1B. This field has one bit for
    165             each port on the hub with additional pad bits, if
    166             necessary, to make the number of bits in the field an
    167             integer multiple of 8.
    168      */
    169     //uint8_t * port_pwr_ctrl_mask;
    170 } usb_hub_descriptor_t;
    171 
    172 
     141/** One bit for the device and one bit for every port */
     142#define STATUS_BYTES(ports) ((1 + ports + 7) / 8)
    173143
    174144/**     @brief usb hub specific request types.
     
    204174    /** */
    205175    USB_HUB_REQUEST_CLEAR_FEATURE = 1,
    206     /** */
     176    /** USB 1.0 only */
    207177    USB_HUB_REQUEST_GET_STATE = 2,
    208178    /** */
     
    211181    USB_HUB_REQUEST_GET_DESCRIPTOR = 6,
    212182    /** */
    213     USB_HUB_REQUEST_SET_DESCRIPTOR = 7
     183    USB_HUB_REQUEST_SET_DESCRIPTOR = 7,
     184    /** */
     185    USB_HUB_REQUEST_CLEAR_TT_BUFFER = 8,
     186    /** */
     187    USB_HUB_REQUEST_RESET_TT = 9,
     188    /** */
     189    USB_HUB_GET_TT_STATE = 10,
     190    /** */
     191    USB_HUB_STOP_TT = 11,
    214192} usb_hub_request_t;
    215193
     
    218196 */
    219197/* 7 (basic size) + 2*32 (port bitmasks) */
    220 #define USB_HUB_MAX_DESCRIPTOR_SIZE 71
     198#define USB_HUB_MAX_DESCRIPTOR_SIZE (7 + 2 * 32)
    221199
    222200#endif
Note: See TracChangeset for help on using the changeset viewer.