Changeset 395bb79 in mainline
- Timestamp:
- 2012-12-16T18:17:20Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4bfe063
- Parents:
- f51587f5
- Location:
- uspace/drv/bus/usb/ohci
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/hc.h
rf51587f5 r395bb79 51 51 /** Main OHCI driver structure */ 52 52 typedef struct hc { 53 /** Generic USB hc driver */54 hcd_t generic;55 56 53 /** Memory mapped I/O registers area */ 57 54 ohci_regs_t *registers; -
uspace/drv/bus/usb/ohci/ohci.c
rf51587f5 r395bb79 187 187 "Failed to create OHCI HC function: %s.\n", str_error(ret)); 188 188 ddf_fun_set_ops(instance->hc_fun, &hc_ops); 189 hc _t *hc = ddf_fun_data_alloc(instance->hc_fun, sizeof(hc_t));190 ret = hc ? EOK : ENOMEM;189 hcd_t *hcd = ddf_fun_data_alloc(instance->hc_fun, sizeof(hcd_t)); 190 ret = hcd ? EOK : ENOMEM; 191 191 CHECK_RET_DEST_FREE_RETURN(ret, 192 192 "Failed to allocate HCD structure: %s.\n", str_error(ret)); 193 193 194 hcd_init(&hc->generic, USB_SPEED_FULL, 195 BANDWIDTH_AVAILABLE_USB11, bandwidth_count_usb11); 194 hcd_init(hcd, USB_SPEED_FULL, BANDWIDTH_AVAILABLE_USB11, 195 bandwidth_count_usb11); 196 197 ret = ddf_fun_bind(instance->hc_fun); 198 CHECK_RET_DEST_FREE_RETURN(ret, 199 "Failed to bind OHCI device function: %s.\n", str_error(ret)); 200 201 ret = ddf_fun_add_to_category(instance->hc_fun, USB_HC_CATEGORY); 202 CHECK_RET_DEST_FREE_RETURN(ret, 203 "Failed to add OHCI to HC class: %s.\n", str_error(ret)); 204 205 /* HC should be ok at this point (except it can't do anything) */ 196 206 197 207 instance->rh_fun = ddf_fun_create(device, fun_inner, "ohci_rh"); … … 227 237 CHECK_RET_DEST_FREE_RETURN(ret, 228 238 "Failed to generate IRQ code: %s.\n", str_error(ret)); 229 230 239 231 240 /* Register handler to avoid interrupt lockup */ … … 247 256 } 248 257 249 ret = hc_init(hc, reg_base, reg_size, interrupts); 258 hc_t *hc_impl = malloc(sizeof(hc_t)); 259 assert(hc_impl); 260 261 ret = hc_init(hc_impl, reg_base, reg_size, interrupts); 250 262 CHECK_RET_DEST_FREE_RETURN(ret, 251 263 "Failed to init ohci_hcd: %s.\n", str_error(ret)); 252 264 253 hcd_set_implementation( &hc->generic, hc, hc_schedule,265 hcd_set_implementation(hcd, hc_impl, hc_schedule, 254 266 ohci_endpoint_init, ohci_endpoint_fini); 255 267 256 268 #define CHECK_RET_FINI_RETURN(ret, message...) \ 257 269 if (ret != EOK) { \ 258 hc_fini(hc ); \270 hc_fini(hc_impl); \ 259 271 unregister_interrupt_handler(device, irq); \ 260 272 CHECK_RET_DEST_FREE_RETURN(ret, message); \ 261 273 } else (void)0 262 274 263 264 ret = ddf_fun_bind(instance->hc_fun); 265 CHECK_RET_FINI_RETURN(ret, 266 "Failed to bind OHCI device function: %s.\n", str_error(ret)); 267 268 ret = ddf_fun_add_to_category(instance->hc_fun, USB_HC_CATEGORY); 269 CHECK_RET_FINI_RETURN(ret, 270 "Failed to add OHCI to HC class: %s.\n", str_error(ret)); 271 272 ret = hcd_register_hub(&hc->generic, &hc->rh.address, instance->rh_fun); 275 ret = hcd_register_hub(hcd, &hc_impl->rh.address, instance->rh_fun); 273 276 CHECK_RET_FINI_RETURN(ret, 274 277 "Failed to register OHCI root hub: %s.\n", str_error(ret));
Note:
See TracChangeset
for help on using the changeset viewer.