Ignore:
File:
1 edited

Legend:

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

    r816f5f4 r58563585  
    5151        assert(pipe != NULL);
    5252
    53         if (!pipe->auto_reset_halt || (pipe->desc.endpoint_no != 0)) {
     53        if (!pipe->auto_reset_halt || (pipe->endpoint_no != 0)) {
    5454                return;
    5555        }
     
    8888        }
    8989
    90         if ((pipe->desc.direction != USB_DIRECTION_BOTH)
    91             || (pipe->desc.transfer_type != USB_TRANSFER_CONTROL)) {
     90        if ((pipe->direction != USB_DIRECTION_BOTH)
     91            || (pipe->transfer_type != USB_TRANSFER_CONTROL)) {
    9292                return EBADF;
    9393        }
     
    9898        async_exch_t *exch = async_exchange_begin(pipe->bus_session);
    9999        size_t act_size = 0;
    100         const int rc = usb_read(exch, pipe->desc.endpoint_no, setup_packet, buffer,
     100        const int rc = usb_read(exch, pipe->endpoint_no, setup_packet, buffer,
    101101            buffer_size, &act_size);
    102102        async_exchange_end(exch);
     
    142142        }
    143143
    144         if ((pipe->desc.direction != USB_DIRECTION_BOTH)
    145             || (pipe->desc.transfer_type != USB_TRANSFER_CONTROL)) {
     144        if ((pipe->direction != USB_DIRECTION_BOTH)
     145            || (pipe->transfer_type != USB_TRANSFER_CONTROL)) {
    146146                return EBADF;
    147147        }
     
    152152        async_exch_t *exch = async_exchange_begin(pipe->bus_session);
    153153        const int rc = usb_write(exch,
    154             pipe->desc.endpoint_no, setup_packet, buffer, buffer_size);
     154            pipe->endpoint_no, setup_packet, buffer, buffer_size);
    155155        async_exchange_end(exch);
    156156
     
    183183        }
    184184
    185         if (pipe->desc.direction != USB_DIRECTION_IN) {
    186                 return EBADF;
    187         }
    188 
    189         if (pipe->desc.transfer_type == USB_TRANSFER_CONTROL) {
     185        if (pipe->direction != USB_DIRECTION_IN) {
     186                return EBADF;
     187        }
     188
     189        if (pipe->transfer_type == USB_TRANSFER_CONTROL) {
    190190                return EBADF;
    191191        }
    192192
    193193        /* Isochronous transfer are not supported (yet) */
    194         if (pipe->desc.transfer_type != USB_TRANSFER_INTERRUPT &&
    195             pipe->desc.transfer_type != USB_TRANSFER_BULK)
     194        if (pipe->transfer_type != USB_TRANSFER_INTERRUPT &&
     195            pipe->transfer_type != USB_TRANSFER_BULK)
    196196            return ENOTSUP;
    197197
     
    199199        size_t act_size = 0;
    200200        const int rc =
    201             usb_read(exch, pipe->desc.endpoint_no, 0, buffer, size, &act_size);
     201            usb_read(exch, pipe->endpoint_no, 0, buffer, size, &act_size);
    202202        async_exchange_end(exch);
    203203
     
    224224        }
    225225
    226         if (pipe->desc.direction != USB_DIRECTION_OUT) {
    227                 return EBADF;
    228         }
    229 
    230         if (pipe->desc.transfer_type == USB_TRANSFER_CONTROL) {
     226        if (pipe->direction != USB_DIRECTION_OUT) {
     227                return EBADF;
     228        }
     229
     230        if (pipe->transfer_type == USB_TRANSFER_CONTROL) {
    231231                return EBADF;
    232232        }
    233233
    234234        /* Isochronous transfer are not supported (yet) */
    235         if (pipe->desc.transfer_type != USB_TRANSFER_INTERRUPT &&
    236             pipe->desc.transfer_type != USB_TRANSFER_BULK)
     235        if (pipe->transfer_type != USB_TRANSFER_INTERRUPT &&
     236            pipe->transfer_type != USB_TRANSFER_BULK)
    237237            return ENOTSUP;
    238238
    239239        async_exch_t *exch = async_exchange_begin(pipe->bus_session);
    240         const int rc = usb_write(exch, pipe->desc.endpoint_no, 0, buffer, size);
     240        const int rc = usb_write(exch, pipe->endpoint_no, 0, buffer, size);
    241241        async_exchange_end(exch);
    242242        return rc;
     
    258258        assert(pipe);
    259259
    260         pipe->desc.endpoint_no = endpoint_no;
    261         pipe->desc.transfer_type = transfer_type;
    262         pipe->desc.packets = packets;
    263         pipe->desc.max_packet_size = max_packet_size;
    264         pipe->desc.direction = direction;
     260        pipe->endpoint_no = endpoint_no;
     261        pipe->transfer_type = transfer_type;
     262        pipe->packets = packets;
     263        pipe->max_packet_size = max_packet_size;
     264        pipe->direction = direction;
    265265        pipe->auto_reset_halt = false;
    266266        pipe->bus_session = bus_session;
     
    297297        assert(pipe);
    298298        assert(pipe->bus_session);
    299 
    300         pipe->desc.usb2.polling_interval = interval;
    301299        async_exch_t *exch = async_exchange_begin(pipe->bus_session);
    302300        if (!exch)
    303301                return ENOMEM;
    304 
    305         const int ret = usb_register_endpoint(exch, &pipe->desc);
    306 
     302        const int ret = usb_register_endpoint(exch, pipe->endpoint_no,
     303            pipe->transfer_type, pipe->direction, pipe->max_packet_size,
     304            pipe->packets, interval);
    307305        async_exchange_end(exch);
    308306        return ret;
     
    321319        if (!exch)
    322320                return ENOMEM;
    323 
    324         const int ret = usb_unregister_endpoint(exch, &pipe->desc);
    325 
     321        const int ret = usb_unregister_endpoint(exch, pipe->endpoint_no,
     322            pipe->direction);
    326323        async_exchange_end(exch);
    327324        return ret;
Note: See TracChangeset for help on using the changeset viewer.