Changeset 365e29e2 in mainline
- Timestamp:
- 2011-09-14T19:25:06Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bdd8ad2f
- Parents:
- 56e9fb0
- Location:
- uspace/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_usbhc.c
r56e9fb0 r365e29e2 238 238 } 239 239 240 usb_target_t target = { 241 {.address = DEV_IPC_GET_ARG1(*call), 242 .endpoint = DEV_IPC_GET_ARG2(*call) } 243 }; 244 size_t data_buffer_len = DEV_IPC_GET_ARG3(*call); 240 const usb_target_t target = { .packed = DEV_IPC_GET_ARG1(*call) }; 241 size_t data_buffer_len = DEV_IPC_GET_ARG2(*call); 245 242 246 243 int rc; … … 302 299 } 303 300 304 usb_target_t target = {{ 305 .address = DEV_IPC_GET_ARG1(*call), 306 .endpoint = DEV_IPC_GET_ARG2(*call) 307 }}; 301 const usb_target_t target = { .packed = DEV_IPC_GET_ARG1(*call) }; 308 302 309 303 int rc; … … 379 373 type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % (1 << 8) 380 374 381 _INIT_FROM_HIGH_DATA2(usb_address_t, address, 1); 382 _INIT_FROM_LOW_DATA2(usb_endpoint_t, endpoint, 1); 375 const usb_target_t target = { .packed = DEV_IPC_GET_ARG1(*call) }; 383 376 384 377 _INIT_FROM_HIGH_DATA3(usb_speed_t, speed, 2); … … 395 388 #undef _INIT_FROM_LOW_DATA3 396 389 397 int rc = usb_iface->register_endpoint(fun, address, speed, endpoint, 390 int rc = usb_iface->register_endpoint(fun, target.address, 391 speed, target.endpoint, 398 392 transfer_type, direction, max_packet_size, interval); 399 393 … … 436 430 } 437 431 438 const usb_target_t target = {{ 439 .address = DEV_IPC_GET_ARG1(*call), 440 .endpoint = DEV_IPC_GET_ARG2(*call) 441 }}; 442 432 const usb_target_t target = { .packed = DEV_IPC_GET_ARG1(*call) }; 443 433 444 434 async_transaction_t *trans = async_transaction_create(callid); … … 484 474 } 485 475 486 const usb_target_t target = {{ 487 .address = DEV_IPC_GET_ARG1(*call), 488 .endpoint = DEV_IPC_GET_ARG2(*call) 489 }}; 490 476 const usb_target_t target = { .packed = DEV_IPC_GET_ARG1(*call) }; 491 477 492 478 async_transaction_t *trans = async_transaction_create(callid); -
uspace/lib/usbdev/src/pipesinit.c
r56e9fb0 r365e29e2 486 486 return EBADF; 487 487 488 const usb_target_t target = 489 {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }}; 488 490 #define _PACK2(high, low) (((high) << 16) + (low)) 489 491 #define _PACK3(high, middle, low) (((((high) << 8) + (middle)) << 8) + (low)) … … 491 493 async_exch_t *exch = async_exchange_begin(hc_connection->hc_sess); 492 494 int rc = async_req_4_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 493 IPC_M_USBHC_REGISTER_ENDPOINT, 494 _PACK2(pipe->wire->address, pipe->endpoint_no), 495 IPC_M_USBHC_REGISTER_ENDPOINT, target.packed, 495 496 _PACK3(speed, pipe->transfer_type, pipe->direction), 496 497 _PACK2(pipe->max_packet_size, interval)); -
uspace/lib/usbdev/src/pipesio.c
r56e9fb0 r365e29e2 65 65 void *buffer, size_t size, size_t *size_transfered) 66 66 { 67 /* 68 * Get corresponding IPC method. 69 * In future, replace with static array of mappings 70 * transfer type -> method. 71 */ 72 usbhc_iface_funcs_t ipc_method; 73 switch (pipe->transfer_type) { 74 case USB_TRANSFER_INTERRUPT: 75 case USB_TRANSFER_BULK: 76 ipc_method = IPC_M_USBHC_DATA_READ; 77 break; 78 default: 79 return ENOTSUP; 80 } 67 /* Only interrupt and bulk transfers are supported */ 68 if (pipe->transfer_type != USB_TRANSFER_INTERRUPT && 69 pipe->transfer_type != USB_TRANSFER_BULK) 70 return ENOTSUP; 71 72 const usb_target_t target = 73 {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }}; 81 74 82 75 /* Ensure serialization over the phone. */ … … 87 80 * Make call identifying target USB device and type of transfer. 88 81 */ 89 aid_t opening_request = async_send_ 3(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),90 ipc_method, pipe->wire->address, pipe->endpoint_no, NULL);82 aid_t opening_request = async_send_2(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 83 IPC_M_USBHC_DATA_READ, target.packed, NULL); 91 84 92 85 if (opening_request == 0) { … … 211 204 void *buffer, size_t size) 212 205 { 213 /* 214 * Get corresponding IPC method. 215 * In future, replace with static array of mappings 216 * transfer type -> method. 217 */ 218 usbhc_iface_funcs_t ipc_method; 219 switch (pipe->transfer_type) { 220 case USB_TRANSFER_INTERRUPT: 221 case USB_TRANSFER_BULK: 222 ipc_method = IPC_M_USBHC_DATA_WRITE; 223 break; 224 default: 225 return ENOTSUP; 226 } 206 /* Only interrupt and bulk transfers are supported */ 207 if (pipe->transfer_type != USB_TRANSFER_INTERRUPT && 208 pipe->transfer_type != USB_TRANSFER_BULK) 209 return ENOTSUP; 210 211 const usb_target_t target = 212 {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }}; 227 213 228 214 /* Ensure serialization over the phone. */ … … 233 219 * Make call identifying target USB device and type of transfer. 234 220 */ 235 aid_t opening_request = async_send_ 3(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),236 ipc_method, pipe->wire->address, pipe->endpoint_no, NULL);221 aid_t opening_request = async_send_2(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 222 IPC_M_USBHC_DATA_WRITE, target.packed, NULL); 237 223 238 224 if (opening_request == 0) { … … 348 334 pipe_start_transaction(pipe); 349 335 336 const usb_target_t target = 337 {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }}; 338 350 339 /* 351 340 * Make call identifying target USB device and control transfer type. 352 341 */ 353 342 async_exch_t *exch = async_exchange_begin(pipe->hc_sess); 354 aid_t opening_request = async_send_3(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 355 IPC_M_USBHC_CONTROL_READ, pipe->wire->address, pipe->endpoint_no, 356 NULL); 343 aid_t opening_request = async_send_2(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 344 IPC_M_USBHC_CONTROL_READ, target.packed, NULL); 357 345 358 346 if (opening_request == 0) { … … 494 482 pipe_start_transaction(pipe); 495 483 484 const usb_target_t target = 485 {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }}; 486 496 487 /* 497 488 * Make call identifying target USB device and control transfer type. 498 489 */ 499 490 async_exch_t *exch = async_exchange_begin(pipe->hc_sess); 500 aid_t opening_request = async_send_ 4(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),501 IPC_M_USBHC_CONTROL_WRITE, pipe->wire->address, pipe->endpoint_no,491 aid_t opening_request = async_send_3(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 492 IPC_M_USBHC_CONTROL_WRITE, target.packed, 502 493 data_buffer_size, NULL); 503 494
Note:
See TracChangeset
for help on using the changeset viewer.