Changeset 7b6f116 in mainline for uspace/lib
- Timestamp:
- 2011-05-08T13:47:45Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 19065c7, 3a6e423, 511cfc8, ebf6a40, f50f722
- Parents:
- 60b3bea (diff), 5dfee52 (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. - Location:
- uspace/lib
- Files:
-
- 7 edited
-
drv/generic/remote_usbhc.c (modified) (3 diffs)
-
drv/include/usb_iface.h (modified) (1 diff)
-
drv/include/usbhc_iface.h (modified) (2 diffs)
-
usb/include/usb/host/device_keeper.h (modified) (1 diff)
-
usb/include/usb/hub.h (modified) (1 diff)
-
usb/src/host/device_keeper.c (modified) (1 diff)
-
usb/src/hub.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_usbhc.c
r60b3bea r7b6f116 52 52 static void remote_usbhc_request_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 53 53 static void remote_usbhc_bind_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 54 static void remote_usbhc_find_by_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 54 55 static void remote_usbhc_release_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 55 56 static void remote_usbhc_register_endpoint(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); … … 61 62 remote_usbhc_request_address, 62 63 remote_usbhc_bind_address, 64 remote_usbhc_find_by_address, 63 65 remote_usbhc_release_address, 64 66 … … 161 163 162 164 async_answer_0(callid, rc); 165 } 166 167 void remote_usbhc_find_by_address(ddf_fun_t *fun, void *iface, 168 ipc_callid_t callid, ipc_call_t *call) 169 { 170 usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface; 171 172 if (!usb_iface->find_by_address) { 173 async_answer_0(callid, ENOTSUP); 174 return; 175 } 176 177 usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call); 178 devman_handle_t handle; 179 int rc = usb_iface->find_by_address(fun, address, &handle); 180 181 if (rc == EOK) { 182 async_answer_1(callid, EOK, handle); 183 } else { 184 async_answer_0(callid, rc); 185 } 163 186 } 164 187 -
uspace/lib/drv/include/usb_iface.h
r60b3bea r7b6f116 49 49 * - arbitrary error code if returned by remote implementation 50 50 * - EOK - handle found, first parameter contains the USB address 51 * 52 * The handle must be the one used for binding USB address with 53 * it (IPC_M_USBHC_BIND_ADDRESS), otherwise the host controller 54 * (that this request would eventually reach) would not be able 55 * to find it. 56 * The problem is that this handle is actually assigned to the 57 * function inside driver of the parent device (usually hub driver). 58 * To bypass this problem, the initial caller specify handle as 59 * zero and the first parent assigns the actual value. 60 * See usb_iface_get_address_hub_child_impl() implementation 61 * that could be assigned to device ops of a child device of in a 62 * hub driver. 63 * For example, the USB multi interface device driver (MID) 64 * passes this initial zero without any modification because the 65 * handle must be resolved by its parent. 51 66 */ 52 67 IPC_M_USB_GET_ADDRESS, -
uspace/lib/drv/include/usbhc_iface.h
r60b3bea r7b6f116 105 105 IPC_M_USBHC_BIND_ADDRESS, 106 106 107 /** Get handle binded with given USB address. 108 * Parameters 109 * - USB address 110 * Answer: 111 * - EOK - address binded, first parameter is the devman handle 112 * - ENOENT - address is not in use at the moment 113 */ 114 IPC_M_USBHC_GET_HANDLE_BY_ADDRESS, 115 107 116 /** Release address in use. 108 117 * Arguments: … … 207 216 int (*request_address)(ddf_fun_t *, usb_speed_t, usb_address_t *); 208 217 int (*bind_address)(ddf_fun_t *, usb_address_t, devman_handle_t); 218 int (*find_by_address)(ddf_fun_t *, usb_address_t, devman_handle_t *); 209 219 int (*release_address)(ddf_fun_t *, usb_address_t); 210 220 -
uspace/lib/usb/include/usb/host/device_keeper.h
r60b3bea r7b6f116 80 80 devman_handle_t handle); 81 81 82 bool usb_device_keeper_find_by_address(usb_device_keeper_t *instance, 83 usb_address_t address, devman_handle_t *handle); 84 82 85 usb_speed_t usb_device_keeper_get_speed(usb_device_keeper_t *instance, 83 86 usb_address_t address); -
uspace/lib/usb/include/usb/hub.h
r60b3bea r7b6f116 63 63 const usb_hc_attached_device_t *); 64 64 int usb_hc_unregister_device(usb_hc_connection_t *, usb_address_t); 65 int usb_hc_get_handle_by_address(usb_hc_connection_t *, usb_address_t, 66 devman_handle_t *); 65 67 66 68 #endif -
uspace/lib/usb/src/host/device_keeper.c
r60b3bea r7b6f116 157 157 return ENOENT; 158 158 } 159 160 /** Find devman handled assigned to USB address. 161 * 162 * @param[in] instance Device keeper structure to use. 163 * @param[in] address Address the caller wants to find. 164 * @param[out] handle Where to store found handle. 165 * @return Whether such address is currently occupied. 166 */ 167 bool usb_device_keeper_find_by_address(usb_device_keeper_t *instance, 168 usb_address_t address, devman_handle_t *handle) 169 { 170 assert(instance); 171 fibril_mutex_lock(&instance->guard); 172 if ((address < 0) || (address >= USB_ADDRESS_COUNT)) { 173 fibril_mutex_unlock(&instance->guard); 174 return false; 175 } 176 if (!instance->devices[address].occupied) { 177 fibril_mutex_unlock(&instance->guard); 178 return false; 179 } 180 181 if (handle != NULL) { 182 *handle = instance->devices[address].handle; 183 } 184 185 fibril_mutex_unlock(&instance->guard); 186 return true; 187 } 188 159 189 /*----------------------------------------------------------------------------*/ 160 190 /** Get speed associated with the address -
uspace/lib/usb/src/hub.c
r60b3bea r7b6f116 117 117 DEV_IFACE_ID(USBHC_DEV_IFACE), 118 118 IPC_M_USBHC_RELEASE_ADDRESS, address); 119 } 120 121 /** Get handle of USB device with given address. 122 * 123 * @param[in] connection Opened connection to host controller. 124 * @param[in] address Address of device in question. 125 * @param[out] handle Where to write the device handle. 126 * @return Error code. 127 */ 128 int usb_hc_get_handle_by_address(usb_hc_connection_t *connection, 129 usb_address_t address, devman_handle_t *handle) 130 { 131 CHECK_CONNECTION(connection); 132 133 sysarg_t tmp; 134 int rc = async_req_2_1(connection->hc_phone, 135 DEV_IFACE_ID(USBHC_DEV_IFACE), 136 IPC_M_USBHC_GET_HANDLE_BY_ADDRESS, 137 address, &tmp); 138 if ((rc == EOK) && (handle != NULL)) { 139 *handle = tmp; 140 } 141 142 return rc; 119 143 } 120 144
Note:
See TracChangeset
for help on using the changeset viewer.
