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

Changeset f971e957 in mainline


Ignore:
Timestamp:
2017-10-16T12:03:56Z (4 years ago)
Author:
Michal Staruch <salmelu@…>
Branches:
lfn, master
Children:
bb784ae
Parents:
3afcf68
Message:

Removed hardcoded target for doorbell

Location:
uspace/drv/bus/usb/xhci
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/endpoint.c

    r3afcf68 rf971e957  
    8181}
    8282
    83 static inline uint8_t xhci_endpoint_ctx_offset(xhci_endpoint_t *ep)
     83uint8_t xhci_endpoint_ctx_offset(xhci_endpoint_t *ep)
    8484{
    8585        /* 0 is slot ctx, 1 is EP0, then it's EP1 out, in, EP2 out, in, etc. */
  • uspace/drv/bus/usb/xhci/endpoint.h

    r3afcf68 rf971e957  
    9797void xhci_device_fini(xhci_device_t *);
    9898
     99uint8_t xhci_endpoint_ctx_offset(xhci_endpoint_t *);
     100
    99101int xhci_device_add_endpoint(xhci_device_t *, xhci_endpoint_t *);
    100102int xhci_device_remove_endpoint(xhci_device_t *, xhci_endpoint_t *);
  • uspace/drv/bus/usb/xhci/transfers.c

    r3afcf68 rf971e957  
    167167                return EINVAL;
    168168        }
    169         if (batch->ep->target.endpoint != 0 || batch->ep->transfer_type != USB_TRANSFER_CONTROL) {
     169        if (batch->ep->transfer_type != USB_TRANSFER_CONTROL) {
    170170                /* This method only works for control transfers. */
    171                 usb_log_error("Attempted to schedule control transfer to non 0 endpoint.");
     171                usb_log_error("Attempted to schedule a control transfer to non control endpoint.");
    172172                return EINVAL;
    173173        }
     
    176176
    177177        uint8_t slot_id = xhci_ep->device->slot_id;
    178         xhci_trb_ring_t* ring = hc->dcbaa_virt[slot_id].trs[0];
     178        xhci_trb_ring_t* ring = hc->dcbaa_virt[slot_id].trs[batch->ep->target.endpoint];
    179179
    180180        usb_device_request_setup_packet_t* setup =
     
    254254        /* For control transfers, the target is always 1. */
    255255        // FIXME: ignoring return code
    256         hc_ring_doorbell(hc, slot_id, 1);
     256        const uint8_t target = xhci_endpoint_ctx_offset(xhci_ep);
     257        hc_ring_doorbell(hc, slot_id, target);
    257258
    258259        // Issue a Configure Endpoint command, if needed.
     
    300301
    301302        // TODO: target = endpoint | stream_id << 16
    302         hc_ring_doorbell(hc, slot_id, xhci_ep->base.target.endpoint);
     303        const uint8_t target = xhci_endpoint_ctx_offset(xhci_ep);
     304        hc_ring_doorbell(hc, slot_id, target);
    303305        return EOK;
    304306}
     
    337339        list_append(&transfer->link, &hc->transfers);
    338340
    339         const uint8_t target = 2 * batch->ep->target.endpoint
    340                 + (batch->ep->direction == USB_DIRECTION_IN ? 1 : 0);
     341        const uint8_t target = xhci_endpoint_ctx_offset(xhci_ep);
    341342        usb_log_debug("Ringing doorbell for slot_id = %d, target = %d", slot_id, target);
    342343        return hc_ring_doorbell(hc, slot_id, target);
Note: See TracChangeset for help on using the changeset viewer.