Changeset f971e957 in mainline for uspace/drv/bus/usb/xhci/transfers.c


Ignore:
Timestamp:
2017-10-16T12:03:56Z (7 years ago)
Author:
Michal Staruch <salmelu@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bb784ae
Parents:
3afcf68
Message:

Removed hardcoded target for doorbell

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.