Ignore:
File:
1 edited

Legend:

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

    r4e732f1a r9d58539  
    3434 *
    3535 */
     36#include <usb/usb.h>
    3637#include <usb/dev/pipes.h>
    3738#include <usb/dev/dp.h>
    3839#include <usb/dev/request.h>
    39 #include <usb/usb.h>
    40 #include <usb/descriptor.h>
    41 
     40#include <errno.h>
    4241#include <assert.h>
    43 #include <errno.h>
    4442
    4543#define DEV_DESCR_MAX_PACKET_SIZE_OFFSET 7
     
    150148 * @param interface Interface descriptor under which belongs the @p endpoint.
    151149 * @param endpoint Endpoint descriptor.
     150 * @param wire Connection backing the endpoint pipes.
    152151 * @return Error code.
    153152 */
     
    155154    usb_endpoint_mapping_t *mapping, size_t mapping_count,
    156155    usb_standard_interface_descriptor_t *interface,
    157     usb_standard_endpoint_descriptor_t *endpoint_desc,
    158     usb_dev_session_t *bus_session)
     156    usb_standard_endpoint_descriptor_t *endpoint,
     157    usb_device_connection_t *wire)
    159158{
    160159
     
    164163
    165164        /* Actual endpoint number is in bits 0..3 */
    166         const usb_endpoint_t ep_no = endpoint_desc->endpoint_address & 0x0F;
     165        const usb_endpoint_t ep_no = endpoint->endpoint_address & 0x0F;
    167166
    168167        const usb_endpoint_description_t description = {
    169168                /* Endpoint direction is set by bit 7 */
    170                 .direction = (endpoint_desc->endpoint_address & 128)
     169                .direction = (endpoint->endpoint_address & 128)
    171170                    ? USB_DIRECTION_IN : USB_DIRECTION_OUT,
    172171                /* Transfer type is in bits 0..2 and
    173172                 * the enum values corresponds 1:1 */
    174                 .transfer_type = endpoint_desc->attributes & 3,
     173                .transfer_type = endpoint->attributes & 3,
    175174
    176175                /* Get interface characteristics. */
     
    194193        }
    195194
    196         int rc = usb_pipe_initialize(&ep_mapping->pipe,
    197             ep_no, description.transfer_type,
    198             ED_MPS_PACKET_SIZE_GET(
    199                 uint16_usb2host(endpoint_desc->max_packet_size)),
    200             description.direction,
    201             ED_MPS_TRANS_OPPORTUNITIES_GET(
    202                 uint16_usb2host(endpoint_desc->max_packet_size)), bus_session);
     195        int rc = usb_pipe_initialize(&ep_mapping->pipe, wire,
     196            ep_no, description.transfer_type, endpoint->max_packet_size,
     197            description.direction);
    203198        if (rc != EOK) {
    204199                return rc;
     
    206201
    207202        ep_mapping->present = true;
    208         ep_mapping->descriptor = endpoint_desc;
     203        ep_mapping->descriptor = endpoint;
    209204        ep_mapping->interface = interface;
    210205
     
    224219    usb_endpoint_mapping_t *mapping, size_t mapping_count,
    225220    const usb_dp_parser_t *parser, const usb_dp_parser_data_t *parser_data,
    226     const uint8_t *interface_descriptor, usb_dev_session_t *bus_session)
     221    const uint8_t *interface_descriptor)
    227222{
    228223        const uint8_t *descriptor = usb_dp_get_nested_descriptor(parser,
     
    240235                            (usb_standard_endpoint_descriptor_t *)
    241236                                descriptor,
    242                             bus_session);
     237                            (usb_device_connection_t *) parser_data->arg);
    243238                }
    244239
     
    284279    usb_endpoint_mapping_t *mapping, size_t mapping_count,
    285280    const uint8_t *config_descriptor, size_t config_descriptor_size,
    286     usb_dev_session_t *bus_session)
    287 {
     281    usb_device_connection_t *connection)
     282{
     283        assert(connection);
    288284
    289285        if (config_descriptor == NULL) {
     
    309305                .data = config_descriptor,
    310306                .size = config_descriptor_size,
     307                .arg = connection
    311308        };
    312309
     
    321318        do {
    322319                (void) process_interface(mapping, mapping_count,
    323                     &dp_parser, &dp_data, interface, bus_session);
     320                    &dp_parser, &dp_data, interface);
    324321                interface = usb_dp_get_sibling_descriptor(&dp_parser, &dp_data,
    325322                    config_descriptor, interface);
     
    349346                return EINVAL;
    350347        }
     348
     349
     350        usb_pipe_start_long_transfer(pipe);
    351351
    352352        uint8_t dev_descr_start[CTRL_PIPE_MIN_PACKET_SIZE];
     
    366366                }
    367367        }
     368        usb_pipe_end_long_transfer(pipe);
    368369        if (rc != EOK) {
    369370                return rc;
Note: See TracChangeset for help on using the changeset viewer.