Ignore:
File:
1 edited

Legend:

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

    r82a639cd r9d58539  
    4343 */
    4444typedef enum {
     45        USB_HUB_FEATURE_HUB_LOCAL_POWER = 0,
     46        USB_HUB_FEATURE_HUB_OVER_CURRENT = 1,
    4547        USB_HUB_FEATURE_C_HUB_LOCAL_POWER = 0,
    4648        USB_HUB_FEATURE_C_HUB_OVER_CURRENT = 1,
    47         USB_HUB_FEATURE_HUB_LOCAL_POWER = 0,
    48         USB_HUB_FEATURE_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,
    5756        USB_HUB_FEATURE_C_PORT_CONNECTION = 16,
    5857        USB_HUB_FEATURE_C_PORT_ENABLE = 17,
     
    6059        USB_HUB_FEATURE_C_PORT_OVER_CURRENT = 19,
    6160        USB_HUB_FEATURE_C_PORT_RESET = 20,
    62         USB_HUB_FEATURE_PORT_TEST = 21,
    63         USB_HUB_FEATURE_PORT_INDICATOR = 22
    6461        /* USB_HUB_FEATURE_ = , */
    6562} usb_hub_class_feature_t;
     
    7067        /** Descriptor length. */
    7168        uint8_t length;
    72 
    7369        /** Descriptor type (0x29). */
    7470        uint8_t descriptor_type;
    75 
    7671        /** Number of downstream ports. */
    7772        uint8_t port_count;
    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          */
     73        /** Characteristics bitmask. */
    11174        uint8_t characteristics;
    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 */
     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 */
    12278        uint8_t characteristics_reserved;
    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          */
     79        /** Time from power-on to stabilization of current on the port. */
    13280        uint8_t power_good_time;
    133         /** Maximum current requirements in mA.
    134          *
    135          *  Maximum current requirements of the Hub Controller
    136          *  electronics in mA.
    137          */
     81        /** Maximum current requirements in mA. */
    13882        uint8_t max_current;
    13983} __attribute__ ((packed)) usb_hub_descriptor_header_t;
    14084
    141 /** One bit for the device and one bit for every port */
    142 #define STATUS_BYTES(ports) ((1 + ports + 7) / 8)
     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 */
     91typedef 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
    143173
    144174/**     @brief usb hub specific request types.
     
    174204    /** */
    175205    USB_HUB_REQUEST_CLEAR_FEATURE = 1,
    176     /** USB 1.0 only */
     206    /** */
    177207    USB_HUB_REQUEST_GET_STATE = 2,
    178208    /** */
     
    181211    USB_HUB_REQUEST_GET_DESCRIPTOR = 6,
    182212    /** */
    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,
     213    USB_HUB_REQUEST_SET_DESCRIPTOR = 7
    192214} usb_hub_request_t;
    193215
     
    196218 */
    197219/* 7 (basic size) + 2*32 (port bitmasks) */
    198 #define USB_HUB_MAX_DESCRIPTOR_SIZE (7 + 2 * 32)
     220#define USB_HUB_MAX_DESCRIPTOR_SIZE 71
    199221
    200222#endif
Note: See TracChangeset for help on using the changeset viewer.