Changeset 233e68d in mainline for uspace/lib/usb/src/pipes.c
- Timestamp:
- 2011-02-23T18:28:41Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e9e58ea3
- Parents:
- deece2f (diff), a9c674e0 (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/pipes.c
rdeece2f r233e68d 35 35 #include <usb/usb.h> 36 36 #include <usb/pipes.h> 37 #include <usb/debug.h> 37 38 #include <usbhc_iface.h> 38 39 #include <usb_iface.h> 40 #include <devman.h> 39 41 #include <errno.h> 40 42 #include <assert.h> … … 46 48 * @return USB address or error code. 47 49 */ 48 static usb_address_t get_my_address(int phone, d evice_t *dev)50 static usb_address_t get_my_address(int phone, ddf_dev_t *dev) 49 51 { 50 52 sysarg_t address; 53 54 55 /* 56 * We are sending special value as a handle - zero - to get 57 * handle of the parent function (that handle was used 58 * when registering our device @p dev. 59 */ 51 60 int rc = async_req_2_1(phone, DEV_IFACE_ID(USB_DEV_IFACE), 52 61 IPC_M_USB_GET_ADDRESS, 53 dev->handle, &address);62 0, &address); 54 63 55 64 if (rc != EOK) { … … 65 74 * @return Interface number (negative code means any). 66 75 */ 67 int usb_device_get_assigned_interface(d evice_t *device)76 int usb_device_get_assigned_interface(ddf_dev_t *device) 68 77 { 69 78 int parent_phone = devman_parent_device_connect(device->handle, … … 94 103 */ 95 104 int usb_device_connection_initialize_from_device( 96 usb_device_connection_t *connection, d evice_t *device)105 usb_device_connection_t *connection, ddf_dev_t *dev) 97 106 { 98 107 assert(connection); 99 assert(dev ice);108 assert(dev); 100 109 101 110 int rc; … … 103 112 usb_address_t my_address; 104 113 105 rc = usb_hc_find(dev ice->handle, &hc_handle);114 rc = usb_hc_find(dev->handle, &hc_handle); 106 115 if (rc != EOK) { 107 116 return rc; 108 117 } 109 118 110 int parent_phone = devman_parent_device_connect(dev ice->handle,119 int parent_phone = devman_parent_device_connect(dev->handle, 111 120 IPC_FLAG_BLOCKING); 112 121 if (parent_phone < 0) { … … 114 123 } 115 124 116 my_address = get_my_address(parent_phone, dev ice);125 my_address = get_my_address(parent_phone, dev); 117 126 if (my_address < 0) { 118 127 rc = my_address; … … 191 200 assert(pipe); 192 201 193 if ( pipe->hc_phone >= 0) {202 if (usb_endpoint_pipe_is_session_started(pipe)) { 194 203 return EBUSY; 195 204 } … … 217 226 assert(pipe); 218 227 219 if ( pipe->hc_phone < 0) {228 if (!usb_endpoint_pipe_is_session_started(pipe)) { 220 229 return ENOENT; 221 230 } … … 229 238 230 239 return EOK; 240 } 241 242 /** Tell whether a session is started (open) on the endpoint pipe. 243 * 244 * The expected usage of this function is in assertions for some 245 * nested functions. 246 * 247 * @param pipe Endpoint pipe in question. 248 * @return Whether @p pipe has opened a session. 249 */ 250 bool usb_endpoint_pipe_is_session_started(usb_endpoint_pipe_t *pipe) 251 { 252 return (pipe->hc_phone >= 0); 231 253 } 232 254
Note:
See TracChangeset
for help on using the changeset viewer.