Changeset 5ac5eb1 in mainline
- Timestamp:
- 2017-07-13T14:26:47Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8db42f7
- Parents:
- c362127
- Location:
- uspace/drv/bus/usb/xhci
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/commands.c
rc362127 r5ac5eb1 81 81 trb.control |= host2xhci(32, hc->command_ring.pcs); 82 82 83 // TODO: Setup input control context. 83 return enqueue_trb(hc, &trb, 0, 0); 84 } 85 86 int xhci_send_disable_slot_command(xhci_hc_t *hc, uint32_t slot_id) 87 { 88 xhci_trb_t trb; 89 memset(&trb, 0, sizeof(trb)); 90 91 trb.control = host2xhci(32, XHCI_TRB_TYPE_DISABLE_SLOT_CMD << 10); 92 trb.control |= host2xhci(32, hc->command_ring.pcs); 93 trb.control |= host2xhci(32, slot_id << 24); 84 94 85 95 return enqueue_trb(hc, &trb, 0, 0); … … 88 98 int xhci_handle_command_completion(xhci_hc_t *hc, xhci_trb_t *trb) 89 99 { 90 usb_log_debug 2("HC(%p) Command completed.", hc);100 usb_log_debug("HC(%p) Command completed.", hc); 91 101 xhci_dump_trb(trb); 92 102 93 int code = XHCI_DWORD_EXTRACT(trb->status, 31, 24); 103 int code; 104 uint32_t slot_id; 105 xhci_trb_t *command; 94 106 95 xhci_trb_t *command = (xhci_trb_t *) XHCI_QWORD_EXTRACT(trb->parameter, 63, 4); 107 code = XHCI_DWORD_EXTRACT(trb->status, 31, 24); 108 command = (xhci_trb_t *) XHCI_QWORD_EXTRACT(trb->parameter, 63, 4); 109 slot_id = XHCI_DWORD_EXTRACT(trb->control, 31, 24); 110 (void) slot_id; 96 111 97 switch (TRB_TYPE(*command)) {112 switch (TRB_TYPE(*command)) { 98 113 case XHCI_TRB_TYPE_NO_OP_CMD: 99 114 assert(code == XHCI_TRBC_TRB_ERROR); 100 115 break; 101 116 case XHCI_TRB_TYPE_ENABLE_SLOT_CMD: 102 {103 uint32_t slot_id = XHCI_DWORD_EXTRACT(trb->control, 31, 24);104 (void) slot_id;105 117 // TODO: Call a device addition callback once it's implemented. 106 // Also check for a suitable type of the slot id.107 118 break; 108 } 119 case XHCI_TRB_TYPE_DISABLE_SLOT_CMD: 120 if (code == XHCI_TRBC_SLOT_NOT_ENABLED_ERROR) 121 usb_log_debug2("Slot ID to be disabled was not enabled."); 122 // TODO: Call a device removal callback that will deallocate associated 123 // data structures once it's implemented. 124 break; 109 125 default: 110 usb_log_warning("HC(%p) Command of an unsupported type has been completed.", hc); 126 usb_log_debug2("Unsupported command trb."); 127 xhci_dump_trb(command); 111 128 break; 112 129 } -
uspace/drv/bus/usb/xhci/commands.h
rc362127 r5ac5eb1 42 42 int xhci_send_no_op_command(xhci_hc_t *); 43 43 int xhci_send_enable_slot_command(xhci_hc_t *); 44 int xhci_send_disable_slot_command(xhci_hc_t *, uint32_t); 44 45 45 46 int xhci_handle_command_completion(xhci_hc_t *, xhci_trb_t *); -
uspace/drv/bus/usb/xhci/hc.c
rc362127 r5ac5eb1 360 360 static void hc_handle_event(xhci_hc_t *hc, xhci_trb_t *trb) 361 361 { 362 switch (TRB_TYPE(*trb)) {362 switch (TRB_TYPE(*trb)) { 363 363 case XHCI_TRB_TYPE_COMMAND_COMPLETION_EVENT: 364 364 xhci_handle_command_completion(hc, trb);
Note:
See TracChangeset
for help on using the changeset viewer.