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

Changeset 42bc933 in mainline


Ignore:
Timestamp:
2017-10-09T16:27:02Z (4 years ago)
Author:
Michal Staruch <salmelu@…>
Branches:
lfn, master
Children:
ac18b08
Parents:
a0be5d0
Message:

Dummy for bulk transfers (need to support streams)

Location:
uspace
Files:
4 edited

Legend:

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

    ra0be5d0 r42bc933  
    464464        switch (batch->ep->transfer_type) {
    465465        case USB_TRANSFER_CONTROL:
    466                 xhci_schedule_control_transfer(hc, batch);
    467                 break;
     466                return xhci_schedule_control_transfer(hc, batch);
    468467        case USB_TRANSFER_ISOCHRONOUS:
    469468                /* TODO: Implement me. */
    470469                break;
    471470        case USB_TRANSFER_BULK:
    472                 /* TODO: Implement me. */
    473                 break;
     471                return xhci_schedule_bulk_transfer(hc, batch);
    474472        case USB_TRANSFER_INTERRUPT:
    475473                /* TODO: Implement me. */
  • uspace/drv/bus/usb/xhci/transfers.c

    ra0be5d0 r42bc933  
    221221}
    222222
     223int xhci_schedule_bulk_transfer(xhci_hc_t* hc, usb_transfer_batch_t* batch) {
     224        if (batch->setup_size) {
     225                usb_log_warning("Setup packet present for a bulk transfer.");
     226        }
     227
     228        uint8_t slot_id = batch->ep->hc_data.slot_id;
     229        xhci_trb_ring_t* ring = hc->dcbaa_virt[slot_id].trs[batch->ep->endpoint];
     230
     231        xhci_transfer_t *transfer = xhci_transfer_alloc(batch);
     232
     233        xhci_trb_t trb;
     234        memset(&trb, 0, sizeof(xhci_trb_t));
     235        trb.parameter = (uintptr_t) addr_to_phys(batch->buffer);
     236
     237        // data size (sent for OUT, or buffer size)
     238        TRB_CTRL_SET_XFER_LEN(trb, batch->buffer_size);
     239        // FIXME: TD size 4.11.2.4
     240        TRB_CTRL_SET_TD_SIZE(trb, 1);
     241
     242        // we want an interrupt after this td is done
     243        TRB_CTRL_SET_IOC(trb, 1);
     244
     245        TRB_CTRL_SET_TRB_TYPE(trb, XHCI_TRB_TYPE_NORMAL);
     246
     247        xhci_trb_ring_enqueue(ring, &trb, &transfer->interrupt_trb_phys);
     248        list_append(&transfer->link, &hc->transfers);
     249
     250        /* For control transfers, the target is always 1. */
     251        hc_ring_doorbell(hc, slot_id, 1);
     252        return EOK;
     253}
     254
    223255int xhci_handle_transfer_event(xhci_hc_t* hc, xhci_trb_t* trb)
    224256{
  • uspace/drv/bus/usb/xhci/transfers.h

    ra0be5d0 r42bc933  
    3737#include "trb_ring.h"
    3838
    39 /*
    40 
    41 typedef struct xhci_command {
    42         link_t link;
    43 
    44         xhci_trb_t trb;
    45         uintptr_t trb_phys;
    46 
    47         uint32_t slot_id;
    48         uint32_t status;
    49 
    50         bool completed;
    51 
    52         fibril_mutex_t completed_mtx;
    53         fibril_condvar_t completed_cv;
    54 } xhci_cmd_t;
    55 */
    56 
    5739typedef struct {
    5840        link_t link;
     
    6951void xhci_transfer_fini(xhci_transfer_t*);
    7052int xhci_schedule_control_transfer(xhci_hc_t*, usb_transfer_batch_t*);
     53int xhci_schedule_bulk_transfer(xhci_hc_t*, usb_transfer_batch_t*);
    7154int xhci_handle_transfer_event(xhci_hc_t*, xhci_trb_t*);
  • uspace/lib/usbhost/src/ddf_helpers.c

    ra0be5d0 r42bc933  
    395395        assert(l);
    396396        assert(d);
    397        
     397
    398398        if (d->vendor_id != 0) {
    399399                /* First, with release number. */
     
    402402                    d->vendor_id, d->product_id, (d->device_version >> 8),
    403403                    (d->device_version & 0xff));
    404        
     404
    405405                /* Next, without release number. */
    406406                ADD_MATCHID_OR_RETURN(l, 90, "usb&vendor=%#04x&product=%#04x",
     
    944944            driver->name, ddf_dev_get_name(device));
    945945        return EOK;
    946        
     946
    947947err_polling:
    948948        // TODO: Stop the polling fibril (refactor the interrupt_polling func)
Note: See TracChangeset for help on using the changeset viewer.