Changeset 2ff7360 in mainline
- Timestamp:
- 2011-05-18T15:23:16Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 45e0e07
- Parents:
- aeca5a3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/hc.c
raeca5a3 r2ff7360 56 56 assert(hub_fun); 57 57 58 int ret; 59 60 usb_address_t hub_address = 58 const usb_address_t hub_address = 61 59 device_keeper_get_free_address(&instance->manager, USB_SPEED_FULL); 62 60 if (hub_address <= 0) { 63 usb_log_error("Failed to get OHCI root hub address.\n"); 61 usb_log_error("Failed(%d) to get OHCI root hub address.\n", 62 hub_address); 64 63 return hub_address; 65 64 } … … 68 67 &instance->manager, hub_address, hub_fun->handle); 69 68 70 ret = hc_add_endpoint(instance, hub_address, 0, USB_SPEED_FULL, 69 #define CHECK_RET_RELEASE(ret, message...) \ 70 if (ret != EOK) { \ 71 usb_log_error(message); \ 72 hc_remove_endpoint(instance, hub_address, 0, USB_DIRECTION_BOTH); \ 73 usb_device_keeper_release(&instance->manager, hub_address); \ 74 return ret; \ 75 } else (void)0 76 77 int ret = hc_add_endpoint(instance, hub_address, 0, USB_SPEED_FULL, 71 78 USB_TRANSFER_CONTROL, USB_DIRECTION_BOTH, 64, 0, 0); 72 if (ret != EOK) { 73 usb_log_error("Failed to add OHCI rh endpoint 0.\n"); 74 usb_device_keeper_release(&instance->manager, hub_address); 75 return ret; 76 } 79 CHECK_RET_RELEASE(ret, "Failed(%d) to add OHCI rh endpoint 0.\n", ret); 77 80 78 81 char *match_str = NULL; 79 82 /* DDF needs heap allocated string */ 80 83 ret = asprintf(&match_str, "usb&class=hub"); 81 if (ret < 0) { 82 usb_log_error( 83 "Failed(%d) to create root hub match-id string.\n", ret); 84 usb_device_keeper_release(&instance->manager, hub_address); 85 return ret; 86 } 84 ret = ret > 0 ? 0 : ret; 85 CHECK_RET_RELEASE(ret, "Failed(%d) to create match-id string.\n", ret); 87 86 88 87 ret = ddf_fun_add_match_id(hub_fun, match_str, 100); 89 if (ret != EOK) { 90 usb_log_error("Failed add root hub match-id.\n"); 91 } 88 CHECK_RET_RELEASE(ret, "Failed(%d) add root hub match-id.\n", ret); 89 92 90 ret = ddf_fun_bind(hub_fun); 93 return ret; 91 CHECK_RET_RELEASE(ret, "Failed(%d) to bind root hub function.\n", ret); 92 93 return EOK; 94 #undef CHECK_RET_RELEASE 94 95 } 95 96 /*----------------------------------------------------------------------------*/ … … 121 122 #undef CHECK_RET_RETURN 122 123 123 124 // hc_init_hw(instance); 124 fibril_mutex_initialize(&instance->guard); 125 125 hc_gain_control(instance); 126 fibril_mutex_initialize(&instance->guard);127 126 128 127 rh_init(&instance->rh, instance->registers);
Note:
See TracChangeset
for help on using the changeset viewer.