Changeset ef40434 in mainline for uspace/lib/usbhost/src/iface.c
- Timestamp:
- 2013-01-15T21:50:52Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0f4bff8
- Parents:
- ef4e8eb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/src/iface.c
ref4e8eb ref40434 42 42 #include "ddf_helpers.h" 43 43 44 /** Request address interface function.45 *46 * @param[in] fun DDF function that was called.47 * @param[in] address Pointer to preferred USB address.48 * @param[out] address Place to write a new address.49 * @param[in] strict Fail if the preferred address is not available.50 * @param[in] speed Speed to associate with the new default address.51 * @return Error code.52 */53 static int request_address(54 ddf_fun_t *fun, usb_address_t *address, bool strict, usb_speed_t speed)55 {56 assert(fun);57 hcd_t *hcd = dev_to_hcd(ddf_fun_get_dev(fun));58 assert(hcd);59 assert(address);60 usb_log_debug("Address request: speed: %s, address: %d, strict: %s.\n",61 usb_str_speed(speed), *address, strict ? "YES" : "NO");62 return usb_device_manager_request_address(63 &hcd->dev_manager, address, strict, speed);64 }65 66 /** Bind address interface function.67 *68 * @param[in] fun DDF function that was called.69 * @param[in] address Address of the device70 * @param[in] handle Devman handle of the device driver.71 * @return Error code.72 */73 static int bind_address(74 ddf_fun_t *fun, usb_address_t address, devman_handle_t handle)75 {76 assert(fun);77 hcd_t *hcd = dev_to_hcd(ddf_fun_get_dev(fun));78 assert(hcd);79 80 usb_log_debug("Address bind %d-%" PRIun ".\n", address, handle);81 return usb_device_manager_bind_address(82 &hcd->dev_manager, address, handle);83 }84 85 44 /** Find device handle by address interface function. 86 45 * … … 98 57 return usb_device_manager_get_info_by_address( 99 58 &hcd->dev_manager, address, handle, NULL); 100 }101 102 /** Release address interface function.103 *104 * @param[in] fun DDF function that was called.105 * @param[in] address USB address to be released.106 * @return Error code.107 */108 static int release_address(ddf_fun_t *fun, usb_address_t address)109 {110 assert(fun);111 hcd_t *hcd = dev_to_hcd(ddf_fun_get_dev(fun));112 usb_log_debug("Address release %d.\n", address);113 return hcd_release_address(hcd, address);114 59 } 115 60 … … 134 79 const size_t size = max_packet_size; 135 80 const usb_target_t target = {{.address = address, .endpoint = endpoint}}; 136 81 137 82 usb_log_debug("Register endpoint %d:%d %s-%s %zuB %ums.\n", 138 83 address, endpoint, usb_str_transfer_type(transfer_type), … … 203 148 /** usbhc Interface implementation using hcd_t from libusbhost library. */ 204 149 usbhc_iface_t hcd_iface = { 205 .request_address = request_address,206 .bind_address = bind_address,207 150 .get_handle = find_by_address, 208 .release_address = release_address,209 151 210 152 .register_endpoint = register_endpoint,
Note:
See TracChangeset
for help on using the changeset viewer.