objc2_io_usb_host/generated/AppleUSBDescriptorParsing.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3#[cfg(feature = "objc2-io-kit")]
4use objc2_io_kit::*;
5
6use crate::*;
7
8extern "C-unwind" {
9 /// Get the next descriptor in a configuration descriptor
10 ///
11 /// This method will advance currentDescriptor by its bLength, and validate that the new descriptor fits withing the bounds of configurationDescriptor. Using NULL for currentDescriptor will return the first descriptor after the configuration descriptor.
12 ///
13 /// Parameter `configurationDescriptor`: Configuration descriptor that contains the descriptors to iterate through
14 ///
15 /// Parameter `currentDescriptor`: A descriptor pointer within the bounds of configurationDescriptor, or NULL
16 ///
17 /// Returns: Descriptor pointer, or NULL if no descriptor can be returned
18 ///
19 /// # Safety
20 ///
21 /// - `configuration_descriptor` must be a valid pointer.
22 /// - `current_descriptor` must be a valid pointer.
23 #[cfg(feature = "objc2-io-kit")]
24 pub fn IOUSBGetNextDescriptor(
25 configuration_descriptor: *const IOUSBConfigurationDescriptor,
26 current_descriptor: *const IOUSBDescriptorHeader,
27 ) -> *const IOUSBDescriptorHeader;
28}
29
30extern "C-unwind" {
31 /// Find the next descriptor matching a given type within a configuration descriptor
32 ///
33 /// This method uses getNextDescriptor, and further validates that the returned descriptor's bDescriptorType field matches the type parameter.
34 ///
35 /// Parameter `configurationDescriptor`: Configuration descriptor that contains the descriptors to iterate through
36 ///
37 /// Parameter `currentDescriptor`: A descriptor pointer within the bounds of configurationDescriptor, or NULL
38 ///
39 /// Parameter `type`: tDescriptorType representing the descriptor type to find
40 ///
41 /// Returns: Descriptor pointer, or NULL if no matching descriptor can be found
42 ///
43 /// # Safety
44 ///
45 /// - `configuration_descriptor` must be a valid pointer.
46 /// - `current_descriptor` must be a valid pointer.
47 #[cfg(feature = "objc2-io-kit")]
48 pub fn IOUSBGetNextDescriptorWithType(
49 configuration_descriptor: *const IOUSBConfigurationDescriptor,
50 current_descriptor: *const IOUSBDescriptorHeader,
51 r#type: u8,
52 ) -> *const IOUSBDescriptorHeader;
53}
54
55extern "C-unwind" {
56 /// Get the next descriptor in a configuration descriptor that belongs to another container descriptor
57 ///
58 /// This method uses getNextDescriptor, but will return NULL if another descriptor is found whose bDescriptorType field matches the value used for parentDescriptor's bDescriptorType. Using NULL for currentDescriptor will return the first descriptor after parentDescriptor.
59 ///
60 /// Parameter `configurationDescriptor`: Configuration descriptor that contains the descriptors to iterate through
61 ///
62 /// Parameter `parentDescriptor`: A descriptor pointer within the bounds of configurationDescriptor
63 ///
64 /// Parameter `currentDescriptor`: A descriptor pointer within the bounds of configurationDescriptor, or NULL
65 ///
66 /// Returns: Descriptor pointer, or NULL if no descriptor can be returned
67 ///
68 /// # Safety
69 ///
70 /// - `configuration_descriptor` must be a valid pointer.
71 /// - `parent_descriptor` must be a valid pointer.
72 /// - `current_descriptor` must be a valid pointer.
73 #[cfg(feature = "objc2-io-kit")]
74 pub fn IOUSBGetNextAssociatedDescriptor(
75 configuration_descriptor: *const IOUSBConfigurationDescriptor,
76 parent_descriptor: *const IOUSBDescriptorHeader,
77 current_descriptor: *const IOUSBDescriptorHeader,
78 ) -> *const IOUSBDescriptorHeader;
79}
80
81extern "C-unwind" {
82 /// Find the next descriptor matching a given type within a configuration descriptor that belongs to another container descriptor
83 ///
84 /// This method uses getNextAssociatedDescriptor, and further validates that the returned descriptor's bDescriptorType field matches the type passed parameter.
85 ///
86 /// Parameter `configurationDescriptor`: Configuration descriptor that contains the descriptors to iterate through
87 ///
88 /// Parameter `parentDescriptor`: A descriptor pointer within the bounds of configurationDescriptor
89 ///
90 /// Parameter `currentDescriptor`: A descriptor pointer within the bounds of configurationDescriptor, or NULL
91 ///
92 /// Parameter `type`: tDescriptorType representing the descriptor type to find
93 ///
94 /// Returns: Descriptor pointer, or NULL if no matching descriptor can be found
95 ///
96 /// # Safety
97 ///
98 /// - `configuration_descriptor` must be a valid pointer.
99 /// - `parent_descriptor` must be a valid pointer.
100 /// - `current_descriptor` must be a valid pointer.
101 #[cfg(feature = "objc2-io-kit")]
102 pub fn IOUSBGetNextAssociatedDescriptorWithType(
103 configuration_descriptor: *const IOUSBConfigurationDescriptor,
104 parent_descriptor: *const IOUSBDescriptorHeader,
105 current_descriptor: *const IOUSBDescriptorHeader,
106 r#type: u8,
107 ) -> *const IOUSBDescriptorHeader;
108}
109
110extern "C-unwind" {
111 /// Find the next interface association descriptor in a configuration descriptor
112 ///
113 /// This method uses getNextDescriptorWithType to fetch the next interface association descriptor
114 ///
115 /// Parameter `configurationDescriptor`: Configuration descriptor that contains the descriptors to iterate through
116 ///
117 /// Parameter `currentDescriptor`: A descriptor pointer within the bounds of configurationDescriptor, or NULL
118 ///
119 /// Returns: InterfaceAssociationDescriptor pointer, or NULL if no matching descriptor can be found
120 ///
121 /// # Safety
122 ///
123 /// - `configuration_descriptor` must be a valid pointer.
124 /// - `current_descriptor` must be a valid pointer.
125 #[cfg(feature = "objc2-io-kit")]
126 pub fn IOUSBGetNextInterfaceAssociationDescriptor(
127 configuration_descriptor: *const IOUSBConfigurationDescriptor,
128 current_descriptor: *const IOUSBDescriptorHeader,
129 ) -> *const IOUSBInterfaceAssociationDescriptor;
130}
131
132extern "C-unwind" {
133 /// Find the next interface descriptor in a configuration descriptor
134 ///
135 /// This method uses getNextDescriptorWithType to fetch the next interface descriptor
136 ///
137 /// Parameter `configurationDescriptor`: Configuration descriptor that contains the descriptors to iterate through
138 ///
139 /// Parameter `currentDescriptor`: A descriptor pointer within the bounds of configurationDescriptor, or NULL
140 ///
141 /// Returns: InterfaceDescriptor pointer, or NULL if no matching descriptor can be found
142 ///
143 /// # Safety
144 ///
145 /// - `configuration_descriptor` must be a valid pointer.
146 /// - `current_descriptor` must be a valid pointer.
147 #[cfg(feature = "objc2-io-kit")]
148 pub fn IOUSBGetNextInterfaceDescriptor(
149 configuration_descriptor: *const IOUSBConfigurationDescriptor,
150 current_descriptor: *const IOUSBDescriptorHeader,
151 ) -> *const IOUSBInterfaceDescriptor;
152}
153
154extern "C-unwind" {
155 /// Find the next endpoint descriptor associated with an interface descriptor
156 ///
157 /// This method uses getNextAssociatedDescriptorWithType to fetch the next endpoint descriptor associated with a specific interface descriptor
158 ///
159 /// Parameter `configurationDescriptor`: Configuration descriptor that contains the descriptors to iterate through
160 ///
161 /// Parameter `interfaceDescriptor`: An interface descriptor within the bounds of configurationDescriptor
162 ///
163 /// Parameter `currentDescriptor`: A descriptor pointer within the bounds of configurationDescriptor, or NULL
164 ///
165 /// Returns: EndpointDescriptor pointer, or NULL if no matching descriptor can be found
166 ///
167 /// # Safety
168 ///
169 /// - `configuration_descriptor` must be a valid pointer.
170 /// - `interface_descriptor` must be a valid pointer.
171 /// - `current_descriptor` must be a valid pointer.
172 #[cfg(feature = "objc2-io-kit")]
173 pub fn IOUSBGetNextEndpointDescriptor(
174 configuration_descriptor: *const IOUSBConfigurationDescriptor,
175 interface_descriptor: *const IOUSBInterfaceDescriptor,
176 current_descriptor: *const IOUSBDescriptorHeader,
177 ) -> *const IOUSBEndpointDescriptor;
178}
179
180extern "C-unwind" {
181 /// Get the next device capability descriptor in a BOS descriptor
182 ///
183 /// This method will advance currentDescriptor by its bLength, and validate that the new descriptor fits withing the bounds of bosDescriptor. Using NULL for currentDescriptor will return the first descriptor after the BOS descriptor.
184 ///
185 /// Parameter `bosDescriptor`: BOS descriptor that contains the descriptors to iterate through
186 ///
187 /// Parameter `currentDescriptor`: A descriptor pointer within the bounds of bosDescriptor, or NULL
188 ///
189 /// Returns: DeviceCapabilityDescriptor pointer, or NULL if no descriptor can be returned
190 ///
191 /// # Safety
192 ///
193 /// - `bos_descriptor` must be a valid pointer.
194 /// - `current_descriptor` must be a valid pointer.
195 #[cfg(feature = "objc2-io-kit")]
196 pub fn IOUSBGetNextCapabilityDescriptor(
197 bos_descriptor: *const IOUSBBOSDescriptor,
198 current_descriptor: *const IOUSBDeviceCapabilityDescriptorHeader,
199 ) -> *const IOUSBDeviceCapabilityDescriptorHeader;
200}
201
202extern "C-unwind" {
203 /// Find the next descriptor matching a given type within a BOS descriptor
204 ///
205 /// This method uses getNextCapabilityDescriptor, and further validates that the returned descriptor's bDevCapabilityType field matches the type parameter.
206 ///
207 /// Parameter `bosDescriptor`: BOS descriptor that contains the descriptors to iterate through
208 ///
209 /// Parameter `currentDescriptor`: A descriptor pointer within the bounds of bosDescriptor, or NULL
210 ///
211 /// Parameter `type`: tDeviceCapabilityType representing the descriptor type to find
212 ///
213 /// Returns: DeviceCapabilityDescriptor pointer, or NULL if no matching descriptor can be found
214 ///
215 /// # Safety
216 ///
217 /// - `bos_descriptor` must be a valid pointer.
218 /// - `current_descriptor` must be a valid pointer.
219 #[cfg(feature = "objc2-io-kit")]
220 pub fn IOUSBGetNextCapabilityDescriptorWithType(
221 bos_descriptor: *const IOUSBBOSDescriptor,
222 current_descriptor: *const IOUSBDeviceCapabilityDescriptorHeader,
223 r#type: u8,
224 ) -> *const IOUSBDeviceCapabilityDescriptorHeader;
225}
226
227extern "C-unwind" {
228 /// Find the first USB20ExtensionCapabilityDescriptor in a BOS descriptor
229 ///
230 /// This method uses getNextCapabilityDescriptorWithType to fetch the first USB20ExtensionCapabilityDescriptor
231 ///
232 /// Parameter `bosDescriptor`: BOS descriptor that contains the descriptors to iterate through
233 ///
234 /// Returns: USB20ExtensionCapabilityDescriptor pointer, or NULL if no matching descriptor can be found
235 ///
236 /// # Safety
237 ///
238 /// `bos_descriptor` must be a valid pointer.
239 #[cfg(feature = "objc2-io-kit")]
240 pub fn IOUSBGetUSB20ExtensionDeviceCapabilityDescriptor(
241 bos_descriptor: *const IOUSBBOSDescriptor,
242 ) -> *const IOUSBDeviceCapabilityUSB2Extension;
243}
244
245extern "C-unwind" {
246 /// Find the first SuperSpeedUSBDeviceCapabilityDescriptor in a BOS descriptor
247 ///
248 /// This method uses getNextCapabilityDescriptorWithType to fetch the first SuperSpeedUSBDeviceCapabilityDescriptor
249 ///
250 /// Parameter `bosDescriptor`: BOS descriptor that contains the descriptors to iterate through
251 ///
252 /// Returns: SuperSpeedUSBDeviceCapabilityDescriptor pointer, or NULL if no matching descriptor can be found
253 ///
254 /// # Safety
255 ///
256 /// `bos_descriptor` must be a valid pointer.
257 #[cfg(feature = "objc2-io-kit")]
258 pub fn IOUSBGetSuperSpeedDeviceCapabilityDescriptor(
259 bos_descriptor: *const IOUSBBOSDescriptor,
260 ) -> *const IOUSBDeviceCapabilitySuperSpeedUSB;
261}
262
263extern "C-unwind" {
264 /// Find the first SuperSpeedPlusUSBDeviceCapabilityDescriptor in a BOS descriptor
265 ///
266 /// This method uses getNextCapabilityDescriptorWithType to fetch the first SuperSpeedPlusUSBDeviceCapabilityDescriptor
267 ///
268 /// Parameter `bosDescriptor`: BOS descriptor that contains the descriptors to iterate through
269 ///
270 /// Returns: SuperSpeedPlusUSBDeviceCapabilityDescriptor pointer, or NULL if no matching descriptor can be found
271 ///
272 /// # Safety
273 ///
274 /// `bos_descriptor` must be a valid pointer.
275 #[cfg(feature = "objc2-io-kit")]
276 pub fn IOUSBGetSuperSpeedPlusDeviceCapabilityDescriptor(
277 bos_descriptor: *const IOUSBBOSDescriptor,
278 ) -> *const IOUSBDeviceCapabilitySuperSpeedPlusUSB;
279}
280
281extern "C-unwind" {
282 /// Find the first ContainerIDCapabilityDescriptor in a BOS descriptor
283 ///
284 /// This method uses getNextCapabilityDescriptorWithType to fetch the first ContainerIDCapabilityDescriptor
285 ///
286 /// Parameter `bosDescriptor`: BOS descriptor that contains the descriptors to iterate through
287 ///
288 /// Returns: ContainerIDCapabilityDescriptor pointer, or NULL if no matching descriptor can be found
289 ///
290 /// # Safety
291 ///
292 /// `bos_descriptor` must be a valid pointer.
293 #[cfg(feature = "objc2-io-kit")]
294 pub fn IOUSBGetContainerIDDescriptor(
295 bos_descriptor: *const IOUSBBOSDescriptor,
296 ) -> *const IOUSBDeviceCapabilityContainerID;
297}
298
299extern "C-unwind" {
300 /// Find the first PlatformCapabilityDescriptor in a BOS descriptor
301 ///
302 /// This method uses getNextCapabilityDescriptorWithType to fetch the first PlatformCapabilityDescriptor
303 ///
304 /// Parameter `bosDescriptor`: BOS descriptor that contains the descriptors to iterate through
305 ///
306 /// Returns: PlatformCapabilityDescriptor pointer, or NULL if no matching descriptor can be found
307 ///
308 /// # Safety
309 ///
310 /// - `bos_descriptor` must be a valid pointer.
311 /// - The returned struct field 5 Array TODO.
312 #[cfg(feature = "objc2-io-kit")]
313 pub fn IOUSBGetPlatformCapabilityDescriptor(
314 bos_descriptor: *const IOUSBBOSDescriptor,
315 ) -> *const IOUSBPlatformCapabilityDescriptor;
316}
317
318extern "C-unwind" {
319 /// Find the first BillboardCapabilityDescriptor in a BOS descriptor
320 ///
321 /// This method uses getNextCapabilityDescriptorWithType to fetch the first BillboardCapabilityDescriptor
322 ///
323 /// Parameter `bosDescriptor`: BOS descriptor that contains the descriptors to iterate through
324 ///
325 /// Returns: BillboardCapabilityDescriptor pointer, or NULL if no matching descriptor can be found
326 ///
327 /// # Safety
328 ///
329 /// `bos_descriptor` must be a valid pointer.
330 #[cfg(feature = "objc2-io-kit")]
331 pub fn IOUSBGetBillboardDescriptor(
332 bos_descriptor: *const IOUSBBOSDescriptor,
333 ) -> *const IOUSBDeviceCapabilityBillboard;
334}
335
336extern "C-unwind" {
337 /// Extract the direction of an endpoint from an endpoint descriptor
338 ///
339 /// This method parses an endpoint descriptor to determine its transfer direction
340 ///
341 /// Parameter `descriptor`: The descriptor to parse
342 ///
343 /// Returns: tEndpointDirection indicating the direction found. Control endpoints return tEndpointDirection.
344 ///
345 /// # Safety
346 ///
347 /// `descriptor` must be a valid pointer.
348 #[cfg(feature = "objc2-io-kit")]
349 pub fn IOUSBGetEndpointDirection(descriptor: *const IOUSBEndpointDescriptor) -> u8;
350}
351
352extern "C-unwind" {
353 /// Extract the direction and number of an endpoint from an endpoint descriptor
354 ///
355 /// This method parses an endpoint descriptor to determine its address
356 ///
357 /// Parameter `descriptor`: The descriptor to parse
358 ///
359 /// Returns: uint8_t representing direction and endpoint number
360 ///
361 /// # Safety
362 ///
363 /// `descriptor` must be a valid pointer.
364 #[cfg(feature = "objc2-io-kit")]
365 pub fn IOUSBGetEndpointAddress(descriptor: *const IOUSBEndpointDescriptor) -> u8;
366}
367
368extern "C-unwind" {
369 /// Extract the number of an endpoint from an endpoint descriptor
370 ///
371 /// This method parses an endpoint descriptor to determine its number, excluding direction
372 ///
373 /// Parameter `descriptor`: The descriptor to parse
374 ///
375 /// Returns: uint8_t representing endpoint number
376 ///
377 /// # Safety
378 ///
379 /// `descriptor` must be a valid pointer.
380 #[cfg(feature = "objc2-io-kit")]
381 pub fn IOUSBGetEndpointNumber(descriptor: *const IOUSBEndpointDescriptor) -> u8;
382}
383
384extern "C-unwind" {
385 /// Extract the type of an endpoint from an endpoint descriptor
386 ///
387 /// This method parses an endpoint descriptor to determine its type
388 ///
389 /// Parameter `descriptor`: The descriptor to parse
390 ///
391 /// Returns: tEndpointType indicating the type found.
392 ///
393 /// # Safety
394 ///
395 /// `descriptor` must be a valid pointer.
396 #[cfg(feature = "objc2-io-kit")]
397 pub fn IOUSBGetEndpointType(descriptor: *const IOUSBEndpointDescriptor) -> u8;
398}
399
400extern "C-unwind" {
401 /// Extract the usage type of an endpoint from an endpoint descriptor
402 ///
403 /// This method parses an endpoint descriptor to determine its usage type. Only periodic endpoints have usage types
404 ///
405 /// Parameter `descriptor`: The descriptor to parse
406 ///
407 /// Returns: tEndpointUsageType indicating the type found.
408 ///
409 /// # Safety
410 ///
411 /// `descriptor` must be a valid pointer.
412 #[cfg(feature = "objc2-io-kit")]
413 pub fn IOUSBGetEndpointUsageType(descriptor: *const IOUSBEndpointDescriptor) -> u8;
414}
415
416extern "C-unwind" {
417 /// Extract the synchronization type of an endpoint from an endpoint descriptor
418 ///
419 /// This method parses an endpoint descriptor to determine its synchronization type. Only Isochronous endpoints have non-zero synchronization types
420 ///
421 /// Parameter `descriptor`: The descriptor to parse
422 ///
423 /// Returns: tEndpointSynchronizationType indicating the type found.
424 ///
425 /// # Safety
426 ///
427 /// `descriptor` must be a valid pointer.
428 #[cfg(feature = "objc2-io-kit")]
429 pub fn IOUSBGetEndpointSynchronizationType(descriptor: *const IOUSBEndpointDescriptor) -> u8;
430}
431
432extern "C-unwind" {
433 /// Extract the max packet size from an endpoint descriptor
434 ///
435 /// This method parses an endpoint descriptor to determine its max packet size, which does not take into account mult or burst factors.
436 ///
437 /// Parameter `usbDeviceSpeed`: The operational speed of the device
438 ///
439 /// Parameter `descriptor`: The descriptor to parse
440 ///
441 /// Returns: uint16_t The max packet size in bytes
442 ///
443 /// # Safety
444 ///
445 /// `descriptor` must be a valid pointer.
446 #[cfg(feature = "objc2-io-kit")]
447 pub fn IOUSBGetEndpointMaxPacketSize(
448 usb_device_speed: u32,
449 descriptor: *const IOUSBEndpointDescriptor,
450 ) -> u16;
451}
452
453extern "C-unwind" {
454 /// Extract the burst size from endpoint descriptors
455 ///
456 /// This method parses endpoint descriptors to determine burst size, which includes mult and burst factors as applicable. SuperSpeed Plus isochronous endpoints will return the dwBytesPerInterval field from the SuperSpeedPlusIsochronousEndpointCompanionDescriptor parameter.
457 ///
458 /// Parameter `usbDeviceSpeed`: The operational speed of the device
459 ///
460 /// Parameter `descriptor`: The EndpointDescriptor to parse
461 ///
462 /// Parameter `companionDescriptor`: The SuperSpeedEndpointCompanionDescriptor to parse, or NULL
463 ///
464 /// Parameter `sspCompanionDescriptor`: The SuperSpeedPlusIsochronousEndpointCompanionDescriptor to parse, or NULL
465 ///
466 /// Returns: uint32_t The burst size in bytes
467 ///
468 /// # Safety
469 ///
470 /// - `descriptor` must be a valid pointer.
471 /// - `companion_descriptor` must be a valid pointer.
472 /// - `ssp_companion_descriptor` must be a valid pointer.
473 #[cfg(feature = "objc2-io-kit")]
474 pub fn IOUSBGetEndpointBurstSize(
475 usb_device_speed: u32,
476 descriptor: *const IOUSBEndpointDescriptor,
477 companion_descriptor: *const IOUSBSuperSpeedEndpointCompanionDescriptor,
478 ssp_companion_descriptor: *const IOUSBSuperSpeedPlusIsochronousEndpointCompanionDescriptor,
479 ) -> u32;
480}
481
482extern "C-unwind" {
483 /// Extract the mult count from endpoint descriptors
484 ///
485 /// This method parses endpoint descriptors to determine mult
486 ///
487 /// Parameter `usbDeviceSpeed`: The operational speed of the device
488 ///
489 /// Parameter `descriptor`: The EndpointDescriptor to parse
490 ///
491 /// Parameter `companionDescriptor`: The SuperSpeedEndpointCompanionDescriptor to parse, or NULL
492 ///
493 /// Parameter `sspCompanionDescriptor`: The SuperSpeedPlusIsochronousEndpointCompanionDescriptor to parse, or NULL
494 ///
495 /// Returns: uint8_t The mult count
496 ///
497 /// # Safety
498 ///
499 /// - `descriptor` must be a valid pointer.
500 /// - `companion_descriptor` must be a valid pointer.
501 /// - `ssp_companion_descriptor` must be a valid pointer.
502 #[cfg(feature = "objc2-io-kit")]
503 pub fn IOUSBGetEndpointMult(
504 usb_device_speed: u32,
505 descriptor: *const IOUSBEndpointDescriptor,
506 companion_descriptor: *const IOUSBSuperSpeedEndpointCompanionDescriptor,
507 ssp_companion_descriptor: *const IOUSBSuperSpeedPlusIsochronousEndpointCompanionDescriptor,
508 ) -> u8;
509}
510
511extern "C-unwind" {
512 /// Extract the interval of an endpoint descriptor
513 ///
514 /// This method parses an endpoint descriptor and returns the service interval as n in (2^(n-1)) microframes
515 ///
516 /// Parameter `usbDeviceSpeed`: The operational speed of the device
517 ///
518 /// Parameter `descriptor`: The EndpointDescriptor to parse
519 ///
520 /// Returns: uint32_t Encoded endpoint interval
521 ///
522 /// # Safety
523 ///
524 /// `descriptor` must be a valid pointer.
525 #[cfg(feature = "objc2-io-kit")]
526 pub fn IOUSBGetEndpointIntervalEncodedMicroframes(
527 usb_device_speed: u32,
528 descriptor: *const IOUSBEndpointDescriptor,
529 ) -> u32;
530}
531
532extern "C-unwind" {
533 /// Extract the interval of an endpoint descriptor
534 ///
535 /// This method parses an endpoint descriptor and returns the service interval in microframes
536 ///
537 /// Parameter `usbDeviceSpeed`: The operational speed of the device
538 ///
539 /// Parameter `descriptor`: The EndpointDescriptor to parse
540 ///
541 /// Returns: uint32_t Endpoint interval in microframes
542 ///
543 /// # Safety
544 ///
545 /// `descriptor` must be a valid pointer.
546 #[cfg(feature = "objc2-io-kit")]
547 pub fn IOUSBGetEndpointIntervalMicroframes(
548 usb_device_speed: u32,
549 descriptor: *const IOUSBEndpointDescriptor,
550 ) -> u32;
551}
552
553extern "C-unwind" {
554 /// Extract the interval of an endpoint descriptor
555 ///
556 /// This method parses an endpoint descriptor and returns the service interval in frames
557 ///
558 /// Parameter `usbDeviceSpeed`: The operational speed of the device
559 ///
560 /// Parameter `descriptor`: The EndpointDescriptor to parse
561 ///
562 /// Returns: uint32_t Endpoint interval in frames
563 ///
564 /// # Safety
565 ///
566 /// `descriptor` must be a valid pointer.
567 #[cfg(feature = "objc2-io-kit")]
568 pub fn IOUSBGetEndpointIntervalFrames(
569 usb_device_speed: u32,
570 descriptor: *const IOUSBEndpointDescriptor,
571 ) -> u32;
572}
573
574extern "C-unwind" {
575 /// Extract the number of streams supported by an endpoint
576 ///
577 /// This method parses endpoint descriptors and returns the number of streams supported as n in (2^n)
578 ///
579 /// Parameter `usbDeviceSpeed`: The operational speed of the device
580 ///
581 /// Parameter `descriptor`: The EndpointDescriptor to parse
582 ///
583 /// Parameter `companionDescriptor`: The SuperSpeedEndpointCompanionDescriptor to parse
584 ///
585 /// Returns: uint32_t Encoded number of streams
586 ///
587 /// # Safety
588 ///
589 /// - `descriptor` must be a valid pointer.
590 /// - `companion_descriptor` must be a valid pointer.
591 #[cfg(feature = "objc2-io-kit")]
592 pub fn IOUSBGetEndpointMaxStreamsEncoded(
593 usb_device_speed: u32,
594 descriptor: *const IOUSBEndpointDescriptor,
595 companion_descriptor: *const IOUSBSuperSpeedEndpointCompanionDescriptor,
596 ) -> u32;
597}
598
599extern "C-unwind" {
600 /// Extract the number of streams supported by an endpoint
601 ///
602 /// This method parses endpoint descriptors and returns the number of streams supported
603 ///
604 /// Parameter `usbDeviceSpeed`: The operational speed of the device
605 ///
606 /// Parameter `descriptor`: The EndpointDescriptor to parse
607 ///
608 /// Parameter `companionDescriptor`: The SuperSpeedEndpointCompanionDescriptor to parse
609 ///
610 /// Returns: uint32_t Number of streams
611 ///
612 /// # Safety
613 ///
614 /// - `descriptor` must be a valid pointer.
615 /// - `companion_descriptor` must be a valid pointer.
616 #[cfg(feature = "objc2-io-kit")]
617 pub fn IOUSBGetEndpointMaxStreams(
618 usb_device_speed: u32,
619 descriptor: *const IOUSBEndpointDescriptor,
620 companion_descriptor: *const IOUSBSuperSpeedEndpointCompanionDescriptor,
621 ) -> u32;
622}
623
624extern "C-unwind" {
625 /// Extract the maximum bus current required by a configuration descriptor
626 ///
627 /// This method parses a configuration descriptor and returns the number of milliamps required to power the device
628 ///
629 /// Parameter `usbDeviceSpeed`: The operational speed of the device
630 ///
631 /// Parameter `descriptor`: The ConfigurationDescriptor to parse
632 ///
633 /// Returns: uint32_t milliamps required
634 ///
635 /// # Safety
636 ///
637 /// `descriptor` must be a valid pointer.
638 #[cfg(feature = "objc2-io-kit")]
639 pub fn IOUSBGetConfigurationMaxPowerMilliAmps(
640 usb_device_speed: u32,
641 descriptor: *const IOUSBConfigurationDescriptor,
642 ) -> u32;
643}