Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbdev/src/pipesinit.c

    r5bc8250 r58563585  
    3838#include <usb/dev/request.h>
    3939#include <usb/usb.h>
    40 #include <usb/debug.h>
    4140#include <usb/descriptor.h>
    4241
     
    6059        NESTING(INTERFACE, HID),
    6160        NESTING(HID, HID_REPORT),
    62         NESTING(ENDPOINT, SSPEED_EP_COMPANION),
    6361        LAST_NESTING
    6462};
     
    7270{
    7371        return descriptor[1] == USB_DESCTYPE_ENDPOINT;
    74 }
    75 
    76 /** Tells whether given descriptor is of superspeed companion type.
    77  *
    78  * @param descriptor Descriptor in question.
    79  * @return Whether the given descriptor is superspeed companion descriptor.
    80  */
    81 static inline bool is_superspeed_companion_descriptor(const uint8_t *descriptor)
    82 {
    83         return descriptor[1] == USB_DESCTYPE_SSPEED_EP_COMPANION;
    8472}
    8573
     
    162150 * @param interface Interface descriptor under which belongs the @p endpoint.
    163151 * @param endpoint Endpoint descriptor.
    164  * @param companion Superspeed companion descriptor.
    165152 * @return Error code.
    166153 */
     
    169156    usb_standard_interface_descriptor_t *interface,
    170157    usb_standard_endpoint_descriptor_t *endpoint_desc,
    171     usb_superspeed_endpoint_companion_descriptor_t *companion_desc,
    172158    usb_dev_session_t *bus_session)
    173159{
     
    208194        }
    209195
    210         unsigned max_burst = 0;
    211         unsigned max_streams = 0;
    212         if(companion_desc) {
    213                 max_burst = companion_desc->max_burst;
    214                 max_streams = SS_COMPANION_MAX_STREAMS(companion_desc->attributes);
    215         }
    216 
    217196        int rc = usb_pipe_initialize(&ep_mapping->pipe,
    218197            ep_no, description.transfer_type,
    219198            ED_MPS_PACKET_SIZE_GET(
    220199                uint16_usb2host(endpoint_desc->max_packet_size)),
    221             description.direction, ED_MPS_TRANS_OPPORTUNITIES_GET(
    222                 uint16_usb2host(endpoint_desc->max_packet_size)),
    223             max_burst, max_streams, bus_session);
     200            description.direction,
     201            ED_MPS_TRANS_OPPORTUNITIES_GET(
     202                uint16_usb2host(endpoint_desc->max_packet_size)), bus_session);
    224203        if (rc != EOK) {
    225204                return rc;
     
    228207        ep_mapping->present = true;
    229208        ep_mapping->descriptor = endpoint_desc;
    230         ep_mapping->companion_descriptor = companion_desc;
    231209        ep_mapping->interface = interface;
    232210
     
    257235        do {
    258236                if (is_endpoint_descriptor(descriptor)) {
    259                         /* Check if companion descriptor is present too, it should immediatelly follow. */
    260                         const uint8_t *companion_desc = usb_dp_get_nested_descriptor(parser,
    261                                 parser_data, descriptor);
    262                         if (companion_desc && !is_superspeed_companion_descriptor(companion_desc)) {
    263                                 /* Not what we wanted, don't pass it further. */
    264                                 companion_desc = NULL;
    265                         }
    266 
    267237                        (void) process_endpoint(mapping, mapping_count,
    268238                            (usb_standard_interface_descriptor_t *)
     
    270240                            (usb_standard_endpoint_descriptor_t *)
    271241                                descriptor,
    272                             (usb_superspeed_endpoint_companion_descriptor_t *)
    273                                 companion_desc,
    274242                            bus_session);
    275243                }
     
    320288        if (config_descriptor == NULL)
    321289                return EBADMEM;
    322 
     290       
    323291        if (config_descriptor_size <
    324292            sizeof(usb_standard_configuration_descriptor_t)) {
     
    375343        static_assert(DEV_DESCR_MAX_PACKET_SIZE_OFFSET < CTRL_PIPE_MIN_PACKET_SIZE);
    376344
    377         if ((pipe->desc.direction != USB_DIRECTION_BOTH) ||
    378             (pipe->desc.transfer_type != USB_TRANSFER_CONTROL) ||
    379             (pipe->desc.endpoint_no != 0)) {
     345        if ((pipe->direction != USB_DIRECTION_BOTH) ||
     346            (pipe->transfer_type != USB_TRANSFER_CONTROL) ||
     347            (pipe->endpoint_no != 0)) {
    380348                return EINVAL;
    381349        }
     
    401369        }
    402370
    403         pipe->desc.max_packet_size
     371        pipe->max_packet_size
    404372            = dev_descr_start[DEV_DESCR_MAX_PACKET_SIZE_OFFSET];
    405373
Note: See TracChangeset for help on using the changeset viewer.