Changeset 3bacee1 in mainline for uspace/drv/bus/usb/ehci/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/ehci/hc.c
r76d0981d r3bacee1 133 133 134 134 ehci_regs_t *registers = 135 135 (ehci_regs_t *)(RNGABSPTR(regs) + EHCI_RD8(instance->caps->caplength)); 136 136 code->cmds[0].addr = (void *) ®isters->usbsts; 137 137 code->cmds[3].addr = (void *) ®isters->usbsts; … … 158 158 if (hw_res->mem_ranges.count != 1 || 159 159 hw_res->mem_ranges.ranges[0].size < 160 161 160 (sizeof(ehci_caps_regs_t) + sizeof(ehci_regs_t))) 161 return EINVAL; 162 162 163 163 errno_t ret = pio_enable_range(&hw_res->mem_ranges.ranges[0], … … 169 169 } 170 170 171 usb_log_info("HC(%p): Device registers at %" PRIx64" (%zuB) accessible.",171 usb_log_info("HC(%p): Device registers at %" PRIx64 " (%zuB) accessible.", 172 172 instance, hw_res->mem_ranges.ranges[0].address.absolute, 173 173 hw_res->mem_ranges.ranges[0].size); 174 174 instance->registers = 175 (void *)instance->caps + EHCI_RD8(instance->caps->caplength);175 (void *)instance->caps + EHCI_RD8(instance->caps->caplength); 176 176 usb_log_info("HC(%p): Device control registers at %" PRIx64, instance, 177 hw_res->mem_ranges.ranges[0].address.absolute 178 +EHCI_RD8(instance->caps->caplength));177 hw_res->mem_ranges.ranges[0].address.absolute + 178 EHCI_RD8(instance->caps->caplength)); 179 179 180 180 list_initialize(&instance->pending_endpoints); … … 221 221 usb_str_transfer_type_short(ep->transfer_type), 222 222 usb_str_direction(ep->direction)); 223 switch (ep->transfer_type) 224 { 223 switch (ep->transfer_type) { 225 224 case USB_TRANSFER_CONTROL: 226 225 case USB_TRANSFER_BULK: … … 245 244 usb_str_transfer_type_short(ep->transfer_type), 246 245 usb_str_direction(ep->direction)); 247 switch (ep->transfer_type) 248 { 246 switch (ep->transfer_type) { 249 247 case USB_TRANSFER_INTERRUPT: 250 248 endpoint_list_remove_ep(&instance->int_list, ehci_ep); … … 305 303 } 306 304 307 endpoint_t * 308 ehci_endpoint_t * 305 endpoint_t *const ep = batch->ep; 306 ehci_endpoint_t *const ehci_ep = ehci_endpoint_get(ep); 309 307 ehci_transfer_batch_t *ehci_batch = ehci_transfer_batch_get(batch); 310 308 … … 345 343 assert(hc); 346 344 347 usb_log_debug2("HC(%p): Interrupt: %" PRIx32, hc, status);345 usb_log_debug2("HC(%p): Interrupt: %" PRIx32, hc, status); 348 346 if (status & USB_STS_PORT_CHANGE_FLAG) { 349 347 ehci_rh_interrupt(&hc->rh); … … 361 359 362 360 usb_log_debug2("HC(%p): Scanning %lu pending endpoints", hc, 363 361 list_count(&hc->pending_endpoints)); 364 362 list_foreach_safe(hc->pending_endpoints, current, next) { 365 ehci_endpoint_t *ep 366 =list_get_instance(current, ehci_endpoint_t, pending_link);367 368 ehci_transfer_batch_t *batch 369 =ehci_transfer_batch_get(ep->base.active_batch);363 ehci_endpoint_t *ep = 364 list_get_instance(current, ehci_endpoint_t, pending_link); 365 366 ehci_transfer_batch_t *batch = 367 ehci_transfer_batch_get(ep->base.active_batch); 370 368 assert(batch); 371 369 … … 429 427 assert(instance->periodic_list); 430 428 uintptr_t phys_base = 431 addr_to_phys((void *)instance->periodic_list);429 addr_to_phys((void *)instance->periodic_list); 432 430 assert((phys_base & USB_PERIODIC_LIST_BASE_MASK) == phys_base); 433 431 EHCI_WR(instance->registers->periodiclistbase, phys_base); … … 437 435 438 436 /* Enable Async schedule */ 439 phys_base = addr_to_phys((void *)instance->async_list.list_head);437 phys_base = addr_to_phys((void *)instance->async_list.list_head); 440 438 assert((phys_base & USB_ASYNCLIST_MASK) == phys_base); 441 439 EHCI_WR(instance->registers->asynclistaddr, phys_base); … … 516 514 517 515 usb_log_debug2("HC(%p): Initializing Periodic list.", instance); 518 for (unsigned i = 0; i < PAGE_SIZE/sizeof(link_pointer_t); ++i) 519 { 516 for (unsigned i = 0; i < PAGE_SIZE / sizeof(link_pointer_t); ++i) { 520 517 /* Disable everything for now */ 521 518 instance->periodic_list[i] =
Note:
See TracChangeset
for help on using the changeset viewer.