Changeset 4daee7a in mainline
- Timestamp:
- 2012-12-16T16:26:30Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8de2cca
- Parents:
- f29931c
- Location:
- uspace
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/hc.c
rf29931c r4daee7a 135 135 136 136 return EOK; 137 }138 139 /** Announce OHCI root hub to the DDF140 *141 * @param[in] instance OHCI driver intance142 * @param[in] hub_fun DDF fuction representing OHCI root hub143 * @return Error code144 */145 int hc_register_hub(hc_t *instance, ddf_fun_t *hub_fun)146 {147 assert(instance);148 assert(hub_fun);149 150 /* Try to get address 1 for root hub. */151 instance->rh.address = 1;152 int ret = usb_device_manager_request_address(153 &instance->generic.dev_manager, &instance->rh.address, false,154 USB_SPEED_FULL);155 if (ret != EOK) {156 usb_log_error("Failed to get OHCI root hub address: %s\n",157 str_error(ret));158 return ret;159 }160 161 #define CHECK_RET_UNREG_RETURN(ret, message...) \162 if (ret != EOK) { \163 usb_log_error(message); \164 usb_endpoint_manager_remove_ep( \165 &instance->generic.ep_manager, instance->rh.address, 0, \166 USB_DIRECTION_BOTH, NULL, NULL); \167 usb_device_manager_release_address( \168 &instance->generic.dev_manager, instance->rh.address); \169 return ret; \170 } else (void)0171 172 ret = usb_endpoint_manager_add_ep(173 &instance->generic.ep_manager, instance->rh.address, 0,174 USB_DIRECTION_BOTH, USB_TRANSFER_CONTROL, USB_SPEED_FULL, 64,175 0, NULL, NULL);176 CHECK_RET_UNREG_RETURN(ret,177 "Failed to register root hub control endpoint: %s.\n",178 str_error(ret));179 180 ret = ddf_fun_add_match_id(hub_fun, "usb&class=hub", 100);181 CHECK_RET_UNREG_RETURN(ret,182 "Failed to add root hub match-id: %s.\n", str_error(ret));183 184 ret = ddf_fun_bind(hub_fun);185 CHECK_RET_UNREG_RETURN(ret,186 "Failed to bind root hub function: %s.\n", str_error(ret));187 188 ret = usb_device_manager_bind_address(&instance->generic.dev_manager,189 instance->rh.address, ddf_fun_get_handle(hub_fun));190 if (ret != EOK)191 usb_log_warning("Failed to bind root hub address: %s.\n",192 str_error(ret));193 194 return EOK;195 #undef CHECK_RET_RELEASE196 137 } 197 138 -
uspace/drv/bus/usb/ohci/ohci.c
rf29931c r4daee7a 248 248 "Failed to add OHCI to HC class: %s.\n", str_error(ret)); 249 249 250 ret = hc _register_hub(hc, instance->rh_fun);250 ret = hcd_register_hub(&hc->generic, &hc->rh.address, instance->rh_fun); 251 251 CHECK_RET_FINI_RETURN(ret, 252 252 "Failed to register OHCI root hub: %s.\n", str_error(ret)); -
uspace/lib/usbhost/Makefile
rf29931c r4daee7a 36 36 SOURCES = \ 37 37 src/endpoint.c \ 38 src/hcd.c \ 38 39 src/iface.c \ 39 40 src/usb_device_manager.c \ -
uspace/lib/usbhost/include/usb/host/hcd.h
rf29931c r4daee7a 74 74 */ 75 75 static inline void hcd_init(hcd_t *hcd, usb_speed_t max_speed, size_t bandwidth, 76 size_t (*bw_count)(usb_speed_t, usb_transfer_type_t, size_t, size_t))76 bw_count_func_t bw_count) 77 77 { 78 78 assert(hcd); … … 83 83 hcd->ep_add_hook = NULL; 84 84 hcd->ep_remove_hook = NULL; 85 } 86 87 static inline void hcd_set_implementation(hcd_t *hcd, void *data, 88 schedule_hook_t schedule, ep_add_hook_t add_hook, ep_remove_hook_t rem_hook) 89 { 90 assert(hcd); 91 hcd->private_data = data; 92 hcd->schedule = schedule; 93 hcd->ep_add_hook = add_hook; 94 hcd->ep_remove_hook = rem_hook; 95 85 96 } 86 97 … … 98 109 } 99 110 111 int hcd_register_hub(hcd_t *instance, usb_address_t *address, ddf_fun_t *hub_fun); 112 113 100 114 /** Data retrieve wrapper. 101 115 * @param fun ddf function, non-null. … … 107 121 } 108 122 123 109 124 extern usbhc_iface_t hcd_iface; 110 125
Note:
See TracChangeset
for help on using the changeset viewer.