Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 4ee5272 in mainline


Ignore:
Timestamp:
2014-01-19T04:45:39Z (8 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
2be477d5
Parents:
615abda
Message:

libusb, usbhub: Add USB2 features and structures

Location:
uspace
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhub/status.h

    r615abda r4ee5272  
    6464#define USB_HUB_PORT_STATUS_HIGH_SPEED \
    6565    (uint32_usb2host(1 << 10))
     66#define USB_HUB_PORT_STATUS_TEST_MODE \
     67    (uint32_usb2host(1 << 11))
     68#define USB_HUB_PORT_INDICATOR_CONTROL \
     69    (uint32_usb2host(1 << 12))
    6670
    6771#define USB_HUB_PORT_C_STATUS_CONNECTION \
  • uspace/lib/usb/include/usb/classes/hub.h

    r615abda r4ee5272  
    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,
     
    5959        USB_HUB_FEATURE_C_PORT_OVER_CURRENT = 19,
    6060        USB_HUB_FEATURE_C_PORT_RESET = 20,
     61        USB_HUB_FEATURE_PORT_TEST = 21,
     62        USB_HUB_FEATURE_PORT_INDICATOR = 22
    6163        /* USB_HUB_FEATURE_ = , */
    6264} usb_hub_class_feature_t;
     
    171173    /** */
    172174    USB_HUB_REQUEST_CLEAR_FEATURE = 1,
    173     /** */
     175    /** USB 1.0 only */
    174176    USB_HUB_REQUEST_GET_STATE = 2,
    175177    /** */
     
    178180    USB_HUB_REQUEST_GET_DESCRIPTOR = 6,
    179181    /** */
    180     USB_HUB_REQUEST_SET_DESCRIPTOR = 7
     182    USB_HUB_REQUEST_SET_DESCRIPTOR = 7,
     183    /** */
     184    USB_HUB_REQUEST_CLEAR_TT_BUFFER = 8,
     185    /** */
     186    USB_HUB_REQUEST_RESET_TT = 9,
     187    /** */
     188    USB_HUB_GET_TT_STATE = 10,
     189    /** */
     190    USB_HUB_STOP_TT = 11,
    181191} usb_hub_request_t;
    182192
     
    185195 */
    186196/* 7 (basic size) + 2*32 (port bitmasks) */
    187 #define USB_HUB_MAX_DESCRIPTOR_SIZE 71
     197#define USB_HUB_MAX_DESCRIPTOR_SIZE (7 + 2 * 32)
    188198
    189199#endif
  • uspace/lib/usb/include/usb/descriptor.h

    r615abda r4ee5272  
    4545        USB_DESCTYPE_INTERFACE = 4,
    4646        USB_DESCTYPE_ENDPOINT = 5,
     47        /* New in USB2.0 */
     48        USB_DESCTYPE_DEVICE_QUALIFIER = 6,
     49        USB_DESCTYPE_OTHER_SPEED_CONFIGURATION = 7,
     50        USB_DESCTYPE_INTERFACE_POWER = 8,
     51        /* Class specific */
    4752        USB_DESCTYPE_HID = 0x21,
    4853        USB_DESCTYPE_HID_REPORT = 0x22,
     
    8994} __attribute__ ((packed)) usb_standard_device_descriptor_t;
    9095
     96/** USB device qualifier decriptor is basically a cut down version of the device
     97 * descriptor with values that would be valid if the device operated on the
     98 * other speed (HIGH vs. FULL)
     99 */
     100typedef struct {
     101        /** Size of this descriptor in bytes */
     102        uint8_t length;
     103        /** Descriptor type (USB_DESCTYPE_DEVICE_QUALIFIER) */
     104        uint8_t descriptor_type;
     105        /** USB specification release number.
     106         * The number shall be coded as binary-coded decimal (BCD).
     107         */
     108        uint16_t usb_spec_version;
     109        /** Device class. */
     110        uint8_t device_class;
     111        /** Device sub-class. */
     112        uint8_t device_subclass;
     113        /** Device protocol. */
     114        uint8_t device_protocol;
     115        /** Maximum packet size for endpoint zero.
     116         * Valid values are only 8, 16, 32, 64).
     117         */
     118        uint8_t max_packet_size;
     119        /** Number of possible configurations. */
     120        uint8_t configuration_count;
     121        uint8_t reserved;
     122} __attribute__ ((packed)) usb_standard_device_qualifier_descriptor_t;
     123
    91124/** Standard USB configuration descriptor.
    92125 */
     
    116149} __attribute__ ((packed)) usb_standard_configuration_descriptor_t;
    117150
     151/** USB Other Speed Configuration descriptor shows values that would change
     152 * in the configuration descriptor if the device operated at its other
     153 * possible speed (HIGH vs. FULL)
     154 */
     155typedef usb_standard_configuration_descriptor_t
     156    usb_other_speed_configuration_descriptor_t;
     157
    118158/** Standard USB interface descriptor.
    119159 */
  • uspace/lib/usb/include/usb/request.h

    r615abda r4ee5272  
    5454} usb_stddevreq_t;
    5555
     56/** Standard device features */
     57typedef enum {
     58        USB_FEATURE_ENDPOINT_HALT = 0,
     59        USB_FEATURE_DEVICE_REMOTE_WAKEUP = 1,
     60        USB_FEATURE_TEST_MODE = 2
     61} usb_std_feature_t;
     62
    5663/** USB device status - device is self powered (opposed to bus powered). */
    5764#define USB_DEVICE_STATUS_SELF_POWERED ((uint16_t)(1 << 0))
     
    6269/** USB endpoint status - endpoint is halted (stalled). */
    6370#define USB_ENDPOINT_STATUS_HALTED ((uint16_t)(1 << 0))
    64 
    65 /** USB feature selector - endpoint halt (stall). */
    66 #define USB_FEATURE_SELECTOR_ENDPOINT_HALT (0)
    67 
    68 /** USB feature selector - device remote wake-up. */
    69 #define USB_FEATURE_SELECTOR_REMOTE_WAKEUP (1)
    7071
    7172/** Device request setup packet.
  • uspace/lib/usb/src/usb.c

    r615abda r4ee5272  
    135135                /* 0x2 ( HOST to device | STANDART | TO ENPOINT) */
    136136                if ((request->request_type == 0x2) &&
    137                     (request->value == USB_FEATURE_SELECTOR_ENDPOINT_HALT))
     137                    (request->value == USB_FEATURE_ENDPOINT_HALT))
    138138                        return uint16_usb2host(request->index);
    139139                break;
  • uspace/lib/usbdev/src/request.c

    r615abda r4ee5272  
    823823        return usb_request_clear_feature(pipe,
    824824            USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_ENDPOINT,
    825             uint16_host2usb(USB_FEATURE_SELECTOR_ENDPOINT_HALT),
     825            uint16_host2usb(USB_FEATURE_ENDPOINT_HALT),
    826826            uint16_host2usb(ep_index));
    827827}
Note: See TracChangeset for help on using the changeset viewer.