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

Changeset 6d91888 in mainline


Ignore:
Timestamp:
2017-11-21T12:51:37Z (4 years ago)
Author:
Aearsis <Hlavaty.Ondrej@…>
Branches:
lfn, master
Children:
6283cefb
Parents:
375211d2
Message:

xhci: deal with short transfers

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

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/hw_struct/trb.h

    r375211d2 r6d91888  
    211211}
    212212
    213 enum xhci_trb_completion_code {
     213typedef enum xhci_trb_completion_code {
    214214        XHCI_TRBC_INVALID = 0,
    215215        XHCI_TRBC_SUCCESS,
     
    255255         * 224 - 255 vendor defined info
    256256         */
    257 };
     257} xhci_trb_completion_code_t;
    258258
    259259#endif
  • uspace/drv/bus/usb/xhci/transfers.c

    r375211d2 r6d91888  
    444444        }
    445445
    446         batch->error = (TRB_COMPLETION_CODE(*trb) == XHCI_TRBC_SUCCESS) ? EOK : ENAK;
    447         batch->transfered_size = batch->buffer_size - TRB_TRANSFER_LENGTH(*trb);
     446        const xhci_trb_completion_code_t completion_code = TRB_COMPLETION_CODE(*trb);
     447        switch (completion_code) {
     448                case XHCI_TRBC_SHORT_PACKET:
     449                        usb_log_debug("Short transfer.");
     450                        /* fallthrough */
     451                case XHCI_TRBC_SUCCESS:
     452                        batch->error = EOK;
     453                        batch->transfered_size = batch->buffer_size - TRB_TRANSFER_LENGTH(*trb);
     454                        break;
     455
     456                default:
     457                        usb_log_warning("Transfer not successfull: %u", completion_code);
     458                        batch->error = EIO;
     459        }
     460
    448461        usb_transfer_batch_reset_toggle(batch);
    449462        endpoint_deactivate_locked(&ep->base);
Note: See TracChangeset for help on using the changeset viewer.