Changes in uspace/lib/usbdev/src/pipesinit.c [277ff98:3ddbd38] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/pipesinit.c
r277ff98 r3ddbd38 349 349 fibril_mutex_initialize(&pipe->guard); 350 350 pipe->wire = connection; 351 pipe->hc_sess = NULL; 352 fibril_mutex_initialize(&pipe->hc_sess_mutex); 351 353 pipe->endpoint_no = endpoint_no; 352 354 pipe->transfer_type = transfer_type; 353 355 pipe->max_packet_size = max_packet_size; 354 356 pipe->direction = direction; 357 pipe->refcount = 0; 358 pipe->refcount_soft = 0; 355 359 pipe->auto_reset_halt = false; 356 360 … … 371 375 assert(connection); 372 376 373 int rc = usb_pipe_initialize(pipe, connection, 0, USB_TRANSFER_CONTROL, 374 CTRL_PIPE_MIN_PACKET_SIZE, USB_DIRECTION_BOTH); 377 int rc = usb_pipe_initialize(pipe, connection, 378 0, USB_TRANSFER_CONTROL, CTRL_PIPE_MIN_PACKET_SIZE, 379 USB_DIRECTION_BOTH); 375 380 376 381 pipe->auto_reset_halt = true; … … 437 442 * @return Error code. 438 443 */ 439 int usb_pipe_register(usb_pipe_t *pipe, unsigned interval) 444 int usb_pipe_register(usb_pipe_t *pipe, unsigned interval, 445 usb_hc_connection_t *hc_connection) 440 446 { 441 447 assert(pipe); 442 448 assert(pipe->wire); 443 assert(pipe->wire->hc_connection); 444 445 return usb_hc_register_endpoint(pipe->wire->hc_connection, 446 pipe->wire->address, pipe->endpoint_no, pipe->transfer_type, 447 pipe->direction, pipe->max_packet_size, interval); 449 assert(hc_connection); 450 451 if (!usb_hc_connection_is_opened(hc_connection)) 452 return EBADF; 453 async_exch_t *exch = async_exchange_begin(hc_connection->hc_sess); 454 if (!exch) 455 return ENOMEM; 456 const int ret = usbhc_register_endpoint(exch, 457 pipe->wire->address, pipe->endpoint_no, pipe->transfer_type, 458 pipe->direction, pipe->max_packet_size, interval); 459 460 async_exchange_end(exch); 461 return ret; 448 462 } 449 463 … … 454 468 * @return Error code. 455 469 */ 456 int usb_pipe_unregister(usb_pipe_t *pipe) 470 int usb_pipe_unregister(usb_pipe_t *pipe, 471 usb_hc_connection_t *hc_connection) 457 472 { 458 473 assert(pipe); 459 474 assert(pipe->wire); 460 assert(pipe->wire->hc_connection); 461 462 return usb_hc_unregister_endpoint(pipe->wire->hc_connection, 475 assert(hc_connection); 476 477 if (!usb_hc_connection_is_opened(hc_connection)) 478 return EBADF; 479 480 async_exch_t *exch = async_exchange_begin(hc_connection->hc_sess); 481 if (!exch) 482 return ENOMEM; 483 const int ret = usbhc_unregister_endpoint(exch, 463 484 pipe->wire->address, pipe->endpoint_no, pipe->direction); 485 async_exchange_end(exch); 486 487 return ret; 464 488 } 465 489
Note:
See TracChangeset
for help on using the changeset viewer.