Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ehci/hc.c

    r8d2dd7f2 r741bcdeb  
    8989};
    9090
    91 static void hc_start(hc_t *instance);
    9291static int hc_init_memory(hc_t *instance);
    9392
     
    9897 * @return Error code.
    9998 */
    100 int ehci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res)
     99int ehci_hc_gen_irq_code(irq_code_t *code, hcd_t *hcd, const hw_res_list_parsed_t *hw_res)
    101100{
    102101        assert(code);
    103102        assert(hw_res);
     103
     104        hc_t *instance = hcd_get_driver_data(hcd);
    104105
    105106        if (hw_res->irqs.count != 1 || hw_res->mem_ranges.count != 1)
     
    128129
    129130        memcpy(code->cmds, ehci_irq_commands, sizeof(ehci_irq_commands));
    130         ehci_caps_regs_t *caps = NULL;
    131 
    132         int ret = pio_enable_range(&regs, (void**)&caps);
    133         if (ret != EOK) {
    134                 free(code->ranges);
    135                 free(code->cmds);
    136                 return ret;
    137         }
    138131
    139132        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));
    141134        code->cmds[0].addr = (void *) &registers->usbsts;
    142135        code->cmds[3].addr = (void *) &registers->usbsts;
     
    156149 * @return Error code
    157150 */
    158 int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)
     151int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res)
    159152{
    160153        assert(instance);
     
    172165                return ret;
    173166        }
     167
    174168        usb_log_info("HC(%p): Device registers at %"PRIx64" (%zuB) accessible.",
    175169            instance, hw_res->mem_ranges.ranges[0].address.absolute,
     
    195189        ehci_rh_init(
    196190            &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);
    200193        return EOK;
    201194}
     
    222215        ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep);
    223216        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,
    225218            usb_str_transfer_type_short(ep->transfer_type),
    226219            usb_str_direction(ep->direction));
     
    246239        ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep);
    247240        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,
    249242            usb_str_transfer_type_short(ep->transfer_type),
    250243            usb_str_direction(ep->direction));
     
    298291
    299292        /* 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)) {
    301294                usb_log_debug("HC(%p): Scheduling BATCH(%p) for RH(%p)",
    302295                    instance, batch, &instance->rh);
     
    368361 * @param[in] instance EHCI hc driver structure.
    369362 */
    370 void hc_start(hc_t *instance)
    371 {
    372         assert(instance);
     363int hc_start(hc_t *instance, bool interrupts)
     364{
     365        assert(instance);
     366        usb_log_debug("HC(%p): Starting HW.", instance);
     367
    373368        /* Turn off the HC if it's running, Reseting a running device is
    374369         * undefined */
     
    435430        EHCI_WR(instance->registers->usbsts, EHCI_RD(instance->registers->usbsts));
    436431        EHCI_WR(instance->registers->usbintr, EHCI_USED_INTERRUPTS);
     432
     433        return EOK;
    437434}
    438435
Note: See TracChangeset for help on using the changeset viewer.