Changes in uspace/lib/usb/src/usbdrv.c [cb59f787:4689d40] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/usbdrv.c
rcb59f787 r4689d40 55 55 /** Connect to host controller the device is physically attached to. 56 56 * 57 * @param handle Device handle.57 * @param dev Device asking for connection. 58 58 * @param flags Connection flags (blocking connection). 59 59 * @return Phone to corresponding HC or error code. … … 64 64 * Call parent hub to obtain device handle of respective HC. 65 65 */ 66 return ENOTSUP; 66 67 /* 68 * FIXME: currently we connect always to virtual host controller. 69 */ 70 int rc; 71 devman_handle_t handle; 72 73 rc = devman_device_get_handle("/vhc", &handle, 0); 74 if (rc != EOK) { 75 return rc; 76 } 77 78 int phone = devman_device_connect(handle, 0); 79 80 return phone; 67 81 } 68 82 … … 75 89 usb_address_t usb_drv_get_my_address(int phone, device_t *dev) 76 90 { 77 return ENOTSUP; 91 ipcarg_t address; 92 int rc = async_req_1_1(phone, IPC_M_USBHC_GET_ADDRESS, 93 dev->handle, &address); 94 95 if (rc != EOK) { 96 return rc; 97 } 98 99 return (usb_address_t) address; 100 } 101 102 /** Tell HC to reserve default address. 103 * 104 * @param phone Open phone to host controller driver. 105 * @return Error code. 106 */ 107 int usb_drv_reserve_default_address(int phone) 108 { 109 return async_req_0_0(phone, IPC_M_USBHC_RESERVE_DEFAULT_ADDRESS); 110 } 111 112 /** Tell HC to release default address. 113 * 114 * @param phone Open phone to host controller driver. 115 * @return Error code. 116 */ 117 int usb_drv_release_default_address(int phone) 118 { 119 return async_req_0_0(phone, IPC_M_USBHC_RELEASE_DEFAULT_ADDRESS); 120 } 121 122 /** Ask HC for free address assignment. 123 * 124 * @param phone Open phone to host controller driver. 125 * @return Assigned USB address or negative error code. 126 */ 127 usb_address_t usb_drv_request_address(int phone) 128 { 129 ipcarg_t address; 130 int rc = async_req_0_1(phone, IPC_M_USBHC_REQUEST_ADDRESS, &address); 131 if (rc != EOK) { 132 return rc; 133 } else { 134 return (usb_address_t) address; 135 } 136 } 137 138 /** Inform HC about binding address with devman handle. 139 * 140 * @param phone Open phone to host controller driver. 141 * @param address Address to be binded. 142 * @param handle Devman handle of the device. 143 * @return Error code. 144 */ 145 int usb_drv_bind_address(int phone, usb_address_t address, 146 devman_handle_t handle) 147 { 148 int rc = async_req_2_0(phone, IPC_M_USBHC_BIND_ADDRESS, 149 address, handle); 150 151 return rc; 152 } 153 154 /** Inform HC about address release. 155 * 156 * @param phone Open phone to host controller driver. 157 * @param address Address to be released. 158 * @return Error code. 159 */ 160 int usb_drv_release_address(int phone, usb_address_t address) 161 { 162 return async_req_1_0(phone, IPC_M_USBHC_RELEASE_ADDRESS, address); 78 163 } 79 164 … … 323 408 } 324 409 410 /** Start control write transfer. */ 411 int usb_drv_async_control_write_setup(int phone, usb_target_t target, 412 void *buffer, size_t size, 413 usb_handle_t *handle) 414 { 415 return async_send_buffer(phone, 416 IPC_M_USBHC_CONTROL_WRITE_SETUP, 417 target, 418 buffer, size, 419 handle); 420 } 421 422 /** Send data during control write transfer. */ 423 int usb_drv_async_control_write_data(int phone, usb_target_t target, 424 void *buffer, size_t size, 425 usb_handle_t *handle) 426 { 427 return async_send_buffer(phone, 428 IPC_M_USBHC_CONTROL_WRITE_DATA, 429 target, 430 buffer, size, 431 handle); 432 } 433 434 /** Finalize control write transfer. */ 435 int usb_drv_async_control_write_status(int phone, usb_target_t target, 436 usb_handle_t *handle) 437 { 438 return async_recv_buffer(phone, 439 IPC_M_USBHC_CONTROL_WRITE_STATUS, 440 target, 441 NULL, 0, NULL, 442 handle); 443 } 444 445 /** Start control read transfer. */ 446 int usb_drv_async_control_read_setup(int phone, usb_target_t target, 447 void *buffer, size_t size, 448 usb_handle_t *handle) 449 { 450 return async_send_buffer(phone, 451 IPC_M_USBHC_CONTROL_READ_SETUP, 452 target, 453 buffer, size, 454 handle); 455 } 456 457 /** Read data during control read transfer. */ 458 int usb_drv_async_control_read_data(int phone, usb_target_t target, 459 void *buffer, size_t size, size_t *actual_size, 460 usb_handle_t *handle) 461 { 462 return async_recv_buffer(phone, 463 IPC_M_USBHC_CONTROL_READ_DATA, 464 target, 465 buffer, size, actual_size, 466 handle); 467 } 468 469 /** Finalize control read transfer. */ 470 int usb_drv_async_control_read_status(int phone, usb_target_t target, 471 usb_handle_t *handle) 472 { 473 return async_send_buffer(phone, 474 IPC_M_USBHC_CONTROL_READ_STATUS, 475 target, 476 NULL, 0, 477 handle); 478 } 479 325 480 /** 326 481 * @}
Note:
See TracChangeset
for help on using the changeset viewer.