Changeset ba4a03a5 in mainline for uspace/drv/bus/usb/ohci/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/ohci/hc.c

    re3a07bba rba4a03a5  
    100100 * @param[out] cmds Commands buffer.
    101101 * @param[in] cmds_size Size of the commands buffer (bytes).
    102  * @param[in] regs Device's register range.
     102 * @param[in] hw_res Device's resources.
    103103 *
    104104 * @return Error code.
    105105 */
    106 int hc_gen_irq_code(irq_code_t *code, addr_range_t *regs)
     106int hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res)
    107107{
    108108        assert(code);
    109         if (RNGSZ(*regs) < sizeof(ohci_regs_t))
     109        assert(hw_res);
     110
     111        if (hw_res->irqs.count != 1 || hw_res->mem_ranges.count != 1)
     112                return EINVAL;
     113
     114        const addr_range_t regs = hw_res->mem_ranges.ranges[0];
     115
     116        if (RNGSZ(regs) < sizeof(ohci_regs_t))
    110117                return EOVERFLOW;
    111118
     
    124131
    125132        memcpy(code->ranges, ohci_pio_ranges, sizeof(ohci_pio_ranges));
    126         code->ranges[0].base = RNGABS(*regs);
     133        code->ranges[0].base = RNGABS(regs);
    127134
    128135        memcpy(code->cmds, ohci_irq_commands, sizeof(ohci_irq_commands));
    129         ohci_regs_t *registers = (ohci_regs_t *) RNGABSPTR(*regs);
     136        ohci_regs_t *registers = (ohci_regs_t *) RNGABSPTR(regs);
    130137        code->cmds[0].addr = (void *) &registers->interrupt_status;
    131138        code->cmds[3].addr = (void *) &registers->interrupt_status;
    132139        OHCI_WR(code->cmds[1].value, OHCI_USED_INTERRUPTS);
    133140
    134         return EOK;
     141        usb_log_debug("Memory mapped regs at %p (size %zu), IRQ %d.\n",
     142            RNGABSPTR(regs), RNGSZ(regs), hw_res->irqs.irqs[0]);
     143
     144        return hw_res->irqs.irqs[0];
    135145}
    136146
Note: See TracChangeset for help on using the changeset viewer.