Changeset 27736cf in mainline
- Timestamp:
- 2011-10-31T16:50:31Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 07a7a97d
- Parents:
- f37eb84
- Location:
- uspace
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/hc_iface.c
rf37eb84 r27736cf 120 120 */ 121 121 static int register_endpoint(ddf_fun_t *fun, 122 usb_address_t address, usb_ speed_t speed, usb_endpoint_t endpoint,122 usb_address_t address, usb_endpoint_t endpoint, 123 123 usb_transfer_type_t transfer_type, usb_direction_t direction, 124 124 size_t max_packet_size, unsigned int interval) -
uspace/drv/bus/usb/vhc/connhost.c
rf37eb84 r27736cf 128 128 */ 129 129 static int register_endpoint(ddf_fun_t *fun, 130 usb_address_t address, usb_ speed_t speed, usb_endpoint_t endpoint,130 usb_address_t address, usb_endpoint_t endpoint, 131 131 usb_transfer_type_t transfer_type, usb_direction_t direction, 132 132 size_t max_packet_size, unsigned int interval) -
uspace/lib/drv/generic/remote_usbhc.c
rf37eb84 r27736cf 55 55 static remote_iface_func_ptr_t remote_usbhc_iface_ops[] = { 56 56 [IPC_M_USBHC_REQUEST_ADDRESS] = remote_usbhc_request_address, 57 [IPC_M_USBHC_RELEASE_ADDRESS] = remote_usbhc_release_address, 57 58 [IPC_M_USBHC_BIND_ADDRESS] = remote_usbhc_bind_address, 58 59 [IPC_M_USBHC_GET_HANDLE_BY_ADDRESS] = remote_usbhc_find_by_address, 59 [IPC_M_USBHC_RELEASE_ADDRESS] = remote_usbhc_release_address,60 60 61 61 [IPC_M_USBHC_REGISTER_ENDPOINT] = remote_usbhc_register_endpoint, … … 234 234 235 235 #define _INIT_FROM_HIGH_DATA2(type, var, arg_no) \ 236 type var = (type) DEV_IPC_GET_ARG##arg_no(*call) / (1 <<16)236 type var = (type) (DEV_IPC_GET_ARG##arg_no(*call) >> 16) 237 237 #define _INIT_FROM_LOW_DATA2(type, var, arg_no) \ 238 type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % (1 << 16) 239 #define _INIT_FROM_HIGH_DATA3(type, var, arg_no) \ 240 type var = (type) DEV_IPC_GET_ARG##arg_no(*call) / (1 << 16) 241 #define _INIT_FROM_MIDDLE_DATA3(type, var, arg_no) \ 242 type var = (type) (DEV_IPC_GET_ARG##arg_no(*call) / (1 << 8)) % (1 << 8) 243 #define _INIT_FROM_LOW_DATA3(type, var, arg_no) \ 244 type var = (type) DEV_IPC_GET_ARG##arg_no(*call) % (1 << 8) 238 type var = (type) (DEV_IPC_GET_ARG##arg_no(*call) & 0xffff) 245 239 246 240 const usb_target_t target = { .packed = DEV_IPC_GET_ARG1(*call) }; 247 241 248 _INIT_FROM_HIGH_DATA3(usb_speed_t, speed, 2); 249 _INIT_FROM_MIDDLE_DATA3(usb_transfer_type_t, transfer_type, 2); 250 _INIT_FROM_LOW_DATA3(usb_direction_t, direction, 2); 242 _INIT_FROM_HIGH_DATA2(usb_transfer_type_t, transfer_type, 2); 243 _INIT_FROM_LOW_DATA2(usb_direction_t, direction, 2); 251 244 252 245 _INIT_FROM_HIGH_DATA2(size_t, max_packet_size, 3); … … 255 248 #undef _INIT_FROM_HIGH_DATA2 256 249 #undef _INIT_FROM_LOW_DATA2 257 #undef _INIT_FROM_HIGH_DATA3 258 #undef _INIT_FROM_MIDDLE_DATA3 259 #undef _INIT_FROM_LOW_DATA3 260 261 int rc = usb_iface->register_endpoint(fun, target.address, speed, 250 251 int rc = usb_iface->register_endpoint(fun, target.address, 262 252 target.endpoint, transfer_type, direction, max_packet_size, interval); 263 253 -
uspace/lib/drv/include/usbhc_iface.h
rf37eb84 r27736cf 176 176 177 177 int (*register_endpoint)(ddf_fun_t *, 178 usb_address_t, usb_ speed_t, usb_endpoint_t,178 usb_address_t, usb_endpoint_t, 179 179 usb_transfer_type_t, usb_direction_t, size_t, unsigned int); 180 180 int (*unregister_endpoint)(ddf_fun_t *, usb_address_t, usb_endpoint_t, -
uspace/lib/usbdev/include/usb/dev/pipes.h
rf37eb84 r27736cf 172 172 int usb_pipe_initialize_from_configuration(usb_endpoint_mapping_t *, 173 173 size_t, const uint8_t *, size_t, usb_device_connection_t *); 174 int usb_pipe_register_with_speed(usb_pipe_t *, usb_speed_t,175 unsigned int, usb_hc_connection_t *);176 174 int usb_pipe_register(usb_pipe_t *, unsigned int, usb_hc_connection_t *); 177 175 int usb_pipe_unregister(usb_pipe_t *, usb_hc_connection_t *); -
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 } -
uspace/lib/usbhost/src/iface.c
rf37eb84 r27736cf 182 182 /*----------------------------------------------------------------------------*/ 183 183 static int register_endpoint( 184 ddf_fun_t *fun, usb_address_t address, usb_speed_t ep_speed, 185 usb_endpoint_t endpoint, 184 ddf_fun_t *fun, usb_address_t address, usb_endpoint_t endpoint, 186 185 usb_transfer_type_t transfer_type, usb_direction_t direction, 187 186 size_t max_packet_size, unsigned int interval)
Note:
See TracChangeset
for help on using the changeset viewer.