Changeset a045ab1 in mainline for uspace/lib/usb/src/hc.c
- Timestamp:
- 2011-12-11T13:55:20Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2c202c5
- Parents:
- 6df14c5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/hc.c
r6df14c5 ra045ab1 37 37 #include <async.h> 38 38 #include <dev_iface.h> 39 #include <usb_iface.h>40 39 #include <usbhc_iface.h> 41 40 #include <usb/hc.h> 42 41 #include <usb/debug.h> 42 #include <usb/dev.h> 43 43 #include <errno.h> 44 44 #include <assert.h> … … 288 288 return ret; 289 289 } 290 /*----------------------------------------------------------------------------*/291 /** Tell USB address assigned to device with given handle.292 *293 * @param dev_handle Devman handle of the USB device in question.294 * @return USB address or negative error code.295 */296 usb_address_t usb_get_address_by_handle(devman_handle_t dev_handle)297 {298 async_sess_t *parent_sess =299 devman_parent_device_connect(EXCHANGE_ATOMIC, dev_handle,300 IPC_FLAG_BLOCKING);301 if (!parent_sess)302 return ENOMEM;303 304 async_exch_t *exch = async_exchange_begin(parent_sess);305 if (!exch) {306 async_hangup(parent_sess);307 return ENOMEM;308 }309 usb_address_t address;310 const int ret = usb_get_my_address(exch, &address);311 312 async_exchange_end(exch);313 async_hangup(parent_sess);314 315 if (ret != EOK)316 return ret;317 318 return address;319 }320 321 /** Find host controller handle for the device.322 *323 * @param[in] device_handle Device devman handle.324 * @param[out] hc_handle Where to store handle of host controller325 * controlling device with @p device_handle handle.326 * @return Error code.327 */328 int usb_find_hc(devman_handle_t device_handle, devman_handle_t *hc_handle)329 {330 async_sess_t *parent_sess =331 devman_parent_device_connect(EXCHANGE_ATOMIC, device_handle,332 IPC_FLAG_BLOCKING);333 if (!parent_sess)334 return ENOMEM;335 336 async_exch_t *exch = async_exchange_begin(parent_sess);337 if (!exch) {338 async_hangup(parent_sess);339 return ENOMEM;340 }341 const int ret = usb_get_hc_handle(exch, hc_handle);342 343 async_exchange_end(exch);344 async_hangup(parent_sess);345 346 return ret;347 }348 290 349 291 /**
Note:
See TracChangeset
for help on using the changeset viewer.