Changeset ef4e8eb in mainline for uspace/lib/usb/src
- Timestamp:
- 2013-01-15T20:39:09Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ef40434
- Parents:
- 918e1e84
- Location:
- uspace/lib/usb/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/ddfiface.c
r918e1e84 ref4e8eb 40 40 #include <usb/hc.h> 41 41 #include <usb/debug.h> 42 #include <usb/dev/hub.h>43 42 #include <errno.h> 44 43 #include <assert.h> … … 52 51 }; 53 52 54 /** DDF interface for USB device, implementation for child of a typical hub. */55 usb_iface_t usb_iface_hub_child_impl = {56 .get_hc_handle = usb_iface_get_hc_handle_device_impl,57 .get_my_address = usb_iface_get_my_address_from_device_data,58 };59 60 61 53 /** Get host controller handle, interface implementation for hub driver. 62 54 * … … 69 61 assert(fun); 70 62 return usb_get_hc_by_handle(ddf_fun_get_handle(fun), handle); 71 }72 73 /** Get host controller handle, interface implementation for HC driver.74 *75 * @param[in] fun Device function the operation is running on.76 * @param[out] handle Storage for the host controller handle.77 * @return Always EOK.78 */79 int usb_iface_get_hc_handle_hc_impl(ddf_fun_t *fun, devman_handle_t *handle)80 {81 assert(fun);82 83 if (handle != NULL) {84 *handle = ddf_fun_get_handle(fun);85 }86 87 return EOK;88 63 } 89 64 … … 102 77 } 103 78 104 /** Get USB device address, interface implementation for child of105 * a hub driver.106 *107 * This implementation eccepts 0 as valid handle and replaces it with fun's108 * handle.109 *110 * @param[in] fun Device function the operation is running on.111 * @param[in] handle Devman handle of USB device we want address of.112 * @param[out] address Storage for USB address of device with handle @p handle.113 * @return Error code.114 */115 int usb_iface_get_my_address_from_device_data(ddf_fun_t *fun,116 usb_address_t *address)117 {118 const usb_hub_attached_device_t *device = ddf_fun_data_get(fun);119 assert(device->fun == fun);120 if (address)121 *address = device->address;122 return EOK;123 }124 79 125 80 /** -
uspace/lib/usb/src/hc.c
r918e1e84 ref4e8eb 164 164 } 165 165 166 /** Ask host controller for free address assignment.167 *168 * @param connection Opened connection to host controller.169 * @param preferred Preferred SUB address.170 * @param strict Fail if the preferred address is not avialable.171 * @param speed Speed of the new device (device that will be assigned172 * the returned address).173 * @return Assigned USB address or negative error code.174 */175 usb_address_t usb_hc_request_address(usb_hc_connection_t *connection,176 usb_address_t preferred, bool strict, usb_speed_t speed)177 {178 async_exch_t *exch;179 EXCH_INIT(connection, exch);180 181 usb_address_t address = preferred;182 const int ret = usbhc_request_address(exch, &address, strict, speed);183 184 EXCH_FINI(connection, exch);185 return ret == EOK ? address : ret;186 }187 188 int usb_hc_bind_address(usb_hc_connection_t * connection,189 usb_address_t address, devman_handle_t handle)190 {191 async_exch_t *exch;192 EXCH_INIT(connection, exch);193 194 const int ret = usbhc_bind_address(exch, address, handle);195 196 EXCH_FINI(connection, exch);197 return ret;198 }199 166 200 167 /** Get handle of USB device with given address. … … 217 184 } 218 185 219 int usb_hc_release_address(usb_hc_connection_t *connection,220 usb_address_t address)221 {222 async_exch_t *exch;223 EXCH_INIT(connection, exch);224 225 const int ret = usbhc_release_address(exch, address);226 227 EXCH_FINI(connection, exch);228 return ret;229 }230 231 186 int usb_hc_register_endpoint(usb_hc_connection_t *connection, 232 187 usb_address_t address, usb_endpoint_t endpoint, usb_transfer_type_t type,
Note:
See TracChangeset
for help on using the changeset viewer.