Changeset 7813516 in mainline for uspace/drv/bus/usb/ohci
- 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/ohci
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/hc.c
rd1df381 r7813516 148 148 * 149 149 * @param[in] instance Memory place for the structure. 150 * @param[in] regs Device's I/O registers range.150 * @param[in] regs Device's resources 151 151 * @param[in] interrupts True if w interrupts should be used 152 152 * @return Error code 153 153 */ 154 int hc_init(hc_t *instance, addr_range_t *regs, bool interrupts) 155 { 156 assert(instance); 157 158 int ret = pio_enable_range(regs, (void **) &instance->registers); 154 int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts) 155 { 156 assert(instance); 157 assert(hw_res); 158 if (hw_res->mem_ranges.count != 1 || 159 hw_res->mem_ranges.ranges[0].size < sizeof(ohci_regs_t)) 160 return EINVAL; 161 162 int ret = pio_enable_range(&hw_res->mem_ranges.ranges[0], 163 (void **) &instance->registers); 159 164 if (ret != EOK) { 160 usb_log_error("Failed to gain access to deviceregisters: %s.\n",165 usb_log_error("Failed to gain access to registers: %s.\n", 161 166 str_error(ret)); 162 167 return ret; 163 168 } 169 usb_log_debug("Device registers at %" PRIx64 " (%zuB) accessible.\n", 170 hw_res->mem_ranges.ranges[0].address.absolute, 171 hw_res->mem_ranges.ranges[0].size); 164 172 165 173 list_initialize(&instance->pending_batches); … … 186 194 return EOK; 187 195 } 196 197 /** Safely dispose host controller internal structures 198 * 199 * @param[in] instance Host controller structure to use. 200 */ 201 void hc_fini(hc_t *instance) 202 { 203 assert(instance); 204 /* TODO: implement*/ 205 }; 188 206 189 207 void hc_enqueue_endpoint(hc_t *instance, const endpoint_t *ep) -
uspace/drv/bus/usb/ohci/hc.h
rd1df381 r7813516 77 77 int hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res); 78 78 int hc_register_hub(hc_t *instance, ddf_fun_t *hub_fun); 79 int hc_init(hc_t *instance, addr_range_t *regs, bool interrupts); 80 81 /** Safely dispose host controller internal structures 82 * 83 * @param[in] instance Host controller structure to use. 84 */ 85 static inline void hc_fini(hc_t *instance) { /* TODO: implement*/ }; 79 int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts); 80 void hc_fini(hc_t *instance); 86 81 87 82 void hc_enqueue_endpoint(hc_t *instance, const endpoint_t *ep); -
uspace/drv/bus/usb/ohci/ohci.c
rd1df381 r7813516 87 87 hw_res_list_parsed_t hw_res; 88 88 int ret = hcd_ddf_get_registers(device, &hw_res); 89 if (ret != EOK || 90 hw_res.irqs.count != 1 || hw_res.mem_ranges.count != 1) { 89 if (ret != EOK) { 91 90 usb_log_error("Failed to get register memory addresses " 92 91 "for %" PRIun ": %s.\n", ddf_dev_get_handle(device), … … 94 93 return ret; 95 94 } 96 addr_range_t regs = hw_res.mem_ranges.ranges[0];97 95 98 96 /* Initialize generic HCD driver */ … … 127 125 128 126 /* Initialize OHCI HC */ 129 ret = hc_init(hc, & regs, interrupts);127 ret = hc_init(hc, &hw_res, interrupts); 130 128 hw_res_list_parsed_clean(&hw_res); 131 129 if (ret != EOK) {
Note:
See TracChangeset
for help on using the changeset viewer.
