Changes in uspace/drv/bus/usb/uhci/hc.c [d930980:7de1988c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/hc.c
rd930980 r7de1988c 105 105 * @param[out] cmds Commands buffer. 106 106 * @param[in] cmds_size Size of the commands buffer (bytes). 107 * @param[in] regs Physical address of device's registers. 108 * @param[in] reg_size Size of the register area (bytes). 107 * @param[in] regs Device's register range. 109 108 * 110 109 * @return Error code. … … 112 111 int 113 112 hc_get_irq_code(irq_pio_range_t ranges[], size_t ranges_size, irq_cmd_t cmds[], 114 size_t cmds_size, uintptr_t regs, size_t reg_size)113 size_t cmds_size, addr_range_t *regs) 115 114 { 116 115 if ((ranges_size < sizeof(uhci_irq_pio_ranges)) || 117 116 (cmds_size < sizeof(uhci_irq_commands)) || 118 ( reg_size< sizeof(uhci_regs_t)))117 (RNGSZ(*regs) < sizeof(uhci_regs_t))) 119 118 return EOVERFLOW; 120 119 121 120 memcpy(ranges, uhci_irq_pio_ranges, sizeof(uhci_irq_pio_ranges)); 122 ranges[0].base = regs;121 ranges[0].base = RNGABS(*regs); 123 122 124 123 memcpy(cmds, uhci_irq_commands, sizeof(uhci_irq_commands)); 125 uhci_regs_t *registers = (uhci_regs_t *) regs;124 uhci_regs_t *registers = (uhci_regs_t *) RNGABSPTR(*regs); 126 125 cmds[0].addr = ®isters->usbsts; 127 126 cmds[3].addr = ®isters->usbsts; … … 133 132 * 134 133 * @param[in] device Host controller DDF device 135 * @param[in] reg_base Register range base 136 * @param[in] reg_size Register range size 134 * @param[in] regs Register range 137 135 * @param[in] irq Interrupt number 138 136 * @paran[in] handler Interrupt handler … … 140 138 * @return EOK on success or negative error code 141 139 */ 142 int hc_register_irq_handler(ddf_dev_t *device, uintptr_t reg_base, size_t reg_size,143 int irq, interrupt_handler_t handler)140 int hc_register_irq_handler(ddf_dev_t *device, addr_range_t *regs, int irq, 141 interrupt_handler_t handler) 144 142 { 145 143 int rc; … … 147 145 irq_cmd_t irq_cmds[hc_irq_cmd_count]; 148 146 rc = hc_get_irq_code(irq_ranges, sizeof(irq_ranges), irq_cmds, 149 sizeof(irq_cmds), reg _base, reg_size);147 sizeof(irq_cmds), regs); 150 148 if (rc != EOK) { 151 149 usb_log_error("Failed to generate IRQ commands: %s.\n", … … 232 230 * 233 231 * @param[in] instance Memory place to initialize. 234 * @param[in] regs Address of I/O control registers. 235 * @param[in] reg_size Size of I/O control registers. 232 * @param[in] regs Range of device's I/O control registers. 236 233 * @param[in] interrupts True if hw interrupts should be used. 237 234 * @return Error code. … … 241 238 * interrupt fibrils. 242 239 */ 243 int hc_init(hc_t *instance, void *regs, size_t reg_size, bool interrupts)244 { 245 assert(reg _size >= sizeof(uhci_regs_t));240 int hc_init(hc_t *instance, addr_range_t *regs, bool interrupts) 241 { 242 assert(regs->size >= sizeof(uhci_regs_t)); 246 243 int rc; 247 244 … … 251 248 /* allow access to hc control registers */ 252 249 uhci_regs_t *io; 253 rc = pio_enable (regs, reg_size, (void **)&io);250 rc = pio_enable_range(regs, (void **) &io); 254 251 if (rc != EOK) { 255 252 usb_log_error("Failed to gain access to registers at %p: %s.\n", … … 260 257 instance->registers = io; 261 258 usb_log_debug( 262 "Device registers at %p (%zuB) accessible.\n", io, reg _size);259 "Device registers at %p (%zuB) accessible.\n", io, regs->size); 263 260 264 261 rc = hc_init_mem_structures(instance);
Note:
See TracChangeset
for help on using the changeset viewer.