Changeset 6b433a8 in mainline for uspace/lib


Ignore:
Timestamp:
2017-11-20T19:14:31Z (8 years ago)
Author:
Salmelu <salmelu@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
27b0ea0
Parents:
d3086873
Message:

Isochronous transfers - endpoint initialization

Location:
uspace/lib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/include/usb_iface.h

    rd3086873 r6b433a8  
    126126                unsigned max_burst;
    127127                unsigned max_streams;
     128                unsigned mult;
     129                unsigned bytes_per_interval;
    128130        } usb3;
    129131} usb_endpoint_desc_t;
  • uspace/lib/usb/include/usb/descriptor.h

    rd3086873 r6b433a8  
    240240         * For bulk endpoints, this field contains the amount of streams
    241241         * supported by the endpoint.
    242          * For isochronous endpoints, this field contains either maximum
    243          * number of packets supported within a service interval, or
    244          * whether an isochronous endpoint companion descriptor follows.
     242         * For isochronous endpoints, this field contains maximum
     243         * number of packets supported within a service interval.
     244         * Warning: the values returned by macros may not make any sense
     245         * for specific endpoint types.
    245246         */
    246247        uint8_t attributes;
    247248#define SS_COMPANION_MAX_STREAMS(attributes) \
    248249        (attributes & 0x1f)
     250#define SS_COMPANION_MULT(attributes) \
     251        (attributes & 0x3)
    249252        /** The total number of bytes this endpoint will transfer
    250253         * every service interval (SI).
  • uspace/lib/usbdev/include/usb/dev/pipes.h

    rd3086873 r6b433a8  
    9797
    9898int usb_pipe_initialize(usb_pipe_t *, usb_endpoint_t, usb_transfer_type_t,
    99     size_t, usb_direction_t, unsigned, unsigned, unsigned, usb_dev_session_t *);
     99    size_t, usb_direction_t, unsigned, unsigned, unsigned, unsigned, unsigned, usb_dev_session_t *);
    100100int usb_pipe_initialize_default_control(usb_pipe_t *, usb_dev_session_t *);
    101101
  • uspace/lib/usbdev/src/pipes.c

    rd3086873 r6b433a8  
    255255    usb_transfer_type_t transfer_type, size_t max_packet_size,
    256256    usb_direction_t direction, unsigned packets,
    257     unsigned max_burst, unsigned max_streams, usb_dev_session_t *bus_session)
    258 {
    259         // FIXME refactor this function
     257    unsigned max_burst, unsigned max_streams, unsigned bytes_per_interval,
     258        unsigned mult, usb_dev_session_t *bus_session)
     259{
     260        // FIXME: refactor this function PLEASE
    260261        assert(pipe);
    261262
     
    267268        pipe->desc.usb3.max_burst = max_burst;
    268269        pipe->desc.usb3.max_streams = max_streams;
     270        pipe->desc.usb3.mult = mult;
     271        pipe->desc.usb3.bytes_per_interval = bytes_per_interval;
    269272        pipe->auto_reset_halt = false;
    270273        pipe->bus_session = bus_session;
     
    284287
    285288        const int rc = usb_pipe_initialize(pipe, 0, USB_TRANSFER_CONTROL,
    286             CTRL_PIPE_MIN_PACKET_SIZE, USB_DIRECTION_BOTH, 1, 0, 0, bus_session);
     289            CTRL_PIPE_MIN_PACKET_SIZE, USB_DIRECTION_BOTH, 1, 0, 0, 0, 0, bus_session);
    287290
    288291        pipe->auto_reset_halt = true;
  • uspace/lib/usbdev/src/pipesinit.c

    rd3086873 r6b433a8  
    210210        unsigned max_burst = 0;
    211211        unsigned max_streams = 0;
     212        unsigned bytes_per_interval = 0;
     213        unsigned mult = 0;
    212214        if(companion_desc) {
    213215                max_burst = companion_desc->max_burst;
    214216                max_streams = SS_COMPANION_MAX_STREAMS(companion_desc->attributes);
    215         }
    216 
     217                bytes_per_interval = companion_desc->bytes_per_interval;
     218                mult = SS_COMPANION_MULT(companion_desc->attributes);
     219        }
     220
     221        // FIXME: USB2 packets and USB3 max_burst are probably the same thing
     222        // See 4.14.2.1.1 of XHCI specification -> possibly refactor into one somehow-named field
    217223        int rc = usb_pipe_initialize(&ep_mapping->pipe,
    218224            ep_no, description.transfer_type,
     
    221227            description.direction, ED_MPS_TRANS_OPPORTUNITIES_GET(
    222228                uint16_usb2host(endpoint_desc->max_packet_size)),
    223             max_burst, max_streams, bus_session);
     229            max_burst, max_streams, bytes_per_interval, mult, bus_session);
    224230        if (rc != EOK) {
    225231                return rc;
Note: See TracChangeset for help on using the changeset viewer.