Changeset ec700c7 in mainline for uspace/lib/usbdev/src/pipesinit.c
- Timestamp:
- 2017-10-23T23:17:14Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 894f58c
- Parents:
- b724494
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/pipesinit.c
rb724494 rec700c7 38 38 #include <usb/dev/request.h> 39 39 #include <usb/usb.h> 40 #include <usb/debug.h> 40 41 #include <usb/descriptor.h> 41 42 … … 59 60 NESTING(INTERFACE, HID), 60 61 NESTING(HID, HID_REPORT), 62 NESTING(ENDPOINT, SSPEED_EP_COMPANION), 61 63 LAST_NESTING 62 64 }; … … 70 72 { 71 73 return descriptor[1] == USB_DESCTYPE_ENDPOINT; 74 } 75 76 /** Tells whether given descriptor is of superspeed companion type. 77 * 78 * @param descriptor Descriptor in question. 79 * @return Whether the given descriptor is superspeed companion descriptor. 80 */ 81 static inline bool is_superspeed_companion_descriptor(const uint8_t *descriptor) 82 { 83 return descriptor[1] == USB_DESCTYPE_SSPEED_EP_COMPANION; 72 84 } 73 85 … … 150 162 * @param interface Interface descriptor under which belongs the @p endpoint. 151 163 * @param endpoint Endpoint descriptor. 164 * @param companion Superspeed companion descriptor. 152 165 * @return Error code. 153 166 */ … … 156 169 usb_standard_interface_descriptor_t *interface, 157 170 usb_standard_endpoint_descriptor_t *endpoint_desc, 171 usb_superspeed_endpoint_companion_descriptor_t *companion_desc, 158 172 usb_dev_session_t *bus_session) 159 173 { … … 194 208 } 195 209 210 unsigned max_burst = 0; 211 unsigned max_streams = 0; 212 if(companion_desc) { 213 max_burst = companion_desc->max_burst; 214 max_streams = SS_COMPANION_MAX_STREAMS(companion_desc->attributes); 215 } 216 196 217 int rc = usb_pipe_initialize(&ep_mapping->pipe, 197 218 ep_no, description.transfer_type, 198 219 ED_MPS_PACKET_SIZE_GET( 199 220 uint16_usb2host(endpoint_desc->max_packet_size)), 200 description.direction, 221 description.direction, max_burst, max_streams, 201 222 ED_MPS_TRANS_OPPORTUNITIES_GET( 202 223 uint16_usb2host(endpoint_desc->max_packet_size)), bus_session); … … 207 228 ep_mapping->present = true; 208 229 ep_mapping->descriptor = endpoint_desc; 230 ep_mapping->companion_descriptor = companion_desc; 209 231 ep_mapping->interface = interface; 210 232 … … 235 257 do { 236 258 if (is_endpoint_descriptor(descriptor)) { 259 /* Check if companion descriptor is present too, it should immediatelly follow. */ 260 const uint8_t *companion_desc = usb_dp_get_nested_descriptor(parser, 261 parser_data, descriptor); 262 if (companion_desc && !is_superspeed_companion_descriptor(companion_desc)) { 263 /* Not what we wanted, don't pass it further. */ 264 companion_desc = NULL; 265 } 266 237 267 (void) process_endpoint(mapping, mapping_count, 238 268 (usb_standard_interface_descriptor_t *) … … 240 270 (usb_standard_endpoint_descriptor_t *) 241 271 descriptor, 272 (usb_superspeed_endpoint_companion_descriptor_t *) 273 companion_desc, 242 274 bus_session); 243 275 }
Note:
See TracChangeset
for help on using the changeset viewer.