Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: Add macros for interrupt endpoint types.

The USB 3.0 spec defines a new way of differentiating interrupt
endpoints. The idea is that some interrupt endpoints are used for
notifications, i.e. they continually NAK the transfer until something
changes on the device. Other interrupt endpoints are used as a way to
periodically transfer data.

The USB 3.0 endpoint descriptor uses bits 5:4 of bmAttributes for
interrupt endpoints, to define the endpoint as either a Notification
endpoint, or a Periodic endpoint. Introduce macros to dig out that
information.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>

+11
+11
include/linux/usb/ch9.h
··· 392 392 #define USB_ENDPOINT_XFER_INT 3 393 393 #define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 394 394 395 + /* The USB 3.0 spec redefines bits 5:4 of bmAttributes as interrupt ep type. */ 396 + #define USB_ENDPOINT_INTRTYPE 0x30 397 + #define USB_ENDPOINT_INTR_PERIODIC (0 << 4) 398 + #define USB_ENDPOINT_INTR_NOTIFICATION (1 << 4) 399 + 395 400 #define USB_ENDPOINT_SYNCTYPE 0x0c 396 401 #define USB_ENDPOINT_SYNC_NONE (0 << 2) 397 402 #define USB_ENDPOINT_SYNC_ASYNC (1 << 2) ··· 597 592 static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd) 598 593 { 599 594 return __le16_to_cpu(epd->wMaxPacketSize); 595 + } 596 + 597 + static inline int usb_endpoint_interrupt_type( 598 + const struct usb_endpoint_descriptor *epd) 599 + { 600 + return epd->bmAttributes & USB_ENDPOINT_INTRTYPE; 600 601 } 601 602 602 603 /*-------------------------------------------------------------------------*/