Changeset ba4a03a5 in mainline for uspace/drv/bus/usb/uhci
- Timestamp:
- 2013-12-31T23:11:00Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d1df381
- Parents:
- e3a07bba
- Location:
- uspace/drv/bus/usb/uhci
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/hc.c
re3a07bba rba4a03a5 102 102 /** Generate IRQ code. 103 103 * @param[out] code IRQ code structure. 104 * @param[in] regs Device's register range.104 * @param[in] hw_res Device's resources. 105 105 * 106 106 * @return Error code. 107 107 */ 108 int hc_gen_irq_code(irq_code_t *code, addr_range_t *regs)108 int hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res) 109 109 { 110 110 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)) 113 118 return EOVERFLOW; 114 119 … … 127 132 128 133 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); 130 135 131 136 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); 133 138 code->cmds[0].addr = (void*)®isters->usbsts; 134 139 code->cmds[3].addr = (void*)®isters->usbsts; 135 140 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]; 137 145 } 138 146 -
uspace/drv/bus/usb/uhci/hc.h
re3a07bba rba4a03a5 127 127 } hc_t; 128 128 129 int hc_gen_irq_code(irq_code_t *code, addr_range_t *regs);129 int hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res); 130 130 void hc_interrupt(hc_t *instance, uint16_t status); 131 131 int hc_init(hc_t *instance, addr_range_t *regs, bool interupts); -
uspace/drv/bus/usb/uhci/uhci.c
re3a07bba rba4a03a5 98 98 addr_range_t regs = hw_res.io_ranges.ranges[0]; 99 99 const int irq = hw_res.irqs.irqs[0]; 100 hw_res_list_parsed_clean(&hw_res);101 102 usb_log_debug("I/O regs at %p (size %zu), IRQ %d.\n",103 RNGABSPTR(regs), RNGSZ(regs), irq);104 100 105 101 ret = hcd_ddf_setup_hc(device, USB_SPEED_FULL, … … 107 103 if (ret != EOK) { 108 104 usb_log_error("Failed to setup generic HCD.\n"); 105 hw_res_list_parsed_clean(&hw_res); 109 106 return ret; 110 107 } … … 113 110 if (!hc) { 114 111 usb_log_error("Failed to allocate UHCI HC structure.\n"); 112 hw_res_list_parsed_clean(&hw_res); 115 113 ret = ENOMEM; 116 114 goto ddf_hc_clean; … … 118 116 119 117 bool interrupts = false; 120 ret = hcd_ddf_setup_interrupts(device, & regs, irq, irq_handler,118 ret = hcd_ddf_setup_interrupts(device, &hw_res, irq_handler, 121 119 hc_gen_irq_code); 122 120 if (ret != EOK) { … … 129 127 130 128 ret = hc_init(hc, ®s, interrupts); 129 hw_res_list_parsed_clean(&hw_res); 131 130 if (ret != EOK) { 132 131 usb_log_error("Failed to init uhci_hcd: %s.\n", str_error(ret));
Note:
See TracChangeset
for help on using the changeset viewer.
