Changeset 2e8a01b in mainline
- Timestamp:
- 2011-07-10T21:17:38Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1f6eb7d
- Parents:
- 1ecc5de
- Location:
- uspace/drv/bus/usb/ohci
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/hc.c
r1ecc5de r2e8a01b 177 177 * and accepts physical addresses in IRQ code. 178 178 * TODO: remove */ 179 void *registers; 180 const int ret = pio_enable((void*)regs, reg_size, ®isters); 179 ohci_regs_t *registers; 180 const int ret = pio_enable((void*)regs, reg_size, (void**)®isters); 181 182 /* Some bogus access to force create mapping. DO NOT remove, 183 * unless whole virtual addresses in irq is replaced */ 184 registers->revision; 181 185 182 186 if (ret != EOK) … … 185 189 memcpy(cmds, ohci_irq_commands, sizeof(ohci_irq_commands)); 186 190 187 void *address = (void*)& (((ohci_regs_t*)registers)->interrupt_status);191 void *address = (void*)®isters->interrupt_status; 188 192 cmds[0].addr = address; 189 193 cmds[3].addr = address; -
uspace/drv/bus/usb/ohci/ohci.c
r1ecc5de r2e8a01b 194 194 (void *) reg_base, reg_size, irq); 195 195 196 const size_t cmd_count = hc_irq_cmd_count(); 197 irq_cmd_t irq_cmds[cmd_count]; 198 ret = 199 hc_get_irq_commands(irq_cmds, sizeof(irq_cmds), reg_base, reg_size); 200 CHECK_RET_DEST_FREE_RETURN(ret, 201 "Failed to generate IRQ code: %s.\n", str_error(ret)); 202 203 irq_code_t irq_code = { .cmdcount = cmd_count, .cmds = irq_cmds }; 204 205 /* Register handler to avoid interrupt lockup */ 206 ret = register_interrupt_handler(device, irq, irq_handler, 207 &irq_code); 208 CHECK_RET_DEST_FREE_RETURN(ret, 209 "Failed(%d) to register interrupt handler.\n", ret); 210 211 /* Try to enable interrupts */ 196 212 bool interrupts = false; 197 #ifdef CONFIG_USBHC_NO_INTERRUPTS198 usb_log_warning("Interrupts disabled in OS config, "199 "falling back to polling.\n");200 #else201 213 ret = pci_enable_interrupts(device); 202 214 if (ret != EOK) { 203 usb_log_warning("Failed to enable interrupts: %s. \n",204 str_error(ret));205 usb_log_info("HW interrupts not available, "206 "falling back to polling.\n");215 usb_log_warning("Failed to enable interrupts: %s." 216 "Falling back to pollling\n", str_error(ret)); 217 /* We don't need that handler */ 218 unregister_interrupt_handler(device, irq); 207 219 } else { 208 220 usb_log_debug("Hw interrupts enabled.\n"); 209 221 interrupts = true; 210 222 } 211 #endif212 223 213 224 ret = hc_init(&instance->hc, reg_base, reg_size, interrupts); … … 216 227 #define CHECK_RET_FINI_RETURN(ret, message...) \ 217 228 if (ret != EOK) { \ 229 unregister_interrupt_handler(device, irq); \ 218 230 hc_fini(&instance->hc); \ 219 231 CHECK_RET_DEST_FREE_RETURN(ret, message); \ 220 232 } else (void)0 221 233 222 /* It does no harm if we register this on polling */223 ret = register_interrupt_handler(device, irq, irq_handler,224 &instance->hc.interrupt_code);225 CHECK_RET_FINI_RETURN(ret,226 "Failed(%d) to register interrupt handler.\n", ret);227 234 228 235 ret = ddf_fun_bind(instance->hc_fun);
Note:
See TracChangeset
for help on using the changeset viewer.