Changes in uspace/drv/bus/usb/ehci/hc.c [8d2dd7f2:a5b3de6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/hc.c
r8d2dd7f2 ra5b3de6 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->device->address, ep->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->device->address, ep->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->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); 303 296 return ehci_rh_schedule(&instance->rh, batch); 304 297 } 298 305 299 ehci_transfer_batch_t *ehci_batch = ehci_transfer_batch_get(batch); 306 if (!ehci_batch) 307 return ENOMEM; 300 301 const int err = ehci_transfer_batch_prepare(ehci_batch); 302 if (err) 303 return err; 308 304 309 305 fibril_mutex_lock(&instance->guard); … … 350 346 ehci_transfer_batch_from_link(current); 351 347 352 if (ehci_transfer_batch_ is_complete(batch)) {348 if (ehci_transfer_batch_check_completed(batch)) { 353 349 list_remove(current); 354 ehci_transfer_batch_finish_dispose(batch);350 usb_transfer_batch_finish(&batch->base); 355 351 } 356 352 } … … 368 364 * @param[in] instance EHCI hc driver structure. 369 365 */ 370 void hc_start(hc_t *instance) 371 { 372 assert(instance); 366 int hc_start(hc_t *instance, bool interrupts) 367 { 368 assert(instance); 369 usb_log_debug("HC(%p): Starting HW.", instance); 370 373 371 /* Turn off the HC if it's running, Reseting a running device is 374 372 * undefined */ … … 435 433 EHCI_WR(instance->registers->usbsts, EHCI_RD(instance->registers->usbsts)); 436 434 EHCI_WR(instance->registers->usbintr, EHCI_USED_INTERRUPTS); 435 436 return EOK; 437 437 } 438 438
Note:
See TracChangeset
for help on using the changeset viewer.