Changeset eb1a2f4 in mainline for uspace/lib/usb/src/ddfiface.c
- Timestamp:
- 2011-02-22T23:30:56Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3b5d1535, a9c674e0
- Parents:
- dbe25f1 (diff), 664af708 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/ddfiface.c
rdbe25f1 reb1a2f4 34 34 */ 35 35 #include <ipc/devman.h> 36 #include <devman.h> 37 #include <async.h> 36 38 #include <usb/ddfiface.h> 39 #include <usb/debug.h> 37 40 #include <errno.h> 41 #include <assert.h> 38 42 39 43 /** DDF interface for USB device, implementation for typical hub. */ … … 56 60 * @return Error code. 57 61 */ 58 int usb_iface_get_hc_handle_hub_impl(d evice_t *device, devman_handle_t *handle)62 int usb_iface_get_hc_handle_hub_impl(ddf_fun_t *fun, devman_handle_t *handle) 59 63 { 60 assert( device);61 return usb_hc_find( device->handle, handle);64 assert(fun); 65 return usb_hc_find(fun->handle, handle); 62 66 } 63 67 … … 69 73 * @return Error code. 70 74 */ 71 int usb_iface_get_hc_handle_hub_child_impl(d evice_t *device,75 int usb_iface_get_hc_handle_hub_child_impl(ddf_fun_t *fun, 72 76 devman_handle_t *handle) 73 77 { 74 assert(device); 75 device_t *parent = device->parent; 78 assert(fun != NULL); 76 79 77 /* Default error, device does not support this operation. */ 78 int rc = ENOTSUP; 79 80 if (parent && parent->ops && parent->ops->interfaces[USB_DEV_IFACE]) { 81 usb_iface_t *usb_iface 82 = (usb_iface_t *) parent->ops->interfaces[USB_DEV_IFACE]; 83 assert(usb_iface != NULL); 84 85 if (usb_iface->get_hc_handle) { 86 rc = usb_iface->get_hc_handle(parent, handle); 87 } 80 int parent_phone = devman_parent_device_connect(fun->handle, 81 IPC_FLAG_BLOCKING); 82 if (parent_phone < 0) { 83 return parent_phone; 88 84 } 89 85 90 return rc; 86 sysarg_t hc_handle; 87 int rc = async_req_1_1(parent_phone, DEV_IFACE_ID(USB_DEV_IFACE), 88 IPC_M_USB_GET_HOST_CONTROLLER_HANDLE, &hc_handle); 89 90 if (rc != EOK) { 91 return rc; 92 } 93 94 *handle = hc_handle; 95 96 return EOK; 91 97 } 92 98 … … 97 103 * @return Always EOK. 98 104 */ 99 int usb_iface_get_hc_handle_hc_impl(d evice_t *device, devman_handle_t *handle)105 int usb_iface_get_hc_handle_hc_impl(ddf_fun_t *fun, devman_handle_t *handle) 100 106 { 101 assert( device);107 assert(fun); 102 108 103 109 if (handle != NULL) { 104 *handle = device->handle;110 *handle = fun->handle; 105 111 } 106 112 … … 115 121 * @return Error code. 116 122 */ 117 int usb_iface_get_address_hub_impl(d evice_t *device, devman_handle_t handle,123 int usb_iface_get_address_hub_impl(ddf_fun_t *fun, devman_handle_t handle, 118 124 usb_address_t *address) 119 125 { 120 assert( device);121 int parent_phone = devman_parent_device_connect( device->handle,126 assert(fun); 127 int parent_phone = devman_parent_device_connect(fun->handle, 122 128 IPC_FLAG_BLOCKING); 123 129 if (parent_phone < 0) { … … 150 156 * @return Error code. 151 157 */ 152 int usb_iface_get_address_hub_child_impl(d evice_t *device,158 int usb_iface_get_address_hub_child_impl(ddf_fun_t *fun, 153 159 devman_handle_t handle, usb_address_t *address) 154 160 { 155 assert(device); 156 device_t *parent = device->parent; 157 158 /* Default error, device does not support this operation. */ 159 int rc = ENOTSUP; 160 161 if (parent && parent->ops && parent->ops->interfaces[USB_DEV_IFACE]) { 162 usb_iface_t *usb_iface 163 = (usb_iface_t *) parent->ops->interfaces[USB_DEV_IFACE]; 164 assert(usb_iface != NULL); 165 166 if (usb_iface->get_address) { 167 rc = usb_iface->get_address(parent, handle, address); 168 } 161 if (handle == 0) { 162 handle = fun->handle; 169 163 } 170 171 return rc; 164 return usb_iface_get_address_hub_impl(fun, handle, address); 172 165 } 173 166
Note:
See TracChangeset
for help on using the changeset viewer.