Changeset ba4a03a5 in mainline for uspace/drv/bus/usb/ehci/hc.c


Ignore:
Timestamp:
2013-12-31T23:11:00Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d1df381
Parents:
e3a07bba
Message:

usb host: Use all hw resources when generating irq code.

File:
1 edited

Legend:

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

    re3a07bba rba4a03a5  
    9999 * @param[out] cmds Commands buffer.
    100100 * @param[in] cmds_size Size of the commands buffer (bytes).
    101  * @param[in] regs Device's register range.
     101 * @param[in] hw_res Device's resources.
    102102 *
    103103 * @return Error code.
    104104 */
    105 int hc_gen_irq_code(irq_code_t *code, addr_range_t *regs)
     105int hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res)
    106106{
    107107        assert(code);
    108         if (RNGSZ(*regs) < sizeof(ehci_regs_t))
     108        assert(hw_res);
     109
     110        if (hw_res->irqs.count != 1 || hw_res->mem_ranges.count != 1)
     111                return EINVAL;
     112
     113        addr_range_t regs = hw_res->mem_ranges.ranges[0];
     114
     115        if (RNGSZ(regs) < sizeof(ehci_regs_t))
    109116                return EOVERFLOW;
    110117
     
    123130
    124131        memcpy(code->ranges, ehci_pio_ranges, sizeof(ehci_pio_ranges));
    125         code->ranges[0].base = RNGABS(*regs);
     132        code->ranges[0].base = RNGABS(regs);
    126133
    127134        memcpy(code->cmds, ehci_irq_commands, sizeof(ehci_irq_commands));
    128135        ehci_caps_regs_t *caps = NULL;
    129         int ret = pio_enable_range(regs, (void**)&caps);
     136        int ret = pio_enable_range(&regs, (void**)&caps);
    130137        if (ret != EOK) {
    131138                return ret;
    132139        }
    133140        ehci_regs_t *registers =
    134             (ehci_regs_t *)(RNGABSPTR(*regs) + EHCI_RD8(caps->caplength));
     141            (ehci_regs_t *)(RNGABSPTR(regs) + EHCI_RD8(caps->caplength));
    135142        code->cmds[0].addr = (void *) &registers->usbsts;
    136143        code->cmds[3].addr = (void *) &registers->usbsts;
    137144        EHCI_WR(code->cmds[1].value, EHCI_USED_INTERRUPTS);
    138145
    139         return EOK;
     146        usb_log_debug("Memory mapped regs at %p (size %zu), IRQ %d.\n",
     147            RNGABSPTR(regs), RNGSZ(regs), hw_res->irqs.irqs[0]);
     148
     149        return hw_res->irqs.irqs[0];
    140150}
    141151
Note: See TracChangeset for help on using the changeset viewer.