Changeset 9efad54 in mainline for uspace/lib/usbdev/src/pipesinit.c
- Timestamp:
- 2018-01-06T21:15:48Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 56257ba
- Parents:
- c901632
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/pipesinit.c
rc901632 r9efad54 156 156 } 157 157 158 static void parse_endpoint_descriptors(usb_endpoint_desc_t *ep_desc,159 usb_standard_endpoint_descriptor_t *endpoint_desc,160 usb_superspeed_endpoint_companion_descriptor_t *companion_desc)161 {162 *ep_desc = (usb_endpoint_desc_t) {163 /* Actual endpoint number is in bits 0..3 */164 .endpoint_no = endpoint_desc->endpoint_address & 0x0F,165 /* Transfer type is in bits 0..2 and166 * the enum values corresponds 1:1 */167 .transfer_type = endpoint_desc->attributes & 3,168 /* Endpoint direction is set by bit 7 */169 .direction = (endpoint_desc->endpoint_address & 128)170 ? USB_DIRECTION_IN : USB_DIRECTION_OUT,171 // FIXME: USB2 max_packet_size is limited to 1023 bytes, 1024+ doesn't work for USB3172 // See 4.14.2.1.1 of XHCI specification -> possibly refactor into one somehow-named field173 .max_packet_size174 = ED_MPS_PACKET_SIZE_GET(uint16_usb2host(endpoint_desc->max_packet_size)),175 .interval = endpoint_desc->poll_interval,176 // FIXME: USB2 packets and USB3 max_burst are probably the same thing177 .packets = ED_MPS_TRANS_OPPORTUNITIES_GET(uint16_usb2host(endpoint_desc->max_packet_size)),178 };179 180 if (companion_desc) {181 ep_desc->usb3 = (usb3_endpoint_desc_t) {182 .max_burst = companion_desc->max_burst,183 .max_streams184 = SS_COMPANION_MAX_STREAMS(companion_desc->attributes),185 .bytes_per_interval186 = companion_desc->bytes_per_interval,187 .mult = SS_COMPANION_MULT(companion_desc->attributes),188 };189 }190 }191 192 193 158 /** Process endpoint descriptor. 194 159 * … … 211 176 * Get endpoint characteristics. 212 177 */ 213 usb_endpoint_desc_t ep_desc;214 parse_endpoint_descriptors(&ep_desc, endpoint_desc, companion_desc);215 216 178 const usb_endpoint_description_t description = { 217 . direction = ep_desc.direction,218 . transfer_type = ep_desc.transfer_type,179 .transfer_type = USB_ED_GET_TRANSFER_TYPE(*endpoint_desc), 180 .direction = USB_ED_GET_DIR(*endpoint_desc), 219 181 220 182 /* Get interface characteristics. */ … … 238 200 } 239 201 240 int err = usb_pipe_initialize(&ep_mapping->pipe, bus_session, &ep_desc);202 int err = usb_pipe_initialize(&ep_mapping->pipe, bus_session, description.transfer_type); 241 203 if (err) 242 204 return err;
Note:
See TracChangeset
for help on using the changeset viewer.