Changeset c48f6ab in mainline for uspace/lib/usbdev/src/pipesinit.c
- Timestamp:
- 2011-11-30T20:14:37Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1f5c9c96
- Parents:
- fb48a0e (diff), f9776ae5 (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/usbdev/src/pipesinit.c
rfb48a0e rc48f6ab 54 54 55 55 /** Nesting pairs of standard descriptors. */ 56 static usb_dp_descriptor_nesting_t descriptor_nesting[] = {56 static const usb_dp_descriptor_nesting_t descriptor_nesting[] = { 57 57 NESTING(CONFIGURATION, INTERFACE), 58 58 NESTING(INTERFACE, ENDPOINT), … … 405 405 } 406 406 407 #define TRY_LOOP(attempt_var) \408 for (attempt_var = 0; attempt_var < 3; attempt_var++)409 410 size_t failed_attempts;411 int rc;412 407 413 408 usb_pipe_start_long_transfer(pipe); … … 415 410 uint8_t dev_descr_start[CTRL_PIPE_MIN_PACKET_SIZE]; 416 411 size_t transferred_size; 417 TRY_LOOP(failed_attempts) { 412 int rc; 413 for (size_t attempt_var = 0; attempt_var < 3; ++attempt_var) { 418 414 rc = usb_request_get_descriptor(pipe, USB_REQUEST_TYPE_STANDARD, 419 415 USB_REQUEST_RECIPIENT_DEVICE, USB_DESCTYPE_DEVICE, … … 450 446 { 451 447 assert(pipe); 448 assert(pipe->wire); 452 449 assert(hc_connection); 453 450 454 451 if (!usb_hc_connection_is_opened(hc_connection)) 455 452 return EBADF; 456 457 const usb_target_t target =458 {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }};459 #define _PACK2(high, low) (((high & 0xffff) << 16) | (low & 0xffff))460 461 453 async_exch_t *exch = async_exchange_begin(hc_connection->hc_sess); 462 int rc = async_req_4_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 463 IPC_M_USBHC_REGISTER_ENDPOINT, target.packed, 464 _PACK2(pipe->transfer_type, pipe->direction), 465 _PACK2(pipe->max_packet_size, interval)); 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 466 460 async_exchange_end(exch); 467 468 #undef _PACK2 469 return rc; 461 return ret; 470 462 } 471 463 … … 482 474 assert(pipe->wire); 483 475 assert(hc_connection); 484 476 485 477 if (!usb_hc_connection_is_opened(hc_connection)) 486 478 return EBADF; 487 479 488 480 async_exch_t *exch = async_exchange_begin(hc_connection->hc_sess); 489 int rc = async_req_4_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 490 IPC_M_USBHC_UNREGISTER_ENDPOINT, 481 if (!exch) 482 return ENOMEM; 483 const int ret = usbhc_unregister_endpoint(exch, 491 484 pipe->wire->address, pipe->endpoint_no, pipe->direction); 492 485 async_exchange_end(exch); 493 494 return r c;486 487 return ret; 495 488 } 496 489
Note:
See TracChangeset
for help on using the changeset viewer.