Changeset 27736cf in mainline for uspace/lib/usbdev/src/pipesinit.c
- Timestamp:
- 2011-10-31T16:50:31Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 07a7a97d
- Parents:
- f37eb84
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/pipesinit.c
rf37eb84 r27736cf 454 454 * @return Error code. 455 455 */ 456 int usb_pipe_register(usb_pipe_t *pipe, 457 unsigned int interval, 458 usb_hc_connection_t *hc_connection) 459 { 460 return usb_pipe_register_with_speed(pipe, USB_SPEED_MAX + 1, 461 interval, hc_connection); 462 } 463 464 /** Register endpoint with a speed at the host controller. 465 * 466 * You will rarely need to use this function because it is needed only 467 * if the registered endpoint is of address 0 and there is no other way 468 * to tell speed of the device at address 0. 469 * 470 * @param pipe Pipe to be registered. 471 * @param speed Speed of the device 472 * (invalid speed means use previously specified one). 473 * @param interval Polling interval. 474 * @param hc_connection Connection to the host controller (must be opened). 475 * @return Error code. 476 */ 477 int usb_pipe_register_with_speed(usb_pipe_t *pipe, usb_speed_t speed, 478 unsigned int interval, 456 int usb_pipe_register(usb_pipe_t *pipe, unsigned interval, 479 457 usb_hc_connection_t *hc_connection) 480 458 { 481 459 assert(pipe); 482 460 assert(hc_connection); 483 461 484 462 if (!usb_hc_connection_is_opened(hc_connection)) 485 463 return EBADF; 486 464 487 465 const usb_target_t target = 488 466 {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }}; 489 #define _PACK2(high, low) (((high) << 16) + (low)) 490 #define _PACK3(high, middle, low) (((((high) << 8) + (middle)) << 8) + (low)) 491 467 #define _PACK2(high, low) (((high & 0xffff) << 16) | (low & 0xffff)) 468 492 469 async_exch_t *exch = async_exchange_begin(hc_connection->hc_sess); 493 470 int rc = async_req_4_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 494 471 IPC_M_USBHC_REGISTER_ENDPOINT, target.packed, 495 _PACK 3(speed,pipe->transfer_type, pipe->direction),472 _PACK2(pipe->transfer_type, pipe->direction), 496 473 _PACK2(pipe->max_packet_size, interval)); 497 474 async_exchange_end(exch); 498 475 499 476 #undef _PACK2 500 #undef _PACK3501 502 477 return rc; 503 478 }
Note:
See TracChangeset
for help on using the changeset viewer.