Changeset 3bacee1 in mainline for uspace/drv/bus/usb/uhci/hc.c
- Timestamp:
- 2018-04-12T16:27:17Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3cf22f9
- Parents:
- 76d0981d
- git-author:
- Jiri Svoboda <jiri@…> (2018-04-11 19:25:33)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-04-12 16:27:17)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/hc.c
r76d0981d r3bacee1 142 142 memcpy(code->cmds, uhci_irq_commands, sizeof(uhci_irq_commands)); 143 143 uhci_regs_t *registers = (uhci_regs_t *) RNGABSPTR(regs); 144 code->cmds[0].addr = (void *)®isters->usbsts;145 code->cmds[3].addr = (void *)®isters->usbsts;144 code->cmds[0].addr = (void *)®isters->usbsts; 145 code->cmds[3].addr = (void *)®isters->usbsts; 146 146 147 147 usb_log_debug("I/O regs at %p (size %zu), IRQ %d.", … … 215 215 if (hw_res->io_ranges.count != 1 || 216 216 hw_res->io_ranges.ranges[0].size < sizeof(uhci_regs_t)) 217 217 return EINVAL; 218 218 219 219 instance->hw_failures = 0; … … 224 224 if (ret != EOK) { 225 225 usb_log_error("Failed to gain access to registers: %s.", 226 226 str_error(ret)); 227 227 return ret; 228 228 } … … 285 285 /* Reset hc, all states and counters. Hope that hw is not broken */ 286 286 pio_write_16(®isters->usbcmd, UHCI_CMD_HCRESET); 287 do { async_usleep(10); } 288 while ((pio_read_16(®isters->usbcmd) & UHCI_CMD_HCRESET) != 0); 287 do { 288 async_usleep(10); 289 } while ((pio_read_16(®isters->usbcmd) & UHCI_CMD_HCRESET) != 0); 289 290 290 291 /* Set frame to exactly 1ms */ … … 331 332 static errno_t endpoint_register(endpoint_t *ep) 332 333 { 333 hc_t * 334 hc_t *const hc = bus_to_hc(endpoint_get_bus(ep)); 334 335 335 336 const errno_t err = usb2_bus_endpoint_register(&hc->bus_helper, ep); … … 353 354 static void endpoint_unregister(endpoint_t *ep) 354 355 { 355 hc_t * 356 hc_t *const hc = bus_to_hc(endpoint_get_bus(ep)); 356 357 usb2_bus_endpoint_unregister(&hc->bus_helper, ep); 357 358 … … 390 391 } 391 392 392 uhci_transfer_batch_t * 393 393 uhci_transfer_batch_t *const batch = 394 uhci_transfer_batch_get(ep->active_batch); 394 395 395 396 /* Remove the batch from the schedule to stop it from being finished. */ … … 412 413 static int device_enumerate(device_t *dev) 413 414 { 414 hc_t * 415 hc_t *const hc = bus_to_hc(dev->bus); 415 416 return usb2_bus_device_enumerate(&hc->bus_helper, dev); 416 417 } … … 418 419 static void device_gone(device_t *dev) 419 420 { 420 hc_t * 421 hc_t *const hc = bus_to_hc(dev->bus); 421 422 usb2_bus_device_gone(&hc->bus_helper, dev); 422 423 } … … 482 483 /* Set all frames to point to the first queue head */ 483 484 const uint32_t queue = LINK_POINTER_QH( 484 485 addr_to_phys(instance->transfers_interrupt.queue_head)); 485 486 486 487 for (unsigned i = 0; i < UHCI_FRAME_LIST_COUNT; ++i) { … … 524 525 /* Connect lists into one schedule */ 525 526 transfer_list_set_next(&instance->transfers_control_full, 526 527 &instance->transfers_bulk_full); 527 528 transfer_list_set_next(&instance->transfers_control_slow, 528 529 &instance->transfers_control_full); 529 530 transfer_list_set_next(&instance->transfers_interrupt, 530 531 &instance->transfers_control_slow); 531 532 532 533 /*FSBR, This feature is not needed (adds no benefit) and is supposedly … … 539 540 /* Assign pointers to be used during scheduling */ 540 541 instance->transfers[USB_SPEED_FULL][USB_TRANSFER_INTERRUPT] = 541 &instance->transfers_interrupt;542 &instance->transfers_interrupt; 542 543 instance->transfers[USB_SPEED_LOW][USB_TRANSFER_INTERRUPT] = 543 &instance->transfers_interrupt;544 &instance->transfers_interrupt; 544 545 instance->transfers[USB_SPEED_FULL][USB_TRANSFER_CONTROL] = 545 &instance->transfers_control_full;546 &instance->transfers_control_full; 546 547 instance->transfers[USB_SPEED_LOW][USB_TRANSFER_CONTROL] = 547 &instance->transfers_control_slow;548 &instance->transfers_control_slow; 548 549 instance->transfers[USB_SPEED_FULL][USB_TRANSFER_BULK] = 549 &instance->transfers_bulk_full;550 &instance->transfers_bulk_full; 550 551 551 552 return EOK; … … 582 583 return uhci_rh_schedule(&hc->rh, batch); 583 584 584 transfer_list_t * 585 transfer_list_t *const list = 585 586 hc->transfers[ep->device->speed][ep->transfer_type]; 586 587 … … 629 630 int frnum = pio_read_16(&instance->registers->frnum) & 0x3ff; 630 631 631 uintptr_t expected_pa = instance->frame_list[frnum] 632 &LINK_POINTER_ADDRESS_MASK;632 uintptr_t expected_pa = instance->frame_list[frnum] & 633 LINK_POINTER_ADDRESS_MASK; 633 634 uintptr_t real_pa = addr_to_phys(QH(interrupt)); 634 635 if (expected_pa != real_pa) { … … 653 654 expected_pa = QH(control_full)->next & LINK_POINTER_ADDRESS_MASK; 654 655 real_pa = addr_to_phys(QH(bulk_full)); 655 if (expected_pa != real_pa 656 if (expected_pa != real_pa) { 656 657 usb_log_debug("Bulk QH: %p vs. %p.", 657 658 (void *) expected_pa, (void *) real_pa);
Note:
See TracChangeset
for help on using the changeset viewer.