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

    re3a07bba rba4a03a5  
    102102/** Generate IRQ code.
    103103 * @param[out] code IRQ code structure.
    104  * @param[in] regs Device's register range.
     104 * @param[in] hw_res Device's resources.
    105105 *
    106106 * @return Error code.
    107107 */
    108 int hc_gen_irq_code(irq_code_t *code, addr_range_t *regs)
     108int hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res)
    109109{
    110110        assert(code);
    111 
    112         if (RNGSZ(*regs) < sizeof(uhci_regs_t))
     111        assert(hw_res);
     112
     113        if (hw_res->irqs.count != 1 || hw_res->io_ranges.count != 1)
     114                return EINVAL;
     115        const addr_range_t regs = hw_res->io_ranges.ranges[0];
     116
     117        if (RNGSZ(regs) < sizeof(uhci_regs_t))
    113118                return EOVERFLOW;
    114119
     
    127132
    128133        memcpy(code->ranges, uhci_irq_pio_ranges, sizeof(uhci_irq_pio_ranges));
    129         code->ranges[0].base = RNGABS(*regs);
     134        code->ranges[0].base = RNGABS(regs);
    130135
    131136        memcpy(code->cmds, uhci_irq_commands, sizeof(uhci_irq_commands));
    132         uhci_regs_t *registers = (uhci_regs_t *) RNGABSPTR(*regs);
     137        uhci_regs_t *registers = (uhci_regs_t *) RNGABSPTR(regs);
    133138        code->cmds[0].addr = (void*)&registers->usbsts;
    134139        code->cmds[3].addr = (void*)&registers->usbsts;
    135140
    136         return EOK;
     141        usb_log_debug("I/O 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];
    137145}
    138146
Note: See TracChangeset for help on using the changeset viewer.