Changeset 7813516 in mainline for uspace/drv/bus/usb/uhci
- Timestamp:
- 2014-01-01T01:19:10Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7191992
- Parents:
- d1df381
- Location:
- uspace/drv/bus/usb/uhci
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/hc.c
rd1df381 r7813516 212 212 * interrupt fibrils. 213 213 */ 214 int hc_init(hc_t *instance, addr_range_t *regs, bool interrupts) 215 { 216 assert(instance); 217 assert(regs); 218 assert(regs->size >= sizeof(uhci_regs_t)); 214 int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts) 215 { 216 assert(instance); 217 assert(hw_res); 218 if (hw_res->io_ranges.count != 1 || 219 hw_res->io_ranges.ranges[0].size < sizeof(uhci_regs_t)) 220 return EINVAL; 219 221 220 222 instance->hw_interrupts = interrupts; … … 222 224 223 225 /* allow access to hc control registers */ 224 uhci_regs_t *io;225 int ret = pio_enable_range(regs, (void **) &io);226 int ret = pio_enable_range(&hw_res->io_ranges.ranges[0], 227 (void **) &instance->registers); 226 228 if (ret != EOK) { 227 usb_log_error("Failed to gain access to registers at %p: %s.\n",228 io,str_error(ret));229 usb_log_error("Failed to gain access to registers: %s.\n", 230 str_error(ret)); 229 231 return ret; 230 232 } 231 instance->registers = io; 232 233 usb_log_debug(234 "Device registers at %p (%zuB) accessible.\n", io, regs->size);233 234 usb_log_debug("Device registers at %" PRIx64 " (%zuB) accessible.\n", 235 hw_res->io_ranges.ranges[0].address.absolute, 236 hw_res->io_ranges.ranges[0].size); 235 237 236 238 ret = hc_init_mem_structures(instance); … … 253 255 254 256 return EOK; 257 } 258 259 /** Safely dispose host controller internal structures 260 * 261 * @param[in] instance Host controller structure to use. 262 */ 263 void hc_fini(hc_t *instance) 264 { 265 assert(instance); 266 //TODO Implement 255 267 } 256 268 -
uspace/drv/bus/usb/uhci/hc.h
rd1df381 r7813516 129 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 int hc_init(hc_t *instance, addr_range_t *regs, bool interupts); 131 int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interupts); 132 void hc_fini(hc_t *instance); 132 133 int hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch); 133 134 134 /** Safely dispose host controller internal structures135 *136 * @param[in] instance Host controller structure to use.137 */138 static inline void hc_fini(hc_t *instance) {} /* TODO: implement*/139 135 #endif 140 136 -
uspace/drv/bus/usb/uhci/uhci.c
rd1df381 r7813516 89 89 hw_res_list_parsed_t hw_res; 90 90 int ret = hcd_ddf_get_registers(device, &hw_res); 91 if (ret != EOK || 92 hw_res.irqs.count != 1 || hw_res.io_ranges.count != 1) { 91 if (ret != EOK) { 93 92 usb_log_error("Failed to get register memory addresses " 94 93 "for %" PRIun ": %s.\n", ddf_dev_get_handle(device), … … 96 95 return ret; 97 96 } 98 addr_range_t regs = hw_res.io_ranges.ranges[0];99 97 100 98 ret = hcd_ddf_setup_hc(device, USB_SPEED_FULL, … … 125 123 } 126 124 127 ret = hc_init(hc, & regs, interrupts);125 ret = hc_init(hc, &hw_res, interrupts); 128 126 hw_res_list_parsed_clean(&hw_res); 129 127 if (ret != EOK) { 130 128 usb_log_error("Failed to init uhci_hcd: %s.\n", str_error(ret)); 131 129 goto irq_unregister; 132 // TODO This is unfortunate, we have neither legacy nor real USB133 130 } 134 131
Note:
See TracChangeset
for help on using the changeset viewer.
