Ignore:
File:
1 edited

Legend:

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

    r9d58539 r2c24983  
    6767        /** Descriptor length. */
    6868        uint8_t length;
     69
    6970        /** Descriptor type (0x29). */
    7071        uint8_t descriptor_type;
     72
    7173        /** Number of downstream ports. */
    7274        uint8_t port_count;
    73         /** Characteristics bitmask. */
     75
     76        /** Characteristics bitmask.
     77         *
     78         *  D1..D0: Logical Power Switching Mode
     79         *  00: Ganged power switching (all ports power at
     80         *  once)
     81         *  01: Individual port power switching
     82         *  1X: Reserved. Used only on 1.0 compliant hubs
     83         *  that implement no power switching.
     84         *  D2: Identifies a Compound Device
     85         *  0: Hub is not part of a compound device
     86         *  1: Hub is part of a compound device
     87         *  D4..D3: Over-current Protection Mode
     88         *  00: Global Over-current Protection. The hub
     89         *  reports over-current as a summation of all
     90         *  ports current draw, without a breakdown of
     91         *  individual port over-current status.
     92         *  01: Individual Port Over-current Protection. The
     93         *  hub reports over-current on a per-port basis.
     94         *  Each port has an over-current indicator.
     95         *  1X: No Over-current Protection. This option is
     96         *  allowed only for bus-powered hubs that do not
     97         *  implement over-current protection.
     98         *  D6..D5: TT think time
     99         *  00: At most 8 FS bit times
     100         *  01: At most 16 FS bit times
     101         *  10: At most 24 FS bit times
     102         *  11: At most 32 FS bit times
     103         *  D7: Port indicators
     104         *  0: Not supported
     105         *  1: Supported
     106         *  D15...D8: Reserved
     107         */
    74108        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 */
     109#define HUB_CHAR_POWER_PER_PORT_FLAG    (1 << 0)
     110#define HUB_CHAR_NO_POWER_SWITCH_FLAG   (1 << 1)
     111#define HUB_CHAR_COMPOUND_DEVICE        (1 << 2)
     112#define HUB_CHAR_OC_PER_PORT_FLAG       (1 << 3)
     113#define HUB_CHAR_NO_OC_FLAG             (1 << 4)
     114#define HUB_CHAR_TT_THINK_16            (1 << 5)
     115#define HUB_CHAR_TT_THINK_8             (1 << 6)
     116#define HUB_CHAR_INDICATORS_FLAG        (1 << 7)
     117
     118        /** Unused part of characteristics field */
    78119        uint8_t characteristics_reserved;
    79         /** Time from power-on to stabilization of current on the port. */
     120
     121        /** Time from power-on to stabilization of current on the port.
     122         *
     123         *  Time (in 2ms intervals) from the time the power-on
     124         *  sequence begins on a port until power is good on that
     125         *  port. The USB System Software uses this value to
     126         *  determine how long to wait before accessing a
     127         *  powered-on port.
     128         */
    80129        uint8_t power_good_time;
    81         /** Maximum current requirements in mA. */
     130        /** Maximum current requirements in mA.
     131         *
     132         *  Maximum current requirements of the Hub Controller
     133         *  electronics in mA.
     134         */
    82135        uint8_t max_current;
    83136} __attribute__ ((packed)) usb_hub_descriptor_header_t;
    84137
    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 
     138/** One bit for the device and one bit for every port */
     139#define STATUS_BYTES(ports) ((1 + ports + 7) / 8)
    173140
    174141/**     @brief usb hub specific request types.
Note: See TracChangeset for help on using the changeset viewer.