Changeset 86650db in mainline
- Timestamp:
- 2018-01-05T22:47:26Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3f42eab
- Parents:
- 9e5b162
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/pipesinit.c
r9e5b162 r86650db 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 and 166 * 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 USB3 172 // See 4.14.2.1.1 of XHCI specification -> possibly refactor into one somehow-named field 173 .max_packet_size 174 = 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 thing 177 .packets = ED_MPS_TRANS_OPPORTUNITIES_GET(uint16_usb2host(endpoint_desc->max_packet_size)), 178 }; 179 180 /* TODO Extract USB2-related information */ 181 ep_desc->usb2 = (usb2_endpoint_desc_t) { 0 }; 182 183 if (companion_desc) { 184 ep_desc->usb3 = (usb3_endpoint_desc_t) { 185 .max_burst = companion_desc->max_burst, 186 .max_streams 187 = SS_COMPANION_MAX_STREAMS(companion_desc->attributes), 188 .bytes_per_interval 189 = companion_desc->bytes_per_interval, 190 .mult = SS_COMPANION_MULT(companion_desc->attributes), 191 }; 192 } 193 } 194 195 158 196 /** Process endpoint descriptor. 159 197 * … … 176 214 * Get endpoint characteristics. 177 215 */ 178 179 /* Actual endpoint number is in bits 0..3 */ 180 const usb_endpoint_t ep_no = endpoint_desc->endpoint_address & 0x0F; 216 usb_endpoint_desc_t ep_desc; 217 parse_endpoint_descriptors(&ep_desc, endpoint_desc, companion_desc); 181 218 182 219 const usb_endpoint_description_t description = { 183 /* Endpoint direction is set by bit 7 */ 184 .direction = (endpoint_desc->endpoint_address & 128) 185 ? USB_DIRECTION_IN : USB_DIRECTION_OUT, 186 /* Transfer type is in bits 0..2 and 187 * the enum values corresponds 1:1 */ 188 .transfer_type = endpoint_desc->attributes & 3, 220 .direction = ep_desc.direction, 221 .transfer_type = ep_desc.transfer_type, 189 222 190 223 /* Get interface characteristics. */ … … 206 239 if (ep_mapping->present) { 207 240 return EEXIST; 208 }209 210 usb_endpoint_desc_t ep_desc = {211 .endpoint_no = ep_no,212 .transfer_type = description.transfer_type,213 .direction = description.direction,214 // FIXME: USB2 max_packet_size is limited to 1023 bytes, 1024+ doesn't work for USB3215 // See 4.14.2.1.1 of XHCI specification -> possibly refactor into one somehow-named field216 .max_packet_size217 = ED_MPS_PACKET_SIZE_GET(uint16_usb2host(endpoint_desc->max_packet_size)),218 .interval = endpoint_desc->poll_interval,219 // FIXME: USB2 packets and USB3 max_burst are probably the same thing220 .packets221 = ED_MPS_TRANS_OPPORTUNITIES_GET(uint16_usb2host(endpoint_desc->max_packet_size)),222 };223 224 /* TODO Extract USB2-related information */225 ep_desc.usb2 = (usb2_endpoint_desc_t) { 0 };226 227 if (companion_desc) {228 ep_desc.usb3 = (usb3_endpoint_desc_t) {229 .max_burst = companion_desc->max_burst,230 .max_streams231 = SS_COMPANION_MAX_STREAMS(companion_desc->attributes),232 .bytes_per_interval233 = companion_desc->bytes_per_interval,234 .mult = SS_COMPANION_MULT(companion_desc->attributes),235 };236 241 } 237 242
Note:
See TracChangeset
for help on using the changeset viewer.