Changeset e4d7363 in mainline for uspace/drv/bus/usb/ehci/hc.c
- Timestamp:
- 2017-06-22T21:34:39Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 91ca111
- Parents:
- cb89430
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/hc.c
rcb89430 re4d7363 89 89 }; 90 90 91 static void hc_start(hc_t *instance);92 91 static int hc_init_memory(hc_t *instance); 93 92 … … 98 97 * @return Error code. 99 98 */ 100 int ehci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res)99 int ehci_hc_gen_irq_code(irq_code_t *code, hcd_t *hcd, const hw_res_list_parsed_t *hw_res) 101 100 { 102 101 assert(code); 103 102 assert(hw_res); 103 104 hc_t *instance = hcd_get_driver_data(hcd); 104 105 105 106 if (hw_res->irqs.count != 1 || hw_res->mem_ranges.count != 1) … … 128 129 129 130 memcpy(code->cmds, ehci_irq_commands, sizeof(ehci_irq_commands)); 130 ehci_caps_regs_t *caps = NULL; 131 132 int ret = pio_enable_range(®s, (void**)&caps); 133 if (ret != EOK) { 134 free(code->ranges); 135 free(code->cmds); 136 return ret; 137 } 138 139 ehci_regs_t *registers = 140 (ehci_regs_t *)(RNGABSPTR(regs) + EHCI_RD8(caps->caplength)); 141 code->cmds[0].addr = (void *) ®isters->usbsts; 142 code->cmds[3].addr = (void *) ®isters->usbsts; 131 132 code->cmds[0].addr = (void *) &instance->registers->usbsts; 133 code->cmds[3].addr = (void *) &instance->registers->usbsts; 143 134 EHCI_WR(code->cmds[1].value, EHCI_USED_INTERRUPTS); 144 135 … … 156 147 * @return Error code 157 148 */ 158 int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res , bool interrupts)149 int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res) 159 150 { 160 151 assert(instance); … … 172 163 return ret; 173 164 } 165 174 166 usb_log_info("HC(%p): Device registers at %"PRIx64" (%zuB) accessible.", 175 167 instance, hw_res->mem_ranges.ranges[0].address.absolute, … … 195 187 ehci_rh_init( 196 188 &instance->rh, instance->caps, instance->registers, "ehci rh"); 197 usb_log_debug("HC(%p): Starting HW.", instance);198 hc_start(instance);199 189 200 190 return EOK; … … 368 358 * @param[in] instance EHCI hc driver structure. 369 359 */ 370 void hc_start(hc_t *instance) 371 { 372 assert(instance); 360 int hc_start(hc_t *instance, bool interrupts) 361 { 362 assert(instance); 363 usb_log_debug("HC(%p): Starting HW.", instance); 364 373 365 /* Turn off the HC if it's running, Reseting a running device is 374 366 * undefined */ … … 435 427 EHCI_WR(instance->registers->usbsts, EHCI_RD(instance->registers->usbsts)); 436 428 EHCI_WR(instance->registers->usbintr, EHCI_USED_INTERRUPTS); 429 430 return EOK; 437 431 } 438 432
Note:
See TracChangeset
for help on using the changeset viewer.