Changeset 1998bcd in mainline for uspace/lib/usb
- Timestamp:
- 2011-04-08T22:25:00Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 98064795
- Parents:
- 297341b
- Location:
- uspace/lib/usb
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/host/device_keeper.h
r297341b r1998bcd 73 73 void usb_device_keeper_add_ep( 74 74 usb_device_keeper_t *instance, usb_address_t address, endpoint_t *ep); 75 void usb_device_keeper_del_ep( 76 usb_device_keeper_t *instance, usb_address_t address, endpoint_t *ep); 75 77 76 78 void usb_device_keeper_reserve_default_address( -
uspace/lib/usb/include/usb/pipes.h
r297341b r1998bcd 134 134 int usb_pipe_initialize_from_configuration(usb_endpoint_mapping_t *, 135 135 size_t, uint8_t *, size_t, usb_device_connection_t *); 136 int usb_pipe_register_with_speed(usb_pipe_t *, usb_speed_t, 137 unsigned int, usb_hc_connection_t *); 136 138 int usb_pipe_register(usb_pipe_t *, unsigned int, usb_hc_connection_t *); 137 139 int usb_pipe_unregister(usb_pipe_t *, usb_hc_connection_t *); -
uspace/lib/usb/src/host/device_keeper.c
r297341b r1998bcd 56 56 instance->devices[i].control_used = 0; 57 57 instance->devices[i].handle = 0; 58 instance->devices[i].speed = USB_SPEED_MAX; 58 59 list_initialize(&instance->devices[i].endpoints); 59 60 } 61 // TODO: is this hack enough? 62 // (it is needed to allow smooth registration at default address) 63 instance->devices[0].occupied = true; 60 64 } 61 65 /*----------------------------------------------------------------------------*/ … … 67 71 assert(instance->devices[address].occupied); 68 72 list_append(&ep->same_device_eps, &instance->devices[address].endpoints); 73 fibril_mutex_unlock(&instance->guard); 74 } 75 /*----------------------------------------------------------------------------*/ 76 void usb_device_keeper_del_ep( 77 usb_device_keeper_t *instance, usb_address_t address, endpoint_t *ep) 78 { 79 assert(instance); 80 fibril_mutex_lock(&instance->guard); 81 assert(instance->devices[address].occupied); 82 list_remove(&ep->same_device_eps); 83 list_initialize(&ep->same_device_eps); 69 84 fibril_mutex_unlock(&instance->guard); 70 85 } -
uspace/lib/usb/src/pipesinit.c
r297341b r1998bcd 461 461 usb_hc_connection_t *hc_connection) 462 462 { 463 return usb_pipe_register_with_speed(pipe, USB_SPEED_MAX + 1, 464 interval, hc_connection); 465 } 466 467 /** Register endpoint with a speed at the host controller. 468 * 469 * You will rarely need to use this function because it is needed only 470 * if the registered endpoint is of address 0 and there is no other way 471 * to tell speed of the device at address 0. 472 * 473 * @param pipe Pipe to be registered. 474 * @param speed Speed of the device 475 * (invalid speed means use previously specified one). 476 * @param interval Polling interval. 477 * @param hc_connection Connection to the host controller (must be opened). 478 * @return Error code. 479 */ 480 int usb_pipe_register_with_speed(usb_pipe_t *pipe, usb_speed_t speed, 481 unsigned int interval, 482 usb_hc_connection_t *hc_connection) 483 { 463 484 assert(pipe); 464 485 assert(hc_connection); … … 468 489 } 469 490 470 #define _PACK(high, low) ((high) * 256 + (low)) 471 472 return async_req_5_0(hc_connection->hc_phone, 491 #define _PACK2(high, low) (((high) << 16) + (low)) 492 #define _PACK3(high, middle, low) (((((high) << 8) + (middle)) << 8) + (low)) 493 494 return async_req_4_0(hc_connection->hc_phone, 473 495 DEV_IFACE_ID(USBHC_DEV_IFACE), IPC_M_USBHC_REGISTER_ENDPOINT, 474 _PACK(pipe->wire->address, pipe->endpoint_no), 475 _PACK(pipe->transfer_type, pipe->direction), 476 pipe->max_packet_size, interval); 477 478 #undef _PACK 496 _PACK2(pipe->wire->address, pipe->endpoint_no), 497 _PACK3(speed, pipe->transfer_type, pipe->direction), 498 _PACK2(pipe->max_packet_size, interval)); 499 500 #undef _PACK2 501 #undef _PACK3 479 502 } 480 503
Note:
See TracChangeset
for help on using the changeset viewer.