Changeset e50bdd92 in mainline


Ignore:
Timestamp:
2017-07-23T19:14:43Z (7 years ago)
Author:
Jaroslav Jindrak <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c46c356
Parents:
c4d4fa2
Message:

Event handler now processes all event trbs that belong to us on the event ring. Also added some command testing code to hc_schedule (temporary).

File:
1 edited

Legend:

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

    rc4d4fa2 re50bdd92  
    354354int hc_schedule(xhci_hc_t *hc, usb_transfer_batch_t *batch)
    355355{
     356        // TODO: This function currently contains cmd ring testing
     357        //       stuff, remove it.
     358        xhci_cmd_t *cmd = xhci_alloc_command();
    356359        xhci_dump_state(hc);
    357         xhci_send_no_op_command(hc, NULL);
    358         async_usleep(1000);
     360        xhci_send_no_op_command(hc, cmd);
     361        xhci_wait_for_command(cmd, 1000000);
     362        xhci_free_command(cmd);
     363
    359364        xhci_dump_state(hc);
    360         async_usleep(10000);
    361         xhci_send_no_op_command(hc, NULL);
     365
     366        for (int i = 0; i < 10; ++i) {
     367                xhci_cmd_t *cmd2 = xhci_alloc_command();
     368                xhci_send_enable_slot_command(hc, cmd2);
     369                xhci_wait_for_command(cmd2, 1000000);
     370                usb_log_error("Enabled slot ID: %u.", cmd2->slot_id);
     371                xhci_free_command(cmd2);
     372        }
     373
    362374
    363375        xhci_dump_trb(hc->event_ring.dequeue_trb);
     
    386398        xhci_trb_t trb;
    387399
    388         // TODO: Apparently we are supposed to process events until ering is empty
    389         //       and then update the erdp?
    390400        err = xhci_event_ring_dequeue(event_ring, &trb);;
    391401
    392         switch (err) {
    393         case EOK:
    394                 usb_log_debug2("Dequeued from event ring.");
    395                 xhci_dump_trb(&trb);
    396 
    397                 hc_handle_event(hc, &trb);
    398                 break;
    399         case ENOENT:
    400                 usb_log_debug2("Event ring finished.");
    401                 break;
    402         default:
    403                 usb_log_warning("Error while accessing event ring: %s", str_error(err));
    404         }
     402        while (err != ENOENT) {
     403                if (err == EOK) {
     404                        usb_log_debug2("Dequeued from event ring.");
     405                        xhci_dump_trb(&trb);
     406
     407                        hc_handle_event(hc, &trb);
     408                } else {
     409                        usb_log_warning("Error while accessing event ring: %s", str_error(err));
     410                        break;
     411                }
     412
     413                err = xhci_event_ring_dequeue(event_ring, &trb);;
     414        }
     415        usb_log_debug2("Event ring processing finished.");
    405416
    406417        /* Update the ERDP to make room in the ring */
Note: See TracChangeset for help on using the changeset viewer.