Changeset e50cd7f in mainline for uspace/lib/usb/src/pipesinit.c
- Timestamp:
- 2011-04-17T19:17:55Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 63517c2, cfbbe1d3
- Parents:
- ef354b6 (diff), 8595577b (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/pipesinit.c
ref354b6 re50cd7f 356 356 assert(connection); 357 357 358 fibril_mutex_initialize(&pipe->guard); 358 359 pipe->wire = connection; 359 360 pipe->hc_phone = -1; 361 fibril_mutex_initialize(&pipe->hc_phone_mutex); 360 362 pipe->endpoint_no = endpoint_no; 361 363 pipe->transfer_type = transfer_type; 362 364 pipe->max_packet_size = max_packet_size; 363 365 pipe->direction = direction; 366 pipe->refcount = 0; 367 pipe->auto_reset_halt = false; 364 368 365 369 return EOK; … … 382 386 0, USB_TRANSFER_CONTROL, CTRL_PIPE_MIN_PACKET_SIZE, 383 387 USB_DIRECTION_BOTH); 388 389 pipe->auto_reset_halt = true; 384 390 385 391 return rc; … … 413 419 int rc; 414 420 415 TRY_LOOP(failed_attempts) { 416 rc = usb_pipe_start_session(pipe); 417 if (rc == EOK) { 418 break; 419 } 420 } 421 rc = usb_pipe_start_long_transfer(pipe); 421 422 if (rc != EOK) { 422 423 return rc; … … 439 440 } 440 441 } 441 usb_pipe_end_ session(pipe);442 usb_pipe_end_long_transfer(pipe); 442 443 if (rc != EOK) { 443 444 return rc; … … 461 462 usb_hc_connection_t *hc_connection) 462 463 { 464 return usb_pipe_register_with_speed(pipe, USB_SPEED_MAX + 1, 465 interval, hc_connection); 466 } 467 468 /** Register endpoint with a speed at the host controller. 469 * 470 * You will rarely need to use this function because it is needed only 471 * if the registered endpoint is of address 0 and there is no other way 472 * to tell speed of the device at address 0. 473 * 474 * @param pipe Pipe to be registered. 475 * @param speed Speed of the device 476 * (invalid speed means use previously specified one). 477 * @param interval Polling interval. 478 * @param hc_connection Connection to the host controller (must be opened). 479 * @return Error code. 480 */ 481 int usb_pipe_register_with_speed(usb_pipe_t *pipe, usb_speed_t speed, 482 unsigned int interval, 483 usb_hc_connection_t *hc_connection) 484 { 463 485 assert(pipe); 464 486 assert(hc_connection); … … 468 490 } 469 491 470 #define _PACK(high, low) ((high) * 256 + (low)) 471 472 return async_req_5_0(hc_connection->hc_phone, 492 #define _PACK2(high, low) (((high) << 16) + (low)) 493 #define _PACK3(high, middle, low) (((((high) << 8) + (middle)) << 8) + (low)) 494 495 return async_req_4_0(hc_connection->hc_phone, 473 496 DEV_IFACE_ID(USBHC_DEV_IFACE), IPC_M_USBHC_REGISTER_ENDPOINT, 474 _PACK(pipe->wire->address, pipe->endpoint_no), 475 _PACK(pipe->transfer_type, pipe->direction), 476 pipe->max_packet_size, interval); 477 478 #undef _PACK 497 _PACK2(pipe->wire->address, pipe->endpoint_no), 498 _PACK3(speed, pipe->transfer_type, pipe->direction), 499 _PACK2(pipe->max_packet_size, interval)); 500 501 #undef _PACK2 502 #undef _PACK3 479 503 } 480 504
Note:
See TracChangeset
for help on using the changeset viewer.