Changeset 2b0929e in mainline
- Timestamp:
- 2012-12-21T14:33:23Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 94c40ce2
- Parents:
- 0a12879
- Location:
- uspace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/ohci.c
r0a12879 r2b0929e 159 159 160 160 /* HC should be running OK. We can add root hub */ 161 ret = hcd_ddf_setup_hub(dev _to_hcd(device), &hc_impl->rh.address, device);161 ret = hcd_ddf_setup_hub(device, &hc_impl->rh.address); 162 162 CHECK_RET_CLEAN_RETURN(ret, 163 163 "Failed to register OHCI root hub: %s.\n", str_error(ret)); -
uspace/lib/usbhost/include/usb/host/ddf_helpers.h
r0a12879 r2b0929e 45 45 int hcd_ddf_setup_device(ddf_dev_t *device, ddf_fun_t **hc_fun, 46 46 usb_speed_t max_speed, size_t bw, bw_count_func_t bw_count); 47 int hcd_ddf_setup_hub( hcd_t *instance, usb_address_t *address, ddf_dev_t *dev);47 int hcd_ddf_setup_hub(ddf_dev_t *dev, usb_address_t *address); 48 48 49 49 hcd_t *dev_to_hcd(ddf_dev_t *dev); -
uspace/lib/usbhost/src/ddf_helpers.c
r0a12879 r2b0929e 57 57 hc_dev_t *hc_dev = dev_to_hc_dev(dev); 58 58 if (!hc_dev || !hc_dev->hc_fun) { 59 usb_log_error("Invalid OHCIdevice.\n");59 usb_log_error("Invalid HCD device.\n"); 60 60 return NULL; 61 61 } … … 173 173 /** Announce root hub to the DDF 174 174 * 175 * @param[in] instance OHCI driver instance176 * @param[in ] hub_fun DDF function representing OHCIroot hub175 * @param[in] device Host controller ddf device 176 * @param[in/out] address USB address of the root hub 177 177 * @return Error code 178 178 */ 179 int hcd_ddf_setup_hub(hcd_t *instance, usb_address_t *address, ddf_dev_t *device) 180 { 181 assert(instance); 179 int hcd_ddf_setup_hub(ddf_dev_t *device, usb_address_t *address) 180 { 182 181 assert(address); 183 182 assert(device); 184 183 185 const usb_speed_t speed = instance->dev_manager.max_speed; 186 187 int ret = usb_device_manager_request_address(&instance->dev_manager, 184 hcd_t *hcd = dev_to_hcd(device); 185 186 const usb_speed_t speed = hcd->dev_manager.max_speed; 187 188 int ret = usb_device_manager_request_address(&hcd->dev_manager, 188 189 address, false, speed); 189 190 if (ret != EOK) { … … 197 198 usb_log_error(message); \ 198 199 usb_endpoint_manager_remove_ep( \ 199 & instance->ep_manager, *address, 0, \200 &hcd->ep_manager, *address, 0, \ 200 201 USB_DIRECTION_BOTH, NULL, NULL); \ 201 202 usb_device_manager_release_address( \ 202 & instance->dev_manager, *address); \203 &hcd->dev_manager, *address); \ 203 204 return ret; \ 204 205 } else (void)0 205 206 206 207 ret = usb_endpoint_manager_add_ep( 207 & instance->ep_manager, *address, 0,208 &hcd->ep_manager, *address, 0, 208 209 USB_DIRECTION_BOTH, USB_TRANSFER_CONTROL, speed, 64, 209 210 0, NULL, NULL); … … 229 230 * @param[in] device DDF instance of the device to use. 230 231 * 231 * This function does all the preparatory work for hc driver implementation. 232 * - gets device hw resources 233 * - disables OHCI legacy support 234 * - asks for interrupt 235 * - registers interrupt handler 232 * This function does all the ddf work for hc driver. 236 233 */ 237 234 int hcd_ddf_setup_device(ddf_dev_t *device, ddf_fun_t **hc_fun, … … 243 240 hc_dev_t *instance = ddf_dev_data_alloc(device, sizeof(hc_dev_t)); 244 241 if (instance == NULL) { 245 usb_log_error("Failed to allocate OHCI driver.\n");242 usb_log_error("Failed to allocate HCD ddf structure.\n"); 246 243 return ENOMEM; 247 244 } … … 260 257 int ret = instance->hc_fun ? EOK : ENOMEM; 261 258 CHECK_RET_DEST_FREE_RETURN(ret, 262 "Failed to create OHCIHC function: %s.\n", str_error(ret));259 "Failed to create HCD HC function: %s.\n", str_error(ret)); 263 260 ddf_fun_set_ops(instance->hc_fun, &hc_ops); 264 261 hcd_t *hcd = ddf_fun_data_alloc(instance->hc_fun, sizeof(hcd_t)); … … 271 268 ret = ddf_fun_bind(instance->hc_fun); 272 269 CHECK_RET_DEST_FREE_RETURN(ret, 273 "Failed to bind OHCIdevice function: %s.\n", str_error(ret));270 "Failed to bind HCD device function: %s.\n", str_error(ret)); 274 271 275 272 #define CHECK_RET_UNBIND_FREE_RETURN(ret, message...) \ 276 273 if (ret != EOK) { \ 277 274 ddf_fun_unbind(instance->hc_fun); \ 278 CHECK_RET_DEST_FREE_RETURN(ret, \ 279 "Failed to add OHCI to HC class: %s.\n", str_error(ret)); \ 275 CHECK_RET_DEST_FREE_RETURN(ret, message); \ 280 276 } else (void)0 281 277 ret = ddf_fun_add_to_category(instance->hc_fun, USB_HC_CATEGORY);
Note:
See TracChangeset
for help on using the changeset viewer.