Changeset 0c2d9bb in mainline for uspace/drv/bus/usb/ohci/hc.c
- Timestamp:
- 2013-12-25T22:54:29Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b51cf2c
- Parents:
- f7a33de (diff), ac36aed (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/hc.c
rf7a33de r0c2d9bb 106 106 * @param[out] cmds Commands buffer. 107 107 * @param[in] cmds_size Size of the commands buffer (bytes). 108 * @param[in] regs Physical address of device's registers. 109 * @param[in] reg_size Size of the register area (bytes). 108 * @param[in] regs Device's register range. 110 109 * 111 110 * @return Error code. … … 113 112 int 114 113 hc_get_irq_code(irq_pio_range_t ranges[], size_t ranges_size, irq_cmd_t cmds[], 115 size_t cmds_size, uintptr_t regs, size_t reg_size)114 size_t cmds_size, addr_range_t *regs) 116 115 { 117 116 if ((ranges_size < sizeof(ohci_pio_ranges)) || 118 117 (cmds_size < sizeof(ohci_irq_commands)) || 119 ( reg_size< sizeof(ohci_regs_t)))118 (RNGSZ(*regs) < sizeof(ohci_regs_t))) 120 119 return EOVERFLOW; 121 120 122 121 memcpy(ranges, ohci_pio_ranges, sizeof(ohci_pio_ranges)); 123 ranges[0].base = regs;122 ranges[0].base = RNGABS(*regs); 124 123 125 124 memcpy(cmds, ohci_irq_commands, sizeof(ohci_irq_commands)); 126 ohci_regs_t *registers = (ohci_regs_t *) regs;125 ohci_regs_t *registers = (ohci_regs_t *) RNGABSPTR(*regs); 127 126 cmds[0].addr = (void *) ®isters->interrupt_status; 128 127 cmds[3].addr = (void *) ®isters->interrupt_status; … … 135 134 * 136 135 * @param[in] device Host controller DDF device 137 * @param[in] reg_base Register range base 138 * @param[in] reg_size Register range size 136 * @param[in] regs Register range 139 137 * @param[in] irq Interrupt number 140 138 * @paran[in] handler Interrupt handler … … 142 140 * @return EOK on success or negative error code 143 141 */ 144 int hc_register_irq_handler(ddf_dev_t *device, uintptr_t reg_base, size_t reg_size,145 int irq, interrupt_handler_t handler)142 int hc_register_irq_handler(ddf_dev_t *device, addr_range_t *regs, int irq, 143 interrupt_handler_t handler) 146 144 { 147 145 int rc; … … 158 156 159 157 rc = hc_get_irq_code(irq_ranges, sizeof(irq_ranges), irq_cmds, 160 sizeof(irq_cmds), reg _base, reg_size);158 sizeof(irq_cmds), regs); 161 159 if (rc != EOK) { 162 160 usb_log_error("Failed to generate IRQ code: %s.\n", … … 259 257 * 260 258 * @param[in] instance Memory place for the structure. 261 * @param[in] regs Address of the memory mapped I/O registers. 262 * @param[in] reg_size Size of the memory mapped area. 259 * @param[in] regs Device's I/O registers range. 263 260 * @param[in] interrupts True if w interrupts should be used 264 261 * @return Error code 265 262 */ 266 int hc_init(hc_t *instance, uintptr_t regs, size_t reg_size, bool interrupts) 267 { 268 assert(instance); 269 270 int rc = 271 pio_enable((void*)regs, reg_size, (void**)&instance->registers); 263 int hc_init(hc_t *instance, addr_range_t *regs, bool interrupts) 264 { 265 assert(instance); 266 267 int rc = pio_enable_range(regs, (void **) &instance->registers); 272 268 if (rc != EOK) { 273 269 usb_log_error("Failed to gain access to device registers: %s.\n",
Note:
See TracChangeset
for help on using the changeset viewer.