Changes in uspace/lib/usb/src/pipesinit.c [4ede178:1998bcd] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/pipesinit.c
r4ede178 r1998bcd 356 356 assert(connection); 357 357 358 fibril_mutex_initialize(&pipe->guard);359 358 pipe->wire = connection; 360 359 pipe->hc_phone = -1; 361 fibril_mutex_initialize(&pipe->hc_phone_mutex);362 360 pipe->endpoint_no = endpoint_no; 363 361 pipe->transfer_type = transfer_type; 364 362 pipe->max_packet_size = max_packet_size; 365 363 pipe->direction = direction; 366 pipe->refcount = 0;367 364 368 365 return EOK; … … 416 413 int rc; 417 414 418 rc = usb_pipe_start_long_transfer(pipe); 415 TRY_LOOP(failed_attempts) { 416 rc = usb_pipe_start_session(pipe); 417 if (rc == EOK) { 418 break; 419 } 420 } 419 421 if (rc != EOK) { 420 422 return rc; … … 437 439 } 438 440 } 439 usb_pipe_end_ long_transfer(pipe);441 usb_pipe_end_session(pipe); 440 442 if (rc != EOK) { 441 443 return rc; … … 459 461 usb_hc_connection_t *hc_connection) 460 462 { 463 return usb_pipe_register_with_speed(pipe, USB_SPEED_MAX + 1, 464 interval, hc_connection); 465 } 466 467 /** Register endpoint with a speed at the host controller. 468 * 469 * You will rarely need to use this function because it is needed only 470 * if the registered endpoint is of address 0 and there is no other way 471 * to tell speed of the device at address 0. 472 * 473 * @param pipe Pipe to be registered. 474 * @param speed Speed of the device 475 * (invalid speed means use previously specified one). 476 * @param interval Polling interval. 477 * @param hc_connection Connection to the host controller (must be opened). 478 * @return Error code. 479 */ 480 int usb_pipe_register_with_speed(usb_pipe_t *pipe, usb_speed_t speed, 481 unsigned int interval, 482 usb_hc_connection_t *hc_connection) 483 { 461 484 assert(pipe); 462 485 assert(hc_connection); … … 466 489 } 467 490 468 #define _PACK(high, low) ((high) * 256 + (low)) 469 470 return async_req_5_0(hc_connection->hc_phone, 491 #define _PACK2(high, low) (((high) << 16) + (low)) 492 #define _PACK3(high, middle, low) (((((high) << 8) + (middle)) << 8) + (low)) 493 494 return async_req_4_0(hc_connection->hc_phone, 471 495 DEV_IFACE_ID(USBHC_DEV_IFACE), IPC_M_USBHC_REGISTER_ENDPOINT, 472 _PACK(pipe->wire->address, pipe->endpoint_no), 473 _PACK(pipe->transfer_type, pipe->direction), 474 pipe->max_packet_size, interval); 475 476 #undef _PACK 496 _PACK2(pipe->wire->address, pipe->endpoint_no), 497 _PACK3(speed, pipe->transfer_type, pipe->direction), 498 _PACK2(pipe->max_packet_size, interval)); 499 500 #undef _PACK2 501 #undef _PACK3 477 502 } 478 503
Note:
See TracChangeset
for help on using the changeset viewer.