Changeset e50cd7f in mainline for uspace/lib/drv/generic/remote_usbhc.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/drv/generic/remote_usbhc.c
ref354b6 re50cd7f 50 50 static void remote_usbhc_control_write(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 51 51 static void remote_usbhc_control_read(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 52 static void remote_usbhc_reserve_default_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);53 static void remote_usbhc_release_default_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);54 52 static void remote_usbhc_request_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 55 53 static void remote_usbhc_bind_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); … … 61 59 /** Remote USB host controller interface operations. */ 62 60 static remote_iface_func_ptr_t remote_usbhc_iface_ops [] = { 63 remote_usbhc_reserve_default_address,64 remote_usbhc_release_default_address,65 66 61 remote_usbhc_request_address, 67 62 remote_usbhc_bind_address, … … 129 124 } 130 125 131 void remote_usbhc_reserve_default_address(ddf_fun_t *fun, void *iface,132 ipc_callid_t callid, ipc_call_t *call)133 {134 usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;135 136 if (!usb_iface->reserve_default_address) {137 async_answer_0(callid, ENOTSUP);138 return;139 }140 141 usb_speed_t speed = DEV_IPC_GET_ARG1(*call);142 143 int rc = usb_iface->reserve_default_address(fun, speed);144 145 async_answer_0(callid, rc);146 }147 148 void remote_usbhc_release_default_address(ddf_fun_t *fun, void *iface,149 ipc_callid_t callid, ipc_call_t *call)150 {151 usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;152 153 if (!usb_iface->release_default_address) {154 async_answer_0(callid, ENOTSUP);155 return;156 }157 158 int rc = usb_iface->release_default_address(fun);159 160 async_answer_0(callid, rc);161 }162 163 126 void remote_usbhc_request_address(ddf_fun_t *fun, void *iface, 164 127 ipc_callid_t callid, ipc_call_t *call) … … 270 233 } 271 234 272 size_t max_packet_size = DEV_IPC_GET_ARG3(*call);273 235 usb_target_t target = { 274 236 .address = DEV_IPC_GET_ARG1(*call), … … 300 262 trans->size = len; 301 263 302 rc = transfer_func(fun, target, max_packet_size,264 rc = transfer_func(fun, target, 303 265 buffer, len, 304 266 callback_out, trans); … … 326 288 } 327 289 328 size_t max_packet_size = DEV_IPC_GET_ARG3(*call);329 290 usb_target_t target = { 330 291 .address = DEV_IPC_GET_ARG1(*call), … … 348 309 trans->size = len; 349 310 350 int rc = transfer_func(fun, target, max_packet_size,311 int rc = transfer_func(fun, target, 351 312 trans->buffer, len, 352 313 callback_in, trans); … … 414 375 }; 415 376 size_t data_buffer_len = DEV_IPC_GET_ARG3(*call); 416 size_t max_packet_size = DEV_IPC_GET_ARG4(*call);417 377 418 378 int rc; … … 450 410 trans->size = data_buffer_len; 451 411 452 rc = usb_iface->control_write(fun, target, max_packet_size,412 rc = usb_iface->control_write(fun, target, 453 413 setup_packet, setup_packet_len, 454 414 data_buffer, data_buffer_len, … … 477 437 .endpoint = DEV_IPC_GET_ARG2(*call) 478 438 }; 479 size_t max_packet_size = DEV_IPC_GET_ARG3(*call);480 439 481 440 int rc; … … 515 474 } 516 475 517 rc = usb_iface->control_read(fun, target, max_packet_size,476 rc = usb_iface->control_read(fun, target, 518 477 setup_packet, setup_packet_len, 519 478 trans->buffer, trans->size, … … 537 496 } 538 497 539 #define INIT_FROM_HIGH_DATA(type, var, arg_no) \ 540 type var = (type) DEV_IPC_GET_ARG##arg_no(*call) / 256 541 #define INIT_FROM_LOW_DATA(type, var, arg_no) \ 542 type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % 256 543 544 INIT_FROM_HIGH_DATA(usb_address_t, address, 1); 545 INIT_FROM_LOW_DATA(usb_endpoint_t, endpoint, 1); 546 INIT_FROM_HIGH_DATA(usb_transfer_type_t, transfer_type, 2); 547 INIT_FROM_LOW_DATA(usb_direction_t, direction, 2); 548 549 #undef INIT_FROM_HIGH_DATA 550 #undef INIT_FROM_LOW_DATA 551 552 size_t max_packet_size = (size_t) DEV_IPC_GET_ARG3(*call); 553 unsigned int interval = (unsigned int) DEV_IPC_GET_ARG4(*call); 554 555 int rc = usb_iface->register_endpoint(fun, address, endpoint, 498 #define _INIT_FROM_HIGH_DATA2(type, var, arg_no) \ 499 type var = (type) DEV_IPC_GET_ARG##arg_no(*call) / (1 << 16) 500 #define _INIT_FROM_LOW_DATA2(type, var, arg_no) \ 501 type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % (1 << 16) 502 #define _INIT_FROM_HIGH_DATA3(type, var, arg_no) \ 503 type var = (type) DEV_IPC_GET_ARG##arg_no(*call) / (1 << 16) 504 #define _INIT_FROM_MIDDLE_DATA3(type, var, arg_no) \ 505 type var = (type) (DEV_IPC_GET_ARG##arg_no(*call) / (1 << 8)) % (1 << 8) 506 #define _INIT_FROM_LOW_DATA3(type, var, arg_no) \ 507 type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % (1 << 8) 508 509 _INIT_FROM_HIGH_DATA2(usb_address_t, address, 1); 510 _INIT_FROM_LOW_DATA2(usb_endpoint_t, endpoint, 1); 511 512 _INIT_FROM_HIGH_DATA3(usb_speed_t, speed, 2); 513 _INIT_FROM_MIDDLE_DATA3(usb_transfer_type_t, transfer_type, 2); 514 _INIT_FROM_LOW_DATA3(usb_direction_t, direction, 2); 515 516 _INIT_FROM_HIGH_DATA2(size_t, max_packet_size, 3); 517 _INIT_FROM_LOW_DATA2(unsigned int, interval, 3); 518 519 #undef _INIT_FROM_HIGH_DATA2 520 #undef _INIT_FROM_LOW_DATA2 521 #undef _INIT_FROM_HIGH_DATA3 522 #undef _INIT_FROM_MIDDLE_DATA3 523 #undef _INIT_FROM_LOW_DATA3 524 525 int rc = usb_iface->register_endpoint(fun, address, speed, endpoint, 556 526 transfer_type, direction, max_packet_size, interval); 557 527
Note:
See TracChangeset
for help on using the changeset viewer.