Changeset ba4a03a5 in mainline for uspace/drv/bus/usb/ehci/hc.c
- Timestamp:
- 2013-12-31T23:11:00Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d1df381
- Parents:
- e3a07bba
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/hc.c
re3a07bba rba4a03a5 99 99 * @param[out] cmds Commands buffer. 100 100 * @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. 102 102 * 103 103 * @return Error code. 104 104 */ 105 int hc_gen_irq_code(irq_code_t *code, addr_range_t *regs)105 int hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res) 106 106 { 107 107 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)) 109 116 return EOVERFLOW; 110 117 … … 123 130 124 131 memcpy(code->ranges, ehci_pio_ranges, sizeof(ehci_pio_ranges)); 125 code->ranges[0].base = RNGABS( *regs);132 code->ranges[0].base = RNGABS(regs); 126 133 127 134 memcpy(code->cmds, ehci_irq_commands, sizeof(ehci_irq_commands)); 128 135 ehci_caps_regs_t *caps = NULL; 129 int ret = pio_enable_range( regs, (void**)&caps);136 int ret = pio_enable_range(®s, (void**)&caps); 130 137 if (ret != EOK) { 131 138 return ret; 132 139 } 133 140 ehci_regs_t *registers = 134 (ehci_regs_t *)(RNGABSPTR( *regs) + EHCI_RD8(caps->caplength));141 (ehci_regs_t *)(RNGABSPTR(regs) + EHCI_RD8(caps->caplength)); 135 142 code->cmds[0].addr = (void *) ®isters->usbsts; 136 143 code->cmds[3].addr = (void *) ®isters->usbsts; 137 144 EHCI_WR(code->cmds[1].value, EHCI_USED_INTERRUPTS); 138 145 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]; 140 150 } 141 151
Note:
See TracChangeset
for help on using the changeset viewer.