Changeset ba2fc2c in mainline
- Timestamp:
- 2017-12-19T22:00:50Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 83fb72e
- Parents:
- 0bb4738
- Location:
- uspace/lib/usbdev
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified uspace/lib/usbdev/include/usb/dev/pipes.h ¶
r0bb4738 rba2fc2c 58 58 /** The connection used for sending the data. */ 59 59 usb_dev_session_t *bus_session; 60 /** The session used for isochronous endpoints. 61 * Required as isochronous sends/receive can block the session. 62 */ 63 usb_dev_session_t *isoch_session; 60 64 } usb_pipe_t; 61 65 -
TabularUnified uspace/lib/usbdev/src/pipes.c ¶
r0bb4738 rba2fc2c 191 191 } 192 192 193 /* Isochronous transfer are not supported (yet) */ 194 if (pipe->desc.transfer_type != USB_TRANSFER_INTERRUPT && 195 pipe->desc.transfer_type != USB_TRANSFER_BULK) 196 return ENOTSUP; 197 198 async_exch_t *exch = async_exchange_begin(pipe->bus_session); 193 async_exch_t *exch; 194 if (pipe->desc.transfer_type == USB_TRANSFER_ISOCHRONOUS) 195 exch = async_exchange_begin(pipe->isoch_session); 196 else 197 exch = async_exchange_begin(pipe->bus_session); 199 198 size_t act_size = 0; 200 199 const int rc = … … 232 231 } 233 232 234 /* Isochronous transfer are not supported (yet) */235 if (pipe->desc.transfer_type != USB_TRANSFER_INTERRUPT &&236 pipe->desc.transfer_type != USB_TRANSFER_BULK)237 return ENOTSUP;238 239 async_exch_t *exch = async_exchange_begin(pipe->bus_session); 233 async_exch_t *exch; 234 if (pipe->desc.transfer_type == USB_TRANSFER_ISOCHRONOUS) 235 exch = async_exchange_begin(pipe->isoch_session); 236 else 237 exch = async_exchange_begin(pipe->bus_session); 238 240 239 const int rc = usbhc_write(exch, pipe->desc.endpoint_no, 0, buffer, size); 241 240 async_exchange_end(exch); 242 241 return rc; 242 } 243 244 /** Setup isochronous session for isochronous communication. 245 * Isochronous endpoints need a different session as they might block while waiting for data. 246 * 247 * @param pipe Endpoint pipe being initialized. 248 * @return Error code. 249 */ 250 static int usb_isoch_session_initialize(usb_pipe_t *pipe) { 251 devman_handle_t handle; 252 253 async_exch_t *exch = async_exchange_begin(pipe->bus_session); 254 if (!exch) 255 return EPARTY; 256 257 int ret = usb_get_my_device_handle(exch, &handle); 258 259 async_exchange_end(exch); 260 if (ret != EOK) 261 return ret; 262 263 pipe->isoch_session = usb_dev_connect(handle); 264 if (!pipe->isoch_session) 265 return ENAK; 266 267 return EOK; 243 268 } 244 269 … … 258 283 unsigned mult, usb_dev_session_t *bus_session) 259 284 { 285 int ret = EOK; 260 286 // FIXME: refactor this function PLEASE 261 287 assert(pipe); … … 273 299 pipe->bus_session = bus_session; 274 300 275 return EOK; 301 if (transfer_type == USB_TRANSFER_ISOCHRONOUS) { 302 ret = usb_isoch_session_initialize(pipe); 303 } 304 305 return ret; 276 306 } 277 307
Note:
See TracChangeset
for help on using the changeset viewer.