Changes in uspace/drv/bus/usb/ehci/hc.c [8d2dd7f2:741bcdeb] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/hc.c
r8d2dd7f2 r741bcdeb 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 131 139 132 ehci_regs_t *registers = 140 (ehci_regs_t *)(RNGABSPTR(regs) + EHCI_RD8(caps->caplength));133 (ehci_regs_t *)(RNGABSPTR(regs) + EHCI_RD8(instance->caps->caplength)); 141 134 code->cmds[0].addr = (void *) ®isters->usbsts; 142 135 code->cmds[3].addr = (void *) ®isters->usbsts; … … 156 149 * @return Error code 157 150 */ 158 int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res , bool interrupts)151 int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res) 159 152 { 160 153 assert(instance); … … 172 165 return ret; 173 166 } 167 174 168 usb_log_info("HC(%p): Device registers at %"PRIx64" (%zuB) accessible.", 175 169 instance, hw_res->mem_ranges.ranges[0].address.absolute, … … 195 189 ehci_rh_init( 196 190 &instance->rh, instance->caps, instance->registers, "ehci rh"); 197 usb_log_debug("HC(%p): Starting HW.", instance); 198 hc_start(instance); 199 191 192 ehci_bus_init(&instance->bus, instance); 200 193 return EOK; 201 194 } … … 222 215 ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep); 223 216 usb_log_debug("HC(%p) enqueue EP(%d:%d:%s:%s)\n", instance, 224 ep-> address, ep->endpoint,217 ep->target.address, ep->target.endpoint, 225 218 usb_str_transfer_type_short(ep->transfer_type), 226 219 usb_str_direction(ep->direction)); … … 246 239 ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep); 247 240 usb_log_debug("HC(%p) dequeue EP(%d:%d:%s:%s)\n", instance, 248 ep-> address, ep->endpoint,241 ep->target.address, ep->target.endpoint, 249 242 usb_str_transfer_type_short(ep->transfer_type), 250 243 usb_str_direction(ep->direction)); … … 298 291 299 292 /* Check for root hub communication */ 300 if (batch->ep-> address == ehci_rh_get_address(&instance->rh)) {293 if (batch->ep->target.address == ehci_rh_get_address(&instance->rh)) { 301 294 usb_log_debug("HC(%p): Scheduling BATCH(%p) for RH(%p)", 302 295 instance, batch, &instance->rh); … … 368 361 * @param[in] instance EHCI hc driver structure. 369 362 */ 370 void hc_start(hc_t *instance) 371 { 372 assert(instance); 363 int hc_start(hc_t *instance, bool interrupts) 364 { 365 assert(instance); 366 usb_log_debug("HC(%p): Starting HW.", instance); 367 373 368 /* Turn off the HC if it's running, Reseting a running device is 374 369 * undefined */ … … 435 430 EHCI_WR(instance->registers->usbsts, EHCI_RD(instance->registers->usbsts)); 436 431 EHCI_WR(instance->registers->usbintr, EHCI_USED_INTERRUPTS); 432 433 return EOK; 437 434 } 438 435
Note:
See TracChangeset
for help on using the changeset viewer.