Changeset 4e732f1a in mainline
- Timestamp:
- 2014-01-24T02:10:16Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 42de21a
- Parents:
- 3de7a62
- Location:
- uspace
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/hw_struct/queue_head.c
r3de7a62 r4e732f1a 79 79 } 80 80 81 // TODO Fix 'multi' 1 packet should be safe. Probably won't work82 // without enabling parking mode in async schedule83 81 // TODO Figure out how to correctly use CMASK and SMASK for LS/FS 84 82 // INT transfers. Current values are just guesses 85 /* Setting TT stuff on HS endpoints is OK, the fields are ignored */ 83 /* Setting TT stuff on HS endpoints is OK, the fields are ignored, 84 * and so is setting multi on async (should be 1 anyway)*/ 86 85 EHCI_MEM32_WR(instance->ep_cap, 87 QH_EP_CAP_MULTI_SET( 1) |86 QH_EP_CAP_MULTI_SET(ep->packets) | 88 87 QH_EP_CAP_TT_PORT_SET(ep->tt.port) | 89 88 QH_EP_CAP_TT_ADDR_SET(ep->tt.address) | -
uspace/drv/bus/usb/ehci/hw_struct/queue_head.h
r3de7a62 r4e732f1a 39 39 #include <usb/host/endpoint.h> 40 40 41 #include "../utils/malloc32.h" 41 42 #include "link_pointer.h" 42 43 #include "mem_access.h" -
uspace/drv/bus/usb/ohci/hw_struct/endpoint_descriptor.c
r3de7a62 r4e732f1a 63 63 { 64 64 assert(instance); 65 memset(instance, 0, sizeof( ed_t));65 memset(instance, 0, sizeof(*instance)); 66 66 67 67 if (ep == NULL) { -
uspace/lib/drv/generic/remote_usb.c
r3de7a62 r4e732f1a 161 161 } 162 162 163 int static_assert[sizeof(sysarg_t) >= 4 ? 1 : -1]; 164 typedef union { 165 uint8_t arr[sizeof(sysarg_t)]; 166 sysarg_t arg; 167 } pack8_t; 168 163 169 int usb_register_endpoint(async_exch_t *exch, usb_endpoint_t endpoint, 164 170 usb_transfer_type_t type, usb_direction_t direction, 165 size_t mps, unsigned interval) 166 { 167 if (!exch) 168 return EBADMEM; 169 #define _PACK2(high, low) (((high & 0xffff) << 16) | (low & 0xffff)) 171 size_t mps, unsigned packets, unsigned interval) 172 { 173 if (!exch) 174 return EBADMEM; 175 pack8_t pack; 176 pack.arr[0] = type; 177 pack.arr[1] = direction; 178 pack.arr[2] = interval; 179 pack.arr[3] = packets; 170 180 171 181 return async_req_4_0(exch, DEV_IFACE_ID(USB_DEV_IFACE), 172 IPC_M_USB_REGISTER_ENDPOINT, endpoint, 173 _PACK2(type, direction), _PACK2(mps, interval)); 174 175 #undef _PACK2 182 IPC_M_USB_REGISTER_ENDPOINT, endpoint, pack.arg, mps); 183 176 184 } 177 185 … … 408 416 } 409 417 410 #define _INIT_FROM_HIGH_DATA2(type, var, arg_no) \411 type var = (type) (DEV_IPC_GET_ARG##arg_no(*call) >> 16)412 #define _INIT_FROM_LOW_DATA2(type, var, arg_no) \413 type var = (type) (DEV_IPC_GET_ARG##arg_no(*call) & 0xffff)414 415 418 const usb_endpoint_t endpoint = DEV_IPC_GET_ARG1(*call); 416 417 _INIT_FROM_HIGH_DATA2(usb_transfer_type_t, transfer_type, 2); 418 _INIT_FROM_LOW_DATA2(usb_direction_t, direction, 2); 419 420 _INIT_FROM_HIGH_DATA2(size_t, max_packet_size, 3); 421 _INIT_FROM_LOW_DATA2(unsigned int, interval, 3); 422 423 #undef _INIT_FROM_HIGH_DATA2 424 #undef _INIT_FROM_LOW_DATA2 419 const pack8_t pack = { .arg = DEV_IPC_GET_ARG2(*call)}; 420 const size_t max_packet_size = DEV_IPC_GET_ARG3(*call); 421 422 const usb_transfer_type_t transfer_type = pack.arr[0]; 423 const usb_direction_t direction = pack.arr[1]; 424 unsigned packets = pack.arr[2]; 425 unsigned interval = pack.arr[3]; 425 426 426 427 const int ret = usb_iface->register_endpoint(fun, endpoint, 427 transfer_type, direction, max_packet_size, interval);428 transfer_type, direction, max_packet_size, packets, interval); 428 429 429 430 async_answer_0(callid, ret); -
uspace/lib/drv/include/usb_iface.h
r3de7a62 r4e732f1a 58 58 59 59 int usb_register_endpoint(async_exch_t *, usb_endpoint_t, usb_transfer_type_t, 60 usb_direction_t, size_t, unsigned );60 usb_direction_t, size_t, unsigned, unsigned); 61 61 int usb_unregister_endpoint(async_exch_t *, usb_endpoint_t, usb_direction_t); 62 62 int usb_read(async_exch_t *, usb_endpoint_t, uint64_t, void *, size_t, size_t *); … … 81 81 82 82 int (*register_endpoint)(ddf_fun_t *, usb_endpoint_t, 83 usb_transfer_type_t, usb_direction_t, size_t, unsigned );83 usb_transfer_type_t, usb_direction_t, size_t, unsigned, unsigned); 84 84 int (*unregister_endpoint)(ddf_fun_t *, usb_endpoint_t, 85 85 usb_direction_t); -
uspace/lib/usb/include/usb/descriptor.h
r3de7a62 r4e732f1a 197 197 */ 198 198 uint8_t attributes; 199 /** Maximum packet size. */ 199 /** Maximum packet size. 200 * Lower 10 bits represent the actuall size 201 * Bits 11,12 specify addtional transfer opportunitities for 202 * HS INT and ISO transfers. */ 200 203 uint16_t max_packet_size; 204 #define ED_MPS_PACKET_SIZE_MASK 0x3ff 205 #define ED_MPS_PACKET_SIZE_GET(value) \ 206 ((value) & ED_MPS_PACKET_SIZE_MASK) 207 #define ED_MPS_TRANS_OPPORTUNITIES_GET(value) \ 208 ((((value) >> 10) & 0x3) + 1) 201 209 /** Polling interval in milliseconds. 202 210 * Ignored for bulk and control endpoints. -
uspace/lib/usbdev/include/usb/dev/pipes.h
r3de7a62 r4e732f1a 61 61 size_t max_packet_size; 62 62 63 /** Number of packets per frame/uframe. 64 * Only valid for HS INT and ISO transfers. All others should set to 1*/ 65 unsigned packets; 66 63 67 /** Whether to automatically reset halt on the endpoint. 64 68 * Valid only for control endpoint zero. … … 105 109 106 110 int usb_pipe_initialize(usb_pipe_t *, usb_endpoint_t, usb_transfer_type_t, 107 size_t, usb_direction_t, u sb_dev_session_t *);111 size_t, usb_direction_t, unsigned, usb_dev_session_t *); 108 112 int usb_pipe_initialize_default_control(usb_pipe_t *, usb_dev_session_t *); 109 113 -
uspace/lib/usbdev/src/pipes.c
r3de7a62 r4e732f1a 254 254 int usb_pipe_initialize(usb_pipe_t *pipe, usb_endpoint_t endpoint_no, 255 255 usb_transfer_type_t transfer_type, size_t max_packet_size, 256 usb_direction_t direction, u sb_dev_session_t *bus_session)256 usb_direction_t direction, unsigned packets, usb_dev_session_t *bus_session) 257 257 { 258 258 assert(pipe); … … 260 260 pipe->endpoint_no = endpoint_no; 261 261 pipe->transfer_type = transfer_type; 262 pipe->packets = packets; 262 263 pipe->max_packet_size = max_packet_size; 263 264 pipe->direction = direction; … … 279 280 280 281 const int rc = usb_pipe_initialize(pipe, 0, USB_TRANSFER_CONTROL, 281 CTRL_PIPE_MIN_PACKET_SIZE, USB_DIRECTION_BOTH, bus_session);282 CTRL_PIPE_MIN_PACKET_SIZE, USB_DIRECTION_BOTH, 1, bus_session); 282 283 283 284 pipe->auto_reset_halt = true; … … 301 302 const int ret = usb_register_endpoint(exch, pipe->endpoint_no, 302 303 pipe->transfer_type, pipe->direction, pipe->max_packet_size, 303 interval);304 pipe->packets, interval); 304 305 async_exchange_end(exch); 305 306 return ret; -
uspace/lib/usbdev/src/pipesinit.c
r3de7a62 r4e732f1a 196 196 int rc = usb_pipe_initialize(&ep_mapping->pipe, 197 197 ep_no, description.transfer_type, 198 uint16_usb2host(endpoint_desc->max_packet_size), 199 description.direction, bus_session); 198 ED_MPS_PACKET_SIZE_GET( 199 uint16_usb2host(endpoint_desc->max_packet_size)), 200 description.direction, 201 ED_MPS_TRANS_OPPORTUNITIES_GET( 202 uint16_usb2host(endpoint_desc->max_packet_size)), bus_session); 200 203 if (rc != EOK) { 201 204 return rc; -
uspace/lib/usbhost/include/usb/host/endpoint.h
r3de7a62 r4e732f1a 57 57 /** Maximum size of data packets. */ 58 58 size_t max_packet_size; 59 /** Additional opportunities per uframe */ 60 unsigned packets; 59 61 /** Necessary bandwidth. */ 60 62 size_t bandwidth; … … 85 87 endpoint_t * endpoint_create(usb_address_t address, usb_endpoint_t endpoint, 86 88 usb_direction_t direction, usb_transfer_type_t type, usb_speed_t speed, 87 size_t max_packet_size, size_t bw, usb_address_t tt_address,88 u nsigned tt_port);89 size_t max_packet_size, unsigned packets, size_t bw, 90 usb_address_t tt_address, unsigned tt_port); 89 91 void endpoint_destroy(endpoint_t *instance); 90 92 -
uspace/lib/usbhost/include/usb/host/hcd.h
r3de7a62 r4e732f1a 109 109 110 110 int hcd_add_ep(hcd_t *hcd, usb_target_t target, usb_direction_t dir, 111 usb_transfer_type_t type, size_t max_packet_size, size_t size,112 usb_address_t tt_address, unsigned tt_port);111 usb_transfer_type_t type, size_t max_packet_size, unsigned packets, 112 size_t size, usb_address_t tt_address, unsigned tt_port); 113 113 114 114 int hcd_remove_ep(hcd_t *hcd, usb_target_t target, usb_direction_t dir); -
uspace/lib/usbhost/include/usb/host/usb_bus.h
r3de7a62 r4e732f1a 97 97 int usb_bus_add_ep(usb_bus_t *instance, 98 98 usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction, 99 usb_transfer_type_t type, size_t max_packet_size, size_t data_size,100 ep_add_callback_t callback, void *arg, usb_address_t tt_address,101 u nsigned tt_port);99 usb_transfer_type_t type, size_t max_packet_size, unsigned packets, 100 size_t data_size, ep_add_callback_t callback, void *arg, 101 usb_address_t tt_address, unsigned tt_port); 102 102 103 103 int usb_bus_remove_ep(usb_bus_t *instance, -
uspace/lib/usbhost/src/ddf_helpers.c
r3de7a62 r4e732f1a 110 110 ddf_fun_t *fun, usb_endpoint_t endpoint, 111 111 usb_transfer_type_t transfer_type, usb_direction_t direction, 112 size_t max_packet_size, unsigned interval)112 size_t max_packet_size, unsigned packets, unsigned interval) 113 113 { 114 114 assert(fun); … … 126 126 127 127 return hcd_add_ep(hcd, target, direction, transfer_type, 128 max_packet_size, size, dev->tt_address, dev->port);128 max_packet_size, packets, size, dev->tt_address, dev->port); 129 129 } 130 130 … … 491 491 ret = hcd_add_ep(hcd, 492 492 default_target, USB_DIRECTION_BOTH, USB_TRANSFER_CONTROL, 493 CTRL_PIPE_MIN_PACKET_SIZE, CTRL_PIPE_MIN_PACKET_SIZE, 493 CTRL_PIPE_MIN_PACKET_SIZE, CTRL_PIPE_MIN_PACKET_SIZE, 1, 494 494 tt_address, port); 495 495 … … 517 517 /* Register EP on the new address */ 518 518 ret = hcd_add_ep(hcd, target, USB_DIRECTION_BOTH, USB_TRANSFER_CONTROL, 519 desc.max_packet_size, desc.max_packet_size, tt_address, port); 519 ED_MPS_PACKET_SIZE_GET(uint16_usb2host(desc.max_packet_size)), 520 ED_MPS_TRANS_OPPORTUNITIES_GET(uint16_usb2host(desc.max_packet_size)), 521 ED_MPS_PACKET_SIZE_GET(uint16_usb2host(desc.max_packet_size)), 522 tt_address, port); 520 523 if (ret != EOK) { 521 524 hcd_remove_ep(hcd, default_target, USB_DIRECTION_BOTH); -
uspace/lib/usbhost/src/endpoint.c
r3de7a62 r4e732f1a 50 50 endpoint_t * endpoint_create(usb_address_t address, usb_endpoint_t endpoint, 51 51 usb_direction_t direction, usb_transfer_type_t type, usb_speed_t speed, 52 size_t max_packet_size, size_t bw, usb_address_t tt_address, unsigned tt_p) 52 size_t max_packet_size, unsigned packets, size_t bw, 53 usb_address_t tt_address, unsigned tt_p) 53 54 { 54 55 endpoint_t *instance = malloc(sizeof(endpoint_t)); … … 60 61 instance->speed = speed; 61 62 instance->max_packet_size = max_packet_size; 63 instance->packets = packets; 62 64 instance->bandwidth = bw; 63 65 instance->toggle = 0; -
uspace/lib/usbhost/src/hcd.c
r3de7a62 r4e732f1a 132 132 133 133 int hcd_add_ep(hcd_t *hcd, usb_target_t target, usb_direction_t dir, 134 usb_transfer_type_t type, size_t max_packet_size, size_t size,135 usb_address_t tt_address, unsigned tt_port)134 usb_transfer_type_t type, size_t max_packet_size, unsigned packets, 135 size_t size, usb_address_t tt_address, unsigned tt_port) 136 136 { 137 137 assert(hcd); 138 138 return usb_bus_add_ep(&hcd->bus, target.address, 139 target.endpoint, dir, type, max_packet_size, size, register_helper,140 hcd, tt_address, tt_port);139 target.endpoint, dir, type, max_packet_size, packets, size, 140 register_helper, hcd, tt_address, tt_port); 141 141 } 142 142 -
uspace/lib/usbhost/src/usb_bus.c
r3de7a62 r4e732f1a 301 301 int usb_bus_add_ep(usb_bus_t *instance, 302 302 usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction, 303 usb_transfer_type_t type, size_t max_packet_size, size_t data_size,304 ep_add_callback_t callback, void *arg, usb_address_t tt_address,305 u nsigned tt_port)303 usb_transfer_type_t type, size_t max_packet_size, unsigned packets, 304 size_t data_size, ep_add_callback_t callback, void *arg, 305 usb_address_t tt_address, unsigned tt_port) 306 306 { 307 307 assert(instance); … … 337 337 338 338 ep = endpoint_create(address, endpoint, direction, type, speed, 339 max_packet_size, bw, tt_address, tt_port);339 max_packet_size, packets, bw, tt_address, tt_port); 340 340 if (!ep) { 341 341 fibril_mutex_unlock(&instance->guard);
Note:
See TracChangeset
for help on using the changeset viewer.